3 * Copyright (C) 2011-2024 Filipe Coelho <falktx@falktx.com>
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.
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.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #ifndef CARLA_BACKEND_UTILS_HPP_INCLUDED
19 #define CARLA_BACKEND_UTILS_HPP_INCLUDED
21 #include "CarlaBackend.h"
22 #include "CarlaNative.h"
23 #include "CarlaString.hpp"
25 CARLA_BACKEND_START_NAMESPACE
27 // -----------------------------------------------------------------------
30 const char* PluginOption2Str(const uint option
) noexcept
34 case PLUGIN_OPTION_FIXED_BUFFERS
:
35 return "PLUGIN_OPTION_FIXED_BUFFERS";
36 case PLUGIN_OPTION_FORCE_STEREO
:
37 return "PLUGIN_OPTION_FORCE_STEREO";
38 case PLUGIN_OPTION_MAP_PROGRAM_CHANGES
:
39 return "PLUGIN_OPTION_MAP_PROGRAM_CHANGES";
40 case PLUGIN_OPTION_USE_CHUNKS
:
41 return "PLUGIN_OPTION_USE_CHUNKS";
42 case PLUGIN_OPTION_SEND_CONTROL_CHANGES
:
43 return "PLUGIN_OPTION_SEND_CONTROL_CHANGES";
44 case PLUGIN_OPTION_SEND_CHANNEL_PRESSURE
:
45 return "PLUGIN_OPTION_SEND_CHANNEL_PRESSURE";
46 case PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH
:
47 return "PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH";
48 case PLUGIN_OPTION_SEND_PITCHBEND
:
49 return "PLUGIN_OPTION_SEND_PITCHBEND";
50 case PLUGIN_OPTION_SEND_ALL_SOUND_OFF
:
51 return "PLUGIN_OPTION_SEND_ALL_SOUND_OFF";
54 carla_stderr("CarlaBackend::PluginOption2Str(%i) - invalid option", option
);
58 // -----------------------------------------------------------------------
61 const char* BinaryType2Str(const BinaryType type
) noexcept
68 return "BINARY_POSIX32";
70 return "BINARY_POSIX64";
72 return "BINARY_WIN32";
74 return "BINARY_WIN64";
76 return "BINARY_OTHER";
79 carla_stderr("CarlaBackend::BinaryType2Str(%i) - invalid type", type
);
84 const char* FileType2Str(const FileType type
) noexcept
96 carla_stderr("CarlaBackend::FileType2Str(%i) - invalid type", type
);
101 const char* PluginType2Str(const PluginType type
) noexcept
106 return "PLUGIN_NONE";
107 case PLUGIN_INTERNAL
:
108 return "PLUGIN_INTERNAL";
110 return "PLUGIN_LADSPA";
112 return "PLUGIN_DSSI";
116 return "PLUGIN_VST2";
118 return "PLUGIN_VST3";
130 return "PLUGIN_JACK";
132 return "PLUGIN_JSFX";
134 return "PLUGIN_CLAP";
135 case PLUGIN_TYPE_COUNT
:
139 carla_stderr("CarlaBackend::PluginType2Str(%i) - invalid type", type
);
144 const char* PluginCategory2Str(const PluginCategory category
) noexcept
148 case PLUGIN_CATEGORY_NONE
:
149 return "PLUGIN_CATEGORY_NONE";
150 case PLUGIN_CATEGORY_SYNTH
:
151 return "PLUGIN_CATEGORY_SYNTH";
152 case PLUGIN_CATEGORY_DELAY
:
153 return "PLUGIN_CATEGORY_DELAY";
154 case PLUGIN_CATEGORY_EQ
:
155 return "PLUGIN_CATEGORY_EQ";
156 case PLUGIN_CATEGORY_FILTER
:
157 return "PLUGIN_CATEGORY_FILTER";
158 case PLUGIN_CATEGORY_DISTORTION
:
159 return "PLUGIN_CATEGORY_DISTORTION";
160 case PLUGIN_CATEGORY_DYNAMICS
:
161 return "PLUGIN_CATEGORY_DYNAMICS";
162 case PLUGIN_CATEGORY_MODULATOR
:
163 return "PLUGIN_CATEGORY_MODULATOR";
164 case PLUGIN_CATEGORY_UTILITY
:
165 return "PLUGIN_CATEGORY_UTILITY";
166 case PLUGIN_CATEGORY_OTHER
:
167 return "PLUGIN_CATEGORY_OTHER";
170 carla_stderr("CarlaBackend::PluginCategory2Str(%i) - invalid category", category
);
175 const char* ParameterType2Str(const ParameterType type
) noexcept
179 case PARAMETER_UNKNOWN
:
180 return "PARAMETER_UNKNOWN";
181 case PARAMETER_INPUT
:
182 return "PARAMETER_INPUT";
183 case PARAMETER_OUTPUT
:
184 return "PARAMETER_OUTPUT";
187 carla_stderr("CarlaBackend::ParameterType2Str(%i) - invalid type", type
);
192 const char* InternalParameterIndex2Str(const InternalParameterIndex index
) noexcept
197 return "PARAMETER_NULL";
198 #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
199 case PARAMETER_ACTIVE
:
200 return "PARAMETER_ACTIVE";
201 case PARAMETER_DRYWET
:
202 return "PARAMETER_DRYWET";
203 case PARAMETER_VOLUME
:
204 return "PARAMETER_VOLUME";
205 case PARAMETER_BALANCE_LEFT
:
206 return "PARAMETER_BALANCE_LEFT";
207 case PARAMETER_BALANCE_RIGHT
:
208 return "PARAMETER_BALANCE_RIGHT";
209 case PARAMETER_PANNING
:
210 return "PARAMETER_PANNING";
211 case PARAMETER_CTRL_CHANNEL
:
212 return "PARAMETER_CTRL_CHANNEL";
215 return "PARAMETER_MAX";
218 carla_stderr("CarlaBackend::InternalParameterIndex2Str(%i) - invalid index", index
);
223 const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode
) noexcept
227 case ENGINE_CALLBACK_DEBUG
:
228 return "ENGINE_CALLBACK_DEBUG";
229 case ENGINE_CALLBACK_PLUGIN_ADDED
:
230 return "ENGINE_CALLBACK_PLUGIN_ADDED";
231 case ENGINE_CALLBACK_PLUGIN_REMOVED
:
232 return "ENGINE_CALLBACK_PLUGIN_REMOVED";
233 case ENGINE_CALLBACK_PLUGIN_RENAMED
:
234 return "ENGINE_CALLBACK_PLUGIN_RENAMED";
235 case ENGINE_CALLBACK_PLUGIN_UNAVAILABLE
:
236 return "ENGINE_CALLBACK_PLUGIN_UNAVAILABLE";
237 case ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED
:
238 return "ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED";
239 case ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED
:
240 return "ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED";
241 #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
242 case ENGINE_CALLBACK_PARAMETER_MAPPED_CONTROL_INDEX_CHANGED
:
243 return "ENGINE_CALLBACK_PARAMETER_MAPPED_CONTROL_INDEX_CHANGED";
244 case ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED
:
245 return "ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED";
246 case ENGINE_CALLBACK_OPTION_CHANGED
:
247 return "ENGINE_CALLBACK_OPTION_CHANGED";
249 case ENGINE_CALLBACK_PROGRAM_CHANGED
:
250 return "ENGINE_CALLBACK_PROGRAM_CHANGED";
251 case ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED
:
252 return "ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED";
253 case ENGINE_CALLBACK_UI_STATE_CHANGED
:
254 return "ENGINE_CALLBACK_UI_STATE_CHANGED";
255 case ENGINE_CALLBACK_NOTE_ON
:
256 return "ENGINE_CALLBACK_NOTE_ON";
257 case ENGINE_CALLBACK_NOTE_OFF
:
258 return "ENGINE_CALLBACK_NOTE_OFF";
259 case ENGINE_CALLBACK_UPDATE
:
260 return "ENGINE_CALLBACK_UPDATE";
261 case ENGINE_CALLBACK_RELOAD_INFO
:
262 return "ENGINE_CALLBACK_RELOAD_INFO";
263 case ENGINE_CALLBACK_RELOAD_PARAMETERS
:
264 return "ENGINE_CALLBACK_RELOAD_PARAMETERS";
265 case ENGINE_CALLBACK_RELOAD_PROGRAMS
:
266 return "ENGINE_CALLBACK_RELOAD_PROGRAMS";
267 case ENGINE_CALLBACK_RELOAD_ALL
:
268 return "ENGINE_CALLBACK_RELOAD_ALL";
269 #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
270 case ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED
:
271 return "ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED";
272 case ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED
:
273 return "ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED";
274 case ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED
:
275 return "ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED";
276 case ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED
:
277 return "ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED";
278 case ENGINE_CALLBACK_PATCHBAY_PORT_ADDED
:
279 return "ENGINE_CALLBACK_PATCHBAY_PORT_ADDED";
280 case ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED
:
281 return "ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED";
282 case ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED
:
283 return "ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED";
284 case ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
:
285 return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED";
286 case ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
:
287 return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED";
289 case ENGINE_CALLBACK_ENGINE_STARTED
:
290 return "ENGINE_CALLBACK_ENGINE_STARTED";
291 case ENGINE_CALLBACK_ENGINE_STOPPED
:
292 return "ENGINE_CALLBACK_ENGINE_STOPPED";
293 case ENGINE_CALLBACK_PROCESS_MODE_CHANGED
:
294 return "ENGINE_CALLBACK_PROCESS_MODE_CHANGED";
295 case ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED
:
296 return "ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED";
297 case ENGINE_CALLBACK_BUFFER_SIZE_CHANGED
:
298 return "ENGINE_CALLBACK_BUFFER_SIZE_CHANGED";
299 case ENGINE_CALLBACK_SAMPLE_RATE_CHANGED
:
300 return "ENGINE_CALLBACK_SAMPLE_RATE_CHANGED";
301 case ENGINE_CALLBACK_CANCELABLE_ACTION
:
302 return "ENGINE_CALLBACK_CANCELABLE_ACTION";
303 case ENGINE_CALLBACK_PROJECT_LOAD_FINISHED
:
304 return "ENGINE_CALLBACK_PROJECT_LOAD_FINISHED";
305 case ENGINE_CALLBACK_NSM
:
306 return "ENGINE_CALLBACK_NSM";
307 case ENGINE_CALLBACK_IDLE
:
308 return "ENGINE_CALLBACK_IDLE";
309 case ENGINE_CALLBACK_INFO
:
310 return "ENGINE_CALLBACK_INFO";
311 case ENGINE_CALLBACK_ERROR
:
312 return "ENGINE_CALLBACK_ERROR";
313 case ENGINE_CALLBACK_QUIT
:
314 return "ENGINE_CALLBACK_QUIT";
315 case ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW
:
316 return "ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW";
317 case ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED
:
318 return "ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED";
319 case ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED
:
320 return "ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED";
321 case ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED
:
322 return "ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED";
323 case ENGINE_CALLBACK_PARAMETER_MAPPED_RANGE_CHANGED
:
324 return "ENGINE_CALLBACK_PARAMETER_MAPPED_RANGE_CHANGED";
325 case ENGINE_CALLBACK_PATCHBAY_CLIENT_POSITION_CHANGED
:
326 return "ENGINE_CALLBACK_PATCHBAY_CLIENT_POSITION_CHANGED";
327 case ENGINE_CALLBACK_EMBED_UI_RESIZED
:
328 return "ENGINE_CALLBACK_EMBED_UI_RESIZED";
331 carla_stderr("CarlaBackend::EngineCallbackOpcode2Str(%i) - invalid opcode", opcode
);
336 const char* EngineOption2Str(const EngineOption option
) noexcept
340 case ENGINE_OPTION_DEBUG
:
341 return "ENGINE_OPTION_DEBUG";
342 case ENGINE_OPTION_PROCESS_MODE
:
343 return "ENGINE_OPTION_PROCESS_MODE";
344 case ENGINE_OPTION_TRANSPORT_MODE
:
345 return "ENGINE_OPTION_TRANSPORT_MODE";
346 case ENGINE_OPTION_FORCE_STEREO
:
347 return "ENGINE_OPTION_FORCE_STEREO";
348 case ENGINE_OPTION_PREFER_PLUGIN_BRIDGES
:
349 return "ENGINE_OPTION_PREFER_PLUGIN_BRIDGES";
350 case ENGINE_OPTION_PREFER_UI_BRIDGES
:
351 return "ENGINE_OPTION_PREFER_UI_BRIDGES";
352 case ENGINE_OPTION_UIS_ALWAYS_ON_TOP
:
353 return "ENGINE_OPTION_UIS_ALWAYS_ON_TOP";
354 case ENGINE_OPTION_MAX_PARAMETERS
:
355 return "ENGINE_OPTION_MAX_PARAMETERS";
356 case ENGINE_OPTION_RESET_XRUNS
:
357 return "ENGINE_OPTION_RESET_XRUNS";
358 case ENGINE_OPTION_UI_BRIDGES_TIMEOUT
:
359 return "ENGINE_OPTION_UI_BRIDGES_TIMEOUT";
360 case ENGINE_OPTION_AUDIO_BUFFER_SIZE
:
361 return "ENGINE_OPTION_AUDIO_BUFFER_SIZE";
362 case ENGINE_OPTION_AUDIO_SAMPLE_RATE
:
363 return "ENGINE_OPTION_AUDIO_SAMPLE_RATE";
364 case ENGINE_OPTION_AUDIO_TRIPLE_BUFFER
:
365 return "ENGINE_OPTION_AUDIO_TRIPLE_BUFFER";
366 case ENGINE_OPTION_AUDIO_DRIVER
:
367 return "ENGINE_OPTION_AUDIO_DRIVER";
368 case ENGINE_OPTION_AUDIO_DEVICE
:
369 return "ENGINE_OPTION_AUDIO_DEVICE";
371 case ENGINE_OPTION_OSC_ENABLED
:
372 return "ENGINE_OPTION_OSC_ENABLED";
373 case ENGINE_OPTION_OSC_PORT_UDP
:
374 return "ENGINE_OPTION_OSC_PORT_UDP";
375 case ENGINE_OPTION_OSC_PORT_TCP
:
376 return "ENGINE_OPTION_OSC_PORT_TCP";
378 case ENGINE_OPTION_FILE_PATH
:
379 return "ENGINE_OPTION_FILE_PATH";
380 case ENGINE_OPTION_PLUGIN_PATH
:
381 return "ENGINE_OPTION_PLUGIN_PATH";
382 case ENGINE_OPTION_PATH_BINARIES
:
383 return "ENGINE_OPTION_PATH_BINARIES";
384 case ENGINE_OPTION_PATH_RESOURCES
:
385 return "ENGINE_OPTION_PATH_RESOURCES";
386 case ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR
:
387 return "ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR";
388 case ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR
:
389 return "ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR";
390 case ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR
:
391 return "ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR";
392 case ENGINE_OPTION_FRONTEND_UI_SCALE
:
393 return "ENGINE_OPTION_FRONTEND_UI_SCALE";
394 case ENGINE_OPTION_FRONTEND_WIN_ID
:
395 return "ENGINE_OPTION_FRONTEND_WIN_ID";
396 #if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
397 case ENGINE_OPTION_WINE_EXECUTABLE
:
398 return "ENGINE_OPTION_WINE_EXECUTABLE";
399 case ENGINE_OPTION_WINE_AUTO_PREFIX
:
400 return "ENGINE_OPTION_WINE_AUTO_PREFIX";
401 case ENGINE_OPTION_WINE_FALLBACK_PREFIX
:
402 return "ENGINE_OPTION_WINE_FALLBACK_PREFIX";
403 case ENGINE_OPTION_WINE_RT_PRIO_ENABLED
:
404 return "ENGINE_OPTION_WINE_RT_PRIO_ENABLED";
405 case ENGINE_OPTION_WINE_BASE_RT_PRIO
:
406 return "ENGINE_OPTION_WINE_BASE_RT_PRIO";
407 case ENGINE_OPTION_WINE_SERVER_RT_PRIO
:
408 return "ENGINE_OPTION_WINE_SERVER_RT_PRIO";
411 case ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT
:
412 return "ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT";
414 case ENGINE_OPTION_CLIENT_NAME_PREFIX
:
415 return "ENGINE_OPTION_CLIENT_NAME_PREFIX";
416 case ENGINE_OPTION_PLUGINS_ARE_STANDALONE
:
417 return "ENGINE_OPTION_PLUGINS_ARE_STANDALONE";
420 carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option
);
425 const char* EngineProcessMode2Str(const EngineProcessMode mode
) noexcept
429 case ENGINE_PROCESS_MODE_SINGLE_CLIENT
:
430 return "ENGINE_PROCESS_MODE_SINGLE_CLIENT";
431 case ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS
:
432 return "ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS";
433 case ENGINE_PROCESS_MODE_CONTINUOUS_RACK
:
434 return "ENGINE_PROCESS_MODE_CONTINUOUS_RACK";
435 case ENGINE_PROCESS_MODE_PATCHBAY
:
436 return "ENGINE_PROCESS_MODE_PATCHBAY";
437 case ENGINE_PROCESS_MODE_BRIDGE
:
438 return "ENGINE_PROCESS_MODE_BRIDGE";
441 carla_stderr("CarlaBackend::EngineProcessMode2Str(%i) - invalid mode", mode
);
446 const char* EngineTransportMode2Str(const EngineTransportMode mode
) noexcept
450 case ENGINE_TRANSPORT_MODE_DISABLED
:
451 return "ENGINE_TRANSPORT_MODE_DISABLED";
452 case ENGINE_TRANSPORT_MODE_INTERNAL
:
453 return "ENGINE_TRANSPORT_MODE_INTERNAL";
454 case ENGINE_TRANSPORT_MODE_JACK
:
455 return "ENGINE_TRANSPORT_MODE_JACK";
456 case ENGINE_TRANSPORT_MODE_PLUGIN
:
457 return "ENGINE_TRANSPORT_MODE_PLUGIN";
458 case ENGINE_TRANSPORT_MODE_BRIDGE
:
459 return "ENGINE_TRANSPORT_MODE_BRIDGE";
462 carla_stderr("CarlaBackend::EngineTransportMode2Str(%i) - invalid mode", mode
);
467 const char* FileCallbackOpcode2Str(const FileCallbackOpcode opcode
) noexcept
471 case FILE_CALLBACK_DEBUG
:
472 return "FILE_CALLBACK_DEBUG";
473 case FILE_CALLBACK_OPEN
:
474 return "FILE_CALLBACK_OPEN";
475 case FILE_CALLBACK_SAVE
:
476 return "FILE_CALLBACK_SAVE";
479 carla_stderr("CarlaBackend::FileCallbackOpcode2Str(%i) - invalid opcode", opcode
);
484 const char* PatchbayIcon2Str(const PatchbayIcon icon
) noexcept
488 case PATCHBAY_ICON_APPLICATION
:
489 return "PATCHBAY_ICON_APPLICATION";
490 case PATCHBAY_ICON_PLUGIN
:
491 return "PATCHBAY_ICON_PLUGIN";
492 case PATCHBAY_ICON_HARDWARE
:
493 return "PATCHBAY_ICON_HARDWARE";
494 case PATCHBAY_ICON_CARLA
:
495 return "PATCHBAY_ICON_CARLA";
496 case PATCHBAY_ICON_DISTRHO
:
497 return "PATCHBAY_ICON_DISTRHO";
498 case PATCHBAY_ICON_FILE
:
499 return "PATCHBAY_ICON_FILE";
502 carla_stderr("CarlaBackend::PatchbayIcon2Str(%i) - invalid icon", icon
);
506 // -----------------------------------------------------------------------
509 const char* NativePluginDispatcherOpcode2Str(const NativePluginDispatcherOpcode opcode
) noexcept
513 case NATIVE_PLUGIN_OPCODE_NULL
:
514 return "NATIVE_PLUGIN_OPCODE_NULL";
515 case NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED
:
516 return "NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED";
517 case NATIVE_PLUGIN_OPCODE_SAMPLE_RATE_CHANGED
:
518 return "NATIVE_PLUGIN_OPCODE_SAMPLE_RATE_CHANGED";
519 case NATIVE_PLUGIN_OPCODE_OFFLINE_CHANGED
:
520 return "NATIVE_PLUGIN_OPCODE_OFFLINE_CHANGED";
521 case NATIVE_PLUGIN_OPCODE_UI_NAME_CHANGED
:
522 return "NATIVE_PLUGIN_OPCODE_UI_NAME_CHANGED";
523 case NATIVE_PLUGIN_OPCODE_GET_INTERNAL_HANDLE
:
524 return "NATIVE_PLUGIN_OPCODE_GET_INTERNAL_HANDLE";
525 case NATIVE_PLUGIN_OPCODE_IDLE
:
526 return "NATIVE_PLUGIN_OPCODE_IDLE";
527 case NATIVE_PLUGIN_OPCODE_UI_MIDI_EVENT
:
528 return "NATIVE_PLUGIN_OPCODE_UI_MIDI_EVENT";
529 case NATIVE_PLUGIN_OPCODE_HOST_USES_EMBED
:
530 return "NATIVE_PLUGIN_OPCODE_HOST_USES_EMBED";
531 case NATIVE_PLUGIN_OPCODE_HOST_OPTION
:
532 return "NATIVE_PLUGIN_OPCODE_HOST_OPTION";
535 carla_stderr("CarlaBackend::NativePluginDispatcherOpcode2Str(%i) - invalid icon", opcode
);
540 const char* NativeHostDispatcherOpcode2Str(const NativeHostDispatcherOpcode opcode
) noexcept
544 case NATIVE_HOST_OPCODE_NULL
:
545 return "NATIVE_HOST_OPCODE_NULL";
546 case NATIVE_HOST_OPCODE_UPDATE_PARAMETER
:
547 return "NATIVE_HOST_OPCODE_UPDATE_PARAMETER";
548 case NATIVE_HOST_OPCODE_UPDATE_MIDI_PROGRAM
:
549 return "NATIVE_HOST_OPCODE_UPDATE_MIDI_PROGRAM";
550 case NATIVE_HOST_OPCODE_RELOAD_PARAMETERS
:
551 return "NATIVE_HOST_OPCODE_RELOAD_PARAMETERS";
552 case NATIVE_HOST_OPCODE_RELOAD_MIDI_PROGRAMS
:
553 return "NATIVE_HOST_OPCODE_RELOAD_MIDI_PROGRAMS";
554 case NATIVE_HOST_OPCODE_RELOAD_ALL
:
555 return "NATIVE_HOST_OPCODE_RELOAD_ALL";
556 case NATIVE_HOST_OPCODE_UI_UNAVAILABLE
:
557 return "NATIVE_HOST_OPCODE_UI_UNAVAILABLE";
558 case NATIVE_HOST_OPCODE_HOST_IDLE
:
559 return "NATIVE_HOST_OPCODE_HOST_IDLE";
560 case NATIVE_HOST_OPCODE_INTERNAL_PLUGIN
:
561 return "NATIVE_HOST_OPCODE_INTERNAL_PLUGIN";
562 case NATIVE_HOST_OPCODE_QUEUE_INLINE_DISPLAY
:
563 return "NATIVE_HOST_OPCODE_QUEUE_INLINE_DISPLAY";
564 case NATIVE_HOST_OPCODE_UI_TOUCH_PARAMETER
:
565 return "NATIVE_HOST_OPCODE_UI_TOUCH_PARAMETER";
566 case NATIVE_HOST_OPCODE_REQUEST_IDLE
:
567 return "NATIVE_HOST_OPCODE_REQUEST_IDLE";
568 case NATIVE_HOST_OPCODE_GET_FILE_PATH
:
569 return "NATIVE_HOST_OPCODE_GET_FILE_PATH";
570 case NATIVE_HOST_OPCODE_UI_RESIZE
:
571 return "NATIVE_HOST_OPCODE_UI_RESIZE";
572 case NATIVE_HOST_OPCODE_PREVIEW_BUFFER_DATA
:
573 return "NATIVE_HOST_OPCODE_PREVIEW_BUFFER_DATA";
576 carla_stderr("CarlaBackend::NativeHostDispatcherOpcode2Str(%i) - invalid icon", opcode
);
580 // -----------------------------------------------------------------------
583 const char* getBinaryTypeAsString(const BinaryType type
) noexcept
585 carla_debug("CarlaBackend::getBinaryTypeAsString(%i:%s)", type
, BinaryType2Str(type
));
587 if (type
== BINARY_NATIVE
)
606 carla_stderr("CarlaBackend::getBinaryTypeAsString(%i) - invalid type", type
);
611 BinaryType
getBinaryTypeFromString(const char* const ctype
) noexcept
613 CARLA_SAFE_ASSERT_RETURN(ctype
!= nullptr && ctype
[0] != '\0', BINARY_NONE
);
614 carla_debug("CarlaBackend::getBinaryTypeFromString(\"%s\")", ctype
);
616 CarlaString
stype(ctype
);
625 if (stype
== "native")
626 return BINARY_NATIVE
;
627 if (stype
== "posix32" || stype
== "linux32" || stype
== "mac32")
628 return BINARY_POSIX32
;
629 if (stype
== "posix64" || stype
== "linux64" || stype
== "mac64")
630 return BINARY_POSIX64
;
631 if (stype
== "win32")
633 if (stype
== "win64")
635 if (stype
== "other")
638 carla_stderr("CarlaBackend::getBinaryTypeFromString(\"%s\") - invalid string type", ctype
);
642 // -----------------------------------------------------------------------
645 const char* getPluginCategoryAsString(const PluginCategory category
) noexcept
647 carla_debug("CarlaBackend::getPluginCategoryAsString(%i:%s)", category
, PluginCategory2Str(category
));
651 case PLUGIN_CATEGORY_NONE
:
653 case PLUGIN_CATEGORY_SYNTH
:
655 case PLUGIN_CATEGORY_DELAY
:
657 case PLUGIN_CATEGORY_EQ
:
659 case PLUGIN_CATEGORY_FILTER
:
661 case PLUGIN_CATEGORY_DISTORTION
:
663 case PLUGIN_CATEGORY_DYNAMICS
:
665 case PLUGIN_CATEGORY_MODULATOR
:
667 case PLUGIN_CATEGORY_UTILITY
:
669 case PLUGIN_CATEGORY_OTHER
:
673 carla_stderr("CarlaBackend::getPluginCategoryAsString(%i) - invalid category", category
);
678 PluginCategory
getPluginCategoryFromString(const char* const category
) noexcept
680 CARLA_SAFE_ASSERT_RETURN(category
!= nullptr && category
[0] != '\0', PLUGIN_CATEGORY_NONE
);
681 carla_debug("CarlaBackend::getPluginCategoryFromString(\"%s\")", category
);
683 if (std::strcmp(category
, "none") == 0)
684 return PLUGIN_CATEGORY_NONE
;
685 if (std::strcmp(category
, "synth") == 0)
686 return PLUGIN_CATEGORY_SYNTH
;
687 if (std::strcmp(category
, "delay") == 0)
688 return PLUGIN_CATEGORY_DELAY
;
689 if (std::strcmp(category
, "eq") == 0)
690 return PLUGIN_CATEGORY_EQ
;
691 if (std::strcmp(category
, "filter") == 0)
692 return PLUGIN_CATEGORY_FILTER
;
693 if (std::strcmp(category
, "distortion") == 0)
694 return PLUGIN_CATEGORY_DISTORTION
;
695 if (std::strcmp(category
, "dynamics") == 0)
696 return PLUGIN_CATEGORY_DYNAMICS
;
697 if (std::strcmp(category
, "modulator") == 0)
698 return PLUGIN_CATEGORY_MODULATOR
;
699 if (std::strcmp(category
, "utility") == 0)
700 return PLUGIN_CATEGORY_UTILITY
;
701 if (std::strcmp(category
, "other") == 0)
702 return PLUGIN_CATEGORY_OTHER
;
704 carla_stderr("CarlaBackend::getPluginCategoryFromString(\"%s\") - invalid category", category
);
705 return PLUGIN_CATEGORY_NONE
;
708 // -----------------------------------------------------------------------
711 const char* getPluginTypeAsString(const PluginType type
) noexcept
713 carla_debug("CarlaBackend::getPluginTypeAsString(%i:%s)", type
, PluginType2Str(type
));
719 case PLUGIN_INTERNAL
:
747 case PLUGIN_TYPE_COUNT
:
751 carla_stderr("CarlaBackend::getPluginTypeAsString(%i) - invalid type", type
);
756 PluginType
getPluginTypeFromString(const char* const ctype
) noexcept
758 CARLA_SAFE_ASSERT_RETURN(ctype
!= nullptr && ctype
[0] != '\0', PLUGIN_NONE
);
759 carla_debug("CarlaBackend::getPluginTypeFromString(\"%s\")", ctype
);
761 CarlaString
stype(ctype
);
770 if (stype
== "internal" || stype
== "native")
771 return PLUGIN_INTERNAL
;
772 if (stype
== "ladspa")
773 return PLUGIN_LADSPA
;
778 if (stype
== "vst2" || stype
== "vst")
782 if (stype
== "au" || stype
== "audiounit")
788 if (stype
== "sf2" || stype
== "sf3")
799 carla_stderr("CarlaBackend::getPluginTypeFromString(\"%s\") - invalid string type", ctype
);
803 // -----------------------------------------------------------------------
806 PluginCategory
getPluginCategoryFromName(const char* const name
) noexcept
808 CARLA_SAFE_ASSERT_RETURN(name
!= nullptr && name
[0] != '\0', PLUGIN_CATEGORY_NONE
);
809 carla_debug("CarlaBackend::getPluginCategoryFromName(\"%s\")", name
);
811 CarlaString
sname(name
);
814 return PLUGIN_CATEGORY_NONE
;
818 // generic tags first
819 if (sname
.contains("delay"))
820 return PLUGIN_CATEGORY_DELAY
;
821 if (sname
.contains("reverb"))
822 return PLUGIN_CATEGORY_DELAY
;
825 if (sname
.contains("filter"))
826 return PLUGIN_CATEGORY_FILTER
;
829 if (sname
.contains("distortion"))
830 return PLUGIN_CATEGORY_DISTORTION
;
833 if (sname
.contains("dynamics"))
834 return PLUGIN_CATEGORY_DYNAMICS
;
835 if (sname
.contains("amplifier"))
836 return PLUGIN_CATEGORY_DYNAMICS
;
837 if (sname
.contains("compressor"))
838 return PLUGIN_CATEGORY_DYNAMICS
;
839 if (sname
.contains("enhancer"))
840 return PLUGIN_CATEGORY_DYNAMICS
;
841 if (sname
.contains("exciter"))
842 return PLUGIN_CATEGORY_DYNAMICS
;
843 if (sname
.contains("gate"))
844 return PLUGIN_CATEGORY_DYNAMICS
;
845 if (sname
.contains("limiter"))
846 return PLUGIN_CATEGORY_DYNAMICS
;
849 if (sname
.contains("modulator"))
850 return PLUGIN_CATEGORY_MODULATOR
;
851 if (sname
.contains("chorus"))
852 return PLUGIN_CATEGORY_MODULATOR
;
853 if (sname
.contains("flanger"))
854 return PLUGIN_CATEGORY_MODULATOR
;
855 if (sname
.contains("phaser"))
856 return PLUGIN_CATEGORY_MODULATOR
;
857 if (sname
.contains("saturator"))
858 return PLUGIN_CATEGORY_MODULATOR
;
861 if (sname
.contains("utility"))
862 return PLUGIN_CATEGORY_UTILITY
;
863 if (sname
.contains("analyzer"))
864 return PLUGIN_CATEGORY_UTILITY
;
865 if (sname
.contains("converter"))
866 return PLUGIN_CATEGORY_UTILITY
;
867 if (sname
.contains("deesser"))
868 return PLUGIN_CATEGORY_UTILITY
;
869 if (sname
.contains("mixer"))
870 return PLUGIN_CATEGORY_UTILITY
;
873 if (sname
.contains("verb"))
874 return PLUGIN_CATEGORY_DELAY
;
876 if (sname
.contains("eq"))
877 return PLUGIN_CATEGORY_EQ
;
879 if (sname
.contains("tool"))
880 return PLUGIN_CATEGORY_UTILITY
;
883 if (sname
.contains("synth"))
884 return PLUGIN_CATEGORY_SYNTH
;
887 if (sname
.contains("misc"))
888 return PLUGIN_CATEGORY_OTHER
;
889 if (sname
.contains("other"))
890 return PLUGIN_CATEGORY_OTHER
;
892 return PLUGIN_CATEGORY_NONE
;
895 // -----------------------------------------------------------------------
898 bool isPluginOptionEnabled(const uint options
, const uint option
)
900 if (options
== PLUGIN_OPTIONS_NULL
)
902 if (options
& option
)
908 bool isPluginOptionInverseEnabled(const uint options
, const uint option
)
910 if (options
== PLUGIN_OPTIONS_NULL
)
912 if (options
& option
)
917 // -----------------------------------------------------------------------
919 CARLA_BACKEND_END_NAMESPACE
921 #endif // CARLA_BACKEND_UTILS_HPP_INCLUDED