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.

Messages - 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?

Other Support / Re: SoundEngine loop stream sound
« on: December 03, 2017, 11:15:10 PM »
I can also confirm a synchronization issue.  A previous call to removeSource is wiping the codec field while the StreamThread is busy preloading it.  I managed to catch this happening with the help of logging.

Since I am also Minecraft modding, I think I will take-up CreativeMD's fix, it's essentially what I had in mind (and dreaded the thought of having to resort to).

Pages: [1]