We use tweaked JUCE v1.50. Having a quick look at the tip, this problem will occur on it.
After an error occurred during opening an ASIO device, “error” has a description of the error and close() will be called.
if (error.isNotEmpty())
{
logError (error, err);
if (asioObject != 0 && buffersCreated)
asioObject->disposeBuffers();
Thread::sleep (20);
isStarted = false;
isOpen_ = false;
close();
}
But in close() “error” is cleared.
void close()
{
error = String::empty;
So we fixed it as below.
const String open (const BitArray& inputChannels,
const BitArray& outputChannels,
double sr,
int bufferSizeSamples)
{
#if 1 // prevent other functions from overwriting
String error;
#endif
/* many lines... */
#if 1 // store error message
this->error = error;
#endif
return error;
}