ASIO driver not returning false on init, help requested

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";
}

conditional using the Driver name.
Portaudio already do that kind of stuff.

Gah… Thanks, I’ll check in a workaround. I guess there’s no harm in just always checking the error message, this doesn’t look like it’s a case for a driver-specific hack.

I don’t like checking the driver names deep in Juce win32_asio. But for now of course that would be a fix, but next week another driver might be causing issues, endless road if you’d ask me.
Anyone else experiencing diffculties with a specific brand of audio devices?

Didn’t see your reply yet Jules, i’m a bit afraid drivers might return an error message that might not be fatal or something. So i’m not sure yet wether we can make this assumption.

Hmm. Yes… What exactly is the Denon driver’s name then?

The exact name is:
DENON DJ ASIO Driver

Thanks, try it now…