Just as the question tells. I'm programming a OpenAL driver, and i'm wondering which is the best approach. Is it worth to have 2 buffers on a sound source to stream audio, so one is played while the other is being updated or isn't worth the hassle? which is the best way to synchronize the data streaming so the sound playing is smooth?
Also, i plan on stream everything (i have the audio data stored in a container, which could be a memory buffer, a file, or even a network stream, and i just request a "frame" from it), which is the best way for OpenAL? Thanks!
OpenAL question: Double Buffer or Single buffer streaming?
OpenAL question: Double Buffer or Single buffer streaming?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: OpenAL question: Double Buffer or Single buffer streamin
If you really stream - then yeah - more than 1 buffer. People often use ringbuffers. Or you are lazy like I was and just load the whole song into memory (works if you have 1 song per level and big loading time anyway).
If you want some 1 hour talk about in-depth audio-programming, I can recommend this one: https://www.youtube.com/watch?v=M8Bd7uHH4Yg
If you want some 1 hour talk about in-depth audio-programming, I can recommend this one: https://www.youtube.com/watch?v=M8Bd7uHH4Yg
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: OpenAL question: Double Buffer or Single buffer streamin
I have a working XAudio2 implementation, but i'd like to have a OpenAL one as well. With XAudio2, i just upload a buffer each time the XAudio2 sound has no more buffers pending, but i just provide it a pointer to the buffer where the audio is uncompressed (i don't uncompress the whole file, if it is ogg Vorbis, i keep it compressed, and then, stream from memory, on wavs, on the other hand, it is completely loaded into RAM, and just provide pointers into the raw data) I was wondering if a similar approach is feasible in OpenAL. what mechanisms provides OpenAL to upload the data so the playing is smooth? That's my main concern.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: OpenAL question: Double Buffer or Single buffer streamin
Ok.. seems that OpenAL allows that instead of binding a buffer to a source, you can "queue" a buffer to a source. So, two, or even 3 buffers are okay, while one plays, other fills, and the last waits, (aka, the craziest approach in my head was the right one! XD)
Now what i wonder is: do the buffers get actually copied when they're filled, or they are actually just mere pointers into the main memory, and if you change the main memory, the buffers get updated as well?
Now what i wonder is: do the buffers get actually copied when they're filled, or they are actually just mere pointers into the main memory, and if you change the main memory, the buffers get updated as well?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt