/JuceLibraryCode/modules/juce_audio_plugin_client/utility/juce_PluginHostType.h

https://bitbucket.org/jeromegill/genie · C Header · 160 lines · 120 code · 10 blank · 30 comment · 87 complexity · cc7453e0595065b3718ebefcae555894 MD5 · raw file

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. //==============================================================================
  19. class PluginHostType
  20. {
  21. public:
  22. //==============================================================================
  23. PluginHostType() : type (getHostType())
  24. {
  25. }
  26. //==============================================================================
  27. enum HostType
  28. {
  29. UnknownHost,
  30. AbletonLive6,
  31. AbletonLive7,
  32. AbletonLive8,
  33. AbletonLiveGeneric,
  34. AdobePremierePro,
  35. AppleLogic,
  36. CakewalkSonar8,
  37. CakewalkSonarGeneric,
  38. DigidesignProTools,
  39. EmagicLogic,
  40. Reaper,
  41. MackieTracktion3,
  42. MackieTracktionGeneric,
  43. SteinbergCubase4,
  44. SteinbergCubase5,
  45. SteinbergCubase5Bridged,
  46. SteinbergCubaseGeneric,
  47. SteinbergCubase6,
  48. SteinbergCubase7,
  49. SteinbergWavelab5,
  50. SteinbergWavelab6,
  51. SteinbergWavelab7,
  52. SteinbergWavelabGeneric,
  53. MuseReceptorGeneric,
  54. MagixSamplitude,
  55. FruityLoops,
  56. WaveBurner,
  57. DigitalPerformer,
  58. StudioOne
  59. };
  60. const HostType type;
  61. //==============================================================================
  62. bool isAbletonLive() const noexcept { return type == AbletonLive6 || type == AbletonLive7 || type == AbletonLive8 || type == AbletonLiveGeneric; }
  63. bool isCubase() const noexcept { return type == SteinbergCubase4 || type == SteinbergCubase5 || type == SteinbergCubase5Bridged || type == SteinbergCubase6 || type == SteinbergCubase7 || type == SteinbergCubaseGeneric; }
  64. bool isCubaseBridged() const noexcept { return type == SteinbergCubase5Bridged; }
  65. bool isTracktion() const noexcept { return type == MackieTracktion3 || type == MackieTracktionGeneric; }
  66. bool isSonar() const noexcept { return type == CakewalkSonar8 || type == CakewalkSonarGeneric; }
  67. bool isWavelab() const noexcept { return isWavelabLegacy() || type == SteinbergWavelab7 || type == SteinbergWavelabGeneric; }
  68. bool isWavelabLegacy() const noexcept { return type == SteinbergWavelab5 || type == SteinbergWavelab6; }
  69. bool isPremiere() const noexcept { return type == AdobePremierePro; }
  70. bool isLogic() const noexcept { return type == AppleLogic || type == EmagicLogic; }
  71. bool isReceptor() const noexcept { return type == MuseReceptorGeneric; }
  72. bool isSamplitude() const noexcept { return type == MagixSamplitude; }
  73. bool isFruityLoops() const noexcept { return type == FruityLoops; }
  74. bool isWaveBurner() const noexcept { return type == WaveBurner; }
  75. bool isDigitalPerformer() const noexcept { return type == DigitalPerformer; }
  76. bool isReaper() const noexcept { return type == Reaper; }
  77. bool isStudioOne() const noexcept { return type == StudioOne; }
  78. //==============================================================================
  79. static String getHostPath()
  80. {
  81. return File::getSpecialLocation (File::hostApplicationPath).getFullPathName();
  82. }
  83. //==============================================================================
  84. private:
  85. static HostType getHostType()
  86. {
  87. const String hostPath (getHostPath());
  88. const String hostFilename (File (hostPath).getFileName());
  89. #if JUCE_MAC
  90. if (hostPath.containsIgnoreCase ("Live 6.")) return AbletonLive6;
  91. if (hostPath.containsIgnoreCase ("Live 7.")) return AbletonLive7;
  92. if (hostPath.containsIgnoreCase ("Live 8.")) return AbletonLive8;
  93. if (hostFilename.containsIgnoreCase ("Live")) return AbletonLiveGeneric;
  94. if (hostFilename.containsIgnoreCase ("Adobe Premiere")) return AdobePremierePro;
  95. if (hostFilename.contains ("Logic")) return AppleLogic;
  96. if (hostFilename.containsIgnoreCase ("Pro Tools")) return DigidesignProTools;
  97. if (hostFilename.containsIgnoreCase ("Cubase 4")) return SteinbergCubase4;
  98. if (hostFilename.containsIgnoreCase ("Cubase 5")) return SteinbergCubase5;
  99. if (hostFilename.containsIgnoreCase ("Cubase 6")) return SteinbergCubase6;
  100. if (hostFilename.containsIgnoreCase ("Cubase 7")) return SteinbergCubase7;
  101. if (hostFilename.containsIgnoreCase ("Cubase")) return SteinbergCubaseGeneric;
  102. if (hostPath.containsIgnoreCase ("Wavelab 7")) return SteinbergWavelab7;
  103. if (hostFilename.containsIgnoreCase ("Wavelab")) return SteinbergWavelabGeneric;
  104. if (hostFilename.containsIgnoreCase ("WaveBurner")) return WaveBurner;
  105. if (hostFilename.contains ("Digital Performer")) return DigitalPerformer;
  106. if (hostFilename.containsIgnoreCase ("reaper")) return Reaper;
  107. if (hostPath.containsIgnoreCase ("Studio One")) return StudioOne;
  108. #elif JUCE_WINDOWS
  109. if (hostFilename.containsIgnoreCase ("Live 6.")) return AbletonLive6;
  110. if (hostFilename.containsIgnoreCase ("Live 7.")) return AbletonLive7;
  111. if (hostFilename.containsIgnoreCase ("Live 8.")) return AbletonLive8;
  112. if (hostFilename.containsIgnoreCase ("Live ")) return AbletonLiveGeneric;
  113. if (hostFilename.containsIgnoreCase ("Adobe Premiere")) return AdobePremierePro;
  114. if (hostFilename.containsIgnoreCase ("ProTools")) return DigidesignProTools;
  115. if (hostPath.containsIgnoreCase ("SONAR 8")) return CakewalkSonar8;
  116. if (hostFilename.containsIgnoreCase ("SONAR")) return CakewalkSonarGeneric;
  117. if (hostFilename.containsIgnoreCase ("Logic")) return EmagicLogic;
  118. if (hostPath.containsIgnoreCase ("Tracktion 3")) return MackieTracktion3;
  119. if (hostFilename.containsIgnoreCase ("Tracktion")) return MackieTracktionGeneric;
  120. if (hostFilename.containsIgnoreCase ("reaper")) return Reaper;
  121. if (hostFilename.containsIgnoreCase ("Cubase4")) return SteinbergCubase4;
  122. if (hostFilename.containsIgnoreCase ("Cubase5")) return SteinbergCubase5;
  123. if (hostFilename.containsIgnoreCase ("Cubase6")) return SteinbergCubase6;
  124. if (hostFilename.containsIgnoreCase ("Cubase7")) return SteinbergCubase7;
  125. if (hostFilename.containsIgnoreCase ("Cubase")) return SteinbergCubaseGeneric;
  126. if (hostFilename.containsIgnoreCase ("VSTBridgeApp")) return SteinbergCubase5Bridged;
  127. if (hostPath.containsIgnoreCase ("Wavelab 5")) return SteinbergWavelab5;
  128. if (hostPath.containsIgnoreCase ("Wavelab 6")) return SteinbergWavelab6;
  129. if (hostPath.containsIgnoreCase ("Wavelab 7")) return SteinbergWavelab7;
  130. if (hostFilename.containsIgnoreCase ("Wavelab")) return SteinbergWavelabGeneric;
  131. if (hostFilename.containsIgnoreCase ("rm-host")) return MuseReceptorGeneric;
  132. if (hostFilename.startsWithIgnoreCase ("Sam")) return MagixSamplitude;
  133. if (hostFilename.startsWith ("FL")) return FruityLoops;
  134. if (hostPath.containsIgnoreCase ("Studio One")) return StudioOne;
  135. #elif JUCE_LINUX
  136. jassertfalse // not yet done!
  137. #else
  138. #error
  139. #endif
  140. return UnknownHost;
  141. }
  142. JUCE_DECLARE_NON_COPYABLE (PluginHostType)
  143. };