Determining the DAW?


#1

This seems like it would be one of those evergreen questions, but I haven’t been able to find anything on the Forum or in the Juce API document.

As I test my plugin in different DAWs, I’m finding that the playhead behavior differs from DAW to DAW. I’d like to be able to determine the DAW that’s hosting the plugin. Is there a way to do it?

Thanks for any suggestions.


#2

There’s nothing in the wrapper at the momemnt to get that info, and really I’d prefer to have a system where you don’t need to know anything about the host, because the wrapper should sort it out to make the behaviour consistent. Maybe let us know what workarounds you were planning on using it for, and that might be something that needs to be added to the wrapper…


#3

In this particular case, I’m trying to make a determination about when I clear some buffers based on a sequencer relocating. As an early example, I noticed a real difference the the way that DigitalPerformer and Logic handled plugins on aux tracks. If you’re playing and then stop, DP continues to send ascending time values (in the playhead data). For the same sort of operation, Logic continues to stream time, but changes the time value to zero.

I’ve also observed that DP does a few bursts worth of preroll, no matter what. Logic doesn’t. I am also noticing other less-significant things going on with the playhead. I would expect that when I inevitably (and regrettably) get onto Cubase, there will be further differences. So far, I’ve been able to program around these differences (I think), but in something of a least-common-denominator method.

I agree with you on the general principle of keeping plugins ignorant. Still, there may be some cases where a small set of platform-specific rules could be helpful.


#4

I, for one, vote in favour of making such information available to plug-ins.
I’m stuck at finding some way to deal with keyboard events inside plug-in windows, and knowing what host I’m into would be of great help, because some of them need specific workaround that damage others instead… while other play just fine and need no workaround at all


#5

This is how I managed to obtain the executable name associated with the current process, i.e. the name of the executable of the host application (DAW) which is running our plug-in.

It’s not bullet-proof to rely on such information for determining the application, but knowing that the executable name is “Pro Tools” rather than “Live”, surely is helpful for guessing useful things…


// can't include windows.h before juce, thus
// can't rely on JUCE_WIN32 to be defined
// to know if we're under windows or not

#if (defined (_WIN32) || defined (_WIN64))
#include <windows.h>
#endif

#include <juce.h>

// For mac it is safe to include these headers
// after juce, so we can safely use JUCE_MAC here

#if JUCE_MAC
#include <sys/param.h>
#include <mach-o/dyld.h>
#endif


#if JUCE_WIN32

String getCurrentExecutableName()
{
    WCHAR buf[MAX_PATH] = { '\0' };

    if ( !GetModuleFileNameW( NULL, buf, MAX_PATH ))
    {
        return String::empty;    // Error
    }
    return String(buf);
}

#elif JUCE_MAC

String getCurrentExecutableName() throw()
{
    char str[2*MAXPATHLEN] = {'\0'};

    unsigned int size = 2*MAXPATHLEN;
    if ( _NSGetExecutablePath( str, &size ))
    {
       return String::empty;    // Error
    }

    return String(str, size);
}

#else
#error unsupported OS
#endif

#6

These thanks are rather belated, but I’m now experimenting with your code to see what I can learn. As I test code on various DAWS, I’m more convinced this is useful information to have.