<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 17, 2016 at 10:26 AM, David Griffith <span dir="ltr"><<a href="mailto:dave@661.org" target="_blank">dave@661.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, 17 May 2016, Andrea Del Signore wrote:<br>
<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
On Tue, May 17, 2016 at 12:25 AM, David Griffith <<a href="mailto:dave@661.org" target="_blank">dave@661.org</a>> wrote:<br>
On Mon, 16 May 2016, Andrea Del Signore wrote:<br>
<br></span><span class="">
> I'm not simply trying to mix two files.  My main project is a<br>
> game engine in which two sounds are allowed at any one time. <br>
> For instance, there can be constant background music punctuated<br>
> by sound effects.  I can't get these to mix correctly.<br>
<br>
Hi,<br>
<br>
in that case you can just skip the right number of frames before starting<br>
playing sounds.<br>
<br>
I modified my code to take the start time for each file and schedule the<br>
play time with frame accuracy.<br>
<br>
<a href="http://pastebin.com/0PMyfPvK" rel="noreferrer" target="_blank">http://pastebin.com/0PMyfPvK</a><br>
<br>
If you want your timing to be sample accurate the algorithm is a bit more<br>
complex.<br>
</span></blockquote>
<br>
That won't work.  Your code schedules things ahead of time before anything else happens.  I need to be able to fire off sound effects the instant the player does something to cause them.  I can't know in advance.<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
David Griffith<br>
<a href="mailto:dave@661.org" target="_blank">dave@661.org</a></font></span></blockquote></div><br><br></div><div class="gmail_extra">Yes my code for now implements only your initial request (play 2 sounds spaced by few seconds), and it shows how to schedule N sound files of different length at different times.<br><br></div><div class="gmail_extra">I'll try to write a simple mixer for my next learning exercise :)<br><br></div><div class="gmail_extra">Have a good day,<br></div><div class="gmail_extra">Andrea <br></div></div>