Question

I could not find detailed explanation about this function. What I want to know now is that:

Will this function block current thread? Or it just tells the device to start playing audio asynchronously any returns at once?

Was it helpful?

Solution

Yes, the code which wraps your call to alSourcePlay is blocking so wants to be in its own thread. OpenAL has its own event loop to buffer up and render sound into the audio device(s).

Typically you want a separate thread to make available your source media (thread 1) and another thread for your OpenAL logic (thread 2). This is in addition to your UI thread (thread 3) if any.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top