开发者

Loop OpenAL source with offset

开发者 https://www.devze.com 2022-12-20 01:38 出处:网络
The OpenAL API states that an setting an offset still causes the sound to loop back to zero for looping sources. But is there a way to loop and still have an offset开发者_StackOverflow社区 somehow?

The OpenAL API states that an setting an offset still causes the sound to loop back to zero for looping sources. But is there a way to loop and still have an offset开发者_StackOverflow社区 somehow?

I have an mp3, and since it contains headers with information at the start of the file, there's a small, but noticable, delay in looping when it rewinds.

If not, are there any other compressed formats that don't contain these empty headers?


Maybe your delay could also represent the time to decompress the MP3 data? If your data is small enough to loop anyways, could you use an API to decompress the MP3 to PCM, and then just feed that uncompressed data to AL?

Another option: you don't have to use just one buffer. You can queue them up with alSourceQueueBuffers(). When you stream this way, AL can move immediately from the end of one buffer to the start of the next. So you could enqueue two or three buffers worth of data, then poll the source to see when the first one has been consumed, and enqueue another one. Basically, this would make you responsible for the looping.

0

精彩评论

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

关注公众号