If the buffersize of my RME-Fireface is changing, there will be no additional processBuffer-Callbacks, the audio-output hangs.
After that changes below, i can change the buffersize in driver-control panel and audio is still working HOORAY, without that changes it hangs.
First: The reset-procedure should activated outside the processBuffer-Callback! (because if processBuffer is not called, nothing will happen!)
In juce\modules\juce_audio_devices\native\juce_win32_ASIO.cpp
void resetRequest() noexcept
{
// Lets have a little more time than 20ms
startTimer (500);
}
void resyncRequest() noexcept
{
isReSync = true;
resetRequest();
}
If the driver changes the BufferSize it should also initiate a reset!!
in static long asioMessagesCallback (long selector, long value, const int deviceIndex)
[code]
case kAsioBufferSizeChange:
if (currentASIODev[deviceIndex] != nullptr) //NEW!!!!!!!!!!
currentASIODev[deviceIndex]->resetRequest(); //NEW!!!!!!!!!!
return 1;
[/code]
The driver should also be unloaded, reloaded like when changing the sample-rate. I’ve done this through a quick hack, but maybe it needs some better redesign.
[code]
IN String open (const BigInteger& inputChannels,
...
...
...
if (err == 0)
{
currentSampleRate = sampleRate;
if (needToReset || forceReset) // QUICK HACK TO FORCE A RESET
{
forceReset=false;
if (isReSync)
{
log ("Resync request");
}
log ("! Resetting ASIO after sample rate change");
removeCurrentDriver();
loadDriver();
[/code]
[code]
void timerCallback()
{
if (! insideControlPanelModalLoop)
{
stopTimer();
// used to cause a reset
log ("! ASIO restart request!");
if (deviceIsOpen)
{
AudioIODeviceCallback* const oldCallback = currentCallback;
close();
forceReset=true; // NEW!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
open (BigInteger (currentChansIn), BigInteger (currentChansOut),
currentSampleRate, currentBlockSizeSamples);
if (oldCallback != nullptr)
start (oldCallback);
}
}
else
{
startTimer (100);
}
}[/code]