This will loop infinitely. finished never gets sent to 1, because the
key-down never gets handled, because it never goes back to the
SDL_PollEvent. You seem to be thinking the event loop will run in
parallel automatically, but it won’t. If PortAudio is using a callback
already, you may be able to just return to the event loop during that time,
and have a different function called to close the stream and free the
buffer when finished. Failing that, you may be able to run the audio in a
separate thread; see http://sdldoc.csn.ul.ie/thread.php (may be slightly
out of date).
Note that SDL also provides its own audio functionality, which
uses a callback interface and runs in its own thread automatically. See
http://sdldoc.csn.ul.ie/audio.php (again, may be slightly out of date).
—> Drake WilsonOn Thu, Jun 10, 2004 at 09:18:55PM +0200, Maciej Szupienko wrote:
while(finished==0) {}