tags:

views:

212

answers:

1

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 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?

+1  A: 

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.

invalidname