Alsa buffer size


I have a JUCE build environment installed on a RaspberryPi Zero and have written a non-gui app to play stereo audio using the hifiberry_dac alsa driver as the default device. I’ve instrumented my AudioAppComponent::getNextAudioBlock() function to get some idea of the jitter when running on the Pi Zero. My code indicates that the interval at which getNextAudioBlock() occurs is 11.6 ms, which is what you’d expect for 512 samples at 44.1kHz. All that is great so far.

Next I want to change the size of the audio buffer to 256 samples. I use an AudioDeviceSetup structure to make the change and pass it to deviceManager upon initialization. Then I call getAudioDeviceSetup() to check that the new buffer size is active, which it confirms.

However, the getNextAudioBlock() interval does not change - I’d expect it to be cut in half. Furthermore, alsa reports (through the hw_params file in the /proc… folder) that it’s still using a buffer size of 512.

In short, nothing I’ve tried so far actually changes the audio buffer size. And I have checked the supported buffer sizes reported by the driver to confirm that I’m asking for something that should be possible - at least as far as I understand.

Does anyone have any thoughts or ideas on what I might be doing wrong?