Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CarlaBackendUtils.hpp 17KB

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. /*
  2. * Carla Backend utils
  3. * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the GPL.txt file
  16. */
  17. #ifndef __CARLA_BACKEND_UTILS_HPP__
  18. #define __CARLA_BACKEND_UTILS_HPP__
  19. #include "CarlaBackend.hpp"
  20. #include "CarlaString.hpp"
  21. CARLA_BACKEND_START_NAMESPACE
  22. // -------------------------------------------------
  23. static inline
  24. const char* PluginOption2Str(const unsigned int& option)
  25. {
  26. switch (option)
  27. {
  28. case PLUGIN_OPTION_FIXED_BUFFER:
  29. return "PLUGIN_OPTION_FIXED_BUFFER";
  30. case PLUGIN_OPTION_FORCE_STEREO:
  31. return "PLUGIN_OPTION_FORCE_STEREO";
  32. case PLUGIN_OPTION_MAP_PROGRAM_CHANGES:
  33. return "PLUGIN_OPTION_MAP_PROGRAM_CHANGES";
  34. case PLUGIN_OPTION_USE_CHUNKS:
  35. return "PLUGIN_OPTION_USE_CHUNKS";
  36. case PLUGIN_OPTION_SEND_CONTROL_CHANGES:
  37. return "PLUGIN_OPTION_SEND_CONTROL_CHANGES";
  38. case PLUGIN_OPTION_SEND_CHANNEL_PRESSURE:
  39. return "PLUGIN_OPTION_SEND_CHANNEL_PRESSURE";
  40. case PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH:
  41. return "PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH";
  42. case PLUGIN_OPTION_SEND_PITCHBEND:
  43. return "PLUGIN_OPTION_SEND_PITCHBEND";
  44. case PLUGIN_OPTION_SEND_ALL_SOUND_OFF:
  45. return "PLUGIN_OPTION_SEND_ALL_SOUND_OFF";
  46. }
  47. carla_stderr("CarlaBackend::PluginOption2Str(%i) - invalid type", option);
  48. return nullptr;
  49. }
  50. // -------------------------------------------------
  51. static inline
  52. const char* BinaryType2Str(const BinaryType& type)
  53. {
  54. switch (type)
  55. {
  56. case BINARY_NONE:
  57. return "BINARY_NONE";
  58. case BINARY_POSIX32:
  59. return "BINARY_POSIX32";
  60. case BINARY_POSIX64:
  61. return "BINARY_POSIX64";
  62. case BINARY_WIN32:
  63. return "BINARY_WIN32";
  64. case BINARY_WIN64:
  65. return "BINARY_WIN64";
  66. case BINARY_OTHER:
  67. return "BINARY_OTHER";
  68. }
  69. carla_stderr("CarlaBackend::BinaryType2Str(%i) - invalid type", type);
  70. return nullptr;
  71. }
  72. static inline
  73. const char* PluginType2Str(const PluginType& type)
  74. {
  75. switch (type)
  76. {
  77. case PLUGIN_NONE:
  78. return "PLUGIN_NONE";
  79. case PLUGIN_INTERNAL:
  80. return "PLUGIN_INTERNAL";
  81. case PLUGIN_LADSPA:
  82. return "PLUGIN_LADSPA";
  83. case PLUGIN_DSSI:
  84. return "PLUGIN_DSSI";
  85. case PLUGIN_LV2:
  86. return "PLUGIN_LV2";
  87. case PLUGIN_VST:
  88. return "PLUGIN_VST";
  89. case PLUGIN_VST3:
  90. return "PLUGIN_VST3";
  91. case PLUGIN_GIG:
  92. return "PLUGIN_GIG";
  93. case PLUGIN_SF2:
  94. return "PLUGIN_SF2";
  95. case PLUGIN_SFZ:
  96. return "PLUGIN_SFZ";
  97. }
  98. carla_stderr("CarlaBackend::PluginType2Str(%i) - invalid type", type);
  99. return nullptr;
  100. }
  101. static inline
  102. const char* PluginCategory2Str(const PluginCategory& category)
  103. {
  104. switch (category)
  105. {
  106. case PLUGIN_CATEGORY_NONE:
  107. return "PLUGIN_CATEGORY_NONE";
  108. case PLUGIN_CATEGORY_SYNTH:
  109. return "PLUGIN_CATEGORY_SYNTH";
  110. case PLUGIN_CATEGORY_DELAY:
  111. return "PLUGIN_CATEGORY_DELAY";
  112. case PLUGIN_CATEGORY_EQ:
  113. return "PLUGIN_CATEGORY_EQ";
  114. case PLUGIN_CATEGORY_FILTER:
  115. return "PLUGIN_CATEGORY_FILTER";
  116. case PLUGIN_CATEGORY_DYNAMICS:
  117. return "PLUGIN_CATEGORY_DYNAMICS";
  118. case PLUGIN_CATEGORY_MODULATOR:
  119. return "PLUGIN_CATEGORY_MODULATOR";
  120. case PLUGIN_CATEGORY_UTILITY:
  121. return "PLUGIN_CATEGORY_UTILITY";
  122. case PLUGIN_CATEGORY_OTHER:
  123. return "PLUGIN_CATEGORY_OTHER";
  124. }
  125. carla_stderr("CarlaBackend::PluginCategory2Str(%i) - invalid category", category);
  126. return nullptr;
  127. }
  128. static inline
  129. const char* ParameterType2Str(const ParameterType& type)
  130. {
  131. switch (type)
  132. {
  133. case PARAMETER_UNKNOWN:
  134. return "PARAMETER_UNKNOWN";
  135. case PARAMETER_INPUT:
  136. return "PARAMETER_INPUT";
  137. case PARAMETER_OUTPUT:
  138. return "PARAMETER_OUTPUT";
  139. case PARAMETER_LATENCY:
  140. return "PARAMETER_LATENCY";
  141. case PARAMETER_SAMPLE_RATE:
  142. return "PARAMETER_SAMPLE_RATE";
  143. #ifdef WANT_LV2
  144. case PARAMETER_LV2_FREEWHEEL:
  145. return "PARAMETER_LV2_FREEWHEEL";
  146. case PARAMETER_LV2_TIME:
  147. return "PARAMETER_LV2_TIME";
  148. #endif
  149. }
  150. carla_stderr("CarlaBackend::ParameterType2Str(%i) - invalid type", type);
  151. return nullptr;
  152. }
  153. static inline
  154. const char* InternalParametersIndex2Str(const InternalParametersIndex& index)
  155. {
  156. switch (index)
  157. {
  158. case PARAMETER_NULL:
  159. return "PARAMETER_NULL";
  160. case PARAMETER_ACTIVE:
  161. return "PARAMETER_ACTIVE";
  162. case PARAMETER_DRYWET:
  163. return "PARAMETER_DRYWET";
  164. case PARAMETER_VOLUME:
  165. return "PARAMETER_VOLUME";
  166. case PARAMETER_BALANCE_LEFT:
  167. return "PARAMETER_BALANCE_LEFT";
  168. case PARAMETER_BALANCE_RIGHT:
  169. return "PARAMETER_BALANCE_RIGHT";
  170. case PARAMETER_PANNING:
  171. return "PARAMETER_PANNING";
  172. case PARAMETER_CTRL_CHANNEL:
  173. return "PARAMETER_CTRL_CHANNEL";
  174. case PARAMETER_MAX:
  175. return "PARAMETER_MAX";
  176. }
  177. carla_stderr("CarlaBackend::InternalParametersIndex2Str(%i) - invalid index", index);
  178. return nullptr;
  179. }
  180. static inline
  181. const char* OptionsType2Str(const OptionsType& type)
  182. {
  183. switch (type)
  184. {
  185. case OPTION_PROCESS_NAME:
  186. return "OPTION_PROCESS_NAME";
  187. case OPTION_PROCESS_MODE:
  188. return "OPTION_PROCESS_MODE";
  189. case OPTION_TRANSPORT_MODE:
  190. return "OPTION_TRANSPORT_MODE";
  191. case OPTION_FORCE_STEREO:
  192. return "OPTION_FORCE_STEREO";
  193. case OPTION_PREFER_PLUGIN_BRIDGES:
  194. return "OPTION_PREFER_PLUGIN_BRIDGES";
  195. case OPTION_PREFER_UI_BRIDGES:
  196. return "OPTION_PREFER_UI_BRIDGES";
  197. #ifdef WANT_DSSI
  198. case OPTION_USE_DSSI_VST_CHUNKS:
  199. return "OPTION_USE_DSSI_VST_CHUNKS";
  200. #endif
  201. case OPTION_MAX_PARAMETERS:
  202. return "OPTION_MAX_PARAMETERS";
  203. case OPTION_OSC_UI_TIMEOUT:
  204. return "OPTION_OSC_UI_TIMEOUT";
  205. case OPTION_JACK_AUTOCONNECT:
  206. return "OPTION_JACK_AUTOCONNECT";
  207. case OPTION_JACK_TIMEMASTER:
  208. return "OPTION_JACK_TIMEMASTER";
  209. #ifdef WANT_RTAUDIO
  210. case OPTION_RTAUDIO_BUFFER_SIZE:
  211. return "OPTION_RTAUDIO_BUFFER_SIZE:";
  212. case OPTION_RTAUDIO_SAMPLE_RATE:
  213. return "OPTION_RTAUDIO_SAMPLE_RATE";
  214. case OPTION_RTAUDIO_DEVICE:
  215. return "OPTION_RTAUDIO_DEVICE";
  216. #endif
  217. case OPTION_PATH_RESOURCES:
  218. return "OPTION_PATH_RESOURCES";
  219. #ifndef BUILD_BRIDGE
  220. case OPTION_PATH_BRIDGE_NATIVE:
  221. return "OPTION_PATH_BRIDGE_NATIVE";
  222. case OPTION_PATH_BRIDGE_POSIX32:
  223. return "OPTION_PATH_BRIDGE_POSIX32";
  224. case OPTION_PATH_BRIDGE_POSIX64:
  225. return "OPTION_PATH_BRIDGE_POSIX64";
  226. case OPTION_PATH_BRIDGE_WIN32:
  227. return "OPTION_PATH_BRIDGE_WIN32";
  228. case OPTION_PATH_BRIDGE_WIN64:
  229. return "OPTION_PATH_BRIDGE_WIN64";
  230. #endif
  231. #ifdef WANT_LV2
  232. case OPTION_PATH_BRIDGE_LV2_GTK2:
  233. return "OPTION_PATH_BRIDGE_LV2_GTK2";
  234. case OPTION_PATH_BRIDGE_LV2_GTK3:
  235. return "OPTION_PATH_BRIDGE_LV2_GTK3";
  236. case OPTION_PATH_BRIDGE_LV2_QT4:
  237. return "OPTION_PATH_BRIDGE_LV2_QT4";
  238. case OPTION_PATH_BRIDGE_LV2_QT5:
  239. return "OPTION_PATH_BRIDGE_LV2_QT5";
  240. case OPTION_PATH_BRIDGE_LV2_COCOA:
  241. return "OPTION_PATH_BRIDGE_LV2_COCOA";
  242. case OPTION_PATH_BRIDGE_LV2_WINDOWS:
  243. return "OPTION_PATH_BRIDGE_LV2_WINDOWS";
  244. case OPTION_PATH_BRIDGE_LV2_X11:
  245. return "OPTION_PATH_BRIDGE_LV2_X11";
  246. #endif
  247. #ifdef WANT_VST
  248. case OPTION_PATH_BRIDGE_VST_COCOA:
  249. return "OPTION_PATH_BRIDGE_VST_COCOA";
  250. case OPTION_PATH_BRIDGE_VST_HWND:
  251. return "OPTION_PATH_BRIDGE_VST_HWND";
  252. case OPTION_PATH_BRIDGE_VST_X11:
  253. return "OPTION_PATH_BRIDGE_VST_X11";
  254. #endif
  255. }
  256. carla_stderr("CarlaBackend::OptionsType2Str(%i) - invalid type", type);
  257. return nullptr;
  258. }
  259. static inline
  260. const char* CallbackType2Str(const CallbackType& type)
  261. {
  262. switch (type)
  263. {
  264. case CALLBACK_DEBUG:
  265. return "CALLBACK_DEBUG";
  266. case CALLBACK_PLUGIN_ADDED:
  267. return "CALLBACK_PLUGIN_ADDED";
  268. case CALLBACK_PLUGIN_REMOVED:
  269. return "CALLBACK_PLUGIN_REMOVED";
  270. case CALLBACK_PLUGIN_RENAMED:
  271. return "CALLBACK_PLUGIN_RENAMED";
  272. case CALLBACK_PARAMETER_VALUE_CHANGED:
  273. return "CALLBACK_PARAMETER_VALUE_CHANGED";
  274. case CALLBACK_PARAMETER_DEFAULT_CHANGED:
  275. return "CALLBACK_PARAMETER_DEFAULT_CHANGED";
  276. case CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
  277. return "CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED";
  278. case CALLBACK_PARAMETER_MIDI_CC_CHANGED:
  279. return "CALLBACK_PARAMETER_MIDI_CC_CHANGED";
  280. case CALLBACK_PROGRAM_CHANGED:
  281. return "CALLBACK_PROGRAM_CHANGED";
  282. case CALLBACK_MIDI_PROGRAM_CHANGED:
  283. return "CALLBACK_MIDI_PROGRAM_CHANGED";
  284. case CALLBACK_NOTE_ON:
  285. return "CALLBACK_NOTE_ON";
  286. case CALLBACK_NOTE_OFF:
  287. return "CALLBACK_NOTE_OFF";
  288. case CALLBACK_SHOW_GUI:
  289. return "CALLBACK_SHOW_GUI";
  290. case CALLBACK_UPDATE:
  291. return "CALLBACK_UPDATE";
  292. case CALLBACK_PATCHBAY_CLIENT_ADDED:
  293. return "CALLBACK_PATCHBAY_CLIENT_ADDED";
  294. case CALLBACK_PATCHBAY_CLIENT_REMOVED:
  295. return "CALLBACK_PATCHBAY_CLIENT_REMOVED";
  296. case CALLBACK_PATCHBAY_CLIENT_RENAMED:
  297. return "CALLBACK_PATCHBAY_CLIENT_RENAMED";
  298. case CALLBACK_PATCHBAY_PORT_ADDED:
  299. return "CALLBACK_PATCHBAY_PORT_ADDED";
  300. case CALLBACK_PATCHBAY_PORT_REMOVED:
  301. return "CALLBACK_PATCHBAY_PORT_REMOVED";
  302. case CALLBACK_PATCHBAY_PORT_RENAMED:
  303. return "CALLBACK_PATCHBAY_PORT_RENAMED";
  304. case CALLBACK_PATCHBAY_CONNECTION_ADDED:
  305. return "CALLBACK_PATCHBAY_CONNECTION_ADDED";
  306. case CALLBACK_PATCHBAY_CONNECTION_REMOVED:
  307. return "CALLBACK_PATCHBAY_CONNECTION_REMOVED";
  308. case CALLBACK_RELOAD_INFO:
  309. return "CALLBACK_RELOAD_INFO";
  310. case CALLBACK_RELOAD_PARAMETERS:
  311. return "CALLBACK_RELOAD_PARAMETERS";
  312. case CALLBACK_RELOAD_PROGRAMS:
  313. return "CALLBACK_RELOAD_PROGRAMS";
  314. case CALLBACK_RELOAD_ALL:
  315. return "CALLBACK_RELOAD_ALL";
  316. case CALLBACK_BUFFER_SIZE_CHANGED:
  317. return "CALLBACK_BUFFER_SIZE_CHANGED";
  318. case CALLBACK_SAMPLE_RATE_CHANGED:
  319. return "CALLBACK_SAMPLE_RATE_CHANGED";
  320. case CALLBACK_PROCESS_MODE_CHANGED:
  321. return "CALLBACK_PROCESS_MODE_CHANGED";
  322. case CALLBACK_NSM_ANNOUNCE:
  323. return "CALLBACK_NSM_ANNOUNCE";
  324. case CALLBACK_NSM_OPEN:
  325. return "CALLBACK_NSM_OPEN";
  326. case CALLBACK_NSM_SAVE:
  327. return "CALLBACK_NSM_SAVE";
  328. case CALLBACK_ERROR:
  329. return "CALLBACK_ERROR";
  330. case CALLBACK_INFO:
  331. return "CALLBACK_INFO";
  332. case CALLBACK_QUIT:
  333. return "CALLBACK_QUIT";
  334. }
  335. carla_stderr("CarlaBackend::CallbackType2Str(%i) - invalid type", type);
  336. return nullptr;
  337. }
  338. static inline
  339. const char* ProcessMode2Str(const ProcessMode& mode)
  340. {
  341. switch (mode)
  342. {
  343. case PROCESS_MODE_SINGLE_CLIENT:
  344. return "PROCESS_MODE_SINGLE_CLIENT";
  345. case PROCESS_MODE_MULTIPLE_CLIENTS:
  346. return "PROCESS_MODE_MULTIPLE_CLIENTS";
  347. case PROCESS_MODE_CONTINUOUS_RACK:
  348. return "PROCESS_MODE_CONTINUOUS_RACK";
  349. case PROCESS_MODE_PATCHBAY:
  350. return "PROCESS_MODE_PATCHBAY";
  351. case PROCESS_MODE_BRIDGE:
  352. return "PROCESS_MODE_BRIDGE";
  353. }
  354. carla_stderr("CarlaBackend::ProcessMode2Str(%i) - invalid type", mode);
  355. return nullptr;
  356. }
  357. static inline
  358. const char* TransportMode2Str(const TransportMode& mode)
  359. {
  360. switch (mode)
  361. {
  362. case TRANSPORT_MODE_INTERNAL:
  363. return "TRANSPORT_MODE_INTERNAL";
  364. case TRANSPORT_MODE_JACK:
  365. return "TRANSPORT_MODE_JACK";
  366. case TRANSPORT_MODE_PLUGIN:
  367. return "TRANSPORT_MODE_PLUGIN";
  368. case TRANSPORT_MODE_BRIDGE:
  369. return "TRANSPORT_MODE_BRIDGE";
  370. }
  371. carla_stderr("CarlaBackend::TransportMode2Str(%i) - invalid type", mode);
  372. return nullptr;
  373. }
  374. // -------------------------------------------------
  375. static inline
  376. uintptr_t getAddressFromPointer(void* ptr)
  377. {
  378. CARLA_ASSERT(ptr != nullptr);
  379. uintptr_t* addr = (uintptr_t*)&ptr;
  380. return *addr;
  381. }
  382. static inline
  383. void* getPointerFromAddress(uintptr_t& addr)
  384. {
  385. CARLA_ASSERT(addr != 0);
  386. uintptr_t** const ptr = (uintptr_t**)&addr;
  387. return *ptr;
  388. }
  389. // -------------------------------------------------
  390. static inline
  391. const char* getPluginTypeAsString(const PluginType& type)
  392. {
  393. carla_debug("CarlaBackend::getPluginTypeAsString(%s)", PluginType2Str(type));
  394. switch (type)
  395. {
  396. case PLUGIN_NONE:
  397. return "NONE";
  398. case PLUGIN_INTERNAL:
  399. return "INTERNAL";
  400. case PLUGIN_LADSPA:
  401. return "LADSPA";
  402. case PLUGIN_DSSI:
  403. return "DSSI";
  404. case PLUGIN_LV2:
  405. return "LV2";
  406. case PLUGIN_VST:
  407. return "VST";
  408. case PLUGIN_VST3:
  409. return "VST3";
  410. case PLUGIN_GIG:
  411. return "GIG";
  412. case PLUGIN_SF2:
  413. return "SF2";
  414. case PLUGIN_SFZ:
  415. return "SFZ";
  416. }
  417. carla_stderr("CarlaBackend::getPluginTypeAsString(%i) - invalid type", type);
  418. return "NONE";
  419. }
  420. static inline
  421. PluginType getPluginTypeFromString(const char* const stype)
  422. {
  423. CARLA_ASSERT(stype != nullptr);
  424. carla_debug("CarlaBackend::getPluginTypeFromString(\"%s\")", stype);
  425. if (stype == nullptr)
  426. {
  427. carla_stderr("CarlaBackend::getPluginTypeFromString() - null string type");
  428. return PLUGIN_NONE;
  429. }
  430. if (std::strcmp(stype, "NONE") == 0)
  431. return PLUGIN_NONE;
  432. if (std::strcmp(stype, "INTERNAL") == 0 || std::strcmp(stype, "Internal") == 0)
  433. return PLUGIN_INTERNAL;
  434. if (std::strcmp(stype, "LADSPA") == 0)
  435. return PLUGIN_LADSPA;
  436. if (std::strcmp(stype, "DSSI") == 0)
  437. return PLUGIN_DSSI;
  438. if (std::strcmp(stype, "LV2") == 0)
  439. return PLUGIN_LV2;
  440. if (std::strcmp(stype, "VST") == 0)
  441. return PLUGIN_VST;
  442. if (std::strcmp(stype, "VST3") == 0)
  443. return PLUGIN_VST3;
  444. if (std::strcmp(stype, "GIG") == 0)
  445. return PLUGIN_GIG;
  446. if (std::strcmp(stype, "SF2") == 0)
  447. return PLUGIN_SF2;
  448. if (std::strcmp(stype, "SFZ") == 0)
  449. return PLUGIN_SFZ;
  450. carla_stderr("CarlaBackend::getPluginTypeFromString(\"%s\") - invalid string type", stype);
  451. return PLUGIN_NONE;
  452. }
  453. // -------------------------------------------------
  454. static inline
  455. PluginCategory getPluginCategoryFromName(const char* const name)
  456. {
  457. CARLA_ASSERT(name != nullptr);
  458. carla_debug("CarlaBackend::getPluginCategoryFromName(\"%s\")", name);
  459. if (name == nullptr)
  460. {
  461. carla_stderr("CarlaBackend::getPluginCategoryFromName() - null name");
  462. return PLUGIN_CATEGORY_NONE;
  463. }
  464. CarlaString sname(name);
  465. if (sname.isEmpty())
  466. return PLUGIN_CATEGORY_NONE;
  467. sname.toLower();
  468. // generic tags first
  469. if (sname.contains("delay"))
  470. return PLUGIN_CATEGORY_DELAY;
  471. if (sname.contains("reverb"))
  472. return PLUGIN_CATEGORY_DELAY;
  473. // filter
  474. if (sname.contains("filter"))
  475. return PLUGIN_CATEGORY_FILTER;
  476. // dynamics
  477. if (sname.contains("dynamics"))
  478. return PLUGIN_CATEGORY_DYNAMICS;
  479. if (sname.contains("amplifier"))
  480. return PLUGIN_CATEGORY_DYNAMICS;
  481. if (sname.contains("compressor"))
  482. return PLUGIN_CATEGORY_DYNAMICS;
  483. if (sname.contains("enhancer"))
  484. return PLUGIN_CATEGORY_DYNAMICS;
  485. if (sname.contains("exciter"))
  486. return PLUGIN_CATEGORY_DYNAMICS;
  487. if (sname.contains("gate"))
  488. return PLUGIN_CATEGORY_DYNAMICS;
  489. if (sname.contains("limiter"))
  490. return PLUGIN_CATEGORY_DYNAMICS;
  491. // modulator
  492. if (sname.contains("modulator"))
  493. return PLUGIN_CATEGORY_MODULATOR;
  494. if (sname.contains("chorus"))
  495. return PLUGIN_CATEGORY_MODULATOR;
  496. if (sname.contains("flanger"))
  497. return PLUGIN_CATEGORY_MODULATOR;
  498. if (sname.contains("phaser"))
  499. return PLUGIN_CATEGORY_MODULATOR;
  500. if (sname.contains("saturator"))
  501. return PLUGIN_CATEGORY_MODULATOR;
  502. // utility
  503. if (sname.contains("utility"))
  504. return PLUGIN_CATEGORY_UTILITY;
  505. if (sname.contains("analyzer"))
  506. return PLUGIN_CATEGORY_UTILITY;
  507. if (sname.contains("converter"))
  508. return PLUGIN_CATEGORY_UTILITY;
  509. if (sname.contains("deesser"))
  510. return PLUGIN_CATEGORY_UTILITY;
  511. if (sname.contains("mixer"))
  512. return PLUGIN_CATEGORY_UTILITY;
  513. // common tags
  514. if (sname.contains("verb"))
  515. return PLUGIN_CATEGORY_DELAY;
  516. if (sname.contains("eq"))
  517. return PLUGIN_CATEGORY_EQ;
  518. if (sname.contains("tool"))
  519. return PLUGIN_CATEGORY_UTILITY;
  520. return PLUGIN_CATEGORY_NONE;
  521. }
  522. CARLA_BACKEND_END_NAMESPACE
  523. #endif // __CARLA_BACKEND_UTILS_HPP__