io buffer sizes for audio driver based on IOUserAudioDevice

Dear Sirs,

I've written an audio driver based on IOUserAudioDevice. In my IOOperationHandler I can receive and send the audio samples as expected. Is there any way to configure the number of samples transferred in each call? Currently it seem to be around 512 samples per call, which relates to 10.7 millisecs when operating on 48 kHz samplerate. I'd like to achieve something like 48 or 96 samples per call. I did some experiments and tried calls to SetOutputLatency() etc. but so far I didn't find the right way to change the in_io_buffer_frame_size in the callback. I'd like to do this as smaller buffer sizes would allow lower latencies for the subsequent audio processing.

Thanks and best regards, Johannes

The IO buffer frame size that is called on the driver will be determined by the client process and what they configure their audio IO buffer size to use. A driver really shouldn't be in control of this and should be able to handle buffer sizes up to 4096 samples.

Thanks for this answer. But I'm wondering how to achieve low latency playback when I have to wait for up to 4096 samples before I can further process them inside my driver. So applications like Logic Pro support buffer sizes down to 32 samples which corresponds to 0.66 msec when operating at 48 kHz samplerate. That's fine if you want to go down to latencies below 10 msec. But when another app also starts playing and the second app uses buffers of 4096 samples this ends up in a latency of 85 msec - which is pretty much and if you think about audio/video synchronization even for 25 frames per second this means a delay of 2 frames. Is there a way to force an application to stay below a maximum buffer size? Or how can I know that the samples I've just received in IOUserAudioIOOperationWriteEnd are the final samples for the given time area and will not be overwritten a few moments later by the mixed audio data due to the playback inside a second app. Waiting always for at least 4096 samples would really break all efforts for low latency drivers in my eyes.

Please capture a ktrace when the issue occurs. It looks like there are audio IO overloads which are causing issues. A trace will be needed to identity the issues.

io buffer sizes for audio driver based on IOUserAudioDevice
 
 
Q