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.

569 lines
17KB

  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_UI_STATE_CHANGED:
  203. return "ENGINE_CALLBACK_UI_STATE_CHANGED";
  204. case ENGINE_CALLBACK_NOTE_ON:
  205. return "ENGINE_CALLBACK_NOTE_ON";
  206. case ENGINE_CALLBACK_NOTE_OFF:
  207. return "ENGINE_CALLBACK_NOTE_OFF";
  208. case ENGINE_CALLBACK_UPDATE:
  209. return "ENGINE_CALLBACK_UPDATE";
  210. case ENGINE_CALLBACK_RELOAD_INFO:
  211. return "ENGINE_CALLBACK_RELOAD_INFO";
  212. case ENGINE_CALLBACK_RELOAD_PARAMETERS:
  213. return "ENGINE_CALLBACK_RELOAD_PARAMETERS";
  214. case ENGINE_CALLBACK_RELOAD_PROGRAMS:
  215. return "ENGINE_CALLBACK_RELOAD_PROGRAMS";
  216. case ENGINE_CALLBACK_RELOAD_ALL:
  217. return "ENGINE_CALLBACK_RELOAD_ALL";
  218. case ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED:
  219. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED";
  220. case ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED:
  221. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED";
  222. case ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED:
  223. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED";
  224. case ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED:
  225. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED";
  226. case ENGINE_CALLBACK_PATCHBAY_PORT_ADDED:
  227. return "ENGINE_CALLBACK_PATCHBAY_PORT_ADDED";
  228. case ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED:
  229. return "ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED";
  230. case ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED:
  231. return "ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED";
  232. case ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED:
  233. return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED";
  234. case ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED:
  235. return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED";
  236. case ENGINE_CALLBACK_ENGINE_STARTED:
  237. return "ENGINE_CALLBACK_ENGINE_STARTED";
  238. case ENGINE_CALLBACK_ENGINE_STOPPED:
  239. return "ENGINE_CALLBACK_ENGINE_STOPPED";
  240. case ENGINE_CALLBACK_PROCESS_MODE_CHANGED:
  241. return "ENGINE_CALLBACK_PROCESS_MODE_CHANGED";
  242. case ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED:
  243. return "ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED";
  244. case ENGINE_CALLBACK_BUFFER_SIZE_CHANGED:
  245. return "ENGINE_CALLBACK_BUFFER_SIZE_CHANGED";
  246. case ENGINE_CALLBACK_SAMPLE_RATE_CHANGED:
  247. return "ENGINE_CALLBACK_SAMPLE_RATE_CHANGED";
  248. case ENGINE_CALLBACK_IDLE:
  249. return "ENGINE_CALLBACK_IDLE";
  250. case ENGINE_CALLBACK_INFO:
  251. return "ENGINE_CALLBACK_INFO";
  252. case ENGINE_CALLBACK_ERROR:
  253. return "ENGINE_CALLBACK_ERROR";
  254. case ENGINE_CALLBACK_QUIT:
  255. return "ENGINE_CALLBACK_QUIT";
  256. }
  257. carla_stderr("CarlaBackend::EngineCallbackOpcode2Str(%i) - invalid opcode", opcode);
  258. return nullptr;
  259. }
  260. static inline
  261. const char* EngineOption2Str(const EngineOption option) noexcept
  262. {
  263. switch (option)
  264. {
  265. case ENGINE_OPTION_DEBUG:
  266. return "ENGINE_OPTION_DEBUG";
  267. case ENGINE_OPTION_PROCESS_MODE:
  268. return "ENGINE_OPTION_PROCESS_MODE";
  269. case ENGINE_OPTION_TRANSPORT_MODE:
  270. return "ENGINE_OPTION_TRANSPORT_MODE";
  271. case ENGINE_OPTION_FORCE_STEREO:
  272. return "ENGINE_OPTION_FORCE_STEREO";
  273. case ENGINE_OPTION_PREFER_PLUGIN_BRIDGES:
  274. return "ENGINE_OPTION_PREFER_PLUGIN_BRIDGES";
  275. case ENGINE_OPTION_PREFER_UI_BRIDGES:
  276. return "ENGINE_OPTION_PREFER_UI_BRIDGES";
  277. case ENGINE_OPTION_UIS_ALWAYS_ON_TOP:
  278. return "ENGINE_OPTION_UIS_ALWAYS_ON_TOP";
  279. case ENGINE_OPTION_MAX_PARAMETERS:
  280. return "ENGINE_OPTION_MAX_PARAMETERS";
  281. case ENGINE_OPTION_UI_BRIDGES_TIMEOUT:
  282. return "ENGINE_OPTION_UI_BRIDGES_TIMEOUT";
  283. case ENGINE_OPTION_AUDIO_NUM_PERIODS:
  284. return "ENGINE_OPTION_AUDIO_NUM_PERIODS";
  285. case ENGINE_OPTION_AUDIO_BUFFER_SIZE:
  286. return "ENGINE_OPTION_AUDIO_BUFFER_SIZE";
  287. case ENGINE_OPTION_AUDIO_SAMPLE_RATE:
  288. return "ENGINE_OPTION_AUDIO_SAMPLE_RATE";
  289. case ENGINE_OPTION_AUDIO_DEVICE:
  290. return "ENGINE_OPTION_AUDIO_DEVICE";
  291. case ENGINE_OPTION_NSM_INIT:
  292. return "ENGINE_OPTION_NSM_INIT";
  293. case ENGINE_OPTION_PATH_BINARIES:
  294. return "ENGINE_OPTION_PATH_BINARIES";
  295. case ENGINE_OPTION_PATH_RESOURCES:
  296. return "ENGINE_OPTION_PATH_RESOURCES";
  297. case ENGINE_OPTION_FRONTEND_WIN_ID:
  298. return "ENGINE_OPTION_FRONTEND_WIN_ID";
  299. }
  300. carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option);
  301. return nullptr;
  302. }
  303. static inline
  304. const char* EngineProcessMode2Str(const EngineProcessMode mode) noexcept
  305. {
  306. switch (mode)
  307. {
  308. case ENGINE_PROCESS_MODE_SINGLE_CLIENT:
  309. return "ENGINE_PROCESS_MODE_SINGLE_CLIENT";
  310. case ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS:
  311. return "ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS";
  312. case ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
  313. return "ENGINE_PROCESS_MODE_CONTINUOUS_RACK";
  314. case ENGINE_PROCESS_MODE_PATCHBAY:
  315. return "ENGINE_PROCESS_MODE_PATCHBAY";
  316. case ENGINE_PROCESS_MODE_BRIDGE:
  317. return "ENGINE_PROCESS_MODE_BRIDGE";
  318. }
  319. carla_stderr("CarlaBackend::EngineProcessMode2Str(%i) - invalid mode", mode);
  320. return nullptr;
  321. }
  322. static inline
  323. const char* EngineTransportMode2Str(const EngineTransportMode mode) noexcept
  324. {
  325. switch (mode)
  326. {
  327. case ENGINE_TRANSPORT_MODE_INTERNAL:
  328. return "ENGINE_TRANSPORT_MODE_INTERNAL";
  329. case ENGINE_TRANSPORT_MODE_JACK:
  330. return "ENGINE_TRANSPORT_MODE_JACK";
  331. case ENGINE_TRANSPORT_MODE_PLUGIN:
  332. return "ENGINE_TRANSPORT_MODE_PLUGIN";
  333. case ENGINE_TRANSPORT_MODE_BRIDGE:
  334. return "ENGINE_TRANSPORT_MODE_BRIDGE";
  335. }
  336. carla_stderr("CarlaBackend::EngineTransportMode2Str(%i) - invalid mode", mode);
  337. return nullptr;
  338. }
  339. static inline
  340. const char* FileCallbackOpcode2Str(const FileCallbackOpcode opcode) noexcept
  341. {
  342. switch (opcode)
  343. {
  344. case FILE_CALLBACK_DEBUG:
  345. return "FILE_CALLBACK_DEBUG";
  346. case FILE_CALLBACK_OPEN:
  347. return "FILE_CALLBACK_OPEN";
  348. case FILE_CALLBACK_SAVE:
  349. return "FILE_CALLBACK_SAVE";
  350. }
  351. carla_stderr("CarlaBackend::FileCallbackOpcode2Str(%i) - invalid opcode", opcode);
  352. return nullptr;
  353. }
  354. static inline
  355. const char* PatchbayIcon2Str(const PatchbayIcon icon) noexcept
  356. {
  357. switch (icon)
  358. {
  359. case PATCHBAY_ICON_APPLICATION:
  360. return "PATCHBAY_ICON_APPLICATION";
  361. case PATCHBAY_ICON_PLUGIN:
  362. return "PATCHBAY_ICON_PLUGIN";
  363. case PATCHBAY_ICON_HARDWARE:
  364. return "PATCHBAY_ICON_HARDWARE";
  365. case PATCHBAY_ICON_CARLA:
  366. return "PATCHBAY_ICON_CARLA";
  367. case PATCHBAY_ICON_DISTRHO:
  368. return "PATCHBAY_ICON_DISTRHO";
  369. case PATCHBAY_ICON_FILE:
  370. return "PATCHBAY_ICON_FILE";
  371. }
  372. carla_stderr("CarlaBackend::PatchbayIcon2Str(%i) - invalid icon", icon);
  373. return nullptr;
  374. }
  375. // -----------------------------------------------------------------------
  376. static inline
  377. const char* getPluginTypeAsString(const PluginType type) noexcept
  378. {
  379. carla_debug("CarlaBackend::getPluginTypeAsString(%i:%s)", type, PluginType2Str(type));
  380. switch (type)
  381. {
  382. case PLUGIN_NONE:
  383. return "NONE";
  384. case PLUGIN_INTERNAL:
  385. return "INTERNAL";
  386. case PLUGIN_LADSPA:
  387. return "LADSPA";
  388. case PLUGIN_DSSI:
  389. return "DSSI";
  390. case PLUGIN_LV2:
  391. return "LV2";
  392. case PLUGIN_VST:
  393. return "VST";
  394. case PLUGIN_VST3:
  395. return "VST3";
  396. case PLUGIN_AU:
  397. return "AU";;
  398. case PLUGIN_GIG:
  399. return "GIG";
  400. case PLUGIN_SF2:
  401. return "SF2";
  402. case PLUGIN_SFZ:
  403. return "SFZ";
  404. }
  405. carla_stderr("CarlaBackend::getPluginTypeAsString(%i) - invalid type", type);
  406. return "NONE";
  407. }
  408. static inline
  409. PluginType getPluginTypeFromString(const char* const ctype) noexcept
  410. {
  411. CARLA_SAFE_ASSERT_RETURN(ctype != nullptr && ctype[0] != '\0', PLUGIN_NONE);
  412. carla_debug("CarlaBackend::getPluginTypeFromString(\"%s\")", ctype);
  413. CarlaString stype(ctype);
  414. if (stype.isEmpty())
  415. return PLUGIN_NONE;
  416. stype.toLower();
  417. if (stype == "none")
  418. return PLUGIN_NONE;
  419. if (stype == "internal")
  420. return PLUGIN_INTERNAL;
  421. if (stype == "ladspa")
  422. return PLUGIN_LADSPA;
  423. if (stype == "dssi")
  424. return PLUGIN_DSSI;
  425. if (stype == "lv2")
  426. return PLUGIN_LV2;
  427. if (stype == "vst")
  428. return PLUGIN_VST;
  429. if (stype == "vst3")
  430. return PLUGIN_VST3;
  431. if (stype == "au")
  432. return PLUGIN_AU;
  433. if (stype == "gig")
  434. return PLUGIN_GIG;
  435. if (stype == "sf2")
  436. return PLUGIN_SF2;
  437. if (stype == "sfz")
  438. return PLUGIN_SFZ;
  439. carla_stderr("CarlaBackend::getPluginTypeFromString(\"%s\") - invalid string type", ctype);
  440. return PLUGIN_NONE;
  441. }
  442. // -----------------------------------------------------------------------
  443. static inline
  444. PluginCategory getPluginCategoryFromName(const char* const name) noexcept
  445. {
  446. CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', PLUGIN_CATEGORY_NONE);
  447. carla_debug("CarlaBackend::getPluginCategoryFromName(\"%s\")", name);
  448. CarlaString sname(name);
  449. if (sname.isEmpty())
  450. return PLUGIN_CATEGORY_NONE;
  451. sname.toLower();
  452. // generic tags first
  453. if (sname.contains("delay"))
  454. return PLUGIN_CATEGORY_DELAY;
  455. if (sname.contains("reverb"))
  456. return PLUGIN_CATEGORY_DELAY;
  457. // filter
  458. if (sname.contains("filter"))
  459. return PLUGIN_CATEGORY_FILTER;
  460. // distortion
  461. if (sname.contains("distortion"))
  462. return PLUGIN_CATEGORY_DISTORTION;
  463. // dynamics
  464. if (sname.contains("dynamics"))
  465. return PLUGIN_CATEGORY_DYNAMICS;
  466. if (sname.contains("amplifier"))
  467. return PLUGIN_CATEGORY_DYNAMICS;
  468. if (sname.contains("compressor"))
  469. return PLUGIN_CATEGORY_DYNAMICS;
  470. if (sname.contains("enhancer"))
  471. return PLUGIN_CATEGORY_DYNAMICS;
  472. if (sname.contains("exciter"))
  473. return PLUGIN_CATEGORY_DYNAMICS;
  474. if (sname.contains("gate"))
  475. return PLUGIN_CATEGORY_DYNAMICS;
  476. if (sname.contains("limiter"))
  477. return PLUGIN_CATEGORY_DYNAMICS;
  478. // modulator
  479. if (sname.contains("modulator"))
  480. return PLUGIN_CATEGORY_MODULATOR;
  481. if (sname.contains("chorus"))
  482. return PLUGIN_CATEGORY_MODULATOR;
  483. if (sname.contains("flanger"))
  484. return PLUGIN_CATEGORY_MODULATOR;
  485. if (sname.contains("phaser"))
  486. return PLUGIN_CATEGORY_MODULATOR;
  487. if (sname.contains("saturator"))
  488. return PLUGIN_CATEGORY_MODULATOR;
  489. // utility
  490. if (sname.contains("utility"))
  491. return PLUGIN_CATEGORY_UTILITY;
  492. if (sname.contains("analyzer"))
  493. return PLUGIN_CATEGORY_UTILITY;
  494. if (sname.contains("converter"))
  495. return PLUGIN_CATEGORY_UTILITY;
  496. if (sname.contains("deesser"))
  497. return PLUGIN_CATEGORY_UTILITY;
  498. if (sname.contains("mixer"))
  499. return PLUGIN_CATEGORY_UTILITY;
  500. // common tags
  501. if (sname.contains("verb"))
  502. return PLUGIN_CATEGORY_DELAY;
  503. if (sname.contains("eq"))
  504. return PLUGIN_CATEGORY_EQ;
  505. if (sname.contains("tool"))
  506. return PLUGIN_CATEGORY_UTILITY;
  507. return PLUGIN_CATEGORY_NONE;
  508. }
  509. // -----------------------------------------------------------------------
  510. CARLA_BACKEND_END_NAMESPACE
  511. #endif // CARLA_BACKEND_UTILS_HPP_INCLUDED