I’m not sure I fully understand what the samples value is supposed to represent or otherwise affect.
Since there seems to be no correlation between the sample (audio buffer) size and the data size sent to SDL_QueueAudio. From the wiki: There are no limits on the amount of data you can queue, short of exhaustion of address space.
If I change the samples (buffer size) value what does it affect exactly?
Maybe I get it! With the exception of mono audio the channel data is interleaved in the data stream. So the data I am sending to QueueAudio is interleaved in sizes of sample!!! Yes/No?
I don’t think the channel interleave size is the value of samples. I would expect the channel interleave to be sizeof(format).
So know I don’t know what the samples value is for!
Just a wild guess, but I’m guessing the sample size is a hold over from the SDL 1 days. This Audio example, shows this
wanted.samples = 1024; /* Good low-latency value for callback */. A larger buffer would queue up more data causing a potential lag in audio being played. With the new queuing system, this isn’t needed as much.
It would seem to make more sense in the callback function. Which I’m not using.
SDL_QueueAudio() came way later, and had to use the existing interfaces. 1024 is a reasonable number there for SDL_QueueAudio use (in this case, it’s how much of the queue it will want to drain every time the internal callback function fires…there’s still a callback, it’s just handled internally by SDL).