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.

577 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. #ifndef BUILD_BRIDGE
  156. case PARAMETER_ACTIVE:
  157. return "PARAMETER_ACTIVE";
  158. case PARAMETER_DRYWET:
  159. return "PARAMETER_DRYWET";
  160. case PARAMETER_VOLUME:
  161. return "PARAMETER_VOLUME";
  162. case PARAMETER_BALANCE_LEFT:
  163. return "PARAMETER_BALANCE_LEFT";
  164. case PARAMETER_BALANCE_RIGHT:
  165. return "PARAMETER_BALANCE_RIGHT";
  166. case PARAMETER_PANNING:
  167. return "PARAMETER_PANNING";
  168. case PARAMETER_CTRL_CHANNEL:
  169. return "PARAMETER_CTRL_CHANNEL";
  170. #endif
  171. case PARAMETER_MAX:
  172. return "PARAMETER_MAX";
  173. }
  174. carla_stderr("CarlaBackend::InternalParameterIndex2Str(%i) - invalid index", index);
  175. return nullptr;
  176. }
  177. static inline
  178. const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode) noexcept
  179. {
  180. switch (opcode)
  181. {
  182. case ENGINE_CALLBACK_DEBUG:
  183. return "ENGINE_CALLBACK_DEBUG";
  184. case ENGINE_CALLBACK_PLUGIN_ADDED:
  185. return "ENGINE_CALLBACK_PLUGIN_ADDED";
  186. case ENGINE_CALLBACK_PLUGIN_REMOVED:
  187. return "ENGINE_CALLBACK_PLUGIN_REMOVED";
  188. case ENGINE_CALLBACK_PLUGIN_RENAMED:
  189. return "ENGINE_CALLBACK_PLUGIN_RENAMED";
  190. case ENGINE_CALLBACK_PLUGIN_UNAVAILABLE:
  191. return "ENGINE_CALLBACK_PLUGIN_UNAVAILABLE";
  192. case ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED:
  193. return "ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED";
  194. case ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED:
  195. return "ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED";
  196. #ifndef BUILD_BRIDGE
  197. case ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
  198. return "ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED";
  199. case ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED:
  200. return "ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED";
  201. case ENGINE_CALLBACK_OPTION_CHANGED:
  202. return "ENGINE_CALLBACK_OPTION_CHANGED";
  203. #endif
  204. case ENGINE_CALLBACK_PROGRAM_CHANGED:
  205. return "ENGINE_CALLBACK_PROGRAM_CHANGED";
  206. case ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED:
  207. return "ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED";
  208. case ENGINE_CALLBACK_UI_STATE_CHANGED:
  209. return "ENGINE_CALLBACK_UI_STATE_CHANGED";
  210. case ENGINE_CALLBACK_NOTE_ON:
  211. return "ENGINE_CALLBACK_NOTE_ON";
  212. case ENGINE_CALLBACK_NOTE_OFF:
  213. return "ENGINE_CALLBACK_NOTE_OFF";
  214. case ENGINE_CALLBACK_UPDATE:
  215. return "ENGINE_CALLBACK_UPDATE";
  216. case ENGINE_CALLBACK_RELOAD_INFO:
  217. return "ENGINE_CALLBACK_RELOAD_INFO";
  218. case ENGINE_CALLBACK_RELOAD_PARAMETERS:
  219. return "ENGINE_CALLBACK_RELOAD_PARAMETERS";
  220. case ENGINE_CALLBACK_RELOAD_PROGRAMS:
  221. return "ENGINE_CALLBACK_RELOAD_PROGRAMS";
  222. case ENGINE_CALLBACK_RELOAD_ALL:
  223. return "ENGINE_CALLBACK_RELOAD_ALL";
  224. #ifndef BUILD_BRIDGE
  225. case ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED:
  226. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED";
  227. case ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED:
  228. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED";
  229. case ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED:
  230. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED";
  231. case ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED:
  232. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED";
  233. case ENGINE_CALLBACK_PATCHBAY_PORT_ADDED:
  234. return "ENGINE_CALLBACK_PATCHBAY_PORT_ADDED";
  235. case ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED:
  236. return "ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED";
  237. case ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED:
  238. return "ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED";
  239. case ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED:
  240. return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED";
  241. case ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED:
  242. return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED";
  243. #endif
  244. case ENGINE_CALLBACK_ENGINE_STARTED:
  245. return "ENGINE_CALLBACK_ENGINE_STARTED";
  246. case ENGINE_CALLBACK_ENGINE_STOPPED:
  247. return "ENGINE_CALLBACK_ENGINE_STOPPED";
  248. case ENGINE_CALLBACK_PROCESS_MODE_CHANGED:
  249. return "ENGINE_CALLBACK_PROCESS_MODE_CHANGED";
  250. case ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED:
  251. return "ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED";
  252. case ENGINE_CALLBACK_BUFFER_SIZE_CHANGED:
  253. return "ENGINE_CALLBACK_BUFFER_SIZE_CHANGED";
  254. case ENGINE_CALLBACK_SAMPLE_RATE_CHANGED:
  255. return "ENGINE_CALLBACK_SAMPLE_RATE_CHANGED";
  256. case ENGINE_CALLBACK_IDLE:
  257. return "ENGINE_CALLBACK_IDLE";
  258. case ENGINE_CALLBACK_INFO:
  259. return "ENGINE_CALLBACK_INFO";
  260. case ENGINE_CALLBACK_ERROR:
  261. return "ENGINE_CALLBACK_ERROR";
  262. case ENGINE_CALLBACK_QUIT:
  263. return "ENGINE_CALLBACK_QUIT";
  264. }
  265. carla_stderr("CarlaBackend::EngineCallbackOpcode2Str(%i) - invalid opcode", opcode);
  266. return nullptr;
  267. }
  268. static inline
  269. const char* EngineOption2Str(const EngineOption option) noexcept
  270. {
  271. switch (option)
  272. {
  273. case ENGINE_OPTION_DEBUG:
  274. return "ENGINE_OPTION_DEBUG";
  275. case ENGINE_OPTION_PROCESS_MODE:
  276. return "ENGINE_OPTION_PROCESS_MODE";
  277. case ENGINE_OPTION_TRANSPORT_MODE:
  278. return "ENGINE_OPTION_TRANSPORT_MODE";
  279. case ENGINE_OPTION_FORCE_STEREO:
  280. return "ENGINE_OPTION_FORCE_STEREO";
  281. case ENGINE_OPTION_PREFER_PLUGIN_BRIDGES:
  282. return "ENGINE_OPTION_PREFER_PLUGIN_BRIDGES";
  283. case ENGINE_OPTION_PREFER_UI_BRIDGES:
  284. return "ENGINE_OPTION_PREFER_UI_BRIDGES";
  285. case ENGINE_OPTION_UIS_ALWAYS_ON_TOP:
  286. return "ENGINE_OPTION_UIS_ALWAYS_ON_TOP";
  287. case ENGINE_OPTION_MAX_PARAMETERS:
  288. return "ENGINE_OPTION_MAX_PARAMETERS";
  289. case ENGINE_OPTION_UI_BRIDGES_TIMEOUT:
  290. return "ENGINE_OPTION_UI_BRIDGES_TIMEOUT";
  291. case ENGINE_OPTION_AUDIO_NUM_PERIODS:
  292. return "ENGINE_OPTION_AUDIO_NUM_PERIODS";
  293. case ENGINE_OPTION_AUDIO_BUFFER_SIZE:
  294. return "ENGINE_OPTION_AUDIO_BUFFER_SIZE";
  295. case ENGINE_OPTION_AUDIO_SAMPLE_RATE:
  296. return "ENGINE_OPTION_AUDIO_SAMPLE_RATE";
  297. case ENGINE_OPTION_AUDIO_DEVICE:
  298. return "ENGINE_OPTION_AUDIO_DEVICE";
  299. case ENGINE_OPTION_NSM_INIT:
  300. return "ENGINE_OPTION_NSM_INIT";
  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. static inline
  348. const char* FileCallbackOpcode2Str(const FileCallbackOpcode opcode) noexcept
  349. {
  350. switch (opcode)
  351. {
  352. case FILE_CALLBACK_DEBUG:
  353. return "FILE_CALLBACK_DEBUG";
  354. case FILE_CALLBACK_OPEN:
  355. return "FILE_CALLBACK_OPEN";
  356. case FILE_CALLBACK_SAVE:
  357. return "FILE_CALLBACK_SAVE";
  358. }
  359. carla_stderr("CarlaBackend::FileCallbackOpcode2Str(%i) - invalid opcode", opcode);
  360. return nullptr;
  361. }
  362. static inline
  363. const char* PatchbayIcon2Str(const PatchbayIcon icon) noexcept
  364. {
  365. switch (icon)
  366. {
  367. case PATCHBAY_ICON_APPLICATION:
  368. return "PATCHBAY_ICON_APPLICATION";
  369. case PATCHBAY_ICON_PLUGIN:
  370. return "PATCHBAY_ICON_PLUGIN";
  371. case PATCHBAY_ICON_HARDWARE:
  372. return "PATCHBAY_ICON_HARDWARE";
  373. case PATCHBAY_ICON_CARLA:
  374. return "PATCHBAY_ICON_CARLA";
  375. case PATCHBAY_ICON_DISTRHO:
  376. return "PATCHBAY_ICON_DISTRHO";
  377. case PATCHBAY_ICON_FILE:
  378. return "PATCHBAY_ICON_FILE";
  379. }
  380. carla_stderr("CarlaBackend::PatchbayIcon2Str(%i) - invalid icon", icon);
  381. return nullptr;
  382. }
  383. // -----------------------------------------------------------------------
  384. static inline
  385. const char* getPluginTypeAsString(const PluginType type) noexcept
  386. {
  387. carla_debug("CarlaBackend::getPluginTypeAsString(%i:%s)", type, PluginType2Str(type));
  388. switch (type)
  389. {
  390. case PLUGIN_NONE:
  391. return "NONE";
  392. case PLUGIN_INTERNAL:
  393. return "INTERNAL";
  394. case PLUGIN_LADSPA:
  395. return "LADSPA";
  396. case PLUGIN_DSSI:
  397. return "DSSI";
  398. case PLUGIN_LV2:
  399. return "LV2";
  400. case PLUGIN_VST:
  401. return "VST";
  402. case PLUGIN_VST3:
  403. return "VST3";
  404. case PLUGIN_AU:
  405. return "AU";;
  406. case PLUGIN_GIG:
  407. return "GIG";
  408. case PLUGIN_SF2:
  409. return "SF2";
  410. case PLUGIN_SFZ:
  411. return "SFZ";
  412. }
  413. carla_stderr("CarlaBackend::getPluginTypeAsString(%i) - invalid type", type);
  414. return "NONE";
  415. }
  416. static inline
  417. PluginType getPluginTypeFromString(const char* const ctype) noexcept
  418. {
  419. CARLA_SAFE_ASSERT_RETURN(ctype != nullptr && ctype[0] != '\0', PLUGIN_NONE);
  420. carla_debug("CarlaBackend::getPluginTypeFromString(\"%s\")", ctype);
  421. CarlaString stype(ctype);
  422. if (stype.isEmpty())
  423. return PLUGIN_NONE;
  424. stype.toLower();
  425. if (stype == "none")
  426. return PLUGIN_NONE;
  427. if (stype == "internal")
  428. return PLUGIN_INTERNAL;
  429. if (stype == "ladspa")
  430. return PLUGIN_LADSPA;
  431. if (stype == "dssi")
  432. return PLUGIN_DSSI;
  433. if (stype == "lv2")
  434. return PLUGIN_LV2;
  435. if (stype == "vst")
  436. return PLUGIN_VST;
  437. if (stype == "vst3")
  438. return PLUGIN_VST3;
  439. if (stype == "au")
  440. return PLUGIN_AU;
  441. if (stype == "gig")
  442. return PLUGIN_GIG;
  443. if (stype == "sf2")
  444. return PLUGIN_SF2;
  445. if (stype == "sfz")
  446. return PLUGIN_SFZ;
  447. carla_stderr("CarlaBackend::getPluginTypeFromString(\"%s\") - invalid string type", ctype);
  448. return PLUGIN_NONE;
  449. }
  450. // -----------------------------------------------------------------------
  451. static inline
  452. PluginCategory getPluginCategoryFromName(const char* const name) noexcept
  453. {
  454. CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', PLUGIN_CATEGORY_NONE);
  455. carla_debug("CarlaBackend::getPluginCategoryFromName(\"%s\")", name);
  456. CarlaString sname(name);
  457. if (sname.isEmpty())
  458. return PLUGIN_CATEGORY_NONE;
  459. sname.toLower();
  460. // generic tags first
  461. if (sname.contains("delay"))
  462. return PLUGIN_CATEGORY_DELAY;
  463. if (sname.contains("reverb"))
  464. return PLUGIN_CATEGORY_DELAY;
  465. // filter
  466. if (sname.contains("filter"))
  467. return PLUGIN_CATEGORY_FILTER;
  468. // distortion
  469. if (sname.contains("distortion"))
  470. return PLUGIN_CATEGORY_DISTORTION;
  471. // dynamics
  472. if (sname.contains("dynamics"))
  473. return PLUGIN_CATEGORY_DYNAMICS;
  474. if (sname.contains("amplifier"))
  475. return PLUGIN_CATEGORY_DYNAMICS;
  476. if (sname.contains("compressor"))
  477. return PLUGIN_CATEGORY_DYNAMICS;
  478. if (sname.contains("enhancer"))
  479. return PLUGIN_CATEGORY_DYNAMICS;
  480. if (sname.contains("exciter"))
  481. return PLUGIN_CATEGORY_DYNAMICS;
  482. if (sname.contains("gate"))
  483. return PLUGIN_CATEGORY_DYNAMICS;
  484. if (sname.contains("limiter"))
  485. return PLUGIN_CATEGORY_DYNAMICS;
  486. // modulator
  487. if (sname.contains("modulator"))
  488. return PLUGIN_CATEGORY_MODULATOR;
  489. if (sname.contains("chorus"))
  490. return PLUGIN_CATEGORY_MODULATOR;
  491. if (sname.contains("flanger"))
  492. return PLUGIN_CATEGORY_MODULATOR;
  493. if (sname.contains("phaser"))
  494. return PLUGIN_CATEGORY_MODULATOR;
  495. if (sname.contains("saturator"))
  496. return PLUGIN_CATEGORY_MODULATOR;
  497. // utility
  498. if (sname.contains("utility"))
  499. return PLUGIN_CATEGORY_UTILITY;
  500. if (sname.contains("analyzer"))
  501. return PLUGIN_CATEGORY_UTILITY;
  502. if (sname.contains("converter"))
  503. return PLUGIN_CATEGORY_UTILITY;
  504. if (sname.contains("deesser"))
  505. return PLUGIN_CATEGORY_UTILITY;
  506. if (sname.contains("mixer"))
  507. return PLUGIN_CATEGORY_UTILITY;
  508. // common tags
  509. if (sname.contains("verb"))
  510. return PLUGIN_CATEGORY_DELAY;
  511. if (sname.contains("eq"))
  512. return PLUGIN_CATEGORY_EQ;
  513. if (sname.contains("tool"))
  514. return PLUGIN_CATEGORY_UTILITY;
  515. return PLUGIN_CATEGORY_NONE;
  516. }
  517. // -----------------------------------------------------------------------
  518. CARLA_BACKEND_END_NAMESPACE
  519. #endif // CARLA_BACKEND_UTILS_HPP_INCLUDED