Unable to change BufferSize on Windows.
I'm running into latency issues on Windows. When I iterate over the SupportedStreamConfigs I only get one option:
SupportedStreamConfigRange { channels: 4, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
And when I try to change the buffer size to anything other than BufferSize::Default it tells me
The requested stream configuration is not supported by the device.
I'm kind of at a loss for where to go from here.
Hello CaseyB,
I assume that you try to use WASAPI on Windows ? Right now, you can't choose the buffer size with this host, it's not implemented. By default, cpal try to get the smalest possible buffer. There is already on issue for that (https://github.com/RustAudio/cpal/issues/534). But you have to know that with WASAPI, you can't really choose the buffer size. You can ask for a buffer size and WASPI will try to give it to you but you have no warranty. you can check here : https://docs.microsoft.com/en-us/windows/win32/api/audioclient/nf-audioclient-iaudioclient-initialize (If the call succeeds, the method allocates a buffer that is a least this large). I did some test and the buffer size may vary over time. If you need precise buffer size, you should try Asio host. By the way, if you succed, I am interested since I can't get it to work (https://github.com/RustAudio/cpal/issues/539).
In such case, is there a way to know ahead of time the buffer size that we will receive? Or a sensible upper bound for it? (I need it to implement de-interlacing of the channels)
Because the upper bound I get from the default config is just gigantic: buffer_size: Range { min: 0, max: 4294967295 }