Is this even possible? Would be extra cool if somehow I manage to have a function called every time a buffer has been processed. Any other ideas besides polling the source it's welcomed :D
Asked
Active
Viewed 337 times
0
-
2Did you mean polling the source? – geofftnz Apr 04 '11 at 21:10
-
+1 Indeed I did, sorry about that, I've edited the question – Rad'Val Apr 04 '11 at 21:13
-
Here's something similar: http://stackoverflow.com/questions/1046315/getting-notified-when-a-sound-is-done-playing-in-openal – geofftnz Apr 04 '11 at 21:20
-
1and this, which seems to say no: http://opensource.creative.com/pipermail/openal/2009-April/011616.html – geofftnz Apr 04 '11 at 21:21
-
Yes, I think it's not possible, still I wonder, would it be resource wise comparing with polling? – Rad'Val Apr 04 '11 at 21:29
1 Answers
0
You know how many samples are in each buffer and you know the sample rate that the source is playing at. That should give you a pretty good idea of when the source will finish processing a buffer.
If you're feeling very intrepid, you could hack this into the OpenAL-soft source. By the looks of the code, you would put the change into mixer.c
at the very end of the file, somewhere near the end of the MixSource()
function.
Remembering, of course, that OpenAL-soft is lGPL; so you'd need to release/make available any changes that you made to the library itself.
If you're stuck using pre-included libraries, then you don't have many options. OpenAL rejects the idea of callback functions.

JCooper
- 6,395
- 1
- 25
- 31
-
I think I understand what you are saying JCooper, however, I don't know if I can touch this implementation of OpenAL (iOS). If I could, would knowing the sample rate and the number of samples on each buffer help me as long as the actual processing it's processor dependent? (could take more or less). – Rad'Val Apr 05 '11 at 18:04
-
I doubt you can change the iOS version of OpenAL, but I think you can make it use OpenAL-soft as a plugin, or something. I'm not sure what you mean with the rest of your comment. The length of time taken to process a sound buffer should be more-or-less processor independent. – JCooper Apr 05 '11 at 18:14
-
I choose your answer because even if for iOS won't work (I end up polling the source), maybe it helps someone else that works o a different platform! Thanks! – Rad'Val Apr 05 '11 at 18:21