PageRenderTime 34ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/libs/JUCE/modules/juce_audio_plugin_client/utility/juce_PluginHostType.h

https://github.com/plasm-language/pyplasm
C Header | 247 lines | 205 code | 12 blank | 30 comment | 132 complexity | 2eb0d77a51162bedf78f7e54fe94cdb7 MD5 | raw file
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. //==============================================================================
  18. class PluginHostType
  19. {
  20. public:
  21. //==============================================================================
  22. PluginHostType() : type (getHostType()) {}
  23. PluginHostType (const PluginHostType& other) noexcept : type (other.type) {}
  24. PluginHostType& operator= (const PluginHostType& other) noexcept { type = other.type; return *this; }
  25. //==============================================================================
  26. enum HostType
  27. {
  28. UnknownHost,
  29. AbletonLive6,
  30. AbletonLive7,
  31. AbletonLive8,
  32. AbletonLiveGeneric,
  33. AdobeAudition,
  34. AdobePremierePro,
  35. AppleLogic,
  36. Ardour,
  37. CakewalkSonar8,
  38. CakewalkSonarGeneric,
  39. DigidesignProTools,
  40. DigitalPerformer,
  41. FinalCut,
  42. FruityLoops,
  43. MagixSamplitude,
  44. MergingPyramix,
  45. MuseReceptorGeneric,
  46. Reaper,
  47. SteinbergCubase4,
  48. SteinbergCubase5,
  49. SteinbergCubase5Bridged,
  50. SteinbergCubase6,
  51. SteinbergCubase7,
  52. SteinbergCubase8,
  53. SteinbergCubaseGeneric,
  54. SteinbergNuendo3,
  55. SteinbergNuendo4,
  56. SteinbergNuendo5,
  57. SteinbergNuendoGeneric,
  58. SteinbergWavelab5,
  59. SteinbergWavelab6,
  60. SteinbergWavelab7,
  61. SteinbergWavelab8,
  62. SteinbergWavelabGeneric,
  63. SteinbergTestHost,
  64. StudioOne,
  65. Tracktion3,
  66. TracktionGeneric,
  67. VBVSTScanner,
  68. WaveBurner
  69. };
  70. HostType type;
  71. //==============================================================================
  72. bool isAbletonLive() const noexcept { return type == AbletonLive6 || type == AbletonLive7 || type == AbletonLive8 || type == AbletonLiveGeneric; }
  73. bool isAdobeAudition() const noexcept { return type == AdobeAudition; }
  74. bool isArdour() const noexcept { return type == Ardour; }
  75. bool isDigitalPerformer() const noexcept { return type == DigitalPerformer; }
  76. bool isCubase() const noexcept { return type == SteinbergCubase4 || type == SteinbergCubase5 || type == SteinbergCubase5Bridged || type == SteinbergCubase6 || type == SteinbergCubase7 || type == SteinbergCubase8 || type == SteinbergCubaseGeneric; }
  77. bool isCubase7orLater() const noexcept { return isCubase() && ! (type == SteinbergCubase4 || type == SteinbergCubase5 || type == SteinbergCubase6); }
  78. bool isCubaseBridged() const noexcept { return type == SteinbergCubase5Bridged; }
  79. bool isLogic() const noexcept { return type == AppleLogic; }
  80. bool isFinalCut() const noexcept { return type == FinalCut; }
  81. bool isFruityLoops() const noexcept { return type == FruityLoops; }
  82. bool isNuendo() const noexcept { return type == SteinbergNuendo3 || type == SteinbergNuendo4 || type == SteinbergNuendo5 || type == SteinbergNuendoGeneric; }
  83. bool isPremiere() const noexcept { return type == AdobePremierePro; }
  84. bool isPyramix() const noexcept { return type == MergingPyramix; }
  85. bool isReceptor() const noexcept { return type == MuseReceptorGeneric; }
  86. bool isReaper() const noexcept { return type == Reaper; }
  87. bool isSamplitude() const noexcept { return type == MagixSamplitude; }
  88. bool isSonar() const noexcept { return type == CakewalkSonar8 || type == CakewalkSonarGeneric; }
  89. bool isSteinbergTestHost() const noexcept{ return type == SteinbergTestHost; }
  90. bool isSteinberg() const noexcept { return isCubase() || isNuendo() || isWavelab() || isSteinbergTestHost(); }
  91. bool isStudioOne() const noexcept { return type == StudioOne; }
  92. bool isTracktion() const noexcept { return type == Tracktion3 || type == TracktionGeneric; }
  93. bool isVBVSTScanner() const noexcept { return type == VBVSTScanner; }
  94. bool isWaveBurner() const noexcept { return type == WaveBurner; }
  95. bool isWavelab() const noexcept { return isWavelabLegacy() || type == SteinbergWavelab7 || type == SteinbergWavelab8 || type == SteinbergWavelabGeneric; }
  96. bool isWavelabLegacy() const noexcept { return type == SteinbergWavelab5 || type == SteinbergWavelab6; }
  97. //==============================================================================
  98. const char* getHostDescription() const noexcept
  99. {
  100. switch (type)
  101. {
  102. case AbletonLive6: return "Ableton Live 6";
  103. case AbletonLive7: return "Ableton Live 7";
  104. case AbletonLive8: return "Ableton Live 8";
  105. case AbletonLiveGeneric: return "Ableton Live";
  106. case AdobeAudition: return "Adobe Audition";
  107. case AdobePremierePro: return "Adobe Premiere";
  108. case AppleLogic: return "Apple Logic";
  109. case CakewalkSonar8: return "Cakewalk Sonar 8";
  110. case CakewalkSonarGeneric: return "Cakewalk Sonar";
  111. case DigidesignProTools: return "ProTools";
  112. case DigitalPerformer: return "DigitalPerformer";
  113. case FinalCut: return "Final Cut";
  114. case FruityLoops: return "FruityLoops";
  115. case MagixSamplitude: return "Magix Samplitude";
  116. case MergingPyramix: return "Pyramix";
  117. case MuseReceptorGeneric: return "Muse Receptor";
  118. case Reaper: return "Reaper";
  119. case SteinbergCubase4: return "Steinberg Cubase 4";
  120. case SteinbergCubase5: return "Steinberg Cubase 5";
  121. case SteinbergCubase5Bridged: return "Steinberg Cubase 5 Bridged";
  122. case SteinbergCubase6: return "Steinberg Cubase 6";
  123. case SteinbergCubase7: return "Steinberg Cubase 7";
  124. case SteinbergCubase8: return "Steinberg Cubase 8";
  125. case SteinbergCubaseGeneric: return "Steinberg Cubase";
  126. case SteinbergNuendo3: return "Steinberg Nuendo 3";
  127. case SteinbergNuendo4: return "Steinberg Nuendo 4";
  128. case SteinbergNuendo5: return "Steinberg Nuendo 5";
  129. case SteinbergNuendoGeneric: return "Steinberg Nuendo";
  130. case SteinbergWavelab5: return "Steinberg Wavelab 5";
  131. case SteinbergWavelab6: return "Steinberg Wavelab 6";
  132. case SteinbergWavelab7: return "Steinberg Wavelab 7";
  133. case SteinbergWavelab8: return "Steinberg Wavelab 8";
  134. case SteinbergWavelabGeneric: return "Steinberg Wavelab";
  135. case SteinbergTestHost: return "Steinberg TestHost";
  136. case StudioOne: return "Studio One";
  137. case Tracktion3: return "Tracktion 3";
  138. case TracktionGeneric: return "Tracktion";
  139. case VBVSTScanner: return "VBVSTScanner";
  140. case WaveBurner: return "WaveBurner";
  141. default: break;
  142. }
  143. return "Unknown";
  144. }
  145. //==============================================================================
  146. static String getHostPath()
  147. {
  148. return File::getSpecialLocation (File::hostApplicationPath).getFullPathName();
  149. }
  150. //==============================================================================
  151. private:
  152. static HostType getHostType()
  153. {
  154. const String hostPath (getHostPath());
  155. const String hostFilename (File (hostPath).getFileName());
  156. #if JUCE_MAC
  157. if (hostPath.containsIgnoreCase ("Final Cut Pro.app")) return FinalCut;
  158. if (hostPath.containsIgnoreCase ("Final Cut Pro Trial.app")) return FinalCut;
  159. if (hostPath.containsIgnoreCase ("Live 6.")) return AbletonLive6;
  160. if (hostPath.containsIgnoreCase ("Live 7.")) return AbletonLive7;
  161. if (hostPath.containsIgnoreCase ("Live 8.")) return AbletonLive8;
  162. if (hostFilename.containsIgnoreCase ("Live")) return AbletonLiveGeneric;
  163. if (hostFilename.containsIgnoreCase ("Adobe Premiere")) return AdobePremierePro;
  164. if (hostFilename.contains ("Logic")) return AppleLogic;
  165. if (hostFilename.containsIgnoreCase ("Pro Tools")) return DigidesignProTools;
  166. if (hostFilename.containsIgnoreCase ("Nuendo 3")) return SteinbergNuendo3;
  167. if (hostFilename.containsIgnoreCase ("Nuendo 4")) return SteinbergNuendo4;
  168. if (hostFilename.containsIgnoreCase ("Nuendo 5")) return SteinbergNuendo5;
  169. if (hostFilename.containsIgnoreCase ("Nuendo")) return SteinbergNuendoGeneric;
  170. if (hostFilename.containsIgnoreCase ("Cubase 4")) return SteinbergCubase4;
  171. if (hostFilename.containsIgnoreCase ("Cubase 5")) return SteinbergCubase5;
  172. if (hostFilename.containsIgnoreCase ("Cubase 6")) return SteinbergCubase6;
  173. if (hostFilename.containsIgnoreCase ("Cubase 7")) return SteinbergCubase7;
  174. if (hostFilename.containsIgnoreCase ("Cubase 8")) return SteinbergCubase8;
  175. if (hostFilename.containsIgnoreCase ("Cubase")) return SteinbergCubaseGeneric;
  176. if (hostPath.containsIgnoreCase ("Wavelab 7")) return SteinbergWavelab7;
  177. if (hostPath.containsIgnoreCase ("Wavelab 8")) return SteinbergWavelab8;
  178. if (hostFilename.containsIgnoreCase ("Wavelab")) return SteinbergWavelabGeneric;
  179. if (hostFilename.containsIgnoreCase ("WaveBurner")) return WaveBurner;
  180. if (hostFilename.contains ("Digital Performer")) return DigitalPerformer;
  181. if (hostFilename.containsIgnoreCase ("reaper")) return Reaper;
  182. if (hostPath.containsIgnoreCase ("Studio One")) return StudioOne;
  183. if (hostPath.containsIgnoreCase ("Tracktion 3")) return Tracktion3;
  184. if (hostFilename.containsIgnoreCase ("Tracktion")) return TracktionGeneric;
  185. #elif JUCE_WINDOWS
  186. if (hostFilename.containsIgnoreCase ("Live 6.")) return AbletonLive6;
  187. if (hostFilename.containsIgnoreCase ("Live 7.")) return AbletonLive7;
  188. if (hostFilename.containsIgnoreCase ("Live 8.")) return AbletonLive8;
  189. if (hostFilename.containsIgnoreCase ("Live ")) return AbletonLiveGeneric;
  190. if (hostFilename.containsIgnoreCase ("Audition")) return AdobeAudition;
  191. if (hostFilename.containsIgnoreCase ("Adobe Premiere")) return AdobePremierePro;
  192. if (hostFilename.containsIgnoreCase ("ProTools")) return DigidesignProTools;
  193. if (hostPath.containsIgnoreCase ("SONAR 8")) return CakewalkSonar8;
  194. if (hostFilename.containsIgnoreCase ("SONAR")) return CakewalkSonarGeneric;
  195. if (hostFilename.containsIgnoreCase ("Logic")) return AppleLogic;
  196. if (hostPath.containsIgnoreCase ("Tracktion 3")) return Tracktion3;
  197. if (hostFilename.containsIgnoreCase ("Tracktion")) return TracktionGeneric;
  198. if (hostFilename.containsIgnoreCase ("reaper")) return Reaper;
  199. if (hostFilename.containsIgnoreCase ("Cubase4")) return SteinbergCubase4;
  200. if (hostFilename.containsIgnoreCase ("Cubase5")) return SteinbergCubase5;
  201. if (hostFilename.containsIgnoreCase ("Cubase6")) return SteinbergCubase6;
  202. if (hostFilename.containsIgnoreCase ("Cubase7")) return SteinbergCubase7;
  203. if (hostFilename.containsIgnoreCase ("Cubase8")) return SteinbergCubase8;
  204. if (hostFilename.containsIgnoreCase ("Cubase")) return SteinbergCubaseGeneric;
  205. if (hostFilename.containsIgnoreCase ("VSTBridgeApp")) return SteinbergCubase5Bridged;
  206. if (hostPath.containsIgnoreCase ("Wavelab 5")) return SteinbergWavelab5;
  207. if (hostPath.containsIgnoreCase ("Wavelab 6")) return SteinbergWavelab6;
  208. if (hostPath.containsIgnoreCase ("Wavelab 7")) return SteinbergWavelab7;
  209. if (hostPath.containsIgnoreCase ("Wavelab 8")) return SteinbergWavelab8;
  210. if (hostPath.containsIgnoreCase ("Nuendo")) return SteinbergNuendoGeneric;
  211. if (hostFilename.containsIgnoreCase ("Wavelab")) return SteinbergWavelabGeneric;
  212. if (hostFilename.containsIgnoreCase ("TestHost")) return SteinbergTestHost;
  213. if (hostFilename.containsIgnoreCase ("rm-host")) return MuseReceptorGeneric;
  214. if (hostFilename.startsWith ("FL")) return FruityLoops;
  215. if (hostFilename.contains ("ilbridge.")) return FruityLoops;
  216. if (hostPath.containsIgnoreCase ("Studio One")) return StudioOne;
  217. if (hostPath.containsIgnoreCase ("Digital Performer")) return DigitalPerformer;
  218. if (hostFilename.containsIgnoreCase ("VST_Scanner")) return VBVSTScanner;
  219. if (hostPath.containsIgnoreCase ("Merging Technologies")) return MergingPyramix;
  220. if (hostFilename.startsWithIgnoreCase ("Sam")) return MagixSamplitude;
  221. #elif JUCE_LINUX
  222. if (hostFilename.containsIgnoreCase ("Ardour")) return Ardour;
  223. #else
  224. #error
  225. #endif
  226. return UnknownHost;
  227. }
  228. };