Remove juce completely, cleanup
[carla.git] / source / backend / CarlaHost.h
blob240ba0c2904b2ff0a5e7065933d342039441cab4
1 // SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
2 // SPDX-License-Identifier: GPL-2.0-or-later
4 #ifndef CARLA_HOST_H_INCLUDED
5 #define CARLA_HOST_H_INCLUDED
7 #include "CarlaBackend.h"
9 #ifdef __cplusplus
10 using CARLA_BACKEND_NAMESPACE::BinaryType;
11 using CARLA_BACKEND_NAMESPACE::PluginType;
12 using CARLA_BACKEND_NAMESPACE::PluginCategory;
13 using CARLA_BACKEND_NAMESPACE::InternalParameterIndex;
14 using CARLA_BACKEND_NAMESPACE::EngineCallbackOpcode;
15 using CARLA_BACKEND_NAMESPACE::NsmCallbackOpcode;
16 using CARLA_BACKEND_NAMESPACE::EngineOption;
17 using CARLA_BACKEND_NAMESPACE::EngineProcessMode;
18 using CARLA_BACKEND_NAMESPACE::EngineTransportMode;
19 using CARLA_BACKEND_NAMESPACE::FileCallbackOpcode;
20 using CARLA_BACKEND_NAMESPACE::EngineCallbackFunc;
21 using CARLA_BACKEND_NAMESPACE::FileCallbackFunc;
22 using CARLA_BACKEND_NAMESPACE::ParameterData;
23 using CARLA_BACKEND_NAMESPACE::ParameterRanges;
24 using CARLA_BACKEND_NAMESPACE::MidiProgramData;
25 using CARLA_BACKEND_NAMESPACE::CustomData;
26 using CARLA_BACKEND_NAMESPACE::EngineDriverDeviceInfo;
27 using CARLA_BACKEND_NAMESPACE::CarlaEngine;
28 using CARLA_BACKEND_NAMESPACE::CarlaEngineClient;
29 using CARLA_BACKEND_NAMESPACE::CarlaPlugin;
30 #endif
32 /*!
33 * @defgroup CarlaHostAPI Carla Host API
35 * The Carla Host API.
37 * This API makes it possible to use the Carla Backend in a standalone host application..
39 * None of the returned values in this API calls need to be deleted or free'd.
40 * When a function fails (returns false or NULL), use carla_get_last_error() to find out what went wrong.
41 * @{
44 /* ------------------------------------------------------------------------------------------------------------
45 * Carla Host API (C stuff) */
47 /*!
48 * Information about a loaded plugin.
49 * @see carla_get_plugin_info()
51 typedef struct _CarlaPluginInfo {
52 /*!
53 * Plugin type.
55 PluginType type;
57 /*!
58 * Plugin category.
60 PluginCategory category;
62 /*!
63 * Plugin hints.
64 * @see PluginHints
66 uint hints;
68 /*!
69 * Plugin options available for the user to change.
70 * @see PluginOptions
72 uint optionsAvailable;
74 /*!
75 * Plugin options currently enabled.
76 * Some options are enabled but not available, which means they will always be on.
77 * @see PluginOptions
79 uint optionsEnabled;
81 /*!
82 * Plugin filename.
83 * This can be the plugin binary or resource file.
85 const char* filename;
87 /*!
88 * Plugin name.
89 * This name is unique within a Carla instance.
90 * @see carla_get_real_plugin_name()
92 const char* name;
94 /*!
95 * Plugin label or URI.
97 const char* label;
99 /*!
100 * Plugin author/maker.
102 const char* maker;
105 * Plugin copyright/license.
107 const char* copyright;
110 * Icon name for this plugin, in lowercase.
111 * Default is "plugin".
113 const char* iconName;
116 * Plugin unique Id.
117 * This Id is dependent on the plugin type and may sometimes be 0.
119 int64_t uniqueId;
121 #ifdef __cplusplus
123 * C++ constructor and destructor.
125 CARLA_API _CarlaPluginInfo() noexcept;
126 CARLA_API ~_CarlaPluginInfo() noexcept;
127 CARLA_DECLARE_NON_COPYABLE(_CarlaPluginInfo)
128 #endif
130 } CarlaPluginInfo;
133 * Port count information, used for Audio and MIDI ports and parameters.
134 * @see carla_get_audio_port_count_info()
135 * @see carla_get_midi_port_count_info()
136 * @see carla_get_parameter_count_info()
138 typedef struct _CarlaPortCountInfo {
140 * Number of inputs.
142 uint32_t ins;
145 * Number of outputs.
147 uint32_t outs;
149 } CarlaPortCountInfo;
152 * Parameter information.
153 * @see carla_get_parameter_info()
155 typedef struct _CarlaParameterInfo {
157 * Parameter name.
159 const char* name;
162 * Parameter symbol.
164 const char* symbol;
167 * Parameter unit.
169 const char* unit;
172 * Parameter comment / documentation.
174 const char* comment;
177 * Parameter group name, prefixed by a unique symbol and ":".
179 const char* groupName;
182 * Number of scale points.
183 * @see CarlaScalePointInfo
185 uint32_t scalePointCount;
187 #ifdef __cplusplus
189 * C++ constructor and destructor.
191 CARLA_API _CarlaParameterInfo() noexcept;
192 CARLA_API ~_CarlaParameterInfo() noexcept;
193 CARLA_DECLARE_NON_COPYABLE(_CarlaParameterInfo)
194 #endif
196 } CarlaParameterInfo;
199 * Parameter scale point information.
200 * @see carla_get_parameter_scalepoint_info()
202 typedef struct _CarlaScalePointInfo {
204 * Scale point value.
206 float value;
209 * Scale point label.
211 const char* label;
213 #ifdef __cplusplus
215 * C++ constructor and destructor.
217 CARLA_API _CarlaScalePointInfo() noexcept;
218 CARLA_API ~_CarlaScalePointInfo() noexcept;
219 CARLA_DECLARE_NON_COPYABLE(_CarlaScalePointInfo)
220 #endif
222 } CarlaScalePointInfo;
225 * Transport information.
226 * @see carla_get_transport_info()
228 typedef struct _CarlaTransportInfo {
230 * Wherever transport is playing.
232 bool playing;
235 * Current transport frame.
237 uint64_t frame;
240 * Bar.
242 int32_t bar;
245 * Beat.
247 int32_t beat;
250 * Tick.
252 int32_t tick;
255 * Beats per minute.
257 double bpm;
259 #ifdef __cplusplus
261 * C++ constructor.
263 CARLA_API _CarlaTransportInfo() noexcept;
266 * Clear struct contents.
268 CARLA_API void clear() noexcept;
269 #endif
271 } CarlaTransportInfo;
274 * Runtime engine information.
276 typedef struct _CarlaRuntimeEngineInfo {
278 * DSP load.
280 float load;
283 * Number of xruns.
285 uint32_t xruns;
287 } CarlaRuntimeEngineInfo;
290 * Runtime engine driver device information.
292 typedef struct {
294 * Name of the driver device.
296 const char* name;
299 * This driver device hints.
300 * @see EngineDriverHints
302 uint hints;
305 * Current buffer size.
307 uint bufferSize;
310 * Available buffer sizes.
311 * Terminated with 0.
313 const uint32_t* bufferSizes;
316 * Current sample rate.
318 double sampleRate;
321 * Available sample rates.
322 * Terminated with 0.0.
324 const double* sampleRates;
326 } CarlaRuntimeEngineDriverDeviceInfo;
329 * Image data for LV2 inline display API.
330 * raw image pixmap format is ARGB32,
332 typedef struct {
333 unsigned char* data;
334 int width;
335 int height;
336 int stride;
337 } CarlaInlineDisplayImageSurface;
339 /*! Opaque data type for CarlaHost API calls */
340 typedef struct _CarlaHostHandle* CarlaHostHandle;
342 /* ------------------------------------------------------------------------------------------------------------
343 * Carla Host API (C functions) */
346 * Get how many engine drivers are available.
348 CARLA_API_EXPORT uint carla_get_engine_driver_count(void);
351 * Get an engine driver name.
352 * @param index Driver index
354 CARLA_API_EXPORT const char* carla_get_engine_driver_name(uint index);
357 * Get the device names of an engine driver.
358 * @param index Driver index
360 CARLA_API_EXPORT const char* const* carla_get_engine_driver_device_names(uint index);
363 * Get information about a device driver.
364 * @param index Driver index
365 * @param name Device name
367 CARLA_API_EXPORT const EngineDriverDeviceInfo* carla_get_engine_driver_device_info(uint index, const char* name);
370 * Show a device custom control panel.
371 * @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL
372 * @param index Driver index
373 * @param name Device name
375 CARLA_API_EXPORT bool carla_show_engine_driver_device_control_panel(uint index, const char* name);
378 * Create a global host handle for standalone application usage.
380 CARLA_API_EXPORT CarlaHostHandle carla_standalone_host_init(void);
382 #ifdef __cplusplus
384 * Get the currently used engine, may be NULL.
385 * @note C++ only
387 CARLA_API_EXPORT CarlaEngine* carla_get_engine_from_handle(CarlaHostHandle handle);
388 #endif
391 * Initialize the engine.
392 * Make sure to call carla_engine_idle() at regular intervals afterwards.
393 * @param driverName Driver to use
394 * @param clientName Engine master client name
396 CARLA_API_EXPORT bool carla_engine_init(CarlaHostHandle handle, const char* driverName, const char* clientName);
398 #ifdef BUILD_BRIDGE
400 * Initialize the engine in bridged mode.
402 CARLA_API_EXPORT bool carla_engine_init_bridge(CarlaHostHandle handle,
403 const char audioBaseName[6+1],
404 const char rtClientBaseName[6+1],
405 const char nonRtClientBaseName[6+1],
406 const char nonRtServerBaseName[6+1],
407 const char* clientName);
408 #endif
411 * Close the engine.
412 * This function always closes the engine even if it returns false.
413 * In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
415 CARLA_API_EXPORT bool carla_engine_close(CarlaHostHandle handle);
418 * Idle the engine.
419 * Do not call this if the engine is not running.
421 CARLA_API_EXPORT void carla_engine_idle(CarlaHostHandle handle);
424 * Check if the engine is running.
426 CARLA_API_EXPORT bool carla_is_engine_running(CarlaHostHandle handle);
429 * Get information about the currently running engine.
431 CARLA_API_EXPORT const CarlaRuntimeEngineInfo* carla_get_runtime_engine_info(CarlaHostHandle handle);
433 #ifndef BUILD_BRIDGE
435 * Get information about the currently running engine driver device.
437 CARLA_API_EXPORT const CarlaRuntimeEngineDriverDeviceInfo* carla_get_runtime_engine_driver_device_info(CarlaHostHandle handle);
440 * Dynamically change buffer size and/or sample rate while engine is running.
441 * @see ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE
442 * @see ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE
444 CARLA_API_EXPORT bool carla_set_engine_buffer_size_and_sample_rate(CarlaHostHandle handle,
445 uint bufferSize, double sampleRate);
448 * Show the custom control panel for the current engine device.
449 * @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL
451 CARLA_API_EXPORT bool carla_show_engine_device_control_panel(CarlaHostHandle handle);
452 #endif
455 * Clear the xrun count on the engine, so that the next time carla_get_runtime_engine_info() is called, it returns 0.
457 CARLA_API_EXPORT void carla_clear_engine_xruns(CarlaHostHandle handle);
460 * Tell the engine to stop the current cancelable action.
461 * @see ENGINE_CALLBACK_CANCELABLE_ACTION
463 CARLA_API_EXPORT void carla_cancel_engine_action(CarlaHostHandle handle);
466 * Tell the engine it's about to close.
467 * This is used to prevent the engine thread(s) from reactivating.
468 * Returns true if there's no pending engine events.
470 CARLA_API_EXPORT bool carla_set_engine_about_to_close(CarlaHostHandle handle);
473 * Set the engine callback function.
474 * @param func Callback function
475 * @param ptr Callback pointer
477 CARLA_API_EXPORT void carla_set_engine_callback(CarlaHostHandle handle, EngineCallbackFunc func, void* ptr);
480 * Set an engine option.
481 * @param option Option
482 * @param value Value as number
483 * @param valueStr Value as string
485 CARLA_API_EXPORT void carla_set_engine_option(CarlaHostHandle handle,
486 EngineOption option, int value, const char* valueStr);
489 * Set the file callback function.
490 * @param func Callback function
491 * @param ptr Callback pointer
493 CARLA_API_EXPORT void carla_set_file_callback(CarlaHostHandle handle, FileCallbackFunc func, void* ptr);
496 * Load a file of any type.
497 * This will try to load a generic file as a plugin,
498 * either by direct handling (SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
499 * @see carla_get_supported_file_extensions()
501 CARLA_API_EXPORT bool carla_load_file(CarlaHostHandle handle, const char* filename);
504 * Load a Carla project file.
505 * @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
507 CARLA_API_EXPORT bool carla_load_project(CarlaHostHandle handle, const char* filename);
510 * Save current project to a file.
512 CARLA_API_EXPORT bool carla_save_project(CarlaHostHandle handle, const char* filename);
514 #ifndef BUILD_BRIDGE
516 * Get the currently set project folder.
517 * @note Valid for both standalone and plugin versions.
519 CARLA_API_EXPORT const char* carla_get_current_project_folder(CarlaHostHandle handle);
522 * Get the currently set project filename.
523 * @note Valid only for standalone version.
525 CARLA_API_EXPORT const char* carla_get_current_project_filename(CarlaHostHandle handle);
528 * Clear the currently set project filename.
530 CARLA_API_EXPORT void carla_clear_project_filename(CarlaHostHandle handle);
533 * Connect two patchbay ports.
534 * @param groupIdA Output (source) group
535 * @param portIdA Output (source) port
536 * @param groupIdB Input (target) group
537 * @param portIdB Input (target) port
538 * @note The group corresponds to the client Id received in the engine callback
539 * for ENGINE_CALLBACK_PATCHBAY_PORT_ADDED.
540 * @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
542 CARLA_API_EXPORT bool carla_patchbay_connect(CarlaHostHandle handle,
543 bool external, uint groupIdA, uint portIdA, uint groupIdB, uint portIdB);
546 * Disconnect two patchbay ports.
547 * @param connectionId Connection Id
548 * @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
550 CARLA_API_EXPORT bool carla_patchbay_disconnect(CarlaHostHandle handle, bool external, uint connectionId);
553 * Set the position of a group.
554 * This is purely cached and saved in the project file, Carla backend does nothing with the value.
555 * When loading a project, callbacks are used to inform of the previously saved positions.
556 * @see ENGINE_CALLBACK_PATCHBAY_CLIENT_POSITION_CHANGED
558 CARLA_API_EXPORT bool carla_patchbay_set_group_pos(CarlaHostHandle handle,
559 bool external, uint groupId, int x1, int y1, int x2, int y2);
562 * Force the engine to resend all patchbay clients, ports and connections again.
563 * @param external Wherever to show external/hardware ports instead of internal ones.
564 * Only valid in patchbay engine mode, other modes will ignore this.
566 CARLA_API_EXPORT bool carla_patchbay_refresh(CarlaHostHandle handle, bool external);
569 * Start playback of the engine transport.
571 CARLA_API_EXPORT void carla_transport_play(CarlaHostHandle handle);
574 * Pause the engine transport.
576 CARLA_API_EXPORT void carla_transport_pause(CarlaHostHandle handle);
579 * Set the engine transport bpm.
581 CARLA_API_EXPORT void carla_transport_bpm(CarlaHostHandle handle, double bpm);
584 * Relocate the engine transport to a specific frame.
586 CARLA_API_EXPORT void carla_transport_relocate(CarlaHostHandle handle, uint64_t frame);
589 * Get the current transport frame.
591 CARLA_API_EXPORT uint64_t carla_get_current_transport_frame(CarlaHostHandle handle);
594 * Get the engine transport information.
596 CARLA_API_EXPORT const CarlaTransportInfo* carla_get_transport_info(CarlaHostHandle handle);
597 #endif
600 * Current number of plugins loaded.
602 CARLA_API_EXPORT uint32_t carla_get_current_plugin_count(CarlaHostHandle handle);
605 * Maximum number of loadable plugins allowed.
606 * Returns 0 if engine is not started.
608 CARLA_API_EXPORT uint32_t carla_get_max_plugin_number(CarlaHostHandle handle);
611 * Add a new plugin.
612 * If you don't know the binary type use the BINARY_NATIVE macro.
613 * @param btype Binary type
614 * @param ptype Plugin type
615 * @param filename Filename, if applicable
616 * @param name Name of the plugin, can be NULL
617 * @param label Plugin label, if applicable
618 * @param uniqueId Plugin unique Id, if applicable
619 * @param extraPtr Extra pointer, defined per plugin type
620 * @param options Initial plugin options
622 CARLA_API_EXPORT bool carla_add_plugin(CarlaHostHandle handle,
623 BinaryType btype, PluginType ptype,
624 const char* filename, const char* name, const char* label, int64_t uniqueId,
625 const void* extraPtr, uint options);
628 * Remove one plugin.
629 * @param pluginId Plugin to remove.
631 CARLA_API_EXPORT bool carla_remove_plugin(CarlaHostHandle handle, uint pluginId);
634 * Remove all plugins.
636 CARLA_API_EXPORT bool carla_remove_all_plugins(CarlaHostHandle handle);
638 #ifndef BUILD_BRIDGE
640 * Rename a plugin.
641 * Returns the new name, or NULL if the operation failed.
642 * @param pluginId Plugin to rename
643 * @param newName New plugin name
645 CARLA_API_EXPORT bool carla_rename_plugin(CarlaHostHandle handle, uint pluginId, const char* newName);
648 * Clone a plugin.
649 * @param pluginId Plugin to clone
651 CARLA_API_EXPORT bool carla_clone_plugin(CarlaHostHandle handle, uint pluginId);
654 * Prepare replace of a plugin.
655 * The next call to carla_add_plugin() will use this id, replacing the current plugin.
656 * @param pluginId Plugin to replace
657 * @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
659 CARLA_API_EXPORT bool carla_replace_plugin(CarlaHostHandle handle, uint pluginId);
662 * Switch two plugins positions.
663 * @param pluginIdA Plugin A
664 * @param pluginIdB Plugin B
666 CARLA_API_EXPORT bool carla_switch_plugins(CarlaHostHandle handle, uint pluginIdA, uint pluginIdB);
667 #endif
670 * Load a plugin state.
671 * @param pluginId Plugin
672 * @param filename Path to plugin state
673 * @see carla_save_plugin_state()
675 CARLA_API_EXPORT bool carla_load_plugin_state(CarlaHostHandle handle, uint pluginId, const char* filename);
678 * Save a plugin state.
679 * @param pluginId Plugin
680 * @param filename Path to plugin state
681 * @see carla_load_plugin_state()
683 CARLA_API_EXPORT bool carla_save_plugin_state(CarlaHostHandle handle, uint pluginId, const char* filename);
686 * Export plugin as LV2.
687 * @param pluginId Plugin
688 * @param lv2path Path to lv2 plugin folder
690 CARLA_API_EXPORT bool carla_export_plugin_lv2(CarlaHostHandle handle, uint pluginId, const char* lv2path);
693 * Get information from a plugin.
694 * @param pluginId Plugin
696 CARLA_API_EXPORT const CarlaPluginInfo* carla_get_plugin_info(CarlaHostHandle handle, uint pluginId);
699 * Get audio port count information from a plugin.
700 * @param pluginId Plugin
702 CARLA_API_EXPORT const CarlaPortCountInfo* carla_get_audio_port_count_info(CarlaHostHandle handle, uint pluginId);
705 * Get MIDI port count information from a plugin.
706 * @param pluginId Plugin
708 CARLA_API_EXPORT const CarlaPortCountInfo* carla_get_midi_port_count_info(CarlaHostHandle handle, uint pluginId);
711 * Get parameter count information from a plugin.
712 * @param pluginId Plugin
714 CARLA_API_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(CarlaHostHandle handle, uint pluginId);
717 * Get hints about an audio port.
718 * @param pluginId Plugin
719 * @param isOutput Whether port is output, input otherwise
720 * @param portIndex Port index, related to input or output
722 CARLA_API_EXPORT uint carla_get_audio_port_hints(CarlaHostHandle handle, uint pluginId, bool isOutput, uint32_t portIndex);
725 * Get parameter information from a plugin.
726 * @param pluginId Plugin
727 * @param parameterId Parameter index
728 * @see carla_get_parameter_count()
730 CARLA_API_EXPORT const CarlaParameterInfo* carla_get_parameter_info(CarlaHostHandle handle,
731 uint pluginId,
732 uint32_t parameterId);
735 * Get parameter scale point information from a plugin.
736 * @param pluginId Plugin
737 * @param parameterId Parameter index
738 * @param scalePointId Parameter scale-point index
739 * @see CarlaParameterInfo::scalePointCount
741 CARLA_API_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(CarlaHostHandle handle,
742 uint pluginId,
743 uint32_t parameterId,
744 uint32_t scalePointId);
747 * Get a plugin's parameter data.
748 * @param pluginId Plugin
749 * @param parameterId Parameter index
750 * @see carla_get_parameter_count()
752 CARLA_API_EXPORT const ParameterData* carla_get_parameter_data(CarlaHostHandle handle,
753 uint pluginId, uint32_t parameterId);
756 * Get a plugin's parameter ranges.
757 * @param pluginId Plugin
758 * @param parameterId Parameter index
759 * @see carla_get_parameter_count()
761 CARLA_API_EXPORT const ParameterRanges* carla_get_parameter_ranges(CarlaHostHandle handle,
762 uint pluginId, uint32_t parameterId);
765 * Get a plugin's MIDI program data.
766 * @param pluginId Plugin
767 * @param midiProgramId MIDI Program index
768 * @see carla_get_midi_program_count()
770 CARLA_API_EXPORT const MidiProgramData* carla_get_midi_program_data(CarlaHostHandle handle,
771 uint pluginId, uint32_t midiProgramId);
774 * Get a plugin's custom data, using index.
775 * @param pluginId Plugin
776 * @param customDataId Custom data index
777 * @see carla_get_custom_data_count()
779 CARLA_API_EXPORT const CustomData* carla_get_custom_data(CarlaHostHandle handle, uint pluginId, uint32_t customDataId);
782 * Get a plugin's custom data value, using type and key.
783 * @param pluginId Plugin
784 * @param type Custom data type
785 * @param key Custom data key
786 * @see carla_get_custom_data_count()
788 CARLA_API_EXPORT const char* carla_get_custom_data_value(CarlaHostHandle handle,
789 uint pluginId, const char* type, const char* key);
792 * Get a plugin's chunk data.
793 * @param pluginId Plugin
794 * @see PLUGIN_OPTION_USE_CHUNKS and carla_set_chunk_data()
796 CARLA_API_EXPORT const char* carla_get_chunk_data(CarlaHostHandle handle, uint pluginId);
799 * Get how many parameters a plugin has.
800 * @param pluginId Plugin
802 CARLA_API_EXPORT uint32_t carla_get_parameter_count(CarlaHostHandle handle, uint pluginId);
805 * Get how many programs a plugin has.
806 * @param pluginId Plugin
807 * @see carla_get_program_name()
809 CARLA_API_EXPORT uint32_t carla_get_program_count(CarlaHostHandle handle, uint pluginId);
812 * Get how many MIDI programs a plugin has.
813 * @param pluginId Plugin
814 * @see carla_get_midi_program_name() and carla_get_midi_program_data()
816 CARLA_API_EXPORT uint32_t carla_get_midi_program_count(CarlaHostHandle handle, uint pluginId);
819 * Get how many custom data sets a plugin has.
820 * @param pluginId Plugin
821 * @see carla_get_custom_data()
823 CARLA_API_EXPORT uint32_t carla_get_custom_data_count(CarlaHostHandle handle, uint pluginId);
826 * Get a plugin's parameter text (custom display of internal values).
827 * @param pluginId Plugin
828 * @param parameterId Parameter index
829 * @see PARAMETER_USES_CUSTOM_TEXT
831 CARLA_API_EXPORT const char* carla_get_parameter_text(CarlaHostHandle handle, uint pluginId, uint32_t parameterId);
834 * Get a plugin's program name.
835 * @param pluginId Plugin
836 * @param programId Program index
837 * @see carla_get_program_count()
839 CARLA_API_EXPORT const char* carla_get_program_name(CarlaHostHandle handle, uint pluginId, uint32_t programId);
842 * Get a plugin's MIDI program name.
843 * @param pluginId Plugin
844 * @param midiProgramId MIDI Program index
845 * @see carla_get_midi_program_count()
847 CARLA_API_EXPORT const char* carla_get_midi_program_name(CarlaHostHandle handle, uint pluginId, uint32_t midiProgramId);
850 * Get a plugin's real name.
851 * This is the name the plugin uses to identify itself; may not be unique.
852 * @param pluginId Plugin
854 CARLA_API_EXPORT const char* carla_get_real_plugin_name(CarlaHostHandle handle, uint pluginId);
857 * Get a plugin's program index.
858 * @param pluginId Plugin
860 CARLA_API_EXPORT int32_t carla_get_current_program_index(CarlaHostHandle handle, uint pluginId);
863 * Get a plugin's midi program index.
864 * @param pluginId Plugin
866 CARLA_API_EXPORT int32_t carla_get_current_midi_program_index(CarlaHostHandle handle, uint pluginId);
869 * Get a plugin's default parameter value.
870 * @param pluginId Plugin
871 * @param parameterId Parameter index
873 CARLA_API_EXPORT float carla_get_default_parameter_value(CarlaHostHandle handle, uint pluginId, uint32_t parameterId);
876 * Get a plugin's current parameter value.
877 * @param pluginId Plugin
878 * @param parameterId Parameter index
880 CARLA_API_EXPORT float carla_get_current_parameter_value(CarlaHostHandle handle, uint pluginId, uint32_t parameterId);
883 * Get a plugin's internal parameter value.
884 * @param pluginId Plugin
885 * @param parameterId Parameter index, maybe be negative
886 * @see InternalParameterIndex
888 CARLA_API_EXPORT float carla_get_internal_parameter_value(CarlaHostHandle handle, uint pluginId, int32_t parameterId);
891 * Get a plugin's internal latency, in samples.
892 * @param pluginId Plugin
893 * @see InternalParameterIndex
895 CARLA_API_EXPORT uint32_t carla_get_plugin_latency(CarlaHostHandle handle, uint pluginId);
898 * Get a plugin's peak values.
899 * @param pluginId Plugin
901 CARLA_API_EXPORT const float* carla_get_peak_values(CarlaHostHandle handle, uint pluginId);
904 * Get a plugin's input peak value.
905 * @param pluginId Plugin
906 * @param isLeft Wherever to get the left/mono value, otherwise right.
908 CARLA_API_EXPORT float carla_get_input_peak_value(CarlaHostHandle handle, uint pluginId, bool isLeft);
911 * Get a plugin's output peak value.
912 * @param pluginId Plugin
913 * @param isLeft Wherever to get the left/mono value, otherwise right.
915 CARLA_API_EXPORT float carla_get_output_peak_value(CarlaHostHandle handle, uint pluginId, bool isLeft);
918 * Render a plugin's inline display.
919 * @param pluginId Plugin
921 CARLA_API_EXPORT const CarlaInlineDisplayImageSurface* carla_render_inline_display(CarlaHostHandle handle,
922 uint pluginId,
923 uint32_t width,
924 uint32_t height);
927 * Enable or disable a plugin.
928 * @param pluginId Plugin
929 * @param onOff New active state
931 CARLA_API_EXPORT void carla_set_active(CarlaHostHandle handle, uint pluginId, bool onOff);
933 #ifndef BUILD_BRIDGE
935 * Change a plugin's internal dry/wet.
936 * @param pluginId Plugin
937 * @param value New dry/wet value
939 CARLA_API_EXPORT void carla_set_drywet(CarlaHostHandle handle, uint pluginId, float value);
942 * Change a plugin's internal volume.
943 * @param pluginId Plugin
944 * @param value New volume
946 CARLA_API_EXPORT void carla_set_volume(CarlaHostHandle handle, uint pluginId, float value);
949 * Change a plugin's internal stereo balance, left channel.
950 * @param pluginId Plugin
951 * @param value New value
953 CARLA_API_EXPORT void carla_set_balance_left(CarlaHostHandle handle, uint pluginId, float value);
956 * Change a plugin's internal stereo balance, right channel.
957 * @param pluginId Plugin
958 * @param value New value
960 CARLA_API_EXPORT void carla_set_balance_right(CarlaHostHandle handle, uint pluginId, float value);
963 * Change a plugin's internal mono panning value.
964 * @param pluginId Plugin
965 * @param value New value
967 CARLA_API_EXPORT void carla_set_panning(CarlaHostHandle handle, uint pluginId, float value);
970 * Change a plugin's internal control channel.
971 * @param pluginId Plugin
972 * @param channel New channel
974 CARLA_API_EXPORT void carla_set_ctrl_channel(CarlaHostHandle handle, uint pluginId, int8_t channel);
975 #endif
978 * Enable a plugin's option.
979 * @param pluginId Plugin
980 * @param option An option from PluginOptions
981 * @param yesNo New enabled state
983 CARLA_API_EXPORT void carla_set_option(CarlaHostHandle handle, uint pluginId, uint option, bool yesNo);
986 * Change a plugin's parameter value.
987 * @param pluginId Plugin
988 * @param parameterId Parameter index
989 * @param value New value
991 CARLA_API_EXPORT void carla_set_parameter_value(CarlaHostHandle handle, uint pluginId, uint32_t parameterId, float value);
993 #ifndef BUILD_BRIDGE
995 * Change a plugin's parameter MIDI channel.
996 * @param pluginId Plugin
997 * @param parameterId Parameter index
998 * @param channel New MIDI channel
1000 CARLA_API_EXPORT void carla_set_parameter_midi_channel(CarlaHostHandle handle,
1001 uint pluginId, uint32_t parameterId, uint8_t channel);
1004 * Change a plugin's parameter mapped control index.
1005 * @param pluginId Plugin
1006 * @param parameterId Parameter index
1007 * @param cc New control index
1009 CARLA_API_EXPORT void carla_set_parameter_mapped_control_index(CarlaHostHandle handle,
1010 uint pluginId, uint32_t parameterId, int16_t index);
1013 * Change a plugin's parameter mapped range.
1014 * @param pluginId Plugin
1015 * @param parameterId Parameter index
1016 * @param minimum New mapped minimum
1017 * @param maximum New mapped maximum
1019 CARLA_API_EXPORT void carla_set_parameter_mapped_range(CarlaHostHandle handle,
1020 uint pluginId, uint32_t parameterId, float minimum, float maximum);
1023 * Change a plugin's parameter in drag/touch mode state.
1024 * Usually happens from a UI when the user is moving a parameter with a mouse or similar input.
1025 * @param pluginId Plugin
1026 * @param parameterId Parameter index
1027 * @param touch New state
1029 CARLA_API_EXPORT void carla_set_parameter_touch(CarlaHostHandle handle,
1030 uint pluginId, uint32_t parameterId, bool touch);
1031 #endif
1034 * Change a plugin's current program.
1035 * @param pluginId Plugin
1036 * @param programId New program
1038 CARLA_API_EXPORT void carla_set_program(CarlaHostHandle handle, uint pluginId, uint32_t programId);
1041 * Change a plugin's current MIDI program.
1042 * @param pluginId Plugin
1043 * @param midiProgramId New value
1045 CARLA_API_EXPORT void carla_set_midi_program(CarlaHostHandle handle, uint pluginId, uint32_t midiProgramId);
1048 * Set a plugin's custom data set.
1049 * @param pluginId Plugin
1050 * @param type Type
1051 * @param key Key
1052 * @param value New value
1053 * @see CustomDataTypes and CustomDataKeys
1055 CARLA_API_EXPORT void carla_set_custom_data(CarlaHostHandle handle,
1056 uint pluginId, const char* type, const char* key, const char* value);
1059 * Set a plugin's chunk data.
1060 * @param pluginId Plugin
1061 * @param chunkData New chunk data
1062 * @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
1064 CARLA_API_EXPORT void carla_set_chunk_data(CarlaHostHandle handle, uint pluginId, const char* chunkData);
1067 * Tell a plugin to prepare for save.
1068 * This should be called before saving custom data sets.
1069 * @param pluginId Plugin
1071 CARLA_API_EXPORT void carla_prepare_for_save(CarlaHostHandle handle, uint pluginId);
1074 * Reset all plugin's parameters.
1075 * @param pluginId Plugin
1077 CARLA_API_EXPORT void carla_reset_parameters(CarlaHostHandle handle, uint pluginId);
1080 * Randomize all plugin's parameters.
1081 * @param pluginId Plugin
1083 CARLA_API_EXPORT void carla_randomize_parameters(CarlaHostHandle handle, uint pluginId);
1085 #ifndef BUILD_BRIDGE
1087 * Send a single note of a plugin.
1088 * If velocity is 0, note-off is sent; note-on otherwise.
1089 * @param pluginId Plugin
1090 * @param channel Note channel
1091 * @param note Note pitch
1092 * @param velocity Note velocity
1094 CARLA_API_EXPORT void carla_send_midi_note(CarlaHostHandle handle,
1095 uint pluginId, uint8_t channel, uint8_t note, uint8_t velocity);
1096 #endif
1099 * Set a custom title for the plugin UI window created by Carla.
1101 CARLA_API_EXPORT void carla_set_custom_ui_title(CarlaHostHandle handle, uint pluginId, const char* title);
1104 * Tell a plugin to show its own custom UI.
1105 * @param pluginId Plugin
1106 * @param yesNo New UI state, visible or not
1107 * @see PLUGIN_HAS_CUSTOM_UI
1109 CARLA_API_EXPORT void carla_show_custom_ui(CarlaHostHandle handle, uint pluginId, bool yesNo);
1112 * Embed the plugin's custom UI to the system pointer @a ptr.
1113 * This function is always called from the main thread.
1114 * @note This is very experimental and subject to change at this point
1116 CARLA_API_EXPORT void* carla_embed_custom_ui(CarlaHostHandle handle, uint pluginId, void* ptr);
1119 * Get the current engine buffer size.
1121 CARLA_API_EXPORT uint32_t carla_get_buffer_size(CarlaHostHandle handle);
1124 * Get the current engine sample rate.
1126 CARLA_API_EXPORT double carla_get_sample_rate(CarlaHostHandle handle);
1129 * Get the last error.
1131 CARLA_API_EXPORT const char* carla_get_last_error(CarlaHostHandle handle);
1134 * Get the current engine OSC URL (TCP).
1136 CARLA_API_EXPORT const char* carla_get_host_osc_url_tcp(CarlaHostHandle handle);
1139 * Get the current engine OSC URL (UDP).
1141 CARLA_API_EXPORT const char* carla_get_host_osc_url_udp(CarlaHostHandle handle);
1144 * Initialize NSM (that is, announce ourselves to it).
1145 * Must be called as early as possible in the program's lifecycle.
1146 * Returns true if NSM is available and initialized correctly.
1148 CARLA_API_EXPORT bool carla_nsm_init(CarlaHostHandle handle, uint64_t pid, const char* executableName);
1151 * Respond to an NSM callback.
1153 CARLA_API_EXPORT void carla_nsm_ready(CarlaHostHandle handle, NsmCallbackOpcode opcode);
1155 #ifndef CARLA_UTILS_H_INCLUDED
1157 * Get the complete license text of used third-party code and features.
1158 * Returned string is in basic html format.
1160 CARLA_API_EXPORT const char* carla_get_complete_license_text(void);
1163 * Get the list of supported file extensions in carla_load_file().
1165 CARLA_API_EXPORT const char* const* carla_get_supported_file_extensions(void);
1168 * Get the list of supported features in the current Carla build.
1170 CARLA_API_EXPORT const char* const* carla_get_supported_features(void);
1173 * Get the absolute filename of this carla library.
1175 CARLA_API_EXPORT const char* carla_get_library_filename(void);
1178 * Get the folder where this carla library resides.
1180 CARLA_API_EXPORT const char* carla_get_library_folder(void);
1181 #endif
1183 /** @} */
1185 #endif /* CARLA_HOST_H_INCLUDED */