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.

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