|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556 |
- /*
- * Carla Plugin Host
- * Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * For a full copy of the GNU General Public License see the doc/GPL.txt file.
- */
-
- #ifndef CARLA_BACKEND_H_INCLUDED
- #define CARLA_BACKEND_H_INCLUDED
-
- #include "CarlaDefines.h"
-
- #ifdef CARLA_PROPER_CPP11_SUPPORT
- # include <cstdint>
- #else
- # include <stdint.h>
- #endif
-
- #define STR_MAX 0xFF
-
- #ifdef __cplusplus
- # define CARLA_BACKEND_START_NAMESPACE namespace CarlaBackend {
- # define CARLA_BACKEND_END_NAMESPACE }
- # define CARLA_BACKEND_USE_NAMESPACE using namespace CarlaBackend;
- # include <algorithm>
- # include <cmath>
- # include <limits>
- /* Start namespace */
- CARLA_BACKEND_START_NAMESPACE
- #endif
-
- /*!
- * @defgroup CarlaBackendAPI Carla Backend API
- *
- * The Carla Backend API.
- *
- * These are the base definitions for everything in the Carla backend code.
- * @{
- */
-
- /* ------------------------------------------------------------------------------------------------------------
- * Carla Backend API (base definitions) */
-
- /*!
- * Maximum default number of loadable plugins.
- */
- static const uint MAX_DEFAULT_PLUGINS = 99;
-
- /*!
- * Maximum number of loadable plugins in rack mode.
- */
- static const uint MAX_RACK_PLUGINS = 16;
-
- /*!
- * Maximum number of loadable plugins in patchbay mode.
- */
- static const uint MAX_PATCHBAY_PLUGINS = 255;
-
- /*!
- * Maximum default number of parameters allowed.
- * @see ENGINE_OPTION_MAX_PARAMETERS
- */
- static const uint MAX_DEFAULT_PARAMETERS = 200;
-
- /*!
- * The "plugin Id" for the global Carla instance.
- * Curently only used for audio peaks.
- */
- static const uint MAIN_CARLA_PLUGIN_ID = 0xFFFF;
-
- /* ------------------------------------------------------------------------------------------------------------
- * Engine Driver Device Hints */
-
- /*!
- * @defgroup EngineDriverHints Engine Driver Device Hints
- *
- * Various engine driver device hints.
- * @see CarlaEngine::getHints(), CarlaEngine::getDriverDeviceInfo() and carla_get_engine_driver_device_info()
- * @{
- */
-
- /*!
- * Engine driver device has custom control-panel.
- */
- static const uint ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1;
-
- /*!
- * Engine driver device can use a triple-buffer (3 number of periods instead of the usual 2).
- * @see ENGINE_OPTION_AUDIO_NUM_PERIODS
- */
- static const uint ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2;
-
- /*!
- * Engine driver device can change buffer-size on the fly.
- * @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
- */
- static const uint ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4;
-
- /*!
- * Engine driver device can change sample-rate on the fly.
- * @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
- */
- static const uint ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8;
-
- /** @} */
-
- /* ------------------------------------------------------------------------------------------------------------
- * Plugin Hints */
-
- /*!
- * @defgroup PluginHints Plugin Hints
- *
- * Various plugin hints.
- * @see CarlaPlugin::getHints() and carla_get_plugin_info()
- * @{
- */
-
- /*!
- * Plugin is a bridge.
- * This hint is required because "bridge" itself is not a plugin type.
- */
- static const uint PLUGIN_IS_BRIDGE = 0x001;
-
- /*!
- * Plugin is hard real-time safe.
- */
- static const uint PLUGIN_IS_RTSAFE = 0x002;
-
- /*!
- * Plugin is a synth (produces sound).
- */
- static const uint PLUGIN_IS_SYNTH = 0x004;
-
- /*!
- * Plugin has its own custom UI.
- * @see CarlaPlugin::showCustomUI() and carla_show_custom_ui()
- */
- static const uint PLUGIN_HAS_CUSTOM_UI = 0x008;
-
- /*!
- * Plugin can use internal Dry/Wet control.
- */
- static const uint PLUGIN_CAN_DRYWET = 0x010;
-
- /*!
- * Plugin can use internal Volume control.
- */
- static const uint PLUGIN_CAN_VOLUME = 0x020;
-
- /*!
- * Plugin can use internal (Stereo) Balance controls.
- */
- static const uint PLUGIN_CAN_BALANCE = 0x040;
-
- /*!
- * Plugin can use internal (Mono) Panning control.
- */
- static const uint PLUGIN_CAN_PANNING = 0x080;
-
- /*!
- * Plugin needs a constant, fixed-size audio buffer.
- */
- static const uint PLUGIN_NEEDS_FIXED_BUFFERS = 0x100;
-
- /*!
- * Plugin needs to receive all UI events in the main thread.
- */
- static const uint PLUGIN_NEEDS_UI_MAIN_THREAD = 0x200;
-
- /*!
- * Plugin uses 1 program per MIDI channel.
- * @note: Only used in some internal plugins and sf2 files.
- */
- static const uint PLUGIN_USES_MULTI_PROGS = 0x400;
-
- /*!
- * Plugin can make use of inline display API.
- */
- static const uint PLUGIN_HAS_INLINE_DISPLAY = 0x800;
-
- /** @} */
-
- /* ------------------------------------------------------------------------------------------------------------
- * Plugin Options */
-
- /*!
- * @defgroup PluginOptions Plugin Options
- *
- * Various plugin options.
- * @see CarlaPlugin::getOptionsAvailable(), CarlaPlugin::getOptionsEnabled(), carla_get_plugin_info() and carla_set_option()
- * @{
- */
-
- /*!
- * Use constant/fixed-size audio buffers.
- */
- static const uint PLUGIN_OPTION_FIXED_BUFFERS = 0x001;
-
- /*!
- * Force mono plugin as stereo.
- */
- static const uint PLUGIN_OPTION_FORCE_STEREO = 0x002;
-
- /*!
- * Map MIDI programs to plugin programs.
- */
- static const uint PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004;
-
- /*!
- * Use chunks to save and restore data instead of parameter values.
- */
- static const uint PLUGIN_OPTION_USE_CHUNKS = 0x008;
-
- /*!
- * Send MIDI control change events.
- */
- static const uint PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010;
-
- /*!
- * Send MIDI channel pressure events.
- */
- static const uint PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020;
-
- /*!
- * Send MIDI note after-touch events.
- */
- static const uint PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040;
-
- /*!
- * Send MIDI pitch-bend events.
- */
- static const uint PLUGIN_OPTION_SEND_PITCHBEND = 0x080;
-
- /*!
- * Send MIDI all-sounds/notes-off events, single note-offs otherwise.
- */
- static const uint PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100;
-
- /*!
- * Send MIDI bank/program changes.
- * @note: This option conflicts with PLUGIN_OPTION_MAP_PROGRAM_CHANGES and cannot be used at the same time.
- */
- static const uint PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200;
-
- /** @} */
-
- /* ------------------------------------------------------------------------------------------------------------
- * Parameter Hints */
-
- /*!
- * @defgroup ParameterHints Parameter Hints
- *
- * Various parameter hints.
- * @see CarlaPlugin::getParameterData() and carla_get_parameter_data()
- * @{
- */
-
- /*!
- * Parameter value is boolean.
- * It's always at either minimum or maximum value.
- */
- static const uint PARAMETER_IS_BOOLEAN = 0x001;
-
- /*!
- * Parameter value is integer.
- */
- static const uint PARAMETER_IS_INTEGER = 0x002;
-
- /*!
- * Parameter value is logarithmic.
- */
- static const uint PARAMETER_IS_LOGARITHMIC = 0x004;
-
- /*!
- * Parameter is enabled.
- * It can be viewed, changed and stored.
- */
- static const uint PARAMETER_IS_ENABLED = 0x010;
-
- /*!
- * Parameter is automable (real-time safe).
- */
- static const uint PARAMETER_IS_AUTOMABLE = 0x020;
-
- /*!
- * Parameter is read-only.
- * It cannot be changed.
- */
- static const uint PARAMETER_IS_READ_ONLY = 0x040;
-
- /*!
- * Parameter needs sample rate to work.
- * Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
- */
- static const uint PARAMETER_USES_SAMPLERATE = 0x100;
-
- /*!
- * Parameter uses scale points to define internal values in a meaningful way.
- */
- static const uint PARAMETER_USES_SCALEPOINTS = 0x200;
-
- /*!
- * Parameter uses custom text for displaying its value.
- * @see CarlaPlugin::getParameterText() and carla_get_parameter_text()
- */
- static const uint PARAMETER_USES_CUSTOM_TEXT = 0x400;
-
- /** @} */
-
- /* ------------------------------------------------------------------------------------------------------------
- * Patchbay Port Hints */
-
- /*!
- * @defgroup PatchbayPortHints Patchbay Port Hints
- *
- * Various patchbay port hints.
- * @{
- */
-
- /*!
- * Patchbay port is input.
- * When this hint is not set, port is assumed to be output.
- */
- static const uint PATCHBAY_PORT_IS_INPUT = 0x01;
-
- /*!
- * Patchbay port is of Audio type.
- */
- static const uint PATCHBAY_PORT_TYPE_AUDIO = 0x02;
-
- /*!
- * Patchbay port is of CV type (Control Voltage).
- */
- static const uint PATCHBAY_PORT_TYPE_CV = 0x04;
-
- /*!
- * Patchbay port is of MIDI type.
- */
- static const uint PATCHBAY_PORT_TYPE_MIDI = 0x08;
-
- /*!
- * Patchbay port is of OSC type.
- */
- static const uint PATCHBAY_PORT_TYPE_OSC = 0x10;
-
- /** @} */
-
- /* ------------------------------------------------------------------------------------------------------------
- * Custom Data Types */
-
- /*!
- * @defgroup CustomDataTypes Custom Data Types
- *
- * These types define how the value in the CustomData struct is stored.
- * @see CustomData::type
- * @{
- */
-
- /*!
- * Boolean string type URI.
- * Only "true" and "false" are valid values.
- */
- static const char* const CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean";
-
- /*!
- * Chunk type URI.
- */
- static const char* const CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk";
-
- /*!
- * Property type URI.
- */
- static const char* const CUSTOM_DATA_TYPE_PROPERTY = "http://kxstudio.sf.net/ns/carla/property";
-
- /*!
- * String type URI.
- */
- static const char* const CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string";
-
- /** @} */
-
- /* ------------------------------------------------------------------------------------------------------------
- * Custom Data Keys */
-
- /*!
- * @defgroup CustomDataKeys Custom Data Keys
- *
- * Pre-defined keys used internally in Carla.
- * @see CustomData::key
- * @{
- */
-
- /*!
- * UI position key.
- */
- static const char* const CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition";
-
- /*!
- * UI size key.
- */
- static const char* const CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize";
-
- /*!
- * UI visible key.
- */
- static const char* const CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible";
-
- /** @} */
-
- /* ------------------------------------------------------------------------------------------------------------
- * Binary Type */
-
- /*!
- * The binary type of a plugin.
- */
- typedef enum {
- /*!
- * Null binary type.
- */
- BINARY_NONE = 0,
-
- /*!
- * POSIX 32bit binary.
- */
- BINARY_POSIX32 = 1,
-
- /*!
- * POSIX 64bit binary.
- */
- BINARY_POSIX64 = 2,
-
- /*!
- * Windows 32bit binary.
- */
- BINARY_WIN32 = 3,
-
- /*!
- * Windows 64bit binary.
- */
- BINARY_WIN64 = 4,
-
- /*!
- * Other binary type.
- */
- BINARY_OTHER = 5
-
- } BinaryType;
-
- /* ------------------------------------------------------------------------------------------------------------
- * Plugin Type */
-
- /*!
- * Plugin type.
- * Some files are handled as if they were plugins.
- */
- typedef enum {
- /*!
- * Null plugin type.
- */
- PLUGIN_NONE = 0,
-
- /*!
- * Internal plugin.
- */
- PLUGIN_INTERNAL = 1,
-
- /*!
- * LADSPA plugin.
- */
- PLUGIN_LADSPA = 2,
-
- /*!
- * DSSI plugin.
- */
- PLUGIN_DSSI = 3,
-
- /*!
- * LV2 plugin.
- */
- PLUGIN_LV2 = 4,
-
- /*!
- * VST2 plugin.
- */
- PLUGIN_VST2 = 5,
-
- /*!
- * SF2 file (SoundFont).
- */
- PLUGIN_SF2 = 6,
-
- /*!
- * SFZ file.
- */
- PLUGIN_SFZ = 7,
-
- /*!
- * JACK application.
- */
- PLUGIN_JACK = 8
-
- } PluginType;
-
- /* ------------------------------------------------------------------------------------------------------------
- * Plugin Category */
-
- /*!
- * Plugin category, which describes the functionality of a plugin.
- */
- typedef enum {
- /*!
- * Null plugin category.
- */
- PLUGIN_CATEGORY_NONE = 0,
-
- /*!
- * A synthesizer or generator.
- */
- PLUGIN_CATEGORY_SYNTH = 1,
-
- /*!
- * A delay or reverb.
- */
- PLUGIN_CATEGORY_DELAY = 2,
-
- /*!
- * An equalizer.
- */
- PLUGIN_CATEGORY_EQ = 3,
-
- /*!
- * A filter.
- */
- PLUGIN_CATEGORY_FILTER = 4,
-
- /*!
- * A distortion plugin.
- */
- PLUGIN_CATEGORY_DISTORTION = 5,
-
- /*!
- * A 'dynamic' plugin (amplifier, compressor, gate, etc).
- */
- PLUGIN_CATEGORY_DYNAMICS = 6,
-
- /*!
- * A 'modulator' plugin (chorus, flanger, phaser, etc).
- */
- PLUGIN_CATEGORY_MODULATOR = 7,
-
- /*!
- * An 'utility' plugin (analyzer, converter, mixer, etc).
- */
- PLUGIN_CATEGORY_UTILITY = 8,
-
- /*!
- * Miscellaneous plugin (used to check if the plugin has a category).
- */
- PLUGIN_CATEGORY_OTHER = 9
-
- } PluginCategory;
-
- /* ------------------------------------------------------------------------------------------------------------
- * Parameter Type */
-
- /*!
- * Plugin parameter type.
- */
- typedef enum {
- /*!
- * Null parameter type.
- */
- PARAMETER_UNKNOWN = 0,
-
- /*!
- * Input parameter.
- */
- PARAMETER_INPUT = 1,
-
- /*!
- * Ouput parameter.
- */
- PARAMETER_OUTPUT = 2
-
- } ParameterType;
-
- /* ------------------------------------------------------------------------------------------------------------
- * Internal Parameter Index */
-
- /*!
- * Special parameters used internally in Carla.
- * Plugins do not know about their existence.
- */
- typedef enum {
- /*!
- * Null parameter.
- */
- PARAMETER_NULL = -1,
-
- #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
- /*!
- * Active parameter, boolean type.
- * Default is 'false'.
- */
- PARAMETER_ACTIVE = -2,
-
- /*!
- * Dry/Wet parameter.
- * Range 0.0...1.0; default is 1.0.
- */
- PARAMETER_DRYWET = -3,
-
- /*!
- * Volume parameter.
- * Range 0.0...1.27; default is 1.0.
- */
- PARAMETER_VOLUME = -4,
-
- /*!
- * Stereo Balance-Left parameter.
- * Range -1.0...1.0; default is -1.0.
- */
- PARAMETER_BALANCE_LEFT = -5,
-
- /*!
- * Stereo Balance-Right parameter.
- * Range -1.0...1.0; default is 1.0.
- */
- PARAMETER_BALANCE_RIGHT = -6,
-
- /*!
- * Mono Panning parameter.
- * Range -1.0...1.0; default is 0.0.
- */
- PARAMETER_PANNING = -7,
-
- /*!
- * MIDI Control channel, integer type.
- * Range -1...15 (-1 = off).
- */
- PARAMETER_CTRL_CHANNEL = -8,
- #endif
-
- /*!
- * Max value, defined only for convenience.
- */
- PARAMETER_MAX = -9
-
- } InternalParameterIndex;
-
- /* ------------------------------------------------------------------------------------------------------------
- * Engine Callback Opcode */
-
- /*!
- * Engine callback opcodes.
- * Front-ends must never block indefinitely during a callback.
- * @see EngineCallbackFunc, CarlaEngine::setCallback() and carla_set_engine_callback()
- */
- typedef enum {
- /*!
- * Debug.
- * This opcode is undefined and used only for testing purposes.
- */
- ENGINE_CALLBACK_DEBUG = 0,
-
- /*!
- * A plugin has been added.
- * @a pluginId Plugin Id
- * @a valueStr Plugin name
- */
- ENGINE_CALLBACK_PLUGIN_ADDED = 1,
-
- /*!
- * A plugin has been removed.
- * @a pluginId Plugin Id
- */
- ENGINE_CALLBACK_PLUGIN_REMOVED = 2,
-
- /*!
- * A plugin has been renamed.
- * @a pluginId Plugin Id
- * @a valueStr New plugin name
- */
- ENGINE_CALLBACK_PLUGIN_RENAMED = 3,
-
- /*!
- * A plugin has become unavailable.
- * @a pluginId Plugin Id
- * @a valueStr Related error string
- */
- ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4,
-
- /*!
- * A parameter value has changed.
- * @a pluginId Plugin Id
- * @a value1 Parameter index
- * @a value3 New parameter value
- */
- ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5,
-
- /*!
- * A parameter default has changed.
- * @a pluginId Plugin Id
- * @a value1 Parameter index
- * @a value3 New default value
- */
- ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6,
-
- #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
- /*!
- * A parameter's MIDI CC has changed.
- * @a pluginId Plugin Id
- * @a value1 Parameter index
- * @a value2 New MIDI CC
- */
- ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED = 7,
-
- /*!
- * A parameter's MIDI channel has changed.
- * @a pluginId Plugin Id
- * @a value1 Parameter index
- * @a value2 New MIDI channel
- */
- ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8,
-
- /*!
- * A plugin option has changed.
- * @a pluginId Plugin Id
- * @a value1 Option
- * @a value2 New on/off state (1 for on, 0 for off)
- * @see PluginOptions
- */
- ENGINE_CALLBACK_OPTION_CHANGED = 9,
- #endif
-
- /*!
- * The current program of a plugin has changed.
- * @a pluginId Plugin Id
- * @a value1 New program index
- */
- ENGINE_CALLBACK_PROGRAM_CHANGED = 10,
-
- /*!
- * The current MIDI program of a plugin has changed.
- * @a pluginId Plugin Id
- * @a value1 New MIDI program index
- */
- ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11,
-
- /*!
- * A plugin's custom UI state has changed.
- * @a pluginId Plugin Id
- * @a value1 New state, as follows:
- * 0: UI is now hidden
- * 1: UI is now visible
- * -1: UI has crashed and should not be shown again
- */
- ENGINE_CALLBACK_UI_STATE_CHANGED = 12,
-
- /*!
- * A note has been pressed.
- * @a pluginId Plugin Id
- * @a value1 Channel
- * @a value2 Note
- * @a value3 Velocity
- */
- ENGINE_CALLBACK_NOTE_ON = 13,
-
- /*!
- * A note has been released.
- * @a pluginId Plugin Id
- * @a value1 Channel
- * @a value2 Note
- */
- ENGINE_CALLBACK_NOTE_OFF = 14,
-
- /*!
- * A plugin needs update.
- * @a pluginId Plugin Id
- */
- ENGINE_CALLBACK_UPDATE = 15,
-
- /*!
- * A plugin's data/information has changed.
- * @a pluginId Plugin Id
- */
- ENGINE_CALLBACK_RELOAD_INFO = 16,
-
- /*!
- * A plugin's parameters have changed.
- * @a pluginId Plugin Id
- */
- ENGINE_CALLBACK_RELOAD_PARAMETERS = 17,
-
- /*!
- * A plugin's programs have changed.
- * @a pluginId Plugin Id
- */
- ENGINE_CALLBACK_RELOAD_PROGRAMS = 18,
-
- /*!
- * A plugin state has changed.
- * @a pluginId Plugin Id
- */
- ENGINE_CALLBACK_RELOAD_ALL = 19,
-
- #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH
- /*!
- * A patchbay client has been added.
- * @a pluginId Client Id
- * @a value1 Client icon
- * @a value2 Plugin Id (-1 if not a plugin)
- * @a valueStr Client name
- * @see PatchbayIcon
- */
- ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 20,
-
- /*!
- * A patchbay client has been removed.
- * @a pluginId Client Id
- */
- ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 21,
-
- /*!
- * A patchbay client has been renamed.
- * @a pluginId Client Id
- * @a valueStr New client name
- */
- ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 22,
-
- /*!
- * A patchbay client data has changed.
- * @a pluginId Client Id
- * @a value1 New icon
- * @a value2 New plugin Id (-1 if not a plugin)
- * @see PatchbayIcon
- */
- ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23,
-
- /*!
- * A patchbay port has been added.
- * @a pluginId Client Id
- * @a value1 Port Id
- * @a value2 Port hints
- * @a valueStr Port name
- * @see PatchbayPortHints
- */
- ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24,
-
- /*!
- * A patchbay port has been removed.
- * @a pluginId Client Id
- * @a value1 Port Id
- */
- ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25,
-
- /*!
- * A patchbay port has been renamed.
- * @a pluginId Client Id
- * @a value1 Port Id
- * @a valueStr New port name
- */
- ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED = 26,
-
- /*!
- * A patchbay connection has been added.
- * @a pluginId Connection Id
- * @a valueStr Out group and port plus in group and port, in "og:op:ig:ip" syntax.
- */
- ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 27,
-
- /*!
- * A patchbay connection has been removed.
- * @a pluginId Connection Id
- */
- ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28,
- #endif
-
- /*!
- * Engine started.
- * @a value1 Process mode
- * @a value2 Transport mode
- * @a value3 Sample rate
- * @a valuestr Engine driver
- * @see EngineProcessMode
- * @see EngineTransportMode
- */
- ENGINE_CALLBACK_ENGINE_STARTED = 29,
-
- /*!
- * Engine stopped.
- */
- ENGINE_CALLBACK_ENGINE_STOPPED = 30,
-
- /*!
- * Engine process mode has changed.
- * @a value1 New process mode
- * @see EngineProcessMode
- */
- ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 31,
-
- /*!
- * Engine transport mode has changed.
- * @a value1 New transport mode
- * @see EngineTransportMode
- */
- ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32,
-
- /*!
- * Engine buffer-size changed.
- * @a value1 New buffer size
- */
- ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33,
-
- /*!
- * Engine sample-rate changed.
- * @a value3 New sample rate
- */
- ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34,
-
- /*!
- * Project has finished loading.
- */
- ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 35,
-
- /*!
- * NSM callback.
- * (Work in progress, values are not defined yet)
- */
- ENGINE_CALLBACK_NSM = 36,
-
- /*!
- * Idle frontend.
- * This is used by the engine during long operations that might block the frontend,
- * giving it the possibility to idle while the operation is still in place.
- */
- ENGINE_CALLBACK_IDLE = 37,
-
- /*!
- * Show a message as information.
- * @a valueStr The message
- */
- ENGINE_CALLBACK_INFO = 38,
-
- /*!
- * Show a message as an error.
- * @a valueStr The message
- */
- ENGINE_CALLBACK_ERROR = 39,
-
- /*!
- * The engine has crashed or malfunctioned and will no longer work.
- */
- ENGINE_CALLBACK_QUIT = 40
-
- } EngineCallbackOpcode;
-
- /* ------------------------------------------------------------------------------------------------------------
- * Engine Option */
-
- /*!
- * Engine options.
- * @see CarlaEngine::getOptions(), CarlaEngine::setOption() and carla_set_engine_option()
- */
- typedef enum {
- /*!
- * Debug.
- * This option is undefined and used only for testing purposes.
- */
- ENGINE_OPTION_DEBUG = 0,
-
- /*!
- * Set the engine processing mode.
- * Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_PATCHBAY for all other OSes.
- * @see EngineProcessMode
- */
- ENGINE_OPTION_PROCESS_MODE = 1,
-
- /*!
- * Set the engine transport mode.
- * Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
- * @see EngineTransportMode
- */
- ENGINE_OPTION_TRANSPORT_MODE = 2,
-
- /*!
- * Force mono plugins as stereo, by running 2 instances at the same time.
- * Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
- * @note Not supported by all plugins
- * @see PLUGIN_OPTION_FORCE_STEREO
- */
- ENGINE_OPTION_FORCE_STEREO = 3,
-
- /*!
- * Use plugin bridges whenever possible.
- * Default is no, EXPERIMENTAL.
- */
- ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4,
-
- /*!
- * Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
- * Default is yes.
- */
- ENGINE_OPTION_PREFER_UI_BRIDGES = 5,
-
- /*!
- * Make custom plugin UIs always-on-top.
- * Default is yes.
- */
- ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6,
-
- /*!
- * Maximum number of parameters allowed.
- * Default is MAX_DEFAULT_PARAMETERS.
- */
- ENGINE_OPTION_MAX_PARAMETERS = 7,
-
- /*!
- * Timeout value for how much to wait for UI bridges to respond, in milliseconds.
- * Default is 4000 (4 seconds).
- */
- ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8,
-
- /*!
- * Audio buffer size.
- * Default is 512.
- */
- ENGINE_OPTION_AUDIO_BUFFER_SIZE = 9,
-
- /*!
- * Audio sample rate.
- * Default is 44100.
- */
- ENGINE_OPTION_AUDIO_SAMPLE_RATE = 10,
-
- /*!
- * Wherever to use 3 audio periods instead of the default 2.
- * Default is false.
- */
- ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 11,
-
- /*!
- * Audio device (within a driver).
- * Default unset.
- */
- ENGINE_OPTION_AUDIO_DEVICE = 12,
-
- /*!
- * Set path used for a specific plugin type.
- * Uses value as the plugin format, valueStr as actual path.
- * @see PluginType
- */
- ENGINE_OPTION_PLUGIN_PATH = 13,
-
- /*!
- * Set path to the binary files.
- * Default unset.
- * @note Must be set for plugin and UI bridges to work
- */
- ENGINE_OPTION_PATH_BINARIES = 14,
-
- /*!
- * Set path to the resource files.
- * Default unset.
- * @note Must be set for some internal plugins to work
- */
- ENGINE_OPTION_PATH_RESOURCES = 15,
-
- /*!
- * Prevent bad plugin and UI behaviour.
- * @note: Linux only
- */
- ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 16,
-
- /*!
- * Set frontend winId, used to define as parent window for plugin UIs.
- */
- ENGINE_OPTION_FRONTEND_WIN_ID = 17,
-
- #if !defined(BUILD_BRIDGE_ALTERNATIVE_ARCH) && !defined(CARLA_OS_WIN)
- /*!
- * Set path to wine executable.
- */
- ENGINE_OPTION_WINE_EXECUTABLE = 18,
-
- /*!
- * Enable automatic wineprefix detection.
- */
- ENGINE_OPTION_WINE_AUTO_PREFIX = 19,
-
- /*!
- * Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
- */
- ENGINE_OPTION_WINE_FALLBACK_PREFIX = 20,
-
- /*!
- * Enable realtime priority for Wine application and server threads.
- */
- ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 21,
-
- /*!
- * Base realtime priority for Wine threads.
- */
- ENGINE_OPTION_WINE_BASE_RT_PRIO = 22,
-
- /*!
- * Wine server realtime priority.
- */
- ENGINE_OPTION_WINE_SERVER_RT_PRIO = 23,
- #endif
-
- /*!
- * Capture console output into debug callbacks.
- */
- ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 24
-
- } EngineOption;
-
- /* ------------------------------------------------------------------------------------------------------------
- * Engine Process Mode */
-
- /*!
- * Engine process mode.
- * @see ENGINE_OPTION_PROCESS_MODE
- */
- typedef enum {
- /*!
- * Single client mode.
- * Inputs and outputs are added dynamically as needed by plugins.
- */
- ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0,
-
- /*!
- * Multiple client mode.
- * It has 1 master client + 1 client per plugin.
- */
- ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1,
-
- /*!
- * Single client, 'rack' mode.
- * Processes plugins in order of Id, with forced stereo always on.
- */
- ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2,
-
- /*!
- * Single client, 'patchbay' mode.
- */
- ENGINE_PROCESS_MODE_PATCHBAY = 3,
-
- /*!
- * Special mode, used in plugin-bridges only.
- */
- ENGINE_PROCESS_MODE_BRIDGE = 4
-
- } EngineProcessMode;
-
- /* ------------------------------------------------------------------------------------------------------------
- * Engine Transport Mode */
-
- /*!
- * Engine transport mode.
- * @see ENGINE_OPTION_TRANSPORT_MODE
- */
- typedef enum {
- /*!
- * No transport.
- */
- ENGINE_TRANSPORT_MODE_DISABLED = 0,
-
- /*!
- * Internal transport mode.
- */
- ENGINE_TRANSPORT_MODE_INTERNAL = 1,
-
- /*!
- * Transport from JACK.
- * Only available if driver name is "JACK".
- */
- ENGINE_TRANSPORT_MODE_JACK = 2,
-
- /*!
- * Transport from host, used when Carla is a plugin.
- */
- ENGINE_TRANSPORT_MODE_PLUGIN = 3,
-
- /*!
- * Special mode, used in plugin-bridges only.
- */
- ENGINE_TRANSPORT_MODE_BRIDGE = 4
-
- } EngineTransportMode;
-
- /* ------------------------------------------------------------------------------------------------------------
- * File Callback Opcode */
-
- /*!
- * File callback opcodes.
- * Front-ends must always block-wait for user input.
- * @see FileCallbackFunc, CarlaEngine::setFileCallback() and carla_set_file_callback()
- */
- typedef enum {
- /*!
- * Debug.
- * This opcode is undefined and used only for testing purposes.
- */
- FILE_CALLBACK_DEBUG = 0,
-
- /*!
- * Open file or folder.
- */
- FILE_CALLBACK_OPEN = 1,
-
- /*!
- * Save file or folder.
- */
- FILE_CALLBACK_SAVE = 2
-
- } FileCallbackOpcode;
-
- /* ------------------------------------------------------------------------------------------------------------
- * Patchbay Icon */
-
- /*!
- * The icon of a patchbay client/group.
- */
- enum PatchbayIcon {
- /*!
- * Generic application icon.
- * Used for all non-plugin clients that don't have a specific icon.
- */
- PATCHBAY_ICON_APPLICATION = 0,
-
- /*!
- * Plugin icon.
- * Used for all plugin clients that don't have a specific icon.
- */
- PATCHBAY_ICON_PLUGIN = 1,
-
- /*!
- * Hardware icon.
- * Used for hardware (audio or MIDI) clients.
- */
- PATCHBAY_ICON_HARDWARE = 2,
-
- /*!
- * Carla icon.
- * Used for the main app.
- */
- PATCHBAY_ICON_CARLA = 3,
-
- /*!
- * DISTRHO icon.
- * Used for DISTRHO based plugins.
- */
- PATCHBAY_ICON_DISTRHO = 4,
-
- /*!
- * File icon.
- * Used for file type plugins (like SF2 snd SFZ).
- */
- PATCHBAY_ICON_FILE = 5
- };
-
- /* ------------------------------------------------------------------------------------------------------------
- * Carla Backend API (C stuff) */
-
- /*!
- * Engine callback function.
- * Front-ends must never block indefinitely during a callback.
- * @see EngineCallbackOpcode, CarlaEngine::setCallback() and carla_set_engine_callback()
- */
- typedef void (*EngineCallbackFunc)(void* ptr, EngineCallbackOpcode action, uint pluginId, int value1, int value2, float value3, const char* valueStr);
-
- /*!
- * File callback function.
- * @see FileCallbackOpcode
- */
- typedef const char* (*FileCallbackFunc)(void* ptr, FileCallbackOpcode action, bool isDir, const char* title, const char* filter);
-
- /*!
- * Parameter data.
- */
- typedef struct {
- /*!
- * This parameter type.
- */
- ParameterType type;
-
- /*!
- * This parameter hints.
- * @see ParameterHints
- */
- uint hints;
-
- /*!
- * Index as seen by Carla.
- */
- int32_t index;
-
- /*!
- * Real index as seen by plugins.
- */
- int32_t rindex;
-
- /*!
- * Currently mapped MIDI CC.
- * A value lower than 0 means invalid or unused.
- * Maximum allowed value is 119 (0x77).
- */
- int16_t midiCC;
-
- /*!
- * Currently mapped MIDI channel.
- * Counts from 0 to 15.
- */
- uint8_t midiChannel;
-
- } ParameterData;
-
- /*!
- * Parameter ranges.
- */
- typedef struct _ParameterRanges {
- /*!
- * Default value.
- */
- float def;
-
- /*!
- * Minimum value.
- */
- float min;
-
- /*!
- * Maximum value.
- */
- float max;
-
- /*!
- * Regular, single step value.
- */
- float step;
-
- /*!
- * Small step value.
- */
- float stepSmall;
-
- /*!
- * Large step value.
- */
- float stepLarge;
-
- #ifdef __cplusplus
- /*!
- * Fix the default value within range.
- */
- void fixDefault() noexcept
- {
- fixValue(def);
- }
-
- /*!
- * Fix a value within range.
- */
- void fixValue(float& value) const noexcept
- {
- if (value < min)
- value = min;
- else if (value > max)
- value = max;
- }
-
- /*!
- * Get a fixed value within range.
- */
- const float& getFixedValue(const float& value) const noexcept
- {
- if (value <= min)
- return min;
- if (value >= max)
- return max;
- return value;
- }
-
- /*!
- * Get a value normalized to 0.0<->1.0.
- */
- float getNormalizedValue(const float& value) const noexcept
- {
- const float normValue((value - min) / (max - min));
-
- if (normValue <= 0.0f)
- return 0.0f;
- if (normValue >= 1.0f)
- return 1.0f;
- return normValue;
- }
-
- /*!
- * Get a value normalized to 0.0<->1.0, fixed within range.
- */
- float getFixedAndNormalizedValue(const float& value) const noexcept
- {
- if (value <= min)
- return 0.0f;
- if (value >= max)
- return 1.0f;
-
- const float normValue((value - min) / (max - min));
-
- if (normValue <= 0.0f)
- return 0.0f;
- if (normValue >= 1.0f)
- return 1.0f;
-
- return normValue;
- }
-
- /*!
- * Get a proper value previously normalized to 0.0<->1.0.
- */
- float getUnnormalizedValue(const float& value) const noexcept
- {
- if (value <= 0.0f)
- return min;
- if (value >= 1.0f)
- return max;
-
- return value * (max - min) + min;
- }
-
- /*!
- * Get a logarithmic value previously normalized to 0.0<->1.0.
- */
- float getUnnormalizedLogValue(const float& value) const noexcept
- {
- if (value <= 0.0f)
- return min;
- if (value >= 1.0f)
- return max;
-
- float rmin = min;
-
- if (std::abs(min) < std::numeric_limits<float>::epsilon())
- rmin = 0.00001f;
-
- return rmin * std::pow(max/rmin, value);
- }
- #endif /* __cplusplus */
-
- } ParameterRanges;
-
- /*!
- * MIDI Program data.
- */
- typedef struct {
- /*!
- * MIDI bank.
- */
- uint32_t bank;
-
- /*!
- * MIDI program.
- */
- uint32_t program;
-
- /*!
- * MIDI program name.
- */
- const char* name;
-
- } MidiProgramData;
-
- /*!
- * Custom data, used for saving key:value 'dictionaries'.
- */
- typedef struct {
- /*!
- * Value type, in URI form.
- * @see CustomDataTypes
- */
- const char* type;
-
- /*!
- * Key.
- * @see CustomDataKeys
- */
- const char* key;
-
- /*!
- * Value.
- */
- const char* value;
-
- #ifdef __cplusplus
- /*!
- * Check if valid.
- */
- bool isValid() const noexcept
- {
- if (type == nullptr || type[0] == '\0') return false;
- if (key == nullptr || key [0] == '\0') return false;
- if (value == nullptr) return false;
- return true;
- }
- #endif /* __cplusplus */
-
- } CustomData;
-
- /*!
- * Engine driver device information.
- */
- typedef struct {
- /*!
- * This driver device hints.
- * @see EngineDriverHints
- */
- uint hints;
-
- /*!
- * Available buffer sizes.
- * Terminated with 0.
- */
- const uint32_t* bufferSizes;
-
- /*!
- * Available sample rates.
- * Terminated with 0.0.
- */
- const double* sampleRates;
-
- } EngineDriverDeviceInfo;
-
- /** @} */
-
- #ifdef __cplusplus
- /* Forward declarations of commonly used Carla classes */
- class CarlaEngine;
- class CarlaEngineClient;
- class CarlaPlugin;
- /* End namespace */
- CARLA_BACKEND_END_NAMESPACE
- #endif
-
- #endif /* CARLA_BACKEND_H_INCLUDED */
|