Question on AudioDeviceManager::chooseBestBufferSize()

Hi Jules!

On march, 31st you committed a change to AudioDeviceManager::chooseBestSampleRate in file juce_AudioDeviceManager.cpp:

Coment: "Made AudioDeviceManager prefer to use a device's current sample rate if asked to use a default rate."

Wouldn't it make sense to do the same modification in AudioDeviceManager::chooseBestBufferSize()? Currently this function returns the default buffer size and not the current buffer size.



Hmm.. Not sure that it's as relevent as for the sample rate, because generally when two clients each ask for a different rate, that can be a problem for the device driver, whereas two clients with different buffer sizes is probably fine.

What's the actual problem you think this would solve?

OK, it was more formal reasons that made me proposing this. Maybe it makes no difference. I was mainly confused that I always got a buffer size of 512, but that is just a hardcoded default value for core audio.

I've got another related issue concerning different sample rates:

ASIOAudioIODevice::getCurrentSampleRate() does sometimes return a wrong value. When the samplerate of an audio device that is open in a JUCE application is changed by a different application, this change will not be reflected in the currentSampleRate variable that is returned by this function.

Maybe in juce_win32_ASIO.cpp it should be:

double getCurrentSampleRate() override
   currentSampleRate = getSampleRate();
   return currentSampleRate;