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.

587 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_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. }
  151. carla_stderr("CarlaBackend::ParameterType2Str(%i) - invalid type", type);
  152. return nullptr;
  153. }
  154. static inline
  155. const char* InternalParameterIndex2Str(const InternalParameterIndex index) noexcept
  156. {
  157. switch (index)
  158. {
  159. case PARAMETER_NULL:
  160. return "PARAMETER_NULL";
  161. case PARAMETER_ACTIVE:
  162. return "PARAMETER_ACTIVE";
  163. case PARAMETER_DRYWET:
  164. return "PARAMETER_DRYWET";
  165. case PARAMETER_VOLUME:
  166. return "PARAMETER_VOLUME";
  167. case PARAMETER_BALANCE_LEFT:
  168. return "PARAMETER_BALANCE_LEFT";
  169. case PARAMETER_BALANCE_RIGHT:
  170. return "PARAMETER_BALANCE_RIGHT";
  171. case PARAMETER_PANNING:
  172. return "PARAMETER_PANNING";
  173. case PARAMETER_CTRL_CHANNEL:
  174. return "PARAMETER_CTRL_CHANNEL";
  175. case PARAMETER_MAX:
  176. return "PARAMETER_MAX";
  177. }
  178. carla_stderr("CarlaBackend::InternalParameterIndex2Str(%i) - invalid index", index);
  179. return nullptr;
  180. }
  181. static inline
  182. const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode) noexcept
  183. {
  184. switch (opcode)
  185. {
  186. case ENGINE_CALLBACK_DEBUG:
  187. return "ENGINE_CALLBACK_DEBUG";
  188. case ENGINE_CALLBACK_PLUGIN_ADDED:
  189. return "ENGINE_CALLBACK_PLUGIN_ADDED";
  190. case ENGINE_CALLBACK_PLUGIN_REMOVED:
  191. return "ENGINE_CALLBACK_PLUGIN_REMOVED";
  192. case ENGINE_CALLBACK_PLUGIN_RENAMED:
  193. return "ENGINE_CALLBACK_PLUGIN_RENAMED";
  194. case ENGINE_CALLBACK_PLUGIN_UNAVAILABLE:
  195. return "ENGINE_CALLBACK_PLUGIN_UNAVAILABLE";
  196. case ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED:
  197. return "ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED";
  198. case ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED:
  199. return "ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED";
  200. case ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
  201. return "ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED";
  202. case ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED:
  203. return "ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED";
  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. case ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED:
  225. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED";
  226. case ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED:
  227. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED";
  228. case ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED:
  229. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED";
  230. case ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED:
  231. return "ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED";
  232. case ENGINE_CALLBACK_PATCHBAY_PORT_ADDED:
  233. return "ENGINE_CALLBACK_PATCHBAY_PORT_ADDED";
  234. case ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED:
  235. return "ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED";
  236. case ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED:
  237. return "ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED";
  238. case ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED:
  239. return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED";
  240. case ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED:
  241. return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED";
  242. case ENGINE_CALLBACK_ENGINE_STARTED:
  243. return "ENGINE_CALLBACK_ENGINE_STARTED";
  244. case ENGINE_CALLBACK_ENGINE_STOPPED:
  245. return "ENGINE_CALLBACK_ENGINE_STOPPED";
  246. case ENGINE_CALLBACK_PROCESS_MODE_CHANGED:
  247. return "ENGINE_CALLBACK_PROCESS_MODE_CHANGED";
  248. case ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED:
  249. return "ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED";
  250. case ENGINE_CALLBACK_BUFFER_SIZE_CHANGED:
  251. return "ENGINE_CALLBACK_BUFFER_SIZE_CHANGED";
  252. case ENGINE_CALLBACK_SAMPLE_RATE_CHANGED:
  253. return "ENGINE_CALLBACK_SAMPLE_RATE_CHANGED";
  254. case ENGINE_CALLBACK_IDLE:
  255. return "ENGINE_CALLBACK_IDLE";
  256. case ENGINE_CALLBACK_INFO:
  257. return "ENGINE_CALLBACK_INFO";
  258. case ENGINE_CALLBACK_ERROR:
  259. return "ENGINE_CALLBACK_ERROR";
  260. case ENGINE_CALLBACK_QUIT:
  261. return "ENGINE_CALLBACK_QUIT";
  262. }
  263. carla_stderr("CarlaBackend::EngineCallbackOpcode2Str(%i) - invalid opcode", opcode);
  264. return nullptr;
  265. }
  266. static inline
  267. const char* EngineOption2Str(const EngineOption option) noexcept
  268. {
  269. switch (option)
  270. {
  271. case ENGINE_OPTION_DEBUG:
  272. return "ENGINE_OPTION_DEBUG";
  273. case ENGINE_OPTION_PROCESS_MODE:
  274. return "ENGINE_OPTION_PROCESS_MODE";
  275. case ENGINE_OPTION_TRANSPORT_MODE:
  276. return "ENGINE_OPTION_TRANSPORT_MODE";
  277. case ENGINE_OPTION_FORCE_STEREO:
  278. return "ENGINE_OPTION_FORCE_STEREO";
  279. case ENGINE_OPTION_PREFER_PLUGIN_BRIDGES:
  280. return "ENGINE_OPTION_PREFER_PLUGIN_BRIDGES";
  281. case ENGINE_OPTION_PREFER_UI_BRIDGES:
  282. return "ENGINE_OPTION_PREFER_UI_BRIDGES";
  283. case ENGINE_OPTION_UIS_ALWAYS_ON_TOP:
  284. return "ENGINE_OPTION_UIS_ALWAYS_ON_TOP";
  285. case ENGINE_OPTION_MAX_PARAMETERS:
  286. return "ENGINE_OPTION_MAX_PARAMETERS";
  287. case ENGINE_OPTION_UI_BRIDGES_TIMEOUT:
  288. return "ENGINE_OPTION_UI_BRIDGES_TIMEOUT";
  289. case ENGINE_OPTION_AUDIO_NUM_PERIODS:
  290. return "ENGINE_OPTION_AUDIO_NUM_PERIODS";
  291. case ENGINE_OPTION_AUDIO_BUFFER_SIZE:
  292. return "ENGINE_OPTION_AUDIO_BUFFER_SIZE";
  293. case ENGINE_OPTION_AUDIO_SAMPLE_RATE:
  294. return "ENGINE_OPTION_AUDIO_SAMPLE_RATE";
  295. case ENGINE_OPTION_AUDIO_DEVICE:
  296. return "ENGINE_OPTION_AUDIO_DEVICE";
  297. case ENGINE_OPTION_NSM_INIT:
  298. return "ENGINE_OPTION_NSM_INIT";
  299. case ENGINE_OPTION_PATH_BINARIES:
  300. return "ENGINE_OPTION_PATH_BINARIES";
  301. case ENGINE_OPTION_PATH_RESOURCES:
  302. return "ENGINE_OPTION_PATH_RESOURCES";
  303. case ENGINE_OPTION_FRONTEND_WIN_ID:
  304. return "ENGINE_OPTION_FRONTEND_WIN_ID";
  305. }
  306. carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option);
  307. return nullptr;
  308. }
  309. static inline
  310. const char* EngineProcessMode2Str(const EngineProcessMode mode) noexcept
  311. {
  312. switch (mode)
  313. {
  314. case ENGINE_PROCESS_MODE_SINGLE_CLIENT:
  315. return "ENGINE_PROCESS_MODE_SINGLE_CLIENT";
  316. case ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS:
  317. return "ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS";
  318. case ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
  319. return "ENGINE_PROCESS_MODE_CONTINUOUS_RACK";
  320. case ENGINE_PROCESS_MODE_PATCHBAY:
  321. return "ENGINE_PROCESS_MODE_PATCHBAY";
  322. case ENGINE_PROCESS_MODE_BRIDGE:
  323. return "ENGINE_PROCESS_MODE_BRIDGE";
  324. }
  325. carla_stderr("CarlaBackend::EngineProcessMode2Str(%i) - invalid mode", mode);
  326. return nullptr;
  327. }
  328. static inline
  329. const char* EngineTransportMode2Str(const EngineTransportMode mode) noexcept
  330. {
  331. switch (mode)
  332. {
  333. case ENGINE_TRANSPORT_MODE_INTERNAL:
  334. return "ENGINE_TRANSPORT_MODE_INTERNAL";
  335. case ENGINE_TRANSPORT_MODE_JACK:
  336. return "ENGINE_TRANSPORT_MODE_JACK";
  337. case ENGINE_TRANSPORT_MODE_PLUGIN:
  338. return "ENGINE_TRANSPORT_MODE_PLUGIN";
  339. case ENGINE_TRANSPORT_MODE_BRIDGE:
  340. return "ENGINE_TRANSPORT_MODE_BRIDGE";
  341. }
  342. carla_stderr("CarlaBackend::EngineTransportMode2Str(%i) - invalid mode", mode);
  343. return nullptr;
  344. }
  345. static inline
  346. const char* FileCallbackOpcode2Str(const FileCallbackOpcode opcode) noexcept
  347. {
  348. switch (opcode)
  349. {
  350. case FILE_CALLBACK_DEBUG:
  351. return "FILE_CALLBACK_DEBUG";
  352. case FILE_CALLBACK_OPEN:
  353. return "FILE_CALLBACK_OPEN";
  354. case FILE_CALLBACK_SAVE:
  355. return "FILE_CALLBACK_SAVE";
  356. }
  357. carla_stderr("CarlaBackend::FileCallbackOpcode2Str(%i) - invalid opcode", opcode);
  358. return nullptr;
  359. }
  360. static inline
  361. const char* PatchbayIcon2Str(const PatchbayIcon icon) noexcept
  362. {
  363. switch (icon)
  364. {
  365. case PATCHBAY_ICON_APPLICATION:
  366. return "PATCHBAY_ICON_APPLICATION";
  367. case PATCHBAY_ICON_PLUGIN:
  368. return "PATCHBAY_ICON_PLUGIN";
  369. case PATCHBAY_ICON_HARDWARE:
  370. return "PATCHBAY_ICON_HARDWARE";
  371. case PATCHBAY_ICON_CARLA:
  372. return "PATCHBAY_ICON_CARLA";
  373. case PATCHBAY_ICON_DISTRHO:
  374. return "PATCHBAY_ICON_DISTRHO";
  375. case PATCHBAY_ICON_FILE:
  376. return "PATCHBAY_ICON_FILE";
  377. }
  378. carla_stderr("CarlaBackend::PatchbayIcon2Str(%i) - invalid icon", icon);
  379. return nullptr;
  380. }
  381. // -----------------------------------------------------------------------
  382. static inline
  383. const char* getPluginTypeAsString(const PluginType type) noexcept
  384. {
  385. carla_debug("CarlaBackend::getPluginTypeAsString(%i:%s)", type, PluginType2Str(type));
  386. switch (type)
  387. {
  388. case PLUGIN_NONE:
  389. return "NONE";
  390. case PLUGIN_INTERNAL:
  391. return "INTERNAL";
  392. case PLUGIN_LADSPA:
  393. return "LADSPA";
  394. case PLUGIN_DSSI:
  395. return "DSSI";
  396. case PLUGIN_LV2:
  397. return "LV2";
  398. case PLUGIN_VST:
  399. return "VST";
  400. case PLUGIN_VST3:
  401. return "VST3";
  402. case PLUGIN_AU:
  403. return "AU";
  404. case PLUGIN_JACK:
  405. return "JACK";
  406. case PLUGIN_REWIRE:
  407. return "ReWire";
  408. case PLUGIN_FILE_CSD:
  409. return "CSD";
  410. case PLUGIN_FILE_GIG:
  411. return "GIG";
  412. case PLUGIN_FILE_SF2:
  413. return "SF2";
  414. case PLUGIN_FILE_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 ctype) noexcept
  422. {
  423. CARLA_SAFE_ASSERT_RETURN(ctype != nullptr && ctype[0] != '\0', PLUGIN_NONE);
  424. carla_debug("CarlaBackend::getPluginTypeFromString(\"%s\")", ctype);
  425. CarlaString stype(ctype);
  426. if (stype.isEmpty())
  427. return PLUGIN_NONE;
  428. stype.toLower();
  429. if (stype == "none")
  430. return PLUGIN_NONE;
  431. if (stype == "internal")
  432. return PLUGIN_INTERNAL;
  433. if (stype == "ladspa")
  434. return PLUGIN_LADSPA;
  435. if (stype == "dssi")
  436. return PLUGIN_DSSI;
  437. if (stype == "lv2")
  438. return PLUGIN_LV2;
  439. if (stype == "vst")
  440. return PLUGIN_VST;
  441. if (stype == "vst3")
  442. return PLUGIN_VST3;
  443. if (stype == "au")
  444. return PLUGIN_AU;
  445. if (stype == "jack")
  446. return PLUGIN_JACK;
  447. if (stype == "rewire")
  448. return PLUGIN_REWIRE;
  449. if (stype == "csd")
  450. return PLUGIN_FILE_CSD;
  451. if (stype == "gig")
  452. return PLUGIN_FILE_GIG;
  453. if (stype == "sf2")
  454. return PLUGIN_FILE_SF2;
  455. if (stype == "sfz")
  456. return PLUGIN_FILE_SFZ;
  457. carla_stderr("CarlaBackend::getPluginTypeFromString(\"%s\") - invalid string type", ctype);
  458. return PLUGIN_NONE;
  459. }
  460. // -----------------------------------------------------------------------
  461. static inline
  462. PluginCategory getPluginCategoryFromName(const char* const name) noexcept
  463. {
  464. CARLA_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0', PLUGIN_CATEGORY_NONE);
  465. carla_debug("CarlaBackend::getPluginCategoryFromName(\"%s\")", name);
  466. CarlaString sname(name);
  467. if (sname.isEmpty())
  468. return PLUGIN_CATEGORY_NONE;
  469. sname.toLower();
  470. // generic tags first
  471. if (sname.contains("delay"))
  472. return PLUGIN_CATEGORY_DELAY;
  473. if (sname.contains("reverb"))
  474. return PLUGIN_CATEGORY_DELAY;
  475. // filter
  476. if (sname.contains("filter"))
  477. return PLUGIN_CATEGORY_FILTER;
  478. // distortion
  479. if (sname.contains("distortion"))
  480. return PLUGIN_CATEGORY_DISTORTION;
  481. // dynamics
  482. if (sname.contains("dynamics"))
  483. return PLUGIN_CATEGORY_DYNAMICS;
  484. if (sname.contains("amplifier"))
  485. return PLUGIN_CATEGORY_DYNAMICS;
  486. if (sname.contains("compressor"))
  487. return PLUGIN_CATEGORY_DYNAMICS;
  488. if (sname.contains("enhancer"))
  489. return PLUGIN_CATEGORY_DYNAMICS;
  490. if (sname.contains("exciter"))
  491. return PLUGIN_CATEGORY_DYNAMICS;
  492. if (sname.contains("gate"))
  493. return PLUGIN_CATEGORY_DYNAMICS;
  494. if (sname.contains("limiter"))
  495. return PLUGIN_CATEGORY_DYNAMICS;
  496. // modulator
  497. if (sname.contains("modulator"))
  498. return PLUGIN_CATEGORY_MODULATOR;
  499. if (sname.contains("chorus"))
  500. return PLUGIN_CATEGORY_MODULATOR;
  501. if (sname.contains("flanger"))
  502. return PLUGIN_CATEGORY_MODULATOR;
  503. if (sname.contains("phaser"))
  504. return PLUGIN_CATEGORY_MODULATOR;
  505. if (sname.contains("saturator"))
  506. return PLUGIN_CATEGORY_MODULATOR;
  507. // utility
  508. if (sname.contains("utility"))
  509. return PLUGIN_CATEGORY_UTILITY;
  510. if (sname.contains("analyzer"))
  511. return PLUGIN_CATEGORY_UTILITY;
  512. if (sname.contains("converter"))
  513. return PLUGIN_CATEGORY_UTILITY;
  514. if (sname.contains("deesser"))
  515. return PLUGIN_CATEGORY_UTILITY;
  516. if (sname.contains("mixer"))
  517. return PLUGIN_CATEGORY_UTILITY;
  518. // common tags
  519. if (sname.contains("verb"))
  520. return PLUGIN_CATEGORY_DELAY;
  521. if (sname.contains("eq"))
  522. return PLUGIN_CATEGORY_EQ;
  523. if (sname.contains("tool"))
  524. return PLUGIN_CATEGORY_UTILITY;
  525. return PLUGIN_CATEGORY_NONE;
  526. }
  527. // -----------------------------------------------------------------------
  528. CARLA_BACKEND_END_NAMESPACE
  529. #endif // CARLA_BACKEND_UTILS_HPP_INCLUDED