openal-soft icon indicating copy to clipboard operation
openal-soft copied to clipboard

Some question about play ?

Open xuandu opened this issue 3 years ago • 2 comments

1 IT is multi-thread(have one thread)about openal play? I think openal have it self thread;Producer-consumer-model I use alcsourcequeuebuffers(8);I have one thread to send audio_pcm to the buffer ,and return;i think you have another thread to consume the buffers data ; in my thread ,if I push full ,and I will wait openal playback one(al_buffers_processed >0),then unqueue the index of this buffer ,and push in next audio_data;i think you have yourself thread to consume; but I do not know my understanding is correct?bucause someone think that you have not another thread to consume,IT is Synchronous;

2 I want to get the buffer(one frame) at the time when you playing this buffer's data? I use alcgetsourcei(,al_buffers_processed,num);but the "num" may be 7,6,5,4,3,2,1,0; so I want to know do you have some fun to help me know that "you have (will) consume one buffer"?I hope to have an accurate notice

thanks soooooo much

xuandu avatar Mar 03 '21 03:03 xuandu

bucause someone think that you have not another thread to consume,IT is Synchronous;

Technically speaking, OpenAL can be either synchronous or asynchronous, depending on the device's ALC_SYNC property. However, I'm not aware of any in-use implementation that is synchronous by default, and if you aren't already handling synchronous devices, you don't need to start worrying about it.

I want to get the buffer(one frame) at the time when you playing this buffer's data?

Unfortunately I'm not sure what you're asking. AL_BUFFERS_PROCESSED gets the number of buffers currently in the source queue that have been processed, which means they can be unqueued. When you get 1, then one buffer has been processed and can be unqueued. If it's 0, then no buffers have yet been processed and you can't unqueue any yet.

kcat avatar Mar 03 '21 07:03 kcat

1 This is the case【one fream 's time= 20ms 】 I use Windows computer ,I send the ”alcsourcequeuebuffers“ full,if I want to send the 9th fream, I need about 20ms,so I think when I check the al_buffers_processed ,you have a thread to paly the audio data . but my mate use openal play on browser,when he send the alcsourcequeuebuffers(8) full, if the 9th fream will enqueue,It will take more than a half second,Not consume data at the 20ms ; so I have the question.

2 I want to know if you have any notification or callback function to tell me that you have just finished processing a buffer(one node)?

xuandu avatar Mar 03 '21 08:03 xuandu