开发者

Determine when a buffer has been played without polling the source in OpenAL

开发者 https://www.devze.com 2023-02-21 20:18 出处:网络
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 i开发者_JAVA技巧t\'s welcome

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 i开发者_JAVA技巧t's welcomed :D


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消