[Stk] RtAudio Callback function doesn't get called unless I block waiting for user input

Kyle Hipke kwhipke1 at gmail.com
Fri Jul 6 20:08:36 PDT 2012


I'm writing a game and using RTAudio for processing. Before I enter the
main loop, I call startStream. However, while the physics and graphics
stuff runs in the main loop (on the same thread that I made the call to
startStream in), my callback for processing the stream never gets called.
I've discovered, though, if I just call startStream then wait for user
input (like in the duplex example), my callback DOES get called.

After doing some more research, it appears that the stream is getting
stopped and closed somehow right after I call startStream(). It
happens in RtAudio.cpp
at RtApiIDs :: callBackEvent() on line 4534. The Sleep(50) call is made,
then, once it returns, the memory location *isRunning (in RtAudio.cpp on
line 4925) gets set to false. So sometime during that call to Sleep (50),
that assignment to false happens, which causes the threads responsible for
calling the callback to terminate. But, for some reason, if I sleep the
thread right after the call to startStream is made (by waiting for user
input), that assignment to false DOESN'T happen.

Note that I'm using a duplex stream, also I'm using the SFML library for
my game code. Also, I've compiled RtAudio for DSOUND on Windows.

How can I make sure that my callback gets called while also running the
main loop for the game?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/pipermail/stk/attachments/20120706/6c99c0c1/attachment.html 


More information about the Stk mailing list