Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - MadMartian

Pages: [1]
I have a scenario of problems that I do not know how to resolve or work-around.  From my vantage point this is unavoidable but I would like to check and see if I'm missing how to correctly use the sound API.

I have written an adapter ICodec "MPEGCodec" that streams MPEG audio from Internet radio stations.  During the ICodec's initialize phase I am initiating the connection and querying the header for meta-data.  This always takes a few seconds to complete.  If in the main thread I call any of the sound system commands, the thread blocks.  I found out that the codec preload thread has the THREAD_SYNC monitor locked and the command functions also wait on this monitor.  Since this is my UI thread it effectively freezes the game for a few seconds.  So it looks like if I don't want my UI to freeze-up momentarily then I have to avoid calling sound system functions until the stream has finished preloading.

Is there something I am missing? is there a better way to handle this?  Should I be using a thread other than the main UI thread for querying the sound system?

Pages: [1]