How about juce_win32_ASIO.cpp

Hi, jules
How are you?
I found in juce_win32_ASIO.cpp, there are some new stuff(compared with juce1.46), and could you explain the following new code to me?
in class ASIOAudioIODevice, it has new datamember: optionalDllForDirectLoading (optionalDllForDirectLoading_),

in loadDriver() function

if (optionalDllForDirectLoading.isNotEmpty())
{
HMODULE h = LoadLibrary (optionalDllForDirectLoading);

            if (h != 0)
            {
                typedef HRESULT (CALLBACK* DllGetClassObjectFunc) (REFCLSID clsid, REFIID iid, LPVOID* ppv);
                DllGetClassObjectFunc dllGetClassObject = (DllGetClassObjectFunc) GetProcAddress (h, "DllGetClassObject");

                if (dllGetClassObject != 0)
                {
                    IClassFactory* classFactory = 0;
                    HRESULT hr = dllGetClassObject (classId, IID_IClassFactory, (void**) &classFactory);

                    if (classFactory != 0)
                    {
                        hr = classFactory->CreateInstance (0, classId, (void**) &asioObject);
                        classFactory->Release();
                    }

                    return asioObject != 0;
                }
            }
        }

Issue found in the following code, when I try to set one asio deivce. "asio digidesign driver"
And in loadDriver()
bool loadDriver()
{
removeCurrentDriver();

    JUCE_TRY
    {
		//try {
        if (CoCreateInstance (classId, 0, CLSCTX_INPROC_SERVER,
                              classId, (void**) &asioObject) == S_OK)
        {
            return true;
        }

}

when I try to set a device in plugin, CoCreateInstance () call never get returned.so plugin crashed.
What does this call mean?

you added another function :
AudioIODevice* juce_createASIOAudioIODeviceForGUID (const String& deviceName,
void* guid,
const String& optionalDllForDirectLoading)

what does guid mean?

Thanks!
Leon

You should ignore the optional guid stuff.

And I seem to remember that Digidesign have a delightful feature that makes their driver crash if you’re running a debugger.

Hi, jules
I thought it is related to release plugin crashed when I try to set DeviceType.
It works good for juce146 release plugin, I can set asio device . Juce does not provide the setDeviceType function in juce146.
The release mode plugin crashed only in juce150. So I diff the files to see difference, and found this change in juce150.

Thanks!
Leon

It’s odd that it used to work… It might just be the driver not liking being closed/re-opened in quick succession, or something like that. Hard to debug, really, and I’m not sure what to suggest…