| @@ -28,6 +28,12 @@ namespace juce | |||||
| { | { | ||||
| //============================================================================== | //============================================================================== | ||||
| /** | |||||
| A useful utility class to determine the host or DAW in which your plugin is | |||||
| loaded. | |||||
| Declare a PluginHostType object in your class to use it. | |||||
| */ | |||||
| class PluginHostType | class PluginHostType | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -37,94 +43,127 @@ public: | |||||
| PluginHostType& operator= (const PluginHostType& other) noexcept { type = other.type; return *this; } | PluginHostType& operator= (const PluginHostType& other) noexcept { type = other.type; return *this; } | ||||
| //============================================================================== | //============================================================================== | ||||
| /** Represents the host type and also its version for some hosts. */ | |||||
| enum HostType | enum HostType | ||||
| { | { | ||||
| UnknownHost, | |||||
| AbletonLive6, | |||||
| AbletonLive7, | |||||
| AbletonLive8, | |||||
| AbletonLiveGeneric, | |||||
| AdobeAudition, | |||||
| AdobePremierePro, | |||||
| AppleLogic, | |||||
| Ardour, | |||||
| BitwigStudio, | |||||
| CakewalkSonar8, | |||||
| CakewalkSonarGeneric, | |||||
| DaVinciResolve, | |||||
| DigidesignProTools, | |||||
| DigitalPerformer, | |||||
| FinalCut, | |||||
| FruityLoops, | |||||
| MagixSamplitude, | |||||
| MergingPyramix, | |||||
| MuseReceptorGeneric, | |||||
| Reaper, | |||||
| Renoise, | |||||
| SADiE, | |||||
| SteinbergCubase4, | |||||
| SteinbergCubase5, | |||||
| SteinbergCubase5Bridged, | |||||
| SteinbergCubase6, | |||||
| SteinbergCubase7, | |||||
| SteinbergCubase8, | |||||
| SteinbergCubase8_5, | |||||
| SteinbergCubase9, | |||||
| SteinbergCubaseGeneric, | |||||
| SteinbergNuendo3, | |||||
| SteinbergNuendo4, | |||||
| SteinbergNuendo5, | |||||
| SteinbergNuendoGeneric, | |||||
| SteinbergWavelab5, | |||||
| SteinbergWavelab6, | |||||
| SteinbergWavelab7, | |||||
| SteinbergWavelab8, | |||||
| SteinbergWavelabGeneric, | |||||
| SteinbergTestHost, | |||||
| StudioOne, | |||||
| Tracktion3, | |||||
| TracktionGeneric, | |||||
| TracktionWaveform, | |||||
| VBVSTScanner, | |||||
| WaveBurner | |||||
| UnknownHost, //**< Represents an unknown host. */ | |||||
| AbletonLive6, //**< Represents Ableton Live 6. */ | |||||
| AbletonLive7, //**< Represents Ableton Live 7. */ | |||||
| AbletonLive8, //**< Represents Ableton Live 8. */ | |||||
| AbletonLiveGeneric, //**< Represents Ableton Live. */ | |||||
| AdobeAudition, //**< Represents Adobe Audition. */ | |||||
| AdobePremierePro, //**< Represents Adobe Premiere Pro. */ | |||||
| AppleLogic, //**< Represents Apple Logic Pro. */ | |||||
| Ardour, //**< Represents Ardour. */ | |||||
| BitwigStudio, //**< Represents Bitwig Studio. */ | |||||
| CakewalkSonar8, //**< Represents Cakewalk Sonar 8. */ | |||||
| CakewalkSonarGeneric, //**< Represents Cakewalk Sonar. */ | |||||
| DaVinciResolve, //**< Represents DaVinci Resolve. */ | |||||
| DigidesignProTools, //**< Represents Avid Pro Tools. */ | |||||
| DigitalPerformer, //**< Represents Digital Performer. */ | |||||
| FinalCut, //**< Represents Apple Final Cut Pro. */ | |||||
| FruityLoops, //**< Represents Fruity Loops. */ | |||||
| MagixSamplitude, //**< Represents Magix Samplitude. */ | |||||
| MergingPyramix, //**< Represents Merging Pyramix. */ | |||||
| MuseReceptorGeneric, //**< Represents Muse Receptor. */ | |||||
| Reaper, //**< Represents Cockos Reaper. */ | |||||
| Renoise, //**< Represents Renoise. */ | |||||
| SADiE, //**< Represents SADiE. */ | |||||
| SteinbergCubase4, //**< Represents Steinberg Cubase 4. */ | |||||
| SteinbergCubase5, //**< Represents Steinberg Cubase 5. */ | |||||
| SteinbergCubase5Bridged, //**< Represents Steinberg Cubase 5 Bridged. */ | |||||
| SteinbergCubase6, //**< Represents Steinberg Cubase 6. */ | |||||
| SteinbergCubase7, //**< Represents Steinberg Cubase 7. */ | |||||
| SteinbergCubase8, //**< Represents Steinberg Cubase 8. */ | |||||
| SteinbergCubase8_5, //**< Represents Steinberg Cubase 8.5. */ | |||||
| SteinbergCubase9, //**< Represents Steinberg Cubase 9. */ | |||||
| SteinbergCubaseGeneric, //**< Represents Steinberg Cubase. */ | |||||
| SteinbergNuendo3, //**< Represents Steinberg Nuendo 3. */ | |||||
| SteinbergNuendo4, //**< Represents Steinberg Nuendo 4. */ | |||||
| SteinbergNuendo5, //**< Represents Steinberg Nuendo 5. */ | |||||
| SteinbergNuendoGeneric, //**< Represents Steinberg Nuendo. */ | |||||
| SteinbergWavelab5, //**< Represents Steinberg Wavelab 5. */ | |||||
| SteinbergWavelab6, //**< Represents Steinberg Wavelab 6. */ | |||||
| SteinbergWavelab7, //**< Represents Steinberg Wavelab 7. */ | |||||
| SteinbergWavelab8, //**< Represents Steinberg Wavelab 8. */ | |||||
| SteinbergWavelabGeneric, //**< Represents Steinberg Wavelab. */ | |||||
| SteinbergTestHost, //**< Represents Steinberg's VST3 Test Host. */ | |||||
| StudioOne, //**< Represents PreSonus Studio One. */ | |||||
| Tracktion3, //**< Represents Tracktion 3. */ | |||||
| TracktionGeneric, //**< Represents Tracktion. */ | |||||
| TracktionWaveform, //**< Represents Tracktion Waveform. */ | |||||
| VBVSTScanner, //**< Represents VB Audio VST Scanner. */ | |||||
| WaveBurner //**< Represents Apple WaveBurner. */ | |||||
| }; | }; | ||||
| HostType type; | HostType type; | ||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns true if the host is any version of Ableton Live. */ | |||||
| bool isAbletonLive() const noexcept { return type == AbletonLive6 || type == AbletonLive7 || type == AbletonLive8 || type == AbletonLiveGeneric; } | bool isAbletonLive() const noexcept { return type == AbletonLive6 || type == AbletonLive7 || type == AbletonLive8 || type == AbletonLiveGeneric; } | ||||
| /** Returns true if the host is Adobe Audition. */ | |||||
| bool isAdobeAudition() const noexcept { return type == AdobeAudition; } | bool isAdobeAudition() const noexcept { return type == AdobeAudition; } | ||||
| /** Returns true if the host is Ardour. */ | |||||
| bool isArdour() const noexcept { return type == Ardour; } | bool isArdour() const noexcept { return type == Ardour; } | ||||
| /** Returns true if the host is Bitwig Studio. */ | |||||
| bool isBitwigStudio() const noexcept { return type == BitwigStudio; } | bool isBitwigStudio() const noexcept { return type == BitwigStudio; } | ||||
| /** Returns true if the host is any version of Steinberg Cubase. */ | |||||
| bool isCubase() const noexcept { return type == SteinbergCubase4 || type == SteinbergCubase5 || type == SteinbergCubase5Bridged || type == SteinbergCubase6 || type == SteinbergCubase7 || type == SteinbergCubase8 || type == SteinbergCubase8_5 || type == SteinbergCubase9 || type == SteinbergCubaseGeneric; } | bool isCubase() const noexcept { return type == SteinbergCubase4 || type == SteinbergCubase5 || type == SteinbergCubase5Bridged || type == SteinbergCubase6 || type == SteinbergCubase7 || type == SteinbergCubase8 || type == SteinbergCubase8_5 || type == SteinbergCubase9 || type == SteinbergCubaseGeneric; } | ||||
| /** Returns true if the host is Steinberg Cubase 7 or later. */ | |||||
| bool isCubase7orLater() const noexcept { return isCubase() && ! (type == SteinbergCubase4 || type == SteinbergCubase5 || type == SteinbergCubase6); } | bool isCubase7orLater() const noexcept { return isCubase() && ! (type == SteinbergCubase4 || type == SteinbergCubase5 || type == SteinbergCubase6); } | ||||
| /** Returns true if the host is Steinberg Cubase 5 Bridged. */ | |||||
| bool isCubaseBridged() const noexcept { return type == SteinbergCubase5Bridged; } | bool isCubaseBridged() const noexcept { return type == SteinbergCubase5Bridged; } | ||||
| /** Returns true if the host is DaVinci Resolve. */ | |||||
| bool isDaVinciResolve() const noexcept { return type == DaVinciResolve; } | bool isDaVinciResolve() const noexcept { return type == DaVinciResolve; } | ||||
| /** Returns true if the host is Digital Performer. */ | |||||
| bool isDigitalPerformer() const noexcept { return type == DigitalPerformer; } | bool isDigitalPerformer() const noexcept { return type == DigitalPerformer; } | ||||
| /** Returns true if the host is Apple Final Cut Pro. */ | |||||
| bool isFinalCut() const noexcept { return type == FinalCut; } | bool isFinalCut() const noexcept { return type == FinalCut; } | ||||
| /** Returns true if the host is Fruity Loops. */ | |||||
| bool isFruityLoops() const noexcept { return type == FruityLoops; } | bool isFruityLoops() const noexcept { return type == FruityLoops; } | ||||
| /** Returns true if the host is Apple Logic Pro. */ | |||||
| bool isLogic() const noexcept { return type == AppleLogic; } | bool isLogic() const noexcept { return type == AppleLogic; } | ||||
| /** Returns true if the host is any version of Steinberg Nuendo. */ | |||||
| bool isNuendo() const noexcept { return type == SteinbergNuendo3 || type == SteinbergNuendo4 || type == SteinbergNuendo5 || type == SteinbergNuendoGeneric; } | bool isNuendo() const noexcept { return type == SteinbergNuendo3 || type == SteinbergNuendo4 || type == SteinbergNuendo5 || type == SteinbergNuendoGeneric; } | ||||
| /** Returns true if the host is Adobe Premiere Pro. */ | |||||
| bool isPremiere() const noexcept { return type == AdobePremierePro; } | bool isPremiere() const noexcept { return type == AdobePremierePro; } | ||||
| /** Returns true if the host is Avid Pro Tools. */ | |||||
| bool isProTools() const noexcept { return type == DigidesignProTools; } | bool isProTools() const noexcept { return type == DigidesignProTools; } | ||||
| /** Returns true if the host is Merging Pyramix. */ | |||||
| bool isPyramix() const noexcept { return type == MergingPyramix; } | bool isPyramix() const noexcept { return type == MergingPyramix; } | ||||
| /** Returns true if the host is Muse Receptor. */ | |||||
| bool isReceptor() const noexcept { return type == MuseReceptorGeneric; } | bool isReceptor() const noexcept { return type == MuseReceptorGeneric; } | ||||
| /** Returns true if the host is Cockos Reaper. */ | |||||
| bool isReaper() const noexcept { return type == Reaper; } | bool isReaper() const noexcept { return type == Reaper; } | ||||
| /** Returns true if the host is Renoise. */ | |||||
| bool isRenoise() const noexcept { return type == Renoise; } | bool isRenoise() const noexcept { return type == Renoise; } | ||||
| /** Returns true if the host is SADiE. */ | |||||
| bool isSADiE() const noexcept { return type == SADiE; } | bool isSADiE() const noexcept { return type == SADiE; } | ||||
| /** Returns true if the host is Magix Samplitude. */ | |||||
| bool isSamplitude() const noexcept { return type == MagixSamplitude; } | bool isSamplitude() const noexcept { return type == MagixSamplitude; } | ||||
| /** Returns true if the host is any version of Cakewalk Sonar. */ | |||||
| bool isSonar() const noexcept { return type == CakewalkSonar8 || type == CakewalkSonarGeneric; } | bool isSonar() const noexcept { return type == CakewalkSonar8 || type == CakewalkSonarGeneric; } | ||||
| /** Returns true if the host is Steinberg's VST3 Test Host. */ | |||||
| bool isSteinbergTestHost() const noexcept { return type == SteinbergTestHost; } | bool isSteinbergTestHost() const noexcept { return type == SteinbergTestHost; } | ||||
| /** Returns true if the host is any product from Steinberg. */ | |||||
| bool isSteinberg() const noexcept { return isCubase() || isNuendo() || isWavelab() || isSteinbergTestHost(); } | bool isSteinberg() const noexcept { return isCubase() || isNuendo() || isWavelab() || isSteinbergTestHost(); } | ||||
| /** Returns true if the host is PreSonus Studio One. */ | |||||
| bool isStudioOne() const noexcept { return type == StudioOne; } | bool isStudioOne() const noexcept { return type == StudioOne; } | ||||
| /** Returns true if the host is any version of Tracktion. */ | |||||
| bool isTracktion() const noexcept { return type == Tracktion3 || type == TracktionGeneric || isTracktionWaveform(); } | bool isTracktion() const noexcept { return type == Tracktion3 || type == TracktionGeneric || isTracktionWaveform(); } | ||||
| /** Returns true if the host is Tracktion Waveform. */ | |||||
| bool isTracktionWaveform() const noexcept { return type == TracktionWaveform; } | bool isTracktionWaveform() const noexcept { return type == TracktionWaveform; } | ||||
| /** Returns true if the host is VB Audio VST Scanner. */ | |||||
| bool isVBVSTScanner() const noexcept { return type == VBVSTScanner; } | bool isVBVSTScanner() const noexcept { return type == VBVSTScanner; } | ||||
| /** Returns true if the host is Apple WaveBurner. */ | |||||
| bool isWaveBurner() const noexcept { return type == WaveBurner; } | bool isWaveBurner() const noexcept { return type == WaveBurner; } | ||||
| /** Returns true if the host is any version of Steinberg WaveLab. */ | |||||
| bool isWavelab() const noexcept { return isWavelabLegacy() || type == SteinbergWavelab7 || type == SteinbergWavelab8 || type == SteinbergWavelabGeneric; } | bool isWavelab() const noexcept { return isWavelabLegacy() || type == SteinbergWavelab7 || type == SteinbergWavelab8 || type == SteinbergWavelabGeneric; } | ||||
| /** Returns true if the host is Steinberg WaveLab 6 or below. */ | |||||
| bool isWavelabLegacy() const noexcept { return type == SteinbergWavelab5 || type == SteinbergWavelab6; } | bool isWavelabLegacy() const noexcept { return type == SteinbergWavelab5 || type == SteinbergWavelab6; } | ||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns a human-readable description of the host. */ | |||||
| const char* getHostDescription() const noexcept | const char* getHostDescription() const noexcept | ||||
| { | { | ||||
| switch (type) | switch (type) | ||||
| @@ -181,7 +220,9 @@ public: | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns true if the plugin is connected with Inter-App Audio on iOS. */ | |||||
| bool isInterAppAudioConnected() const; | bool isInterAppAudioConnected() const; | ||||
| /** Switches to the host application when Inter-App Audio is used on iOS. */ | |||||
| void switchToHostApplication() const; | void switchToHostApplication() const; | ||||
| #if JUCE_MODULE_AVAILABLE_juce_gui_basics | #if JUCE_MODULE_AVAILABLE_juce_gui_basics | ||||
| @@ -189,6 +230,7 @@ public: | |||||
| #endif | #endif | ||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns the complete absolute path of the host application executable. */ | |||||
| static String getHostPath() | static String getHostPath() | ||||
| { | { | ||||
| return File::getSpecialLocation (File::hostApplicationPath).getFullPathName(); | return File::getSpecialLocation (File::hostApplicationPath).getFullPathName(); | ||||