Recently we got some clients reporting the fact that our software won’t start if their Denon DJ hardware isn’t connected to their system. This happens on Windows 7 64 bit.
I tracked down the issue and it’s quite an intricate one. First of all, the Denon drivers are badly made so this isn’t a Juce issue. But this is a problem bound to cause problems though.
In juce_win32_ASIO initDriver asioObject->init is called. Most properly written drivers will return false on init reporting that the device itself is not connected to the system.
However the Denon driver returns true, but here’s the catch, if you call asioObject->getErrorMessage it does give an error reporting that the device isn’t found.
So what to do? Can i assume that whenever there is an error message being reported after calling init, even if init succeeded i should bail out? But that might generate false positives.
If i don’t bail out in case of the Denon driver it will crap out when asioObject->release is called. All other calls like getSampleRate seem to work fine (they report nothing of use though).
String initDriver()
{
if (asioObject != nullptr)
{
char buffer [256] = { 0 };
if (! asioObject->init (juce_messageWindowHandle)) //here Denon would return true
{
asioObject->getErrorMessage (buffer);
return String (buffer, sizeof (buffer) - 1);
}
//double check for an error message just to be sure
asioObject->getErrorMessage (buffer);
String error(buffer, sizeof (buffer) - 1);
if (!error.isEmpty())
{
//you sneaky bastard!
return error;
}
// just in case any daft drivers expect this to be called..
asioObject->getDriverName (buffer);
return String::empty;
}
return "No Driver";
}