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.

571 lines
18KB

  1. /*
  2. * Carla Backend utils
  3. * Copyright (C) 2011-2014 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 doc/GPL.txt file.
  16. */
  17. #ifndef CARLA_BACKEND_UTILS_HPP_INCLUDED
  18. #define CARLA_BACKEND_UTILS_HPP_INCLUDED
  19. #include "CarlaBackend.h"
  20. #include "CarlaHost.h"
  21. #include "CarlaString.hpp"
  22. CARLA_BACKEND_START_NAMESPACE
  23. // -----------------------------------------------------------------------
  24. static inline
  25. const char* PluginOption2Str(const uint option) noexcept
  26. {
  27. switch (option)
  28. {
  29. case PLUGIN_OPTION_FIXED_BUFFERS:
  30. return "PLUGIN_OPTION_FIXED_BUFFERS";
  31. case PLUGIN_OPTION_FORCE_STEREO:
  32. return "PLUGIN_OPTION_FORCE_STEREO";
  33. case PLUGIN_OPTION_MAP_PROGRAM_CHANGES:
  34. return "PLUGIN_OPTION_MAP_PROGRAM_CHANGES";
  35. case PLUGIN_OPTION_USE_CHUNKS:
  36. return "PLUGIN_OPTION_USE_CHUNKS";
  37. case PLUGIN_OPTION_SEND_CONTROL_CHANGES:
  38. return "PLUGIN_OPTION_SEND_CONTROL_CHANGES";
  39. case PLUGIN_OPTION_SEND_CHANNEL_PRESSURE:
  40. return "PLUGIN_OPTION_SEND_CHANNEL_PRESSURE";
  41. case PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH:
  42. return "PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH";
  43. case PLUGIN_OPTION_SEND_PITCHBEND:
  44. return "PLUGIN_OPTION_SEND_PITCHBEND";
  45. case PLUGIN_OPTION_SEND_ALL_SOUND_OFF:
  46. return "PLUGIN_OPTION_SEND_ALL_SOUND_OFF";
  47. }
  48. carla_stderr("CarlaBackend::PluginOption2Str(%i) - invalid option", option);
  49. return nullptr;
  50. }
  51. // -----------------------------------------------------------------------
  52. static inline
  53. const char* BinaryType2Str(const BinaryType type) noexcept
  54. {
  55. switch (type)
  56. {
  57. case BINARY_NONE:
  58. return "BINARY_NONE";
  59. case BINARY_POSIX32:
  60. return "BINARY_POSIX32";
  61. case BINARY_POSIX64:
  62. return "BINARY_POSIX64";
  63. case BINARY_WIN32:
  64. return "BINARY_WIN32";
  65. case BINARY_WIN64:
  66. return "BINARY_WIN64";
  67. case BINARY_OTHER:
  68. return "BINARY_OTHER";
  69. }
  70. carla_stderr("CarlaBackend::BinaryType2Str(%i) - invalid type", type);
  71. return nullptr;
  72. }
  73. static inline
  74. const char* PluginType2Str(const PluginType type) noexcept
  75. {
  76. switch (type)
  77. {
  78. case PLUGIN_NONE:
  79. return "PLUGIN_NONE";
  80. case PLUGIN_INTERNAL:
  81. return "PLUGIN_INTERNAL";
  82. case PLUGIN_LADSPA:
  83. return "PLUGIN_LADSPA";
  84. case PLUGIN_DSSI:
  85. return "PLUGIN_DSSI";
  86. case PLUGIN_LV2:
  87. return "PLUGIN_LV2";
  88. case PLUGIN_VST:
  89. return "PLUGIN_VST";
  90. case PLUGIN_VST3:
  91. return "PLUGIN_VST3";
  92. case PLUGIN_AU:
  93. return "PLUGIN_AU";
  94. case PLUGIN_GIG:
  95. return "PLUGIN_GIG";
  96. case PLUGIN_SF2:
  97. return "PLUGIN_SF2";
  98. case PLUGIN_SFZ:
  99. return "PLUGIN_SFZ";
  100. }
  101. carla_stderr("CarlaBackend::PluginType2Str(%i) - invalid type", type);
  102. return nullptr;
  103. }
  104. static inline
  105. const char* PluginCategory2Str(const PluginCategory category) noexcept
  106. {
  107. switch (category)
  108. {
  109. case PLUGIN_CATEGORY_NONE:
  110. return "PLUGIN_CATEGORY_NONE";
  111. case PLUGIN_CATEGORY_SYNTH:
  112. return "PLUGIN_CATEGORY_SYNTH";
  113. case PLUGIN_CATEGORY_DELAY:
  114. return "PLUGIN_CATEGORY_DELAY";
  115. case PLUGIN_CATEGORY_EQ:
  116. return "PLUGIN_CATEGORY_EQ";
  117. case PLUGIN_CATEGORY_FILTER:
  118. return "PLUGIN_CATEGORY_FILTER";
  119. case PLUGIN_CATEGORY_DISTORTION:
  120. return "PLUGIN_CATEGORY_DISTORTION";
  121. case PLUGIN_CATEGORY_DYNAMICS:
  122. return "PLUGIN_CATEGORY_DYNAMICS";
  123. case PLUGIN_CATEGORY_MODULATOR:
  124. return "PLUGIN_CATEGORY_MODULATOR";
  125. case PLUGIN_CATEGORY_UTILITY:
  126. return "PLUGIN_CATEGORY_UTILITY";
  127. case PLUGIN_CATEGORY_OTHER:
  128. return "PLUGIN_CATEGORY_OTHER";
  129. }
  130. carla_stderr("CarlaBackend::PluginCategory2Str(%i) - invalid category", category);
  131. return nullptr;
  132. }
  133. static inline
  134. const char* ParameterType2Str(const ParameterType type) noexcept
  135. {
  136. switch (type)
  137. {
  138. case PARAMETER_UNKNOWN:
  139. return "PARAMETER_UNKNOWN";
  140. case PARAMETER_INPUT:
  141. return "PARAMETER_INPUT";
  142. case PARAMETER_OUTPUT:
  143. return "PARAMETER_OUTPUT";
  144. }
  145. carla_stderr("CarlaBackend::ParameterType2Str(%i) - invalid type", type);
  146. return nullptr;
  147. }
  148. static inline
  149. const char* InternalParameterIndex2Str(const InternalParameterIndex index) noexcept
  150. {
  151. switch (index)
  152. {
  153. case PARAMETER_NULL:
  154. return "PARAMETER_NULL";
  155. case PARAMETER_ACTIVE:
  156. return "PARAMETER_ACTIVE";
  157. case PARAMETER_DRYWET:
  158. return "PARAMETER_DRYWET";
  159. case PARAMETER_VOLUME:
  160. return "PARAMETER_VOLUME";
  161. case PARAMETER_BALANCE_LEFT:
  162. return "PARAMETER_BALANCE_LEFT";
  163. case PARAMETER_BALANCE_RIGHT:
  164. return "PARAMETER_BALANCE_RIGHT";
  165. case PARAMETER_PANNING:
  166. return "PARAMETER_PANNING";
  167. case PARAMETER_CTRL_CHANNEL:
  168. return "PARAMETER_CTRL_CHANNEL";
  169. case PARAMETER_MAX:
  170. return "PARAMETER_MAX";
  171. }
  172. carla_stderr("CarlaBackend::InternalParameterIndex2Str(%i) - invalid index", index);
  173. return nullptr;
  174. }
  175. static inline
  176. const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode) noexcept
  177. {
  178. switch (opcode)
  179. {
  180. case ENGINE_CALLBACK_DEBUG:
  181. return "ENGINE_CALLBACK_DEBUG";
  182. case ENGINE_CALLBACK_PLUGIN_ADDED:
  183. return "ENGINE_CALLBACK_PLUGIN_ADDED";
  184. case ENGINE_CALLBACK_PLUGIN_REMOVED:
  185. return "ENGINE_CALLBACK_PLUGIN_REMOVED";
  186. case ENGINE_CALLBACK_PLUGIN_RENAMED:
  187. return "ENGINE_CALLBACK_PLUGIN_RENAMED";
  188. case ENGINE_CALLBACK_PLUGIN_UNAVAILABLE:
  189. return "ENGINE_CALLBACK_PLUGIN_UNAVAILABLE";
  190. case ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED:
  191. return "ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED";
  192. case ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED:
  193. return "ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED";
  194. case ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
  195. return "ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED";
  196. case ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED:
  197. return "ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED";
  198. case ENGINE_CALLBACK_PROGRAM_CHANGED:
  199. return "ENGINE_CALLBACK_PROGRAM_CHANGED";
  200. case ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED:
  201. return "ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED";
  202. case ENGINE_CALLBACK_OPTION_CHANGED:
  203. return "ENGINE_CALLBACK_OPTION_CHANGED";
  204. case ENGINE_CALLBACK_UI_STATE_CHANGED:
  205. return "ENGINE_CALLBACK_UI_STATE_CHANGED";
  206. case ENGINE_CALLBACK_NOTE_ON:
  207. return "ENGINE_CALLBACK_NOTE_ON";
  208. case ENGINE_CALLBACK_NOTE_OFF:
  209. return "ENGINE_CALLBACK_NOTE_OFF";
  210. case ENGINE_CALLBACK_UPDATE:
  211. return "ENGINE_CALLBACK_UPDATE";
  212. case ENGINE_CALLBACK_RELOAD_INFO:
  213. return "ENGINE_CALLBACK_RELOAD_INFO";
  214. case ENGINE_CALLBACK_RELOAD_PARAMETERS:
  215. return "ENGINE_CALLBACK_RELOAD_PARAMETERS";
  216. case ENGINE_CALLBACK_RELOAD_PROGRAMS:
  217. return "ENGINE_CALLBACK_RELOAD_PROGRAMS";
  218. case ENGINE_CALLBACK_RELOAD_ALL:
  219. return "ENGINE_CALLBACK_RELOAD_ALL";
  220. case ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED:
  221. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED";
  222. case ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED:
  223. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED";
  224. case ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED:
  225. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED";
  226. case ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED:
  227. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED";
  228. case ENGINE_CALLBACK_PATCHBAY_PORT_ADDED:
  229. return "ENGINE_CALLBACK_PATCHBAY_PORT_ADDED";
  230. case ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED:
  231. return "ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED";
  232. case ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED:
  233. return "ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED";
  234. case ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED:
  235. return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED";
  236. case ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED:
  237. return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED";
  238. case ENGINE_CALLBACK_ENGINE_STARTED:
  239. return "ENGINE_CALLBACK_ENGINE_STARTED";
  240. case ENGINE_CALLBACK_ENGINE_STOPPED:
  241. return "ENGINE_CALLBACK_ENGINE_STOPPED";
  242. case ENGINE_CALLBACK_PROCESS_MODE_CHANGED:
  243. return "ENGINE_CALLBACK_PROCESS_MODE_CHANGED";
  244. case ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED:
  245. return "ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED";
  246. case ENGINE_CALLBACK_BUFFER_SIZE_CHANGED:
  247. return "ENGINE_CALLBACK_BUFFER_SIZE_CHANGED";
  248. case ENGINE_CALLBACK_SAMPLE_RATE_CHANGED:
  249. return "ENGINE_CALLBACK_SAMPLE_RATE_CHANGED";
  250. case ENGINE_CALLBACK_IDLE:
  251. return "ENGINE_CALLBACK_IDLE";
  252. case ENGINE_CALLBACK_INFO:
  253. return "ENGINE_CALLBACK_INFO";
  254. case ENGINE_CALLBACK_ERROR:
  255. return "ENGINE_CALLBACK_ERROR";
  256. case ENGINE_CALLBACK_QUIT:
  257. return "ENGINE_CALLBACK_QUIT";
  258. }
  259. carla_stderr("CarlaBackend::EngineCallbackOpcode2Str(%i) - invalid opcode", opcode);
  260. return nullptr;
  261. }
  262. static inline
  263. const char* EngineOption2Str(const EngineOption option) noexcept
  264. {
  265. switch (option)
  266. {
  267. case ENGINE_OPTION_DEBUG:
  268. return "ENGINE_OPTION_DEBUG";
  269. case ENGINE_OPTION_PROCESS_MODE:
  270. return "ENGINE_OPTION_PROCESS_MODE";
  271. case ENGINE_OPTION_TRANSPORT_MODE:
  272. return "ENGINE_OPTION_TRANSPORT_MODE";
  273. case ENGINE_OPTION_FORCE_STEREO:
  274. return "ENGINE_OPTION_FORCE_STEREO";
  275. case ENGINE_OPTION_PREFER_PLUGIN_BRIDGES:
  276. return "ENGINE_OPTION_PREFER_PLUGIN_BRIDGES";
  277. case ENGINE_OPTION_PREFER_UI_BRIDGES:
  278. return "ENGINE_OPTION_PREFER_UI_BRIDGES";
  279. case ENGINE_OPTION_UIS_ALWAYS_ON_TOP:
  280. return "ENGINE_OPTION_UIS_ALWAYS_ON_TOP";
  281. case ENGINE_OPTION_MAX_PARAMETERS:
  282. return "ENGINE_OPTION_MAX_PARAMETERS";
  283. case ENGINE_OPTION_UI_BRIDGES_TIMEOUT:
  284. return "ENGINE_OPTION_UI_BRIDGES_TIMEOUT";
  285. case ENGINE_OPTION_AUDIO_NUM_PERIODS:
  286. return "ENGINE_OPTION_AUDIO_NUM_PERIODS";
  287. case ENGINE_OPTION_AUDIO_BUFFER_SIZE:
  288. return "ENGINE_OPTION_AUDIO_BUFFER_SIZE";
  289. case ENGINE_OPTION_AUDIO_SAMPLE_RATE:
  290. return "ENGINE_OPTION_AUDIO_SAMPLE_RATE";
  291. case ENGINE_OPTION_AUDIO_DEVICE:
  292. return "ENGINE_OPTION_AUDIO_DEVICE";
  293. case ENGINE_OPTION_NSM_INIT:
  294. return "ENGINE_OPTION_NSM_INIT";
  295. case ENGINE_OPTION_PATH_BINARIES:
  296. return "ENGINE_OPTION_PATH_BINARIES";
  297. case ENGINE_OPTION_PATH_RESOURCES:
  298. return "ENGINE_OPTION_PATH_RESOURCES";
  299. case ENGINE_OPTION_FRONTEND_WIN_ID:
  300. return "ENGINE_OPTION_FRONTEND_WIN_ID";
  301. }
  302. carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option);
  303. return nullptr;
  304. }
  305. static inline
  306. const char* EngineProcessMode2Str(const EngineProcessMode mode) noexcept
  307. {
  308. switch (mode)
  309. {
  310. case ENGINE_PROCESS_MODE_SINGLE_CLIENT:
  311. return "ENGINE_PROCESS_MODE_SINGLE_CLIENT";
  312. case ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS:
  313. return "ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS";
  314. case ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
  315. return "ENGINE_PROCESS_MODE_CONTINUOUS_RACK";
  316. case ENGINE_PROCESS_MODE_PATCHBAY:
  317. return "ENGINE_PROCESS_MODE_PATCHBAY";
  318. case ENGINE_PROCESS_MODE_BRIDGE:
  319. return "ENGINE_PROCESS_MODE_BRIDGE";
  320. }
  321. carla_stderr("CarlaBackend::EngineProcessMode2Str(%i) - invalid mode", mode);
  322. return nullptr;
  323. }
  324. static inline
  325. const char* EngineTransportMode2Str(const EngineTransportMode mode) noexcept
  326. {
  327. switch (mode)
  328. {
  329. case ENGINE_TRANSPORT_MODE_INTERNAL:
  330. return "ENGINE_TRANSPORT_MODE_INTERNAL";
  331. case ENGINE_TRANSPORT_MODE_JACK:
  332. return "ENGINE_TRANSPORT_MODE_JACK";
  333. case ENGINE_TRANSPORT_MODE_PLUGIN:
  334. return "ENGINE_TRANSPORT_MODE_PLUGIN";
  335. case ENGINE_TRANSPORT_MODE_BRIDGE:
  336. return "ENGINE_TRANSPORT_MODE_BRIDGE";
  337. }
  338. carla_stderr("CarlaBackend::EngineTransportMode2Str(%i) - invalid mode", mode);
  339. return nullptr;
  340. }
  341. static inline
  342. const char* FileCallbackOpcode2Str(const FileCallbackOpcode opcode) noexcept
  343. {
  344. switch (opcode)
  345. {
  346. case FILE_CALLBACK_DEBUG:
  347. return "FILE_CALLBACK_DEBUG";
  348. case FILE_CALLBACK_OPEN:
  349. return "FILE_CALLBACK_OPEN";
  350. case FILE_CALLBACK_SAVE:
  351. return "FILE_CALLBACK_SAVE";
  352. }
  353. carla_stderr("CarlaBackend::FileCallbackOpcode2Str(%i) - invalid opcode", opcode);
  354. return nullptr;
  355. }
  356. static inline
  357. const char* PatchbayIcon2Str(const PatchbayIcon icon) noexcept
  358. {
  359. switch (icon)
  360. {
  361. case PATCHBAY_ICON_APPLICATION:
  362. return "PATCHBAY_ICON_APPLICATION";
  363. case PATCHBAY_ICON_PLUGIN:
  364. return "PATCHBAY_ICON_PLUGIN";
  365. case PATCHBAY_ICON_HARDWARE:
  366. return "PATCHBAY_ICON_HARDWARE";
  367. case PATCHBAY_ICON_CARLA:
  368. return "PATCHBAY_ICON_CARLA";
  369. case PATCHBAY_ICON_DISTRHO:
  370. return "PATCHBAY_ICON_DISTRHO";
  371. case PATCHBAY_ICON_FILE:
  372. return "PATCHBAY_ICON_FILE";
  373. }
  374. carla_stderr("CarlaBackend::PatchbayIcon2Str(%i) - invalid icon", icon);
  375. return nullptr;
  376. }
  377. // -----------------------------------------------------------------------
  378. static inline
  379. const char* getPluginTypeAsString(const PluginType type) noexcept
  380. {
  381. carla_debug("CarlaBackend::getPluginTypeAsString(%i:%s)", type, PluginType2Str(type));
  382. switch (type)
  383. {
  384. case PLUGIN_NONE:
  385. return "NONE";
  386. case PLUGIN_INTERNAL:
  387. return "INTERNAL";
  388. case PLUGIN_LADSPA:
  389. return "LADSPA";
  390. case PLUGIN_DSSI:
  391. return "DSSI";
  392. case PLUGIN_LV2:
  393. return "LV2";
  394. case PLUGIN_VST:
  395. return "VST";
  396. case PLUGIN_VST3:
  397. return "VST3";
  398. case PLUGIN_AU:
  399. return "AU";;
  400. case PLUGIN_GIG:
  401. return "GIG";
  402. case PLUGIN_SF2:
  403. return "SF2";
  404. case PLUGIN_SFZ:
  405. return "SFZ";
  406. }
  407. carla_stderr("CarlaBackend::getPluginTypeAsString(%i) - invalid type", type);
  408. return "NONE";
  409. }
  410. static inline
  411. PluginType getPluginTypeFromString(const char* const ctype) noexcept
  412. {
  413. CARLA_SAFE_ASSERT_RETURN(ctype != nullptr && ctype[0] != '\0', PLUGIN_NONE);
  414. carla_debug("CarlaBackend::getPluginTypeFromString(\"%s\")", ctype);
  415. CarlaString stype(ctype);
  416. if (stype.isEmpty())
  417. return PLUGIN_NONE;
  418. stype.toLower();
  419. if (stype == "none")
  420. return PLUGIN_NONE;
  421. if (stype == "internal")
  422. return PLUGIN_INTERNAL;
  423. if (stype == "ladspa")
  424. return PLUGIN_LADSPA;
  425. if (stype == "dssi")
  426. return PLUGIN_DSSI;
  427. if (stype == "lv2")
  428. return PLUGIN_LV2;
  429. if (stype == "vst")
  430. return PLUGIN_VST;
  431. if (stype == "vst3")
  432. return PLUGIN_VST3;
  433. if (stype == "au")
  434. return PLUGIN_AU;
  435. if (stype == "gig")
  436. return PLUGIN_GIG;
  437. if (stype == "sf2")
  438. return PLUGIN_SF2;
  439. if (stype == "sfz")
  440. return PLUGIN_SFZ;
  441. carla_stderr("CarlaBackend::getPluginTypeFromString(\"%s\") - invalid string type", ctype);
  442. return PLUGIN_NONE;
  443. }
  444. // -----------------------------------------------------------------------
  445. static inline
  446. PluginCategory getPluginCategoryFromName(const char* const name) noexcept
  447. {
  448. CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', PLUGIN_CATEGORY_NONE);
  449. carla_debug("CarlaBackend::getPluginCategoryFromName(\"%s\")", name);
  450. CarlaString sname(name);
  451. if (sname.isEmpty())
  452. return PLUGIN_CATEGORY_NONE;
  453. sname.toLower();
  454. // generic tags first
  455. if (sname.contains("delay"))
  456. return PLUGIN_CATEGORY_DELAY;
  457. if (sname.contains("reverb"))
  458. return PLUGIN_CATEGORY_DELAY;
  459. // filter
  460. if (sname.contains("filter"))
  461. return PLUGIN_CATEGORY_FILTER;
  462. // distortion
  463. if (sname.contains("distortion"))
  464. return PLUGIN_CATEGORY_DISTORTION;
  465. // dynamics
  466. if (sname.contains("dynamics"))
  467. return PLUGIN_CATEGORY_DYNAMICS;
  468. if (sname.contains("amplifier"))
  469. return PLUGIN_CATEGORY_DYNAMICS;
  470. if (sname.contains("compressor"))
  471. return PLUGIN_CATEGORY_DYNAMICS;
  472. if (sname.contains("enhancer"))
  473. return PLUGIN_CATEGORY_DYNAMICS;
  474. if (sname.contains("exciter"))
  475. return PLUGIN_CATEGORY_DYNAMICS;
  476. if (sname.contains("gate"))
  477. return PLUGIN_CATEGORY_DYNAMICS;
  478. if (sname.contains("limiter"))
  479. return PLUGIN_CATEGORY_DYNAMICS;
  480. // modulator
  481. if (sname.contains("modulator"))
  482. return PLUGIN_CATEGORY_MODULATOR;
  483. if (sname.contains("chorus"))
  484. return PLUGIN_CATEGORY_MODULATOR;
  485. if (sname.contains("flanger"))
  486. return PLUGIN_CATEGORY_MODULATOR;
  487. if (sname.contains("phaser"))
  488. return PLUGIN_CATEGORY_MODULATOR;
  489. if (sname.contains("saturator"))
  490. return PLUGIN_CATEGORY_MODULATOR;
  491. // utility
  492. if (sname.contains("utility"))
  493. return PLUGIN_CATEGORY_UTILITY;
  494. if (sname.contains("analyzer"))
  495. return PLUGIN_CATEGORY_UTILITY;
  496. if (sname.contains("converter"))
  497. return PLUGIN_CATEGORY_UTILITY;
  498. if (sname.contains("deesser"))
  499. return PLUGIN_CATEGORY_UTILITY;
  500. if (sname.contains("mixer"))
  501. return PLUGIN_CATEGORY_UTILITY;
  502. // common tags
  503. if (sname.contains("verb"))
  504. return PLUGIN_CATEGORY_DELAY;
  505. if (sname.contains("eq"))
  506. return PLUGIN_CATEGORY_EQ;
  507. if (sname.contains("tool"))
  508. return PLUGIN_CATEGORY_UTILITY;
  509. return PLUGIN_CATEGORY_NONE;
  510. }
  511. // -----------------------------------------------------------------------
  512. CARLA_BACKEND_END_NAMESPACE
  513. #endif // CARLA_BACKEND_UTILS_HPP_INCLUDED