Cleanup
[carla.git] / source / frontend / carla_backend.py
blob9ff33e39ed00abb9e1850fc8f90b9c07c20a3e42
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
4 # Carla Backend code
5 # Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com>
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of
10 # the License, or any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # For a full copy of the GNU General Public License see the doc/GPL.txt file.
19 # ---------------------------------------------------------------------------------------------------------------------
20 # Imports (Global)
22 from abc import abstractmethod
23 from struct import pack
25 # ---------------------------------------------------------------------------------------------------------------------
26 # Imports (ctypes)
28 from ctypes import (
29 c_bool, c_char_p, c_double, c_float, c_int, c_long, c_longdouble, c_longlong, c_ubyte, c_uint, c_void_p,
30 c_int8, c_int16, c_int32, c_int64, c_uint8, c_uint16, c_uint32, c_uint64,
31 cast, Structure,
32 CDLL, CFUNCTYPE, RTLD_GLOBAL, RTLD_LOCAL, POINTER
35 # ------------------------------------------------------------------------------------------------------------
36 # Imports (Custom)
38 from common import (
39 kIs64bit, HAIKU, LINUX, MACOS, WINDOWS, VERSION
42 # ---------------------------------------------------------------------------------------------------------------------
43 # Define custom types
45 c_enum = c_int
46 c_uintptr = c_uint64 if kIs64bit else c_uint32
48 # ---------------------------------------------------------------------------------------------------------------------
49 # Convert a ctypes c_char_p into a python string
51 def charPtrToString(charPtr):
52 if not charPtr:
53 return ""
54 if isinstance(charPtr, str):
55 return charPtr
56 return charPtr.decode("utf-8", errors="ignore")
58 # ---------------------------------------------------------------------------------------------------------------------
59 # Convert a ctypes POINTER(c_char_p) into a python string list
61 def charPtrPtrToStringList(charPtrPtr):
62 if not charPtrPtr:
63 return []
65 i = 0
66 charPtr = charPtrPtr[0]
67 strList = []
69 while charPtr:
70 strList.append(charPtr.decode("utf-8", errors="ignore"))
72 i += 1
73 charPtr = charPtrPtr[i]
75 return strList
77 # ---------------------------------------------------------------------------------------------------------------------
78 # Convert a ctypes POINTER(c_<num>) into a python number list
80 def numPtrToList(numPtr):
81 if not numPtr:
82 return []
84 i = 0
85 num = numPtr[0] #.value
86 numList = []
88 while num not in (0, 0.0):
89 numList.append(num)
91 i += 1
92 num = numPtr[i] #.value
94 return numList
96 # ---------------------------------------------------------------------------------------------------------------------
97 # Convert a ctypes value into a python one
99 c_int_types = (c_int, c_int8, c_int16, c_int32, c_int64,
100 c_uint, c_uint8, c_uint16, c_uint32, c_uint64, c_long, c_longlong)
101 c_float_types = (c_float, c_double, c_longdouble)
102 c_intp_types = tuple(POINTER(i) for i in c_int_types)
103 c_floatp_types = tuple(POINTER(i) for i in c_float_types)
105 def toPythonType(value, attr):
106 if isinstance(value, (bool, int, float)):
107 return value
108 if isinstance(value, bytes):
109 return charPtrToString(value)
110 # pylint: disable=consider-merging-isinstance
111 if isinstance(value, c_intp_types) or isinstance(value, c_floatp_types):
112 return numPtrToList(value)
113 # pylint: enable=consider-merging-isinstance
114 if isinstance(value, POINTER(c_char_p)):
115 return charPtrPtrToStringList(value)
116 print("..............", attr, ".....................", value, ":", type(value))
117 return value
119 # ---------------------------------------------------------------------------------------------------------------------
120 # Convert a ctypes struct into a python dict
122 def structToDict(struct):
123 # pylint: disable=protected-access
124 return dict((attr, toPythonType(getattr(struct, attr), attr)) for attr, value in struct._fields_)
125 # pylint: enable=protected-access
127 # ---------------------------------------------------------------------------------------------------------------------
128 # Carla Backend API (base definitions)
130 # Maximum default number of loadable plugins.
131 MAX_DEFAULT_PLUGINS = 512
133 # Maximum number of loadable plugins in rack mode.
134 MAX_RACK_PLUGINS = 64
136 # Maximum number of loadable plugins in patchbay mode.
137 MAX_PATCHBAY_PLUGINS = 255
139 # Maximum default number of parameters allowed.
140 # @see ENGINE_OPTION_MAX_PARAMETERS
141 MAX_DEFAULT_PARAMETERS = 200
143 # The "plugin Id" for the global Carla instance.
144 # Currently only used for audio peaks.
145 MAIN_CARLA_PLUGIN_ID = 0xFFFF
147 # ---------------------------------------------------------------------------------------------------------------------
148 # Engine Driver Device Hints
149 # Various engine driver device hints.
150 # @see carla_get_engine_driver_device_info()
152 # Engine driver device has custom control-panel.
153 ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1
155 # Engine driver device can use a triple-buffer (3 number of periods instead of the usual 2).
156 # @see ENGINE_OPTION_AUDIO_NUM_PERIODS
157 ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2
159 # Engine driver device can change buffer-size on the fly.
160 # @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
161 ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4
163 # Engine driver device can change sample-rate on the fly.
164 # @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
165 ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8
167 # ---------------------------------------------------------------------------------------------------------------------
168 # Plugin Hints
169 # Various plugin hints.
170 # @see carla_get_plugin_info()
172 # Plugin is a bridge.
173 # This hint is required because "bridge" itself is not a plugin type.
174 PLUGIN_IS_BRIDGE = 0x001
176 # Plugin is hard real-time safe.
177 PLUGIN_IS_RTSAFE = 0x002
179 # Plugin is a synth (produces sound).
180 PLUGIN_IS_SYNTH = 0x004
182 # Plugin has its own custom UI.
183 # @see carla_show_custom_ui()
184 PLUGIN_HAS_CUSTOM_UI = 0x008
186 # Plugin can use internal Dry/Wet control.
187 PLUGIN_CAN_DRYWET = 0x010
189 # Plugin can use internal Volume control.
190 PLUGIN_CAN_VOLUME = 0x020
192 # Plugin can use internal (Stereo) Balance controls.
193 PLUGIN_CAN_BALANCE = 0x040
195 # Plugin can use internal (Mono) Panning control.
196 PLUGIN_CAN_PANNING = 0x080
198 # Plugin needs a constant, fixed-size audio buffer.
199 PLUGIN_NEEDS_FIXED_BUFFERS = 0x100
201 # Plugin needs to receive all UI events in the main thread.
202 PLUGIN_NEEDS_UI_MAIN_THREAD = 0x200
204 # Plugin uses 1 program per MIDI channel.
205 # @note: Only used in some internal plugins and sf2 files.
206 PLUGIN_USES_MULTI_PROGS = 0x400
208 # Plugin can make use of inline display API.
209 PLUGIN_HAS_INLINE_DISPLAY = 0x800
211 # ---------------------------------------------------------------------------------------------------------------------
212 # Plugin Options
213 # Various plugin options.
214 # @see carla_get_plugin_info() and carla_set_option()
216 # Use constant/fixed-size audio buffers.
217 PLUGIN_OPTION_FIXED_BUFFERS = 0x001
219 # Force mono plugin as stereo.
220 PLUGIN_OPTION_FORCE_STEREO = 0x002
222 # Map MIDI programs to plugin programs.
223 PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004
225 # Use chunks to save and restore data instead of parameter values.
226 PLUGIN_OPTION_USE_CHUNKS = 0x008
228 # Send MIDI control change events.
229 PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010
231 # Send MIDI channel pressure events.
232 PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020
234 # Send MIDI note after-touch events.
235 PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040
237 # Send MIDI pitch-bend events.
238 PLUGIN_OPTION_SEND_PITCHBEND = 0x080
240 # Send MIDI all-sounds/notes-off events, single note-offs otherwise.
241 PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100
243 # Send MIDI bank/program changes.
244 # @note: This option conflicts with PLUGIN_OPTION_MAP_PROGRAM_CHANGES and cannot be used at the same time.
245 PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200
247 # SSkip sending MIDI note events.
248 # This if off-by-default as a way to keep backwards compatibility.
249 # We always want notes enabled by default, not the contrary.
250 PLUGIN_OPTION_SKIP_SENDING_NOTES = 0x400
252 # Special flag to indicate that plugin options are not yet set.
253 # This flag exists because 0x0 as an option value is a valid one, so we need something else to indicate "null-ness".
254 PLUGIN_OPTIONS_NULL = 0x10000
256 # ---------------------------------------------------------------------------------------------------------------------
257 # Parameter Hints
258 # Various parameter hints.
259 # @see CarlaPlugin::getParameterData() and carla_get_parameter_data()
261 # Parameter value is boolean.
262 PARAMETER_IS_BOOLEAN = 0x001
264 # Parameter value is integer.
265 PARAMETER_IS_INTEGER = 0x002
267 # Parameter value is logarithmic.
268 PARAMETER_IS_LOGARITHMIC = 0x004
270 # Parameter is enabled.
271 # It can be viewed, changed and stored.
272 PARAMETER_IS_ENABLED = 0x010
274 # Parameter is automatable (real-time safe).
275 PARAMETER_IS_AUTOMATABLE = 0x020
277 # Parameter is read-only.
278 # It cannot be changed.
279 PARAMETER_IS_READ_ONLY = 0x040
281 # Parameter needs sample rate to work.
282 # Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
283 PARAMETER_USES_SAMPLERATE = 0x100
285 # Parameter uses scale points to define internal values in a meaningful way.
286 PARAMETER_USES_SCALEPOINTS = 0x200
288 # Parameter uses custom text for displaying its value.
289 # @see carla_get_parameter_text()
290 PARAMETER_USES_CUSTOM_TEXT = 0x400
292 # Parameter can be turned into a CV control.
293 PARAMETER_CAN_BE_CV_CONTROLLED = 0x800
295 # Parameter should not be saved as part of the project/session.
296 # @note only valid for parameter inputs.
297 PARAMETER_IS_NOT_SAVED = 0x1000
299 # ---------------------------------------------------------------------------------------------------------------------
300 # Mapped Parameter Flags
301 # Various flags for parameter mappings.
302 # @see ParameterData::mappedFlags
304 PARAMETER_MAPPING_MIDI_DELTA = 0x001
306 # ---------------------------------------------------------------------------------------------------------------------
307 # Patchbay Port Hints
308 # Various patchbay port hints.
310 # Patchbay port is input.
311 # When this hint is not set, port is assumed to be output.
312 PATCHBAY_PORT_IS_INPUT = 0x01
314 # Patchbay port is of Audio type.
315 PATCHBAY_PORT_TYPE_AUDIO = 0x02
317 # Patchbay port is of CV type (Control Voltage).
318 PATCHBAY_PORT_TYPE_CV = 0x04
320 # Patchbay port is of MIDI type.
321 PATCHBAY_PORT_TYPE_MIDI = 0x08
323 # Patchbay port is of OSC type.
324 PATCHBAY_PORT_TYPE_OSC = 0x10
326 # ---------------------------------------------------------------------------------------------------------------------
327 # Patchbay Port Group Hints
328 # Various patchbay port group hints.
330 # Indicates that this group should be considered the "main" input.
331 PATCHBAY_PORT_GROUP_MAIN_INPUT = 0x01
333 # Indicates that this group should be considered the "main" output.
334 PATCHBAY_PORT_GROUP_MAIN_OUTPUT = 0x02
336 # A stereo port group, where the 1st port is left and the 2nd is right.
337 PATCHBAY_PORT_GROUP_STEREO = 0x04
339 # A mid-side stereo group, where the 1st port is center and the 2nd is side.
340 PATCHBAY_PORT_GROUP_MID_SIDE = 0x08
342 # ---------------------------------------------------------------------------------------------------------------------
343 # Custom Data Types
344 # These types define how the value in the CustomData struct is stored.
345 # @see CustomData.type
347 # Boolean string type URI.
348 # Only "true" and "false" are valid values.
349 CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean"
351 # Chunk type URI.
352 CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"
354 # Property type URI.
355 CUSTOM_DATA_TYPE_PROPERTY = "http://kxstudio.sf.net/ns/carla/property"
357 # String type URI.
358 CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string"
360 # ---------------------------------------------------------------------------------------------------------------------
361 # Custom Data Keys
362 # Pre-defined keys used internally in Carla.
363 # @see CustomData.key
365 # Plugin options key.
366 CUSTOM_DATA_KEY_PLUGIN_OPTIONS = "CarlaPluginOptions"
368 # UI position key.
369 CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition"
371 # UI size key.
372 CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize"
374 # UI visible key.
375 CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible"
377 # ---------------------------------------------------------------------------------------------------------------------
378 # Binary Type
379 # The binary type of a plugin.
381 # Null binary type.
382 BINARY_NONE = 0
384 # POSIX 32bit binary.
385 BINARY_POSIX32 = 1
387 # POSIX 64bit binary.
388 BINARY_POSIX64 = 2
390 # Windows 32bit binary.
391 BINARY_WIN32 = 3
393 # Windows 64bit binary.
394 BINARY_WIN64 = 4
396 # Other binary type.
397 BINARY_OTHER = 5
399 # ---------------------------------------------------------------------------------------------------------------------
400 # File Type
401 # File type.
403 # Null file type.
404 FILE_NONE = 0
406 # Audio file.
407 FILE_AUDIO = 1
409 # MIDI file.
410 FILE_MIDI = 2
412 # ---------------------------------------------------------------------------------------------------------------------
413 # Plugin Type
414 # Plugin type.
415 # Some files are handled as if they were plugins.
417 # Null plugin type.
418 PLUGIN_NONE = 0
420 # Internal plugin.
421 PLUGIN_INTERNAL = 1
423 # LADSPA plugin.
424 PLUGIN_LADSPA = 2
426 # DSSI plugin.
427 PLUGIN_DSSI = 3
429 # LV2 plugin.
430 PLUGIN_LV2 = 4
432 # VST2 plugin.
433 PLUGIN_VST2 = 5
435 # VST3 plugin.
436 # @note Windows and MacOS only
437 PLUGIN_VST3 = 6
439 # AU plugin.
440 # @note MacOS only
441 PLUGIN_AU = 7
443 # DLS file.
444 PLUGIN_DLS = 8
446 # GIG file.
447 PLUGIN_GIG = 9
449 # SF2/3 file (SoundFont).
450 PLUGIN_SF2 = 10
452 # SFZ file.
453 PLUGIN_SFZ = 11
455 # JACK application.
456 PLUGIN_JACK = 12
458 # JSFX plugin.
459 PLUGIN_JSFX = 13
461 # CLAP plugin.
462 PLUGIN_CLAP = 14
464 # ---------------------------------------------------------------------------------------------------------------------
465 # Plugin Category
466 # Plugin category, which describes the functionality of a plugin.
468 # Null plugin category.
469 PLUGIN_CATEGORY_NONE = 0
471 # A synthesizer or generator.
472 PLUGIN_CATEGORY_SYNTH = 1
474 # A delay or reverb.
475 PLUGIN_CATEGORY_DELAY = 2
477 # An equalizer.
478 PLUGIN_CATEGORY_EQ = 3
480 # A filter.
481 PLUGIN_CATEGORY_FILTER = 4
483 # A distortion plugin.
484 PLUGIN_CATEGORY_DISTORTION = 5
486 # A 'dynamic' plugin (amplifier, compressor, gate, etc).
487 PLUGIN_CATEGORY_DYNAMICS = 6
489 # A 'modulator' plugin (chorus, flanger, phaser, etc).
490 PLUGIN_CATEGORY_MODULATOR = 7
492 # An 'utility' plugin (analyzer, converter, mixer, etc).
493 PLUGIN_CATEGORY_UTILITY = 8
495 # Miscellaneous plugin (used to check if the plugin has a category).
496 PLUGIN_CATEGORY_OTHER = 9
498 # ---------------------------------------------------------------------------------------------------------------------
499 # Parameter Type
500 # Plugin parameter type.
502 # Null parameter type.
503 PARAMETER_UNKNOWN = 0
505 # Input parameter.
506 PARAMETER_INPUT = 1
508 # Output parameter.
509 PARAMETER_OUTPUT = 2
511 # ---------------------------------------------------------------------------------------------------------------------
512 # Internal Parameter Index
513 # Special parameters used internally in Carla.
514 # Plugins do not know about their existence.
516 # Null parameter.
517 PARAMETER_NULL = -1
519 # Active parameter, boolean type.
520 # Default is 'false'.
521 PARAMETER_ACTIVE = -2
523 # Dry/Wet parameter.
524 # Range 0.0...1.0; default is 1.0.
525 PARAMETER_DRYWET = -3
527 # Volume parameter.
528 # Range 0.0...1.27; default is 1.0.
529 PARAMETER_VOLUME = -4
531 # Stereo Balance-Left parameter.
532 # Range -1.0...1.0; default is -1.0.
533 PARAMETER_BALANCE_LEFT = -5
535 # Stereo Balance-Right parameter.
536 # Range -1.0...1.0; default is 1.0.
537 PARAMETER_BALANCE_RIGHT = -6
539 # Mono Panning parameter.
540 # Range -1.0...1.0; default is 0.0.
541 PARAMETER_PANNING = -7
543 # MIDI Control channel, integer type.
544 # Range -1...15 (-1 = off).
545 PARAMETER_CTRL_CHANNEL = -8
547 # Max value, defined only for convenience.
548 PARAMETER_MAX = -9
550 # ---------------------------------------------------------------------------------------------------------------------
551 # Special Mapped Control Index
553 # Specially designated mapped control indexes.
554 # Values between 0 and 119 (0x77) are reserved for MIDI CC, which uses direct values.
555 # @see ParameterData::mappedControlIndex
557 # Unused control index, meaning no mapping is enabled.
558 CONTROL_INDEX_NONE = -1
560 # CV control index, meaning the parameter is exposed as CV port.
561 CONTROL_INDEX_CV = 130
563 # Special value to indicate MIDI pitchbend.
564 CONTROL_INDEX_MIDI_PITCHBEND = 131
566 # Special value to indicate MIDI learn.
567 CONTROL_INDEX_MIDI_LEARN = 132
569 # Special value to indicate MIDI pitchbend.
570 CONTROL_INDEX_MAX_ALLOWED = CONTROL_INDEX_MIDI_LEARN
572 # ---------------------------------------------------------------------------------------------------------------------
573 # Engine Callback Opcode
574 # Engine callback opcodes.
575 # Front-ends must never block indefinitely during a callback.
576 # @see EngineCallbackFunc and carla_set_engine_callback()
578 # Debug.
579 # This opcode is undefined and used only for testing purposes.
580 ENGINE_CALLBACK_DEBUG = 0
582 # A plugin has been added.
583 # @a pluginId Plugin Id
584 # @a value1 Plugin type
585 # @a valueStr Plugin name
586 ENGINE_CALLBACK_PLUGIN_ADDED = 1
588 # A plugin has been removed.
589 # @a pluginId Plugin Id
590 ENGINE_CALLBACK_PLUGIN_REMOVED = 2
592 # A plugin has been renamed.
593 # @a pluginId Plugin Id
594 # @a valueStr New plugin name
595 ENGINE_CALLBACK_PLUGIN_RENAMED = 3
597 # A plugin has become unavailable.
598 # @a pluginId Plugin Id
599 # @a valueStr Related error string
600 ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4
602 # A parameter value has changed.
603 # @a pluginId Plugin Id
604 # @a value1 Parameter index
605 # @a valuef New parameter value
606 ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5
608 # A parameter default has changed.
609 # @a pluginId Plugin Id
610 # @a value1 Parameter index
611 # @a valuef New default value
612 ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6
614 # A parameter's mapped control index has changed.
615 # @a pluginId Plugin Id
616 # @a value1 Parameter index
617 # @a value2 New control index
618 ENGINE_CALLBACK_PARAMETER_MAPPED_CONTROL_INDEX_CHANGED = 7
620 # A parameter's MIDI channel has changed.
621 # @a pluginId Plugin Id
622 # @a value1 Parameter index
623 # @a value2 New MIDI channel
624 ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8
626 # A plugin option has changed.
627 # @a pluginId Plugin Id
628 # @a value1 Option
629 # @a value2 New on/off state (1 for on, 0 for off)
630 # @see PluginOptions
631 ENGINE_CALLBACK_OPTION_CHANGED = 9
633 # The current program of a plugin has changed.
634 # @a pluginId Plugin Id
635 # @a value1 New program index
636 ENGINE_CALLBACK_PROGRAM_CHANGED = 10
638 # The current MIDI program of a plugin has changed.
639 # @a pluginId Plugin Id
640 # @a value1 New MIDI program index
641 ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11
643 # A plugin's custom UI state has changed.
644 # @a pluginId Plugin Id
645 # @a value1 New state, as follows:
646 # 0: UI is now hidden
647 # 1: UI is now visible
648 # -1: UI has crashed and should not be shown again
649 ENGINE_CALLBACK_UI_STATE_CHANGED = 12
651 # A note has been pressed.
652 # @a pluginId Plugin Id
653 # @a value1 Channel
654 # @a value2 Note
655 # @a value3 Velocity
656 ENGINE_CALLBACK_NOTE_ON = 13
658 # A note has been released.
659 # @a pluginId Plugin Id
660 # @a value1 Channel
661 # @a value2 Note
662 ENGINE_CALLBACK_NOTE_OFF = 14
664 # A plugin needs update.
665 # @a pluginId Plugin Id
666 ENGINE_CALLBACK_UPDATE = 15
668 # A plugin's data/information has changed.
669 # @a pluginId Plugin Id
670 ENGINE_CALLBACK_RELOAD_INFO = 16
672 # A plugin's parameters have changed.
673 # @a pluginId Plugin Id
674 ENGINE_CALLBACK_RELOAD_PARAMETERS = 17
676 # A plugin's programs have changed.
677 # @a pluginId Plugin Id
678 ENGINE_CALLBACK_RELOAD_PROGRAMS = 18
680 # A plugin state has changed.
681 # @a pluginId Plugin Id
682 ENGINE_CALLBACK_RELOAD_ALL = 19
684 # A patchbay client has been added.
685 # @a pluginId Client Id
686 # @a value1 Client icon
687 # @a value2 Plugin Id (-1 if not a plugin)
688 # @a valueStr Client name
689 # @see PatchbayIcon
690 ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 20
692 # A patchbay client has been removed.
693 # @a pluginId Client Id
694 ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 21
696 # A patchbay client has been renamed.
697 # @a pluginId Client Id
698 # @a valueStr New client name
699 ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 22
701 # A patchbay client data has changed.
702 # @a pluginId Client Id
703 # @a value1 New icon
704 # @a value2 New plugin Id (-1 if not a plugin)
705 # @see PatchbayIcon
706 ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23
708 # A patchbay port has been added.
709 # @a pluginId Client Id
710 # @a value1 Port Id
711 # @a value2 Port hints
712 # @a value3 Port group Id (0 for none)
713 # @a valueStr Port name
714 # @see PatchbayPortHints
715 ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24
717 # A patchbay port has been removed.
718 # @a pluginId Client Id
719 # @a value1 Port Id
720 ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25
722 # A patchbay port has changed (like the name or group Id).
723 # @a pluginId Client Id
724 # @a value1 Port Id
725 # @a value2 Port hints
726 # @a value3 Port group Id (0 for none)
727 # @a valueStr New port name
728 ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED = 26
730 # A patchbay connection has been added.
731 # @a pluginId Connection Id
732 # @a valueStr Out group, port plus in group and port, in "og:op:ig:ip" syntax.
733 ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 27
735 # A patchbay connection has been removed.
736 # @a pluginId Connection Id
737 ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28
739 # Engine started.
740 # @a pluginId How many plugins are known to be running
741 # @a value1 Process mode
742 # @a value2 Transport mode
743 # @a value3 Buffer size
744 # @a valuef Sample rate
745 # @a valuestr Engine driver
746 # @see EngineProcessMode
747 # @see EngineTransportMode
748 ENGINE_CALLBACK_ENGINE_STARTED = 29
750 # Engine stopped.
751 ENGINE_CALLBACK_ENGINE_STOPPED = 30
753 # Engine process mode has changed.
754 # @a value1 New process mode
755 # @see EngineProcessMode
756 ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 31
758 # Engine transport mode has changed.
759 # @a value1 New transport mode
760 # @a valueStr New transport features enabled
761 # @see EngineTransportMode
762 ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32
764 # Engine buffer-size changed.
765 # @a value1 New buffer size
766 ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33
768 # Engine sample-rate changed.
769 # @a valuef New sample rate
770 ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34
772 # A cancelable action has been started or stopped.
773 # @a pluginId Plugin Id the action relates to, -1 for none
774 # @a value1 1 for action started, 0 for stopped
775 # @a valueStr Action name
776 ENGINE_CALLBACK_CANCELABLE_ACTION = 35
778 # Project has finished loading.
779 ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 36
781 # NSM callback.
782 # Frontend must call carla_nsm_ready() with opcode as parameter as a response
783 # @a value1 NSM opcode
784 # @a value2 Integer value
785 # @a valueStr String value
786 # @see NsmCallbackOpcode
787 ENGINE_CALLBACK_NSM = 37
789 # Idle frontend.
790 # This is used by the engine during long operations that might block the frontend,
791 # giving it the possibility to idle while the operation is still in place.
792 ENGINE_CALLBACK_IDLE = 38
794 # Show a message as information.
795 # @a valueStr The message
796 ENGINE_CALLBACK_INFO = 39
798 # Show a message as an error.
799 # @a valueStr The message
800 ENGINE_CALLBACK_ERROR = 40
802 # The engine has crashed or malfunctioned and will no longer work.
803 ENGINE_CALLBACK_QUIT = 41
805 # A plugin requested for its inline display to be redrawn.
806 # @a pluginId Plugin Id to redraw
807 ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW = 42
809 # A patchbay port group has been added.
810 # @a pluginId Client Id
811 # @a value1 Group Id (unique within this client)
812 # @a value2 Group hints
813 # @a valueStr Group name
814 # @see PatchbayPortGroupHints
815 ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED = 43
817 # A patchbay port group has been removed.
818 # @a pluginId Client Id
819 # @a value1 Group Id (unique within this client)
820 ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED = 44
822 # A patchbay port group has changed.
823 # @a pluginId Client Id
824 # @a value1 Group Id (unique within this client)
825 # @a value2 Group hints
826 # @a valueStr Group name
827 # @see PatchbayPortGroupHints
828 ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED = 45
830 # A parameter's mapped range has changed.
831 # @a pluginId Plugin Id
832 # @a value1 Parameter index
833 # @a valueStr New mapped range as "%f:%f" syntax
834 ENGINE_CALLBACK_PARAMETER_MAPPED_RANGE_CHANGED = 46
836 # A patchbay client position has changed.
837 # @a pluginId Client Id
838 # @a value1 X position 1
839 # @a value2 Y position 1
840 # @a value3 X position 2
841 # @a valuef Y position 2
842 ENGINE_CALLBACK_PATCHBAY_CLIENT_POSITION_CHANGED = 47
844 # ---------------------------------------------------------------------------------------------------------------------
845 # NSM Callback Opcode
846 # NSM callback opcodes.
847 # @see ENGINE_CALLBACK_NSM
849 # NSM is available and initialized.
850 NSM_CALLBACK_INIT = 0
852 # Error from NSM side.
853 # @a valueInt Error code
854 # @a valueStr Error string
855 NSM_CALLBACK_ERROR = 1
857 # Announce message.
858 # @a valueInt SM Flags (WIP, to be defined)
859 # @a valueStr SM Name
860 NSM_CALLBACK_ANNOUNCE = 2
862 # Open message.
863 # @a valueStr Project filename
864 NSM_CALLBACK_OPEN = 3
866 # Save message.
867 NSM_CALLBACK_SAVE = 4
869 # Session-is-loaded message.
870 NSM_CALLBACK_SESSION_IS_LOADED = 5
872 # Show-optional-gui message.
873 NSM_CALLBACK_SHOW_OPTIONAL_GUI = 6
875 # Hide-optional-gui message.
876 NSM_CALLBACK_HIDE_OPTIONAL_GUI = 7
878 # Set client name id message.
879 NSM_CALLBACK_SET_CLIENT_NAME_ID = 8
881 # ---------------------------------------------------------------------------------------------------------------------
882 # Engine Option
883 # Engine options.
884 # @see carla_set_engine_option()
886 # Debug.
887 # This option is undefined and used only for testing purposes.
888 ENGINE_OPTION_DEBUG = 0
890 # Set the engine processing mode.
891 # Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_CONTINUOUS_RACK for all other OSes.
892 # @see EngineProcessMode
893 ENGINE_OPTION_PROCESS_MODE = 1
895 # Set the engine transport mode.
896 # Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
897 # @see EngineTransportMode
898 ENGINE_OPTION_TRANSPORT_MODE = 2
900 # Force mono plugins as stereo, by running 2 instances at the same time.
901 # Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
902 # @note Not supported by all plugins
903 # @see PLUGIN_OPTION_FORCE_STEREO
904 ENGINE_OPTION_FORCE_STEREO = 3
906 # Use plugin bridges whenever possible.
907 # Default is no, EXPERIMENTAL.
908 ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4
910 # Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
911 # Default is yes.
912 ENGINE_OPTION_PREFER_UI_BRIDGES = 5
914 # Make custom plugin UIs always-on-top.
915 # Default is yes.
916 ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6
918 # Maximum number of parameters allowed.
919 # Default is MAX_DEFAULT_PARAMETERS.
920 ENGINE_OPTION_MAX_PARAMETERS = 7
922 # Reset Xrun counter after project load.
923 ENGINE_OPTION_RESET_XRUNS = 8
925 # Timeout value for how much to wait for UI bridges to respond, in milliseconds.
926 # Default is 4000 (4 seconds).
927 ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 9
929 # Audio buffer size.
930 # Default is 512.
931 ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10
933 # Audio sample rate.
934 # Default is 44100.
935 ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11
937 # Wherever to use 3 audio periods instead of the default 2.
938 # Default is false.
939 ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 12
941 # Audio driver.
942 # Default dppends on platform.
943 ENGINE_OPTION_AUDIO_DRIVER = 13
945 # Audio device (within a driver).
946 # Default unset.
947 ENGINE_OPTION_AUDIO_DEVICE = 14
949 # Wherever to enable OSC support in the engine.
950 ENGINE_OPTION_OSC_ENABLED = 15
952 # The network TCP port to use for OSC.
953 # A value of 0 means use a random port.
954 # A value of < 0 means to not enable the TCP port for OSC.
955 # @note Valid ports begin at 1024 and end at 32767 (inclusive)
956 ENGINE_OPTION_OSC_PORT_TCP = 16
958 # The network UDP port to use for OSC.
959 # A value of 0 means use a random port.
960 # A value of < 0 means to not enable the UDP port for OSC.
961 # @note Disabling this option prevents DSSI UIs from working!
962 # @note Valid ports begin at 1024 and end at 32767 (inclusive)
963 ENGINE_OPTION_OSC_PORT_UDP = 17
965 # Set path used for a specific file type.
966 # Uses value as the file format, valueStr as actual path.
967 ENGINE_OPTION_FILE_PATH = 18
969 # Set path used for a specific plugin type.
970 # Uses value as the plugin format, valueStr as actual path.
971 # @see PluginType
972 ENGINE_OPTION_PLUGIN_PATH = 19
974 # Set path to the binary files.
975 # Default unset.
976 # @note Must be set for plugin and UI bridges to work
977 ENGINE_OPTION_PATH_BINARIES = 20
979 # Set path to the resource files.
980 # Default unset.
981 # @note Must be set for some internal plugins to work
982 ENGINE_OPTION_PATH_RESOURCES = 21
984 # Prevent bad plugin and UI behaviour.
985 # @note: Linux only
986 ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 22
988 # Set background color used in the frontend, so backend can do the same for plugin UIs.
989 ENGINE_OPTION_FRONTEND_BACKGROUND_COLOR = 23
991 # Set foreground color used in the frontend, so backend can do the same for plugin UIs.
992 ENGINE_OPTION_FRONTEND_FOREGROUND_COLOR = 24
994 # Set UI scaling used in the frontend, so backend can do the same for plugin UIs.
995 ENGINE_OPTION_FRONTEND_UI_SCALE = 25
997 # Set frontend winId, used to define as parent window for plugin UIs.
998 ENGINE_OPTION_FRONTEND_WIN_ID = 26
1000 # Set path to wine executable.
1001 ENGINE_OPTION_WINE_EXECUTABLE = 27
1003 # Enable automatic wineprefix detection.
1004 ENGINE_OPTION_WINE_AUTO_PREFIX = 28
1006 # Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
1007 ENGINE_OPTION_WINE_FALLBACK_PREFIX = 29
1009 # Enable realtime priority for Wine application and server threads.
1010 ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 30
1012 # Base realtime priority for Wine threads.
1013 ENGINE_OPTION_WINE_BASE_RT_PRIO = 31
1015 # Wine server realtime priority.
1016 ENGINE_OPTION_WINE_SERVER_RT_PRIO = 32
1018 # Capture console output into debug callbacks
1019 ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 33
1021 # A prefix to give to all plugin clients created by Carla.
1022 # Mostly useful for JACK multi-client mode.
1023 # @note MUST include at least one "." (dot).
1024 ENGINE_OPTION_CLIENT_NAME_PREFIX = 34
1026 # Treat loaded plugins as standalone (that is, there is no host UI to manage them)
1027 ENGINE_OPTION_PLUGINS_ARE_STANDALONE = 35
1029 # ---------------------------------------------------------------------------------------------------------------------
1030 # Engine Process Mode
1031 # Engine process mode.
1032 # @see ENGINE_OPTION_PROCESS_MODE
1034 # Single client mode.
1035 # Inputs and outputs are added dynamically as needed by plugins.
1036 ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0
1038 # Multiple client mode.
1039 # It has 1 master client + 1 client per plugin.
1040 ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1
1042 # Single client, 'rack' mode.
1043 # Processes plugins in order of Id, with forced stereo always on.
1044 ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2
1046 # Single client, 'patchbay' mode.
1047 ENGINE_PROCESS_MODE_PATCHBAY = 3
1049 # Special mode, used in plugin-bridges only.
1050 ENGINE_PROCESS_MODE_BRIDGE = 4
1052 # ---------------------------------------------------------------------------------------------------------------------
1053 # Engine Transport Mode
1054 # Engine transport mode.
1055 # @see ENGINE_OPTION_TRANSPORT_MODE
1057 # No transport.
1058 ENGINE_TRANSPORT_MODE_DISABLED = 0
1060 # Internal transport mode.
1061 ENGINE_TRANSPORT_MODE_INTERNAL = 1
1063 # Transport from JACK.
1064 # Only available if driver name is "JACK".
1065 ENGINE_TRANSPORT_MODE_JACK = 2
1067 # Transport from host, used when Carla is a plugin.
1068 ENGINE_TRANSPORT_MODE_PLUGIN = 3
1070 # Special mode, used in plugin-bridges only.
1071 ENGINE_TRANSPORT_MODE_BRIDGE = 4
1073 # ---------------------------------------------------------------------------------------------------------------------
1074 # File Callback Opcode
1075 # File callback opcodes.
1076 # Front-ends must always block-wait for user input.
1077 # @see FileCallbackFunc and carla_set_file_callback()
1079 # Debug.
1080 # This opcode is undefined and used only for testing purposes.
1081 FILE_CALLBACK_DEBUG = 0
1083 # Open file or folder.
1084 FILE_CALLBACK_OPEN = 1
1086 # Save file or folder.
1087 FILE_CALLBACK_SAVE = 2
1089 # ---------------------------------------------------------------------------------------------------------------------
1090 # Patchbay Icon
1091 # The icon of a patchbay client/group.
1093 # Generic application icon.
1094 # Used for all non-plugin clients that don't have a specific icon.
1095 PATCHBAY_ICON_APPLICATION = 0
1097 # Plugin icon.
1098 # Used for all plugin clients that don't have a specific icon.
1099 PATCHBAY_ICON_PLUGIN = 1
1101 # Hardware icon.
1102 # Used for hardware (audio or MIDI) clients.
1103 PATCHBAY_ICON_HARDWARE = 2
1105 # Carla icon.
1106 # Used for the main app.
1107 PATCHBAY_ICON_CARLA = 3
1109 # DISTRHO icon.
1110 # Used for DISTRHO based plugins.
1111 PATCHBAY_ICON_DISTRHO = 4
1113 # File icon.
1114 # Used for file type plugins (like SF2 and SFZ).
1115 PATCHBAY_ICON_FILE = 5
1117 # ---------------------------------------------------------------------------------------------------------------------
1118 # Carla Backend API (C stuff)
1120 # Engine callback function.
1121 # Front-ends must never block indefinitely during a callback.
1122 # @see EngineCallbackOpcode and carla_set_engine_callback()
1123 EngineCallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_int, c_float, c_char_p)
1125 # File callback function.
1126 # @see FileCallbackOpcode
1127 FileCallbackFunc = CFUNCTYPE(c_char_p, c_void_p, c_enum, c_bool, c_char_p, c_char_p)
1129 # Parameter data.
1130 class ParameterData(Structure):
1131 _fields_ = [
1132 # This parameter type.
1133 ("type", c_enum),
1135 # This parameter hints.
1136 # @see ParameterHints
1137 ("hints", c_uint),
1139 # Index as seen by Carla.
1140 ("index", c_int32),
1142 # Real index as seen by plugins.
1143 ("rindex", c_int32),
1145 # Currently mapped MIDI channel.
1146 # Counts from 0 to 15.
1147 ("midiChannel", c_uint8),
1149 # Currently mapped index.
1150 # @see SpecialMappedControlIndex
1151 ("mappedControlIndex", c_int16),
1153 # Minimum value that this parameter maps to.
1154 ("mappedMinimum", c_float),
1156 # Maximum value that this parameter maps to.
1157 ("mappedMaximum", c_float),
1159 # Flags related to the current mapping of this parameter.
1160 # @see MappedParameterFlags
1161 ("mappedFlags", c_uint)
1164 # Parameter ranges.
1165 class ParameterRanges(Structure):
1166 _fields_ = [
1167 # Default value.
1168 ("def", c_float),
1170 # Minimum value.
1171 ("min", c_float),
1173 # Maximum value.
1174 ("max", c_float),
1176 # Regular, single step value.
1177 ("step", c_float),
1179 # Small step value.
1180 ("stepSmall", c_float),
1182 # Large step value.
1183 ("stepLarge", c_float)
1186 # MIDI Program data.
1187 class MidiProgramData(Structure):
1188 _fields_ = [
1189 # MIDI bank.
1190 ("bank", c_uint32),
1192 # MIDI program.
1193 ("program", c_uint32),
1195 # MIDI program name.
1196 ("name", c_char_p)
1199 # Custom data, used for saving key:value 'dictionaries'.
1200 class CustomData(Structure):
1201 _fields_ = [
1202 # Value type, in URI form.
1203 # @see CustomDataTypes
1204 ("type", c_char_p),
1206 # Key.
1207 # @see CustomDataKeys
1208 ("key", c_char_p),
1210 # Value.
1211 ("value", c_char_p)
1214 # Engine driver device information.
1215 class EngineDriverDeviceInfo(Structure):
1216 _fields_ = [
1217 # This driver device hints.
1218 # @see EngineDriverHints
1219 ("hints", c_uint),
1221 # Available buffer sizes.
1222 # Terminated with 0.
1223 ("bufferSizes", POINTER(c_uint32)),
1225 # Available sample rates.
1226 # Terminated with 0.0.
1227 ("sampleRates", POINTER(c_double))
1230 # ---------------------------------------------------------------------------------------------------------------------
1231 # Carla Backend API (Python compatible stuff)
1233 # @see ParameterData
1234 PyParameterData = {
1235 'type': PARAMETER_UNKNOWN,
1236 'hints': 0x0,
1237 'index': PARAMETER_NULL,
1238 'rindex': -1,
1239 'midiChannel': 0,
1240 'mappedControlIndex': CONTROL_INDEX_NONE,
1241 'mappedMinimum': 0.0,
1242 'mappedMaximum': 0.0,
1243 'mappedFlags': 0x0,
1246 # @see ParameterRanges
1247 PyParameterRanges = {
1248 'def': 0.0,
1249 'min': 0.0,
1250 'max': 1.0,
1251 'step': 0.01,
1252 'stepSmall': 0.0001,
1253 'stepLarge': 0.1
1256 # @see MidiProgramData
1257 PyMidiProgramData = {
1258 'bank': 0,
1259 'program': 0,
1260 'name': None
1263 # @see CustomData
1264 PyCustomData = {
1265 'type': None,
1266 'key': None,
1267 'value': None
1270 # @see EngineDriverDeviceInfo
1271 PyEngineDriverDeviceInfo = {
1272 'hints': 0x0,
1273 'bufferSizes': [],
1274 'sampleRates': []
1277 # ---------------------------------------------------------------------------------------------------------------------
1278 # Carla Host API (C stuff)
1280 # Information about a loaded plugin.
1281 # @see carla_get_plugin_info()
1282 class CarlaPluginInfo(Structure):
1283 _fields_ = [
1284 # Plugin type.
1285 ("type", c_enum),
1287 # Plugin category.
1288 ("category", c_enum),
1290 # Plugin hints.
1291 # @see PluginHints
1292 ("hints", c_uint),
1294 # Plugin options available for the user to change.
1295 # @see PluginOptions
1296 ("optionsAvailable", c_uint),
1298 # Plugin options currently enabled.
1299 # Some options are enabled but not available, which means they will always be on.
1300 # @see PluginOptions
1301 ("optionsEnabled", c_uint),
1303 # Plugin filename.
1304 # This can be the plugin binary or resource file.
1305 ("filename", c_char_p),
1307 # Plugin name.
1308 # This name is unique within a Carla instance.
1309 # @see carla_get_real_plugin_name()
1310 ("name", c_char_p),
1312 # Plugin label or URI.
1313 ("label", c_char_p),
1315 # Plugin author/maker.
1316 ("maker", c_char_p),
1318 # Plugin copyright/license.
1319 ("copyright", c_char_p),
1321 # Icon name for this plugin, in lowercase.
1322 # Default is "plugin".
1323 ("iconName", c_char_p),
1325 # Plugin unique Id.
1326 # This Id is dependent on the plugin type and may sometimes be 0.
1327 ("uniqueId", c_int64)
1330 # Port count information, used for Audio and MIDI ports and parameters.
1331 # @see carla_get_audio_port_count_info()
1332 # @see carla_get_midi_port_count_info()
1333 # @see carla_get_parameter_count_info()
1334 class CarlaPortCountInfo(Structure):
1335 _fields_ = [
1336 # Number of inputs.
1337 ("ins", c_uint32),
1339 # Number of outputs.
1340 ("outs", c_uint32)
1343 # Parameter information.
1344 # @see carla_get_parameter_info()
1345 class CarlaParameterInfo(Structure):
1346 _fields_ = [
1347 # Parameter name.
1348 ("name", c_char_p),
1350 # Parameter symbol.
1351 ("symbol", c_char_p),
1353 # Parameter unit.
1354 ("unit", c_char_p),
1356 # Parameter comment / documentation.
1357 ("comment", c_char_p),
1359 # Parameter group name.
1360 ("groupName", c_char_p),
1362 # Number of scale points.
1363 # @see CarlaScalePointInfo
1364 ("scalePointCount", c_uint32)
1367 # Parameter scale point information.
1368 # @see carla_get_parameter_scalepoint_info()
1369 class CarlaScalePointInfo(Structure):
1370 _fields_ = [
1371 # Scale point value.
1372 ("value", c_float),
1374 # Scale point label.
1375 ("label", c_char_p)
1378 # Transport information.
1379 # @see carla_get_transport_info()
1380 class CarlaTransportInfo(Structure):
1381 _fields_ = [
1382 # Wherever transport is playing.
1383 ("playing", c_bool),
1385 # Current transport frame.
1386 ("frame", c_uint64),
1388 # Bar
1389 ("bar", c_int32),
1391 # Beat
1392 ("beat", c_int32),
1394 # Tick
1395 ("tick", c_int32),
1397 # Beats per minute.
1398 ("bpm", c_double)
1401 # Runtime engine information.
1402 class CarlaRuntimeEngineInfo(Structure):
1403 _fields_ = [
1404 # DSP load.
1405 ("load", c_float),
1407 # Number of xruns.
1408 ("xruns", c_uint32)
1411 # Runtime engine driver device information.
1412 class CarlaRuntimeEngineDriverDeviceInfo(Structure):
1413 _fields_ = [
1414 # Name of the driver device.
1415 ("name", c_char_p),
1417 # This driver device hints.
1418 # @see EngineDriverHints
1419 ("hints", c_uint),
1421 # Current buffer size.
1422 ("bufferSize", c_uint32),
1424 # Available buffer sizes.
1425 # Terminated with 0.
1426 ("bufferSizes", POINTER(c_uint32)),
1428 # Current sample rate.
1429 ("sampleRate", c_double),
1431 # Available sample rates.
1432 # Terminated with 0.0.
1433 ("sampleRates", POINTER(c_double))
1436 # Image data for LV2 inline display API.
1437 # raw image pixmap format is ARGB32,
1438 class CarlaInlineDisplayImageSurface(Structure):
1439 _fields_ = [
1440 ("data", POINTER(c_ubyte)),
1441 ("width", c_int),
1442 ("height", c_int),
1443 ("stride", c_int)
1446 # ---------------------------------------------------------------------------------------------------------------------
1447 # Carla Host API (Python compatible stuff)
1449 # @see CarlaPluginInfo
1450 PyCarlaPluginInfo = {
1451 'type': PLUGIN_NONE,
1452 'category': PLUGIN_CATEGORY_NONE,
1453 'hints': 0x0,
1454 'optionsAvailable': 0x0,
1455 'optionsEnabled': 0x0,
1456 'filename': "",
1457 'name': "",
1458 'label': "",
1459 'maker': "",
1460 'copyright': "",
1461 'iconName': "",
1462 'uniqueId': 0
1465 # @see CarlaPortCountInfo
1466 PyCarlaPortCountInfo = {
1467 'ins': 0,
1468 'outs': 0
1471 # @see CarlaParameterInfo
1472 PyCarlaParameterInfo = {
1473 'name': "",
1474 'symbol': "",
1475 'unit': "",
1476 'comment': "",
1477 'groupName': "",
1478 'scalePointCount': 0,
1481 # @see CarlaScalePointInfo
1482 PyCarlaScalePointInfo = {
1483 'value': 0.0,
1484 'label': ""
1487 # @see CarlaTransportInfo
1488 PyCarlaTransportInfo = {
1489 'playing': False,
1490 'frame': 0,
1491 'bar': 0,
1492 'beat': 0,
1493 'tick': 0,
1494 'bpm': 0.0
1497 # @see CarlaRuntimeEngineInfo
1498 PyCarlaRuntimeEngineInfo = {
1499 'load': 0.0,
1500 'xruns': 0
1503 # @see CarlaRuntimeEngineDriverDeviceInfo
1504 PyCarlaRuntimeEngineDriverDeviceInfo = {
1505 'name': "",
1506 'hints': 0x0,
1507 'bufferSize': 0,
1508 'bufferSizes': [],
1509 'sampleRate': 0.0,
1510 'sampleRates': []
1513 # ---------------------------------------------------------------------------------------------------------------------
1514 # Set BINARY_NATIVE
1516 if WINDOWS:
1517 BINARY_NATIVE = BINARY_WIN64 if kIs64bit else BINARY_WIN32
1518 else:
1519 BINARY_NATIVE = BINARY_POSIX64 if kIs64bit else BINARY_POSIX32
1521 # ---------------------------------------------------------------------------------------------------------------------
1522 # Carla Host object (Meta)
1524 class CarlaHostMeta():
1525 def __init__(self):
1526 # info about this host object
1527 self.isControl = False
1528 self.isPlugin = False
1529 self.isRemote = False
1530 self.nsmOK = False
1532 # settings
1533 self.processMode = ENGINE_PROCESS_MODE_PATCHBAY
1534 self.transportMode = ENGINE_TRANSPORT_MODE_INTERNAL
1535 self.transportExtra = ""
1536 self.nextProcessMode = self.processMode
1537 self.processModeForced = False
1538 self.audioDriverForced = None
1540 # settings
1541 self.experimental = False
1542 self.exportLV2 = False
1543 self.forceStereo = False
1544 self.manageUIs = False
1545 self.maxParameters = 0
1546 self.resetXruns = False
1547 self.preferPluginBridges = False
1548 self.preferUIBridges = False
1549 self.preventBadBehaviour = False
1550 self.showLogs = False
1551 self.showPluginBridges = False
1552 self.showWineBridges = False
1553 self.uiBridgesTimeout = 0
1554 self.uisAlwaysOnTop = False
1556 # settings
1557 self.pathBinaries = ""
1558 self.pathResources = ""
1560 # Get how many engine drivers are available.
1561 @abstractmethod
1562 def get_engine_driver_count(self):
1563 raise NotImplementedError
1565 # Get an engine driver name.
1566 # @param index Driver index
1567 @abstractmethod
1568 def get_engine_driver_name(self, index):
1569 raise NotImplementedError
1571 # Get the device names of an engine driver.
1572 # @param index Driver index
1573 @abstractmethod
1574 def get_engine_driver_device_names(self, index):
1575 raise NotImplementedError
1577 # Get information about a device driver.
1578 # @param index Driver index
1579 # @param name Device name
1580 @abstractmethod
1581 def get_engine_driver_device_info(self, index, name):
1582 raise NotImplementedError
1584 # Show a device custom control panel.
1585 # @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL
1586 # @param index Driver index
1587 # @param name Device name
1588 @abstractmethod
1589 def show_engine_driver_device_control_panel(self, index, name):
1590 raise NotImplementedError
1592 # Initialize the engine.
1593 # Make sure to call carla_engine_idle() at regular intervals afterwards.
1594 # @param driverName Driver to use
1595 # @param clientName Engine master client name
1596 @abstractmethod
1597 def engine_init(self, driverName, clientName):
1598 raise NotImplementedError
1600 # Close the engine.
1601 # This function always closes the engine even if it returns false.
1602 # In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
1603 @abstractmethod
1604 def engine_close(self):
1605 raise NotImplementedError
1607 # Idle the engine.
1608 # Do not call this if the engine is not running.
1609 @abstractmethod
1610 def engine_idle(self):
1611 raise NotImplementedError
1613 # Check if the engine is running.
1614 @abstractmethod
1615 def is_engine_running(self):
1616 raise NotImplementedError
1618 # Get information about the currently running engine.
1619 @abstractmethod
1620 def get_runtime_engine_info(self):
1621 raise NotImplementedError
1623 # Get information about the currently running engine driver device.
1624 @abstractmethod
1625 def get_runtime_engine_driver_device_info(self):
1626 raise NotImplementedError
1628 # Dynamically change buffer size and/or sample rate while engine is running.
1629 # @see ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE
1630 # @see ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE
1631 def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
1632 raise NotImplementedError
1634 # Show the custom control panel for the current engine device.
1635 # @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL
1636 def show_engine_device_control_panel(self):
1637 raise NotImplementedError
1639 # Clear the xrun count on the engine, so that the next time carla_get_runtime_engine_info() is called, it returns 0.
1640 @abstractmethod
1641 def clear_engine_xruns(self):
1642 raise NotImplementedError
1644 # Tell the engine to stop the current cancelable action.
1645 # @see ENGINE_CALLBACK_CANCELABLE_ACTION
1646 @abstractmethod
1647 def cancel_engine_action(self):
1648 raise NotImplementedError
1650 # Tell the engine it's about to close.
1651 # This is used to prevent the engine thread(s) from reactivating.
1652 @abstractmethod
1653 def set_engine_about_to_close(self):
1654 raise NotImplementedError
1656 # Set the engine callback function.
1657 # @param func Callback function
1658 @abstractmethod
1659 def set_engine_callback(self, func):
1660 raise NotImplementedError
1662 # Set an engine option.
1663 # @param option Option
1664 # @param value Value as number
1665 # @param valueStr Value as string
1666 @abstractmethod
1667 def set_engine_option(self, option, value, valueStr):
1668 raise NotImplementedError
1670 # Set the file callback function.
1671 # @param func Callback function
1672 # @param ptr Callback pointer
1673 @abstractmethod
1674 def set_file_callback(self, func):
1675 raise NotImplementedError
1677 # Load a file of any type.
1678 # This will try to load a generic file as a plugin,
1679 # either by direct handling (SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
1680 # @see carla_get_supported_file_extensions()
1681 @abstractmethod
1682 def load_file(self, filename):
1683 raise NotImplementedError
1685 # Load a Carla project file.
1686 # @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
1687 @abstractmethod
1688 def load_project(self, filename):
1689 raise NotImplementedError
1691 # Save current project to a file.
1692 @abstractmethod
1693 def save_project(self, filename):
1694 raise NotImplementedError
1696 # Clear the currently set project filename.
1697 @abstractmethod
1698 def clear_project_filename(self):
1699 raise NotImplementedError
1701 # Connect two patchbay ports.
1702 # @param groupIdA Output group
1703 # @param portIdA Output port
1704 # @param groupIdB Input group
1705 # @param portIdB Input port
1706 # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
1707 @abstractmethod
1708 def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
1709 raise NotImplementedError
1711 # Disconnect two patchbay ports.
1712 # @param connectionId Connection Id
1713 # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
1714 @abstractmethod
1715 def patchbay_disconnect(self, external, connectionId):
1716 raise NotImplementedError
1718 # Set the position of a group.
1719 # This is purely cached and saved in the project file, Carla backend does nothing with the value.
1720 # When loading a project, callbacks are used to inform of the previously saved positions.
1721 # @see ENGINE_CALLBACK_PATCHBAY_CLIENT_POSITION_CHANGED
1722 @abstractmethod
1723 def patchbay_set_group_pos(self, external, groupId, x1, y1, x2, y2):
1724 raise NotImplementedError
1726 # Force the engine to resend all patchbay clients, ports and connections again.
1727 # @param external Wherever to show external/hardware ports instead of internal ones.
1728 # Only valid in patchbay engine mode, other modes will ignore this.
1729 @abstractmethod
1730 def patchbay_refresh(self, external):
1731 raise NotImplementedError
1733 # Start playback of the engine transport.
1734 @abstractmethod
1735 def transport_play(self):
1736 raise NotImplementedError
1738 # Pause the engine transport.
1739 @abstractmethod
1740 def transport_pause(self):
1741 raise NotImplementedError
1743 # Pause the engine transport.
1744 @abstractmethod
1745 def transport_bpm(self, bpm):
1746 raise NotImplementedError
1748 # Relocate the engine transport to a specific frame.
1749 @abstractmethod
1750 def transport_relocate(self, frame):
1751 raise NotImplementedError
1753 # Get the current transport frame.
1754 @abstractmethod
1755 def get_current_transport_frame(self):
1756 raise NotImplementedError
1758 # Get the engine transport information.
1759 @abstractmethod
1760 def get_transport_info(self):
1761 raise NotImplementedError
1763 # Current number of plugins loaded.
1764 @abstractmethod
1765 def get_current_plugin_count(self):
1766 raise NotImplementedError
1768 # Maximum number of loadable plugins allowed.
1769 # Returns 0 if engine is not started.
1770 @abstractmethod
1771 def get_max_plugin_number(self):
1772 raise NotImplementedError
1774 # Add a new plugin.
1775 # If you don't know the binary type use the BINARY_NATIVE macro.
1776 # @param btype Binary type
1777 # @param ptype Plugin type
1778 # @param filename Filename, if applicable
1779 # @param name Name of the plugin, can be NULL
1780 # @param label Plugin label, if applicable
1781 # @param uniqueId Plugin unique Id, if applicable
1782 # @param extraPtr Extra pointer, defined per plugin type
1783 # @param options Initial plugin options
1784 @abstractmethod
1785 def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
1786 raise NotImplementedError
1788 # Remove a plugin.
1789 # @param pluginId Plugin to remove.
1790 @abstractmethod
1791 def remove_plugin(self, pluginId):
1792 raise NotImplementedError
1794 # Remove all plugins.
1795 @abstractmethod
1796 def remove_all_plugins(self):
1797 raise NotImplementedError
1799 # Rename a plugin.
1800 # Returns the new name, or NULL if the operation failed.
1801 # @param pluginId Plugin to rename
1802 # @param newName New plugin name
1803 @abstractmethod
1804 def rename_plugin(self, pluginId, newName):
1805 raise NotImplementedError
1807 # Clone a plugin.
1808 # @param pluginId Plugin to clone
1809 @abstractmethod
1810 def clone_plugin(self, pluginId):
1811 raise NotImplementedError
1813 # Prepare replace of a plugin.
1814 # The next call to carla_add_plugin() will use this id, replacing the current plugin.
1815 # @param pluginId Plugin to replace
1816 # @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
1817 @abstractmethod
1818 def replace_plugin(self, pluginId):
1819 raise NotImplementedError
1821 # Switch two plugins positions.
1822 # @param pluginIdA Plugin A
1823 # @param pluginIdB Plugin B
1824 @abstractmethod
1825 def switch_plugins(self, pluginIdA, pluginIdB):
1826 raise NotImplementedError
1828 # Load a plugin state.
1829 # @param pluginId Plugin
1830 # @param filename Path to plugin state
1831 # @see carla_save_plugin_state()
1832 @abstractmethod
1833 def load_plugin_state(self, pluginId, filename):
1834 raise NotImplementedError
1836 # Save a plugin state.
1837 # @param pluginId Plugin
1838 # @param filename Path to plugin state
1839 # @see carla_load_plugin_state()
1840 @abstractmethod
1841 def save_plugin_state(self, pluginId, filename):
1842 raise NotImplementedError
1844 # Export plugin as LV2.
1845 # @param pluginId Plugin
1846 # @param lv2path Path to lv2 plugin folder
1847 def export_plugin_lv2(self, pluginId, lv2path):
1848 raise NotImplementedError
1850 # Get information from a plugin.
1851 # @param pluginId Plugin
1852 @abstractmethod
1853 def get_plugin_info(self, pluginId):
1854 raise NotImplementedError
1856 # Get audio port count information from a plugin.
1857 # @param pluginId Plugin
1858 @abstractmethod
1859 def get_audio_port_count_info(self, pluginId):
1860 raise NotImplementedError
1862 # Get MIDI port count information from a plugin.
1863 # @param pluginId Plugin
1864 @abstractmethod
1865 def get_midi_port_count_info(self, pluginId):
1866 raise NotImplementedError
1868 # Get parameter count information from a plugin.
1869 # @param pluginId Plugin
1870 @abstractmethod
1871 def get_parameter_count_info(self, pluginId):
1872 raise NotImplementedError
1874 # Get parameter information from a plugin.
1875 # @param pluginId Plugin
1876 # @param parameterId Parameter index
1877 # @see carla_get_parameter_count()
1878 @abstractmethod
1879 def get_parameter_info(self, pluginId, parameterId):
1880 raise NotImplementedError
1882 # Get parameter scale point information from a plugin.
1883 # @param pluginId Plugin
1884 # @param parameterId Parameter index
1885 # @param scalePointId Parameter scale-point index
1886 # @see CarlaParameterInfo::scalePointCount
1887 @abstractmethod
1888 def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
1889 raise NotImplementedError
1891 # Get a plugin's parameter data.
1892 # @param pluginId Plugin
1893 # @param parameterId Parameter index
1894 # @see carla_get_parameter_count()
1895 @abstractmethod
1896 def get_parameter_data(self, pluginId, parameterId):
1897 raise NotImplementedError
1899 # Get a plugin's parameter ranges.
1900 # @param pluginId Plugin
1901 # @param parameterId Parameter index
1902 # @see carla_get_parameter_count()
1903 @abstractmethod
1904 def get_parameter_ranges(self, pluginId, parameterId):
1905 raise NotImplementedError
1907 # Get a plugin's MIDI program data.
1908 # @param pluginId Plugin
1909 # @param midiProgramId MIDI Program index
1910 # @see carla_get_midi_program_count()
1911 @abstractmethod
1912 def get_midi_program_data(self, pluginId, midiProgramId):
1913 raise NotImplementedError
1915 # Get a plugin's custom data, using index.
1916 # @param pluginId Plugin
1917 # @param customDataId Custom data index
1918 # @see carla_get_custom_data_count()
1919 @abstractmethod
1920 def get_custom_data(self, pluginId, customDataId):
1921 raise NotImplementedError
1923 # Get a plugin's custom data value, using type and key.
1924 # @param pluginId Plugin
1925 # @param type Custom data type
1926 # @param key Custom data key
1927 # @see carla_get_custom_data_count()
1928 @abstractmethod
1929 def get_custom_data_value(self, pluginId, type_, key):
1930 raise NotImplementedError
1932 # Get a plugin's chunk data.
1933 # @param pluginId Plugin
1934 # @see PLUGIN_OPTION_USE_CHUNKS
1935 @abstractmethod
1936 def get_chunk_data(self, pluginId):
1937 raise NotImplementedError
1939 # Get how many parameters a plugin has.
1940 # @param pluginId Plugin
1941 @abstractmethod
1942 def get_parameter_count(self, pluginId):
1943 raise NotImplementedError
1945 # Get how many programs a plugin has.
1946 # @param pluginId Plugin
1947 # @see carla_get_program_name()
1948 @abstractmethod
1949 def get_program_count(self, pluginId):
1950 raise NotImplementedError
1952 # Get how many MIDI programs a plugin has.
1953 # @param pluginId Plugin
1954 # @see carla_get_midi_program_name() and carla_get_midi_program_data()
1955 @abstractmethod
1956 def get_midi_program_count(self, pluginId):
1957 raise NotImplementedError
1959 # Get how many custom data sets a plugin has.
1960 # @param pluginId Plugin
1961 # @see carla_get_custom_data()
1962 @abstractmethod
1963 def get_custom_data_count(self, pluginId):
1964 raise NotImplementedError
1966 # Get a plugin's parameter text (custom display of internal values).
1967 # @param pluginId Plugin
1968 # @param parameterId Parameter index
1969 # @see PARAMETER_USES_CUSTOM_TEXT
1970 @abstractmethod
1971 def get_parameter_text(self, pluginId, parameterId):
1972 raise NotImplementedError
1974 # Get a plugin's program name.
1975 # @param pluginId Plugin
1976 # @param programId Program index
1977 # @see carla_get_program_count()
1978 @abstractmethod
1979 def get_program_name(self, pluginId, programId):
1980 raise NotImplementedError
1982 # Get a plugin's MIDI program name.
1983 # @param pluginId Plugin
1984 # @param midiProgramId MIDI Program index
1985 # @see carla_get_midi_program_count()
1986 @abstractmethod
1987 def get_midi_program_name(self, pluginId, midiProgramId):
1988 raise NotImplementedError
1990 # Get a plugin's real name.
1991 # This is the name the plugin uses to identify itself; may not be unique.
1992 # @param pluginId Plugin
1993 @abstractmethod
1994 def get_real_plugin_name(self, pluginId):
1995 raise NotImplementedError
1997 # Get a plugin's program index.
1998 # @param pluginId Plugin
1999 @abstractmethod
2000 def get_current_program_index(self, pluginId):
2001 raise NotImplementedError
2003 # Get a plugin's midi program index.
2004 # @param pluginId Plugin
2005 @abstractmethod
2006 def get_current_midi_program_index(self, pluginId):
2007 raise NotImplementedError
2009 # Get a plugin's default parameter value.
2010 # @param pluginId Plugin
2011 # @param parameterId Parameter index
2012 @abstractmethod
2013 def get_default_parameter_value(self, pluginId, parameterId):
2014 raise NotImplementedError
2016 # Get a plugin's current parameter value.
2017 # @param pluginId Plugin
2018 # @param parameterId Parameter index
2019 @abstractmethod
2020 def get_current_parameter_value(self, pluginId, parameterId):
2021 raise NotImplementedError
2023 # Get a plugin's internal parameter value.
2024 # @param pluginId Plugin
2025 # @param parameterId Parameter index, maybe be negative
2026 # @see InternalParameterIndex
2027 @abstractmethod
2028 def get_internal_parameter_value(self, pluginId, parameterId):
2029 raise NotImplementedError
2031 # Get a plugin's input peak value.
2032 # @param pluginId Plugin
2033 # @param isLeft Wherever to get the left/mono value, otherwise right.
2034 @abstractmethod
2035 def get_input_peak_value(self, pluginId, isLeft):
2036 raise NotImplementedError
2038 # Get a plugin's output peak value.
2039 # @param pluginId Plugin
2040 # @param isLeft Wherever to get the left/mono value, otherwise right.
2041 @abstractmethod
2042 def get_output_peak_value(self, pluginId, isLeft):
2043 raise NotImplementedError
2045 # Render a plugin's inline display.
2046 # @param pluginId Plugin
2047 @abstractmethod
2048 def render_inline_display(self, pluginId, width, height):
2049 raise NotImplementedError
2051 # Enable a plugin's option.
2052 # @param pluginId Plugin
2053 # @param option An option from PluginOptions
2054 # @param yesNo New enabled state
2055 @abstractmethod
2056 def set_option(self, pluginId, option, yesNo):
2057 raise NotImplementedError
2059 # Enable or disable a plugin.
2060 # @param pluginId Plugin
2061 # @param onOff New active state
2062 @abstractmethod
2063 def set_active(self, pluginId, onOff):
2064 raise NotImplementedError
2066 # Change a plugin's internal dry/wet.
2067 # @param pluginId Plugin
2068 # @param value New dry/wet value
2069 @abstractmethod
2070 def set_drywet(self, pluginId, value):
2071 raise NotImplementedError
2073 # Change a plugin's internal volume.
2074 # @param pluginId Plugin
2075 # @param value New volume
2076 @abstractmethod
2077 def set_volume(self, pluginId, value):
2078 raise NotImplementedError
2080 # Change a plugin's internal stereo balance, left channel.
2081 # @param pluginId Plugin
2082 # @param value New value
2083 @abstractmethod
2084 def set_balance_left(self, pluginId, value):
2085 raise NotImplementedError
2087 # Change a plugin's internal stereo balance, right channel.
2088 # @param pluginId Plugin
2089 # @param value New value
2090 @abstractmethod
2091 def set_balance_right(self, pluginId, value):
2092 raise NotImplementedError
2094 # Change a plugin's internal mono panning value.
2095 # @param pluginId Plugin
2096 # @param value New value
2097 @abstractmethod
2098 def set_panning(self, pluginId, value):
2099 raise NotImplementedError
2101 # Change a plugin's internal control channel.
2102 # @param pluginId Plugin
2103 # @param channel New channel
2104 @abstractmethod
2105 def set_ctrl_channel(self, pluginId, channel):
2106 raise NotImplementedError
2108 # Change a plugin's parameter value.
2109 # @param pluginId Plugin
2110 # @param parameterId Parameter index
2111 # @param value New value
2112 @abstractmethod
2113 def set_parameter_value(self, pluginId, parameterId, value):
2114 raise NotImplementedError
2116 # Change a plugin's parameter mapped control index.
2117 # @param pluginId Plugin
2118 # @param parameterId Parameter index
2119 # @param cc New MIDI cc
2120 @abstractmethod
2121 def set_parameter_midi_channel(self, pluginId, parameterId, channel):
2122 raise NotImplementedError
2124 # Change a plugin's parameter MIDI channel.
2125 # @param pluginId Plugin
2126 # @param parameterId Parameter index
2127 # @param channel New control index
2128 @abstractmethod
2129 def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
2130 raise NotImplementedError
2132 # Change a plugin's parameter mapped range.
2133 # @param pluginId Plugin
2134 # @param parameterId Parameter index
2135 # @param minimum New mapped minimum
2136 # @param maximum New mapped maximum
2137 @abstractmethod
2138 def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
2139 raise NotImplementedError
2141 # Change a plugin's parameter in drag/touch mode state.
2142 # Usually happens from a UI when the user is moving a parameter with a mouse or similar input.
2143 # @param pluginId Plugin
2144 # @param parameterId Parameter index
2145 # @param touch New state
2146 @abstractmethod
2147 def set_parameter_touch(self, pluginId, parameterId, touch):
2148 raise NotImplementedError
2150 # Change a plugin's current program.
2151 # @param pluginId Plugin
2152 # @param programId New program
2153 @abstractmethod
2154 def set_program(self, pluginId, programId):
2155 raise NotImplementedError
2157 # Change a plugin's current MIDI program.
2158 # @param pluginId Plugin
2159 # @param midiProgramId New value
2160 @abstractmethod
2161 def set_midi_program(self, pluginId, midiProgramId):
2162 raise NotImplementedError
2164 # Set a plugin's custom data set.
2165 # @param pluginId Plugin
2166 # @param type Type
2167 # @param key Key
2168 # @param value New value
2169 # @see CustomDataTypes and CustomDataKeys
2170 @abstractmethod
2171 def set_custom_data(self, pluginId, type_, key, value):
2172 raise NotImplementedError
2174 # Set a plugin's chunk data.
2175 # @param pluginId Plugin
2176 # @param chunkData New chunk data
2177 # @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
2178 @abstractmethod
2179 def set_chunk_data(self, pluginId, chunkData):
2180 raise NotImplementedError
2182 # Tell a plugin to prepare for save.
2183 # This should be called before saving custom data sets.
2184 # @param pluginId Plugin
2185 @abstractmethod
2186 def prepare_for_save(self, pluginId):
2187 raise NotImplementedError
2189 # Reset all plugin's parameters.
2190 # @param pluginId Plugin
2191 @abstractmethod
2192 def reset_parameters(self, pluginId):
2193 raise NotImplementedError
2195 # Randomize all plugin's parameters.
2196 # @param pluginId Plugin
2197 @abstractmethod
2198 def randomize_parameters(self, pluginId):
2199 raise NotImplementedError
2201 # Send a single note of a plugin.
2202 # If velocity is 0, note-off is sent; note-on otherwise.
2203 # @param pluginId Plugin
2204 # @param channel Note channel
2205 # @param note Note pitch
2206 # @param velocity Note velocity
2207 @abstractmethod
2208 def send_midi_note(self, pluginId, channel, note, velocity):
2209 raise NotImplementedError
2211 # Tell a plugin to show its own custom UI.
2212 # @param pluginId Plugin
2213 # @param yesNo New UI state, visible or not
2214 # @see PLUGIN_HAS_CUSTOM_UI
2215 @abstractmethod
2216 def show_custom_ui(self, pluginId, yesNo):
2217 raise NotImplementedError
2219 # Get the current engine buffer size.
2220 @abstractmethod
2221 def get_buffer_size(self):
2222 raise NotImplementedError
2224 # Get the current engine sample rate.
2225 @abstractmethod
2226 def get_sample_rate(self):
2227 raise NotImplementedError
2229 # Get the last error.
2230 @abstractmethod
2231 def get_last_error(self):
2232 raise NotImplementedError
2234 # Get the current engine OSC URL (TCP).
2235 @abstractmethod
2236 def get_host_osc_url_tcp(self):
2237 raise NotImplementedError
2239 # Get the current engine OSC URL (UDP).
2240 @abstractmethod
2241 def get_host_osc_url_udp(self):
2242 raise NotImplementedError
2244 # Initialize NSM (that is, announce ourselves to it).
2245 # Must be called as early as possible in the program's lifecycle.
2246 # Returns true if NSM is available and initialized correctly.
2247 @abstractmethod
2248 def nsm_init(self, pid, executableName):
2249 raise NotImplementedError
2251 # Respond to an NSM callback.
2252 @abstractmethod
2253 def nsm_ready(self, opcode):
2254 raise NotImplementedError
2256 # ---------------------------------------------------------------------------------------------------------------------
2257 # Carla Host object (dummy/null, does nothing)
2259 class CarlaHostNull(CarlaHostMeta):
2260 def __init__(self):
2261 CarlaHostMeta.__init__(self)
2263 self.fEngineCallback = None
2264 self.fFileCallback = None
2265 self.fEngineRunning = False
2267 def get_engine_driver_count(self):
2268 return 0
2270 def get_engine_driver_name(self, index):
2271 return ""
2273 def get_engine_driver_device_names(self, index):
2274 return []
2276 def get_engine_driver_device_info(self, index, name):
2277 return PyEngineDriverDeviceInfo
2279 def show_engine_driver_device_control_panel(self, index, name):
2280 return False
2282 def engine_init(self, driverName, clientName):
2283 self.fEngineRunning = True
2284 if self.fEngineCallback is not None:
2285 self.fEngineCallback(None,
2286 ENGINE_CALLBACK_ENGINE_STARTED,
2288 self.processMode,
2289 self.transportMode,
2290 0, 0.0,
2291 driverName)
2292 return True
2294 def engine_close(self):
2295 self.fEngineRunning = False
2296 if self.fEngineCallback is not None:
2297 self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0, 0.0, "")
2298 return True
2300 def engine_idle(self):
2301 return
2303 def is_engine_running(self):
2304 return self.fEngineRunning
2306 def get_runtime_engine_info(self):
2307 return PyCarlaRuntimeEngineInfo
2309 def get_runtime_engine_driver_device_info(self):
2310 return PyCarlaRuntimeEngineDriverDeviceInfo
2312 def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
2313 return False
2315 def show_engine_device_control_panel(self):
2316 return False
2318 def clear_engine_xruns(self):
2319 return
2321 def cancel_engine_action(self):
2322 return
2324 def set_engine_about_to_close(self):
2325 return True
2327 def set_engine_callback(self, func):
2328 self.fEngineCallback = func
2330 def set_engine_option(self, option, value, valueStr):
2331 return
2333 def set_file_callback(self, func):
2334 self.fFileCallback = func
2336 def load_file(self, filename):
2337 return False
2339 def load_project(self, filename):
2340 return False
2342 def save_project(self, filename):
2343 return False
2345 def clear_project_filename(self):
2346 return
2348 def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
2349 return False
2351 def patchbay_disconnect(self, external, connectionId):
2352 return False
2354 def patchbay_set_group_pos(self, external, groupId, x1, y1, x2, y2):
2355 return False
2357 def patchbay_refresh(self, external):
2358 return False
2360 def transport_play(self):
2361 return
2363 def transport_pause(self):
2364 return
2366 def transport_bpm(self, bpm):
2367 return
2369 def transport_relocate(self, frame):
2370 return
2372 def get_current_transport_frame(self):
2373 return 0
2375 def get_transport_info(self):
2376 return PyCarlaTransportInfo
2378 def get_current_plugin_count(self):
2379 return 0
2381 def get_max_plugin_number(self):
2382 return 0
2384 def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
2385 return False
2387 def remove_plugin(self, pluginId):
2388 return False
2390 def remove_all_plugins(self):
2391 return False
2393 def rename_plugin(self, pluginId, newName):
2394 return False
2396 def clone_plugin(self, pluginId):
2397 return False
2399 def replace_plugin(self, pluginId):
2400 return False
2402 def switch_plugins(self, pluginIdA, pluginIdB):
2403 return False
2405 def load_plugin_state(self, pluginId, filename):
2406 return False
2408 def save_plugin_state(self, pluginId, filename):
2409 return False
2411 def export_plugin_lv2(self, pluginId, lv2path):
2412 return False
2414 def get_plugin_info(self, pluginId):
2415 return PyCarlaPluginInfo
2417 def get_audio_port_count_info(self, pluginId):
2418 return PyCarlaPortCountInfo
2420 def get_midi_port_count_info(self, pluginId):
2421 return PyCarlaPortCountInfo
2423 def get_parameter_count_info(self, pluginId):
2424 return PyCarlaPortCountInfo
2426 def get_parameter_info(self, pluginId, parameterId):
2427 return PyCarlaParameterInfo
2429 def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
2430 return PyCarlaScalePointInfo
2432 def get_parameter_data(self, pluginId, parameterId):
2433 return PyParameterData
2435 def get_parameter_ranges(self, pluginId, parameterId):
2436 return PyParameterRanges
2438 def get_midi_program_data(self, pluginId, midiProgramId):
2439 return PyMidiProgramData
2441 def get_custom_data(self, pluginId, customDataId):
2442 return PyCustomData
2444 def get_custom_data_value(self, pluginId, type_, key):
2445 return ""
2447 def get_chunk_data(self, pluginId):
2448 return ""
2450 def get_parameter_count(self, pluginId):
2451 return 0
2453 def get_program_count(self, pluginId):
2454 return 0
2456 def get_midi_program_count(self, pluginId):
2457 return 0
2459 def get_custom_data_count(self, pluginId):
2460 return 0
2462 def get_parameter_text(self, pluginId, parameterId):
2463 return ""
2465 def get_program_name(self, pluginId, programId):
2466 return ""
2468 def get_midi_program_name(self, pluginId, midiProgramId):
2469 return ""
2471 def get_real_plugin_name(self, pluginId):
2472 return ""
2474 def get_current_program_index(self, pluginId):
2475 return 0
2477 def get_current_midi_program_index(self, pluginId):
2478 return 0
2480 def get_default_parameter_value(self, pluginId, parameterId):
2481 return 0.0
2483 def get_current_parameter_value(self, pluginId, parameterId):
2484 return 0.0
2486 def get_internal_parameter_value(self, pluginId, parameterId):
2487 return 0.0
2489 def get_input_peak_value(self, pluginId, isLeft):
2490 return 0.0
2492 def get_output_peak_value(self, pluginId, isLeft):
2493 return 0.0
2495 def render_inline_display(self, pluginId, width, height):
2496 return None
2498 def set_option(self, pluginId, option, yesNo):
2499 return
2501 def set_active(self, pluginId, onOff):
2502 return
2504 def set_drywet(self, pluginId, value):
2505 return
2507 def set_volume(self, pluginId, value):
2508 return
2510 def set_balance_left(self, pluginId, value):
2511 return
2513 def set_balance_right(self, pluginId, value):
2514 return
2516 def set_panning(self, pluginId, value):
2517 return
2519 def set_ctrl_channel(self, pluginId, channel):
2520 return
2522 def set_parameter_value(self, pluginId, parameterId, value):
2523 return
2525 def set_parameter_midi_channel(self, pluginId, parameterId, channel):
2526 return
2528 def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
2529 return
2531 def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
2532 return
2534 def set_parameter_touch(self, pluginId, parameterId, touch):
2535 return
2537 def set_program(self, pluginId, programId):
2538 return
2540 def set_midi_program(self, pluginId, midiProgramId):
2541 return
2543 def set_custom_data(self, pluginId, type_, key, value):
2544 return
2546 def set_chunk_data(self, pluginId, chunkData):
2547 return
2549 def prepare_for_save(self, pluginId):
2550 return
2552 def reset_parameters(self, pluginId):
2553 return
2555 def randomize_parameters(self, pluginId):
2556 return
2558 def send_midi_note(self, pluginId, channel, note, velocity):
2559 return
2561 def show_custom_ui(self, pluginId, yesNo):
2562 return
2564 def get_buffer_size(self):
2565 return 0
2567 def get_sample_rate(self):
2568 return 0.0
2570 def get_last_error(self):
2571 return ""
2573 def get_host_osc_url_tcp(self):
2574 return ""
2576 def get_host_osc_url_udp(self):
2577 return ""
2579 def nsm_init(self, pid, executableName):
2580 return False
2582 def nsm_ready(self, opcode):
2583 return
2585 # ---------------------------------------------------------------------------------------------------------------------
2586 # Carla Host object using a DLL
2588 class CarlaHostDLL(CarlaHostMeta):
2589 def __init__(self, libName, loadGlobal):
2590 CarlaHostMeta.__init__(self)
2592 # info about this host object
2593 self.isPlugin = False
2595 self.lib = CDLL(libName, RTLD_GLOBAL if loadGlobal else RTLD_LOCAL)
2597 self.lib.carla_get_engine_driver_count.argtypes = None
2598 self.lib.carla_get_engine_driver_count.restype = c_uint
2600 self.lib.carla_get_engine_driver_name.argtypes = (c_uint,)
2601 self.lib.carla_get_engine_driver_name.restype = c_char_p
2603 self.lib.carla_get_engine_driver_device_names.argtypes = (c_uint,)
2604 self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)
2606 self.lib.carla_get_engine_driver_device_info.argtypes = (c_uint, c_char_p)
2607 self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)
2609 self.lib.carla_show_engine_driver_device_control_panel.argtypes = (c_uint, c_char_p)
2610 self.lib.carla_show_engine_driver_device_control_panel.restype = c_bool
2612 self.lib.carla_standalone_host_init.argtypes = None
2613 self.lib.carla_standalone_host_init.restype = c_void_p
2615 self.lib.carla_engine_init.argtypes = (c_void_p, c_char_p, c_char_p)
2616 self.lib.carla_engine_init.restype = c_bool
2618 self.lib.carla_engine_close.argtypes = (c_void_p,)
2619 self.lib.carla_engine_close.restype = c_bool
2621 self.lib.carla_engine_idle.argtypes = (c_void_p,)
2622 self.lib.carla_engine_idle.restype = None
2624 self.lib.carla_is_engine_running.argtypes = (c_void_p,)
2625 self.lib.carla_is_engine_running.restype = c_bool
2627 self.lib.carla_get_runtime_engine_info.argtypes = (c_void_p,)
2628 self.lib.carla_get_runtime_engine_info.restype = POINTER(CarlaRuntimeEngineInfo)
2630 self.lib.carla_get_runtime_engine_driver_device_info.argtypes = (c_void_p,)
2631 self.lib.carla_get_runtime_engine_driver_device_info.restype = POINTER(CarlaRuntimeEngineDriverDeviceInfo)
2633 self.lib.carla_set_engine_buffer_size_and_sample_rate.argtypes = (c_void_p, c_uint, c_double)
2634 self.lib.carla_set_engine_buffer_size_and_sample_rate.restype = c_bool
2636 self.lib.carla_show_engine_device_control_panel.argtypes = (c_void_p,)
2637 self.lib.carla_show_engine_device_control_panel.restype = c_bool
2639 self.lib.carla_clear_engine_xruns.argtypes = (c_void_p,)
2640 self.lib.carla_clear_engine_xruns.restype = None
2642 self.lib.carla_cancel_engine_action.argtypes = (c_void_p,)
2643 self.lib.carla_cancel_engine_action.restype = None
2645 self.lib.carla_set_engine_about_to_close.argtypes = (c_void_p,)
2646 self.lib.carla_set_engine_about_to_close.restype = c_bool
2648 self.lib.carla_set_engine_callback.argtypes = (c_void_p, EngineCallbackFunc, c_void_p)
2649 self.lib.carla_set_engine_callback.restype = None
2651 self.lib.carla_set_engine_option.argtypes = (c_void_p, c_enum, c_int, c_char_p)
2652 self.lib.carla_set_engine_option.restype = None
2654 self.lib.carla_set_file_callback.argtypes = (c_void_p, FileCallbackFunc, c_void_p)
2655 self.lib.carla_set_file_callback.restype = None
2657 self.lib.carla_load_file.argtypes = (c_void_p, c_char_p)
2658 self.lib.carla_load_file.restype = c_bool
2660 self.lib.carla_load_project.argtypes = (c_void_p, c_char_p)
2661 self.lib.carla_load_project.restype = c_bool
2663 self.lib.carla_save_project.argtypes = (c_void_p, c_char_p)
2664 self.lib.carla_save_project.restype = c_bool
2666 self.lib.carla_clear_project_filename.argtypes = (c_void_p,)
2667 self.lib.carla_clear_project_filename.restype = None
2669 self.lib.carla_patchbay_connect.argtypes = (c_void_p, c_bool, c_uint, c_uint, c_uint, c_uint)
2670 self.lib.carla_patchbay_connect.restype = c_bool
2672 self.lib.carla_patchbay_disconnect.argtypes = (c_void_p, c_bool, c_uint)
2673 self.lib.carla_patchbay_disconnect.restype = c_bool
2675 self.lib.carla_patchbay_set_group_pos.argtypes = (c_void_p, c_bool, c_uint, c_int, c_int, c_int, c_int)
2676 self.lib.carla_patchbay_set_group_pos.restype = c_bool
2678 self.lib.carla_patchbay_refresh.argtypes = (c_void_p, c_bool)
2679 self.lib.carla_patchbay_refresh.restype = c_bool
2681 self.lib.carla_transport_play.argtypes = (c_void_p,)
2682 self.lib.carla_transport_play.restype = None
2684 self.lib.carla_transport_pause.argtypes = (c_void_p,)
2685 self.lib.carla_transport_pause.restype = None
2687 self.lib.carla_transport_bpm.argtypes = (c_void_p, c_double)
2688 self.lib.carla_transport_bpm.restype = None
2690 self.lib.carla_transport_relocate.argtypes = (c_void_p, c_uint64)
2691 self.lib.carla_transport_relocate.restype = None
2693 self.lib.carla_get_current_transport_frame.argtypes = (c_void_p,)
2694 self.lib.carla_get_current_transport_frame.restype = c_uint64
2696 self.lib.carla_get_transport_info.argtypes = (c_void_p,)
2697 self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
2699 self.lib.carla_get_current_plugin_count.argtypes = (c_void_p,)
2700 self.lib.carla_get_current_plugin_count.restype = c_uint32
2702 self.lib.carla_get_max_plugin_number.argtypes = (c_void_p,)
2703 self.lib.carla_get_max_plugin_number.restype = c_uint32
2705 self.lib.carla_add_plugin.argtypes = (c_void_p, c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_int64,
2706 c_void_p, c_uint)
2707 self.lib.carla_add_plugin.restype = c_bool
2709 self.lib.carla_remove_plugin.argtypes = (c_void_p, c_uint)
2710 self.lib.carla_remove_plugin.restype = c_bool
2712 self.lib.carla_remove_all_plugins.argtypes = (c_void_p,)
2713 self.lib.carla_remove_all_plugins.restype = c_bool
2715 self.lib.carla_rename_plugin.argtypes = (c_void_p, c_uint, c_char_p)
2716 self.lib.carla_rename_plugin.restype = c_bool
2718 self.lib.carla_clone_plugin.argtypes = (c_void_p, c_uint)
2719 self.lib.carla_clone_plugin.restype = c_bool
2721 self.lib.carla_replace_plugin.argtypes = (c_void_p, c_uint)
2722 self.lib.carla_replace_plugin.restype = c_bool
2724 self.lib.carla_switch_plugins.argtypes = (c_void_p, c_uint, c_uint)
2725 self.lib.carla_switch_plugins.restype = c_bool
2727 self.lib.carla_load_plugin_state.argtypes = (c_void_p, c_uint, c_char_p)
2728 self.lib.carla_load_plugin_state.restype = c_bool
2730 self.lib.carla_save_plugin_state.argtypes = (c_void_p, c_uint, c_char_p)
2731 self.lib.carla_save_plugin_state.restype = c_bool
2733 self.lib.carla_export_plugin_lv2.argtypes = (c_void_p, c_uint, c_char_p)
2734 self.lib.carla_export_plugin_lv2.restype = c_bool
2736 self.lib.carla_get_plugin_info.argtypes = (c_void_p, c_uint)
2737 self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
2739 self.lib.carla_get_audio_port_count_info.argtypes = (c_void_p, c_uint)
2740 self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
2742 self.lib.carla_get_midi_port_count_info.argtypes = (c_void_p, c_uint)
2743 self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
2745 self.lib.carla_get_parameter_count_info.argtypes = (c_void_p, c_uint)
2746 self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
2748 self.lib.carla_get_parameter_info.argtypes = (c_void_p, c_uint, c_uint32)
2749 self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
2751 self.lib.carla_get_parameter_scalepoint_info.argtypes = (c_void_p, c_uint, c_uint32, c_uint32)
2752 self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
2754 self.lib.carla_get_parameter_data.argtypes = (c_void_p, c_uint, c_uint32)
2755 self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
2757 self.lib.carla_get_parameter_ranges.argtypes = (c_void_p, c_uint, c_uint32)
2758 self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
2760 self.lib.carla_get_midi_program_data.argtypes = (c_void_p, c_uint, c_uint32)
2761 self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
2763 self.lib.carla_get_custom_data.argtypes = (c_void_p, c_uint, c_uint32)
2764 self.lib.carla_get_custom_data.restype = POINTER(CustomData)
2766 self.lib.carla_get_custom_data_value.argtypes = (c_void_p, c_uint, c_char_p, c_char_p)
2767 self.lib.carla_get_custom_data_value.restype = c_char_p
2769 self.lib.carla_get_chunk_data.argtypes = (c_void_p, c_uint)
2770 self.lib.carla_get_chunk_data.restype = c_char_p
2772 self.lib.carla_get_parameter_count.argtypes = (c_void_p, c_uint)
2773 self.lib.carla_get_parameter_count.restype = c_uint32
2775 self.lib.carla_get_program_count.argtypes = (c_void_p, c_uint)
2776 self.lib.carla_get_program_count.restype = c_uint32
2778 self.lib.carla_get_midi_program_count.argtypes = (c_void_p, c_uint)
2779 self.lib.carla_get_midi_program_count.restype = c_uint32
2781 self.lib.carla_get_custom_data_count.argtypes = (c_void_p, c_uint)
2782 self.lib.carla_get_custom_data_count.restype = c_uint32
2784 self.lib.carla_get_parameter_text.argtypes = (c_void_p, c_uint, c_uint32)
2785 self.lib.carla_get_parameter_text.restype = c_char_p
2787 self.lib.carla_get_program_name.argtypes = (c_void_p, c_uint, c_uint32)
2788 self.lib.carla_get_program_name.restype = c_char_p
2790 self.lib.carla_get_midi_program_name.argtypes = (c_void_p, c_uint, c_uint32)
2791 self.lib.carla_get_midi_program_name.restype = c_char_p
2793 self.lib.carla_get_real_plugin_name.argtypes = (c_void_p, c_uint)
2794 self.lib.carla_get_real_plugin_name.restype = c_char_p
2796 self.lib.carla_get_current_program_index.argtypes = (c_void_p, c_uint)
2797 self.lib.carla_get_current_program_index.restype = c_int32
2799 self.lib.carla_get_current_midi_program_index.argtypes = (c_void_p, c_uint)
2800 self.lib.carla_get_current_midi_program_index.restype = c_int32
2802 self.lib.carla_get_default_parameter_value.argtypes = (c_void_p, c_uint, c_uint32)
2803 self.lib.carla_get_default_parameter_value.restype = c_float
2805 self.lib.carla_get_current_parameter_value.argtypes = (c_void_p, c_uint, c_uint32)
2806 self.lib.carla_get_current_parameter_value.restype = c_float
2808 self.lib.carla_get_internal_parameter_value.argtypes = (c_void_p, c_uint, c_int32)
2809 self.lib.carla_get_internal_parameter_value.restype = c_float
2811 self.lib.carla_get_input_peak_value.argtypes = (c_void_p, c_uint, c_bool)
2812 self.lib.carla_get_input_peak_value.restype = c_float
2814 self.lib.carla_get_output_peak_value.argtypes = (c_void_p, c_uint, c_bool)
2815 self.lib.carla_get_output_peak_value.restype = c_float
2817 self.lib.carla_render_inline_display.argtypes = (c_void_p, c_uint, c_uint, c_uint)
2818 self.lib.carla_render_inline_display.restype = POINTER(CarlaInlineDisplayImageSurface)
2820 self.lib.carla_set_option.argtypes = (c_void_p, c_uint, c_uint, c_bool)
2821 self.lib.carla_set_option.restype = None
2823 self.lib.carla_set_active.argtypes = (c_void_p, c_uint, c_bool)
2824 self.lib.carla_set_active.restype = None
2826 self.lib.carla_set_drywet.argtypes = (c_void_p, c_uint, c_float)
2827 self.lib.carla_set_drywet.restype = None
2829 self.lib.carla_set_volume.argtypes = (c_void_p, c_uint, c_float)
2830 self.lib.carla_set_volume.restype = None
2832 self.lib.carla_set_balance_left.argtypes = (c_void_p, c_uint, c_float)
2833 self.lib.carla_set_balance_left.restype = None
2835 self.lib.carla_set_balance_right.argtypes = (c_void_p, c_uint, c_float)
2836 self.lib.carla_set_balance_right.restype = None
2838 self.lib.carla_set_panning.argtypes = (c_void_p, c_uint, c_float)
2839 self.lib.carla_set_panning.restype = None
2841 self.lib.carla_set_ctrl_channel.argtypes = (c_void_p, c_uint, c_int8)
2842 self.lib.carla_set_ctrl_channel.restype = None
2844 self.lib.carla_set_parameter_value.argtypes = (c_void_p, c_uint, c_uint32, c_float)
2845 self.lib.carla_set_parameter_value.restype = None
2847 self.lib.carla_set_parameter_midi_channel.argtypes = (c_void_p, c_uint, c_uint32, c_uint8)
2848 self.lib.carla_set_parameter_midi_channel.restype = None
2850 self.lib.carla_set_parameter_mapped_control_index.argtypes = (c_void_p, c_uint, c_uint32, c_int16)
2851 self.lib.carla_set_parameter_mapped_control_index.restype = None
2853 self.lib.carla_set_parameter_mapped_range.argtypes = (c_void_p, c_uint, c_uint32, c_float, c_float)
2854 self.lib.carla_set_parameter_mapped_range.restype = None
2856 self.lib.carla_set_parameter_touch.argtypes = (c_void_p, c_uint, c_uint32, c_bool)
2857 self.lib.carla_set_parameter_touch.restype = None
2859 self.lib.carla_set_program.argtypes = (c_void_p, c_uint, c_uint32)
2860 self.lib.carla_set_program.restype = None
2862 self.lib.carla_set_midi_program.argtypes = (c_void_p, c_uint, c_uint32)
2863 self.lib.carla_set_midi_program.restype = None
2865 self.lib.carla_set_custom_data.argtypes = (c_void_p, c_uint, c_char_p, c_char_p, c_char_p)
2866 self.lib.carla_set_custom_data.restype = None
2868 self.lib.carla_set_chunk_data.argtypes = (c_void_p, c_uint, c_char_p)
2869 self.lib.carla_set_chunk_data.restype = None
2871 self.lib.carla_prepare_for_save.argtypes = (c_void_p, c_uint)
2872 self.lib.carla_prepare_for_save.restype = None
2874 self.lib.carla_reset_parameters.argtypes = (c_void_p, c_uint)
2875 self.lib.carla_reset_parameters.restype = None
2877 self.lib.carla_randomize_parameters.argtypes = (c_void_p, c_uint)
2878 self.lib.carla_randomize_parameters.restype = None
2880 self.lib.carla_send_midi_note.argtypes = (c_void_p, c_uint, c_uint8, c_uint8, c_uint8)
2881 self.lib.carla_send_midi_note.restype = None
2883 self.lib.carla_show_custom_ui.argtypes = (c_void_p, c_uint, c_bool)
2884 self.lib.carla_show_custom_ui.restype = None
2886 self.lib.carla_get_buffer_size.argtypes = (c_void_p,)
2887 self.lib.carla_get_buffer_size.restype = c_uint32
2889 self.lib.carla_get_sample_rate.argtypes = (c_void_p,)
2890 self.lib.carla_get_sample_rate.restype = c_double
2892 self.lib.carla_get_last_error.argtypes = (c_void_p,)
2893 self.lib.carla_get_last_error.restype = c_char_p
2895 self.lib.carla_get_host_osc_url_tcp.argtypes = (c_void_p,)
2896 self.lib.carla_get_host_osc_url_tcp.restype = c_char_p
2898 self.lib.carla_get_host_osc_url_udp.argtypes = (c_void_p,)
2899 self.lib.carla_get_host_osc_url_udp.restype = c_char_p
2901 self.lib.carla_nsm_init.argtypes = (c_void_p, c_uint64, c_char_p)
2902 self.lib.carla_nsm_init.restype = c_bool
2904 self.lib.carla_nsm_ready.argtypes = (c_void_p, c_int)
2905 self.lib.carla_nsm_ready.restype = None
2907 self.handle = self.lib.carla_standalone_host_init()
2909 self._engineCallback = None
2910 self._fileCallback = None
2912 # --------------------------------------------------------------------------------------------------------
2914 def get_engine_driver_count(self):
2915 return int(self.lib.carla_get_engine_driver_count())
2917 def get_engine_driver_name(self, index):
2918 return charPtrToString(self.lib.carla_get_engine_driver_name(index))
2920 def get_engine_driver_device_names(self, index):
2921 return charPtrPtrToStringList(self.lib.carla_get_engine_driver_device_names(index))
2923 def get_engine_driver_device_info(self, index, name):
2924 return structToDict(self.lib.carla_get_engine_driver_device_info(index, name.encode("utf-8")).contents)
2926 def show_engine_driver_device_control_panel(self, index, name):
2927 return bool(self.lib.carla_show_engine_driver_device_control_panel(index, name.encode("utf-8")))
2929 def engine_init(self, driverName, clientName):
2930 return bool(self.lib.carla_engine_init(self.handle, driverName.encode("utf-8"), clientName.encode("utf-8")))
2932 def engine_close(self):
2933 return bool(self.lib.carla_engine_close(self.handle))
2935 def engine_idle(self):
2936 self.lib.carla_engine_idle(self.handle)
2938 def is_engine_running(self):
2939 return bool(self.lib.carla_is_engine_running(self.handle))
2941 def get_runtime_engine_info(self):
2942 return structToDict(self.lib.carla_get_runtime_engine_info(self.handle).contents)
2944 def get_runtime_engine_driver_device_info(self):
2945 return structToDict(self.lib.carla_get_runtime_engine_driver_device_info(self.handle).contents)
2947 def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
2948 return bool(self.lib.carla_set_engine_buffer_size_and_sample_rate(self.handle, bufferSize, sampleRate))
2950 def show_engine_device_control_panel(self):
2951 return bool(self.lib.carla_show_engine_device_control_panel(self.handle))
2953 def clear_engine_xruns(self):
2954 self.lib.carla_clear_engine_xruns(self.handle)
2956 def cancel_engine_action(self):
2957 self.lib.carla_cancel_engine_action(self.handle)
2959 def set_engine_about_to_close(self):
2960 return bool(self.lib.carla_set_engine_about_to_close(self.handle))
2962 def set_engine_callback(self, func):
2963 self._engineCallback = EngineCallbackFunc(func)
2964 self.lib.carla_set_engine_callback(self.handle, self._engineCallback, None)
2966 def set_engine_option(self, option, value, valueStr):
2967 self.lib.carla_set_engine_option(self.handle, option, value, valueStr.encode("utf-8"))
2969 def set_file_callback(self, func):
2970 self._fileCallback = FileCallbackFunc(func)
2971 self.lib.carla_set_file_callback(self.handle, self._fileCallback, None)
2973 def load_file(self, filename):
2974 return bool(self.lib.carla_load_file(self.handle, filename.encode("utf-8")))
2976 def load_project(self, filename):
2977 return bool(self.lib.carla_load_project(self.handle, filename.encode("utf-8")))
2979 def save_project(self, filename):
2980 return bool(self.lib.carla_save_project(self.handle, filename.encode("utf-8")))
2982 def clear_project_filename(self):
2983 self.lib.carla_clear_project_filename(self.handle)
2985 def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
2986 return bool(self.lib.carla_patchbay_connect(self.handle, external, groupIdA, portIdA, groupIdB, portIdB))
2988 def patchbay_disconnect(self, external, connectionId):
2989 return bool(self.lib.carla_patchbay_disconnect(self.handle, external, connectionId))
2991 def patchbay_set_group_pos(self, external, groupId, x1, y1, x2, y2):
2992 return bool(self.lib.carla_patchbay_set_group_pos(self.handle, external, groupId, x1, y1, x2, y2))
2994 def patchbay_refresh(self, external):
2995 return bool(self.lib.carla_patchbay_refresh(self.handle, external))
2997 def transport_play(self):
2998 self.lib.carla_transport_play(self.handle)
3000 def transport_pause(self):
3001 self.lib.carla_transport_pause(self.handle)
3003 def transport_bpm(self, bpm):
3004 self.lib.carla_transport_bpm(self.handle, bpm)
3006 def transport_relocate(self, frame):
3007 self.lib.carla_transport_relocate(self.handle, frame)
3009 def get_current_transport_frame(self):
3010 return int(self.lib.carla_get_current_transport_frame(self.handle))
3012 def get_transport_info(self):
3013 return structToDict(self.lib.carla_get_transport_info(self.handle).contents)
3015 def get_current_plugin_count(self):
3016 return int(self.lib.carla_get_current_plugin_count(self.handle))
3018 def get_max_plugin_number(self):
3019 return int(self.lib.carla_get_max_plugin_number(self.handle))
3021 def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
3022 cfilename = filename.encode("utf-8") if filename else None
3023 cname = name.encode("utf-8") if name else None
3024 if ptype == PLUGIN_JACK:
3025 clabel = bytes(ord(b) for b in label)
3026 else:
3027 clabel = label.encode("utf-8") if label else None
3028 return bool(self.lib.carla_add_plugin(self.handle,
3029 btype, ptype,
3030 cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p), options))
3032 def remove_plugin(self, pluginId):
3033 return bool(self.lib.carla_remove_plugin(self.handle, pluginId))
3035 def remove_all_plugins(self):
3036 return bool(self.lib.carla_remove_all_plugins(self.handle))
3038 def rename_plugin(self, pluginId, newName):
3039 return bool(self.lib.carla_rename_plugin(self.handle, pluginId, newName.encode("utf-8")))
3041 def clone_plugin(self, pluginId):
3042 return bool(self.lib.carla_clone_plugin(self.handle, pluginId))
3044 def replace_plugin(self, pluginId):
3045 return bool(self.lib.carla_replace_plugin(self.handle, pluginId))
3047 def switch_plugins(self, pluginIdA, pluginIdB):
3048 return bool(self.lib.carla_switch_plugins(self.handle, pluginIdA, pluginIdB))
3050 def load_plugin_state(self, pluginId, filename):
3051 return bool(self.lib.carla_load_plugin_state(self.handle, pluginId, filename.encode("utf-8")))
3053 def save_plugin_state(self, pluginId, filename):
3054 return bool(self.lib.carla_save_plugin_state(self.handle, pluginId, filename.encode("utf-8")))
3056 def export_plugin_lv2(self, pluginId, lv2path):
3057 return bool(self.lib.carla_export_plugin_lv2(self.handle, pluginId, lv2path.encode("utf-8")))
3059 def get_plugin_info(self, pluginId):
3060 return structToDict(self.lib.carla_get_plugin_info(self.handle, pluginId).contents)
3062 def get_audio_port_count_info(self, pluginId):
3063 return structToDict(self.lib.carla_get_audio_port_count_info(self.handle, pluginId).contents)
3065 def get_midi_port_count_info(self, pluginId):
3066 return structToDict(self.lib.carla_get_midi_port_count_info(self.handle, pluginId).contents)
3068 def get_parameter_count_info(self, pluginId):
3069 return structToDict(self.lib.carla_get_parameter_count_info(self.handle, pluginId).contents)
3071 def get_parameter_info(self, pluginId, parameterId):
3072 return structToDict(self.lib.carla_get_parameter_info(self.handle, pluginId, parameterId).contents)
3074 def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
3075 return structToDict(self.lib.carla_get_parameter_scalepoint_info(self.handle,
3076 pluginId,
3077 parameterId,
3078 scalePointId).contents)
3080 def get_parameter_data(self, pluginId, parameterId):
3081 return structToDict(self.lib.carla_get_parameter_data(self.handle, pluginId, parameterId).contents)
3083 def get_parameter_ranges(self, pluginId, parameterId):
3084 return structToDict(self.lib.carla_get_parameter_ranges(self.handle, pluginId, parameterId).contents)
3086 def get_midi_program_data(self, pluginId, midiProgramId):
3087 return structToDict(self.lib.carla_get_midi_program_data(self.handle, pluginId, midiProgramId).contents)
3089 def get_custom_data(self, pluginId, customDataId):
3090 return structToDict(self.lib.carla_get_custom_data(self.handle, pluginId, customDataId).contents)
3092 def get_custom_data_value(self, pluginId, type_, key):
3093 return charPtrToString(self.lib.carla_get_custom_data_value(self.handle,
3094 pluginId,
3095 type_.encode("utf-8"),
3096 key.encode("utf-8")))
3098 def get_chunk_data(self, pluginId):
3099 return charPtrToString(self.lib.carla_get_chunk_data(self.handle, pluginId))
3101 def get_parameter_count(self, pluginId):
3102 return int(self.lib.carla_get_parameter_count(self.handle, pluginId))
3104 def get_program_count(self, pluginId):
3105 return int(self.lib.carla_get_program_count(self.handle, pluginId))
3107 def get_midi_program_count(self, pluginId):
3108 return int(self.lib.carla_get_midi_program_count(self.handle, pluginId))
3110 def get_custom_data_count(self, pluginId):
3111 return int(self.lib.carla_get_custom_data_count(self.handle, pluginId))
3113 def get_parameter_text(self, pluginId, parameterId):
3114 return charPtrToString(self.lib.carla_get_parameter_text(self.handle, pluginId, parameterId))
3116 def get_program_name(self, pluginId, programId):
3117 return charPtrToString(self.lib.carla_get_program_name(self.handle, pluginId, programId))
3119 def get_midi_program_name(self, pluginId, midiProgramId):
3120 return charPtrToString(self.lib.carla_get_midi_program_name(self.handle, pluginId, midiProgramId))
3122 def get_real_plugin_name(self, pluginId):
3123 return charPtrToString(self.lib.carla_get_real_plugin_name(self.handle, pluginId))
3125 def get_current_program_index(self, pluginId):
3126 return int(self.lib.carla_get_current_program_index(self.handle, pluginId))
3128 def get_current_midi_program_index(self, pluginId):
3129 return int(self.lib.carla_get_current_midi_program_index(self.handle, pluginId))
3131 def get_default_parameter_value(self, pluginId, parameterId):
3132 return float(self.lib.carla_get_default_parameter_value(self.handle, pluginId, parameterId))
3134 def get_current_parameter_value(self, pluginId, parameterId):
3135 return float(self.lib.carla_get_current_parameter_value(self.handle, pluginId, parameterId))
3137 def get_internal_parameter_value(self, pluginId, parameterId):
3138 return float(self.lib.carla_get_internal_parameter_value(self.handle, pluginId, parameterId))
3140 def get_input_peak_value(self, pluginId, isLeft):
3141 return float(self.lib.carla_get_input_peak_value(self.handle, pluginId, isLeft))
3143 def get_output_peak_value(self, pluginId, isLeft):
3144 return float(self.lib.carla_get_output_peak_value(self.handle, pluginId, isLeft))
3146 def render_inline_display(self, pluginId, width, height):
3147 ptr = self.lib.carla_render_inline_display(self.handle, pluginId, width, height)
3148 if not ptr or not ptr.contents:
3149 return None
3150 contents = ptr.contents
3151 datalen = contents.height * contents.stride
3152 databuf = pack("%iB" % datalen, *contents.data[:datalen])
3153 data = {
3154 'data': databuf,
3155 'width': contents.width,
3156 'height': contents.height,
3157 'stride': contents.stride,
3159 return data
3161 def set_option(self, pluginId, option, yesNo):
3162 self.lib.carla_set_option(self.handle, pluginId, option, yesNo)
3164 def set_active(self, pluginId, onOff):
3165 self.lib.carla_set_active(self.handle, pluginId, onOff)
3167 def set_drywet(self, pluginId, value):
3168 self.lib.carla_set_drywet(self.handle, pluginId, value)
3170 def set_volume(self, pluginId, value):
3171 self.lib.carla_set_volume(self.handle, pluginId, value)
3173 def set_balance_left(self, pluginId, value):
3174 self.lib.carla_set_balance_left(self.handle, pluginId, value)
3176 def set_balance_right(self, pluginId, value):
3177 self.lib.carla_set_balance_right(self.handle, pluginId, value)
3179 def set_panning(self, pluginId, value):
3180 self.lib.carla_set_panning(self.handle, pluginId, value)
3182 def set_ctrl_channel(self, pluginId, channel):
3183 self.lib.carla_set_ctrl_channel(self.handle, pluginId, channel)
3185 def set_parameter_value(self, pluginId, parameterId, value):
3186 self.lib.carla_set_parameter_value(self.handle, pluginId, parameterId, value)
3188 def set_parameter_midi_channel(self, pluginId, parameterId, channel):
3189 self.lib.carla_set_parameter_midi_channel(self.handle, pluginId, parameterId, channel)
3191 def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
3192 self.lib.carla_set_parameter_mapped_control_index(self.handle, pluginId, parameterId, index)
3194 def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
3195 self.lib.carla_set_parameter_mapped_range(self.handle, pluginId, parameterId, minimum, maximum)
3197 def set_parameter_touch(self, pluginId, parameterId, touch):
3198 self.lib.carla_set_parameter_touch(self.handle, pluginId, parameterId, touch)
3200 def set_program(self, pluginId, programId):
3201 self.lib.carla_set_program(self.handle, pluginId, programId)
3203 def set_midi_program(self, pluginId, midiProgramId):
3204 self.lib.carla_set_midi_program(self.handle, pluginId, midiProgramId)
3206 def set_custom_data(self, pluginId, type_, key, value):
3207 self.lib.carla_set_custom_data(self.handle,
3208 pluginId,
3209 type_.encode("utf-8"),
3210 key.encode("utf-8"),
3211 value.encode("utf-8"))
3213 def set_chunk_data(self, pluginId, chunkData):
3214 self.lib.carla_set_chunk_data(self.handle, pluginId, chunkData.encode("utf-8"))
3216 def prepare_for_save(self, pluginId):
3217 self.lib.carla_prepare_for_save(self.handle, pluginId)
3219 def reset_parameters(self, pluginId):
3220 self.lib.carla_reset_parameters(self.handle, pluginId)
3222 def randomize_parameters(self, pluginId):
3223 self.lib.carla_randomize_parameters(self.handle, pluginId)
3225 def send_midi_note(self, pluginId, channel, note, velocity):
3226 self.lib.carla_send_midi_note(self.handle, pluginId, channel, note, velocity)
3228 def show_custom_ui(self, pluginId, yesNo):
3229 self.lib.carla_show_custom_ui(self.handle, pluginId, yesNo)
3231 def get_buffer_size(self):
3232 return int(self.lib.carla_get_buffer_size(self.handle))
3234 def get_sample_rate(self):
3235 return float(self.lib.carla_get_sample_rate(self.handle))
3237 def get_last_error(self):
3238 return charPtrToString(self.lib.carla_get_last_error(self.handle))
3240 def get_host_osc_url_tcp(self):
3241 return charPtrToString(self.lib.carla_get_host_osc_url_tcp(self.handle))
3243 def get_host_osc_url_udp(self):
3244 return charPtrToString(self.lib.carla_get_host_osc_url_udp(self.handle))
3246 def nsm_init(self, pid, executableName):
3247 return bool(self.lib.carla_nsm_init(self.handle, pid, executableName.encode("utf-8")))
3249 def nsm_ready(self, opcode):
3250 self.lib.carla_nsm_ready(self.handle, opcode)
3252 # ---------------------------------------------------------------------------------------------------------------------
3253 # Helper object for CarlaHostPlugin
3255 class PluginStoreInfo():
3256 def __init__(self):
3257 self.clear()
3259 def clear(self):
3260 self.pluginInfo = PyCarlaPluginInfo.copy()
3261 self.pluginRealName = ""
3262 self.internalValues = [0.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0]
3263 self.audioCountInfo = PyCarlaPortCountInfo.copy()
3264 self.midiCountInfo = PyCarlaPortCountInfo.copy()
3265 self.parameterCount = 0
3266 self.parameterCountInfo = PyCarlaPortCountInfo.copy()
3267 self.parameterInfo = []
3268 self.parameterData = []
3269 self.parameterRanges = []
3270 self.parameterValues = []
3271 self.programCount = 0
3272 self.programCurrent = -1
3273 self.programNames = []
3274 self.midiProgramCount = 0
3275 self.midiProgramCurrent = -1
3276 self.midiProgramData = []
3277 self.customDataCount = 0
3278 self.customData = []
3279 self.peaks = [0.0, 0.0, 0.0, 0.0]
3281 # ---------------------------------------------------------------------------------------------------------------------
3282 # Carla Host object for plugins (using pipes)
3284 class CarlaHostPlugin(CarlaHostMeta):
3285 def __init__(self):
3286 CarlaHostMeta.__init__(self)
3288 # info about this host object
3289 self.isPlugin = True
3290 self.processModeForced = True
3292 # text data to return when requested
3293 self.fMaxPluginNumber = 0
3294 self.fLastError = ""
3296 # plugin info
3297 self.fPluginsInfo = {}
3298 self.fFallbackPluginInfo = PluginStoreInfo()
3300 # runtime engine info
3301 self.fRuntimeEngineInfo = {
3302 "load": 0.0,
3303 "xruns": 0
3306 # transport info
3307 self.fTransportInfo = {
3308 "playing": False,
3309 "frame": 0,
3310 "bar": 0,
3311 "beat": 0,
3312 "tick": 0,
3313 "bpm": 0.0
3316 # some other vars
3317 self.fBufferSize = 0
3318 self.fSampleRate = 0.0
3319 self.fOscTCP = ""
3320 self.fOscUDP = ""
3322 # --------------------------------------------------------------------------------------------------------
3324 # Needs to be reimplemented
3325 @abstractmethod
3326 def sendMsg(self, lines):
3327 raise NotImplementedError
3329 # internal, sets error if sendMsg failed
3330 def sendMsgAndSetError(self, lines):
3331 if self.sendMsg(lines):
3332 return True
3334 self.fLastError = "Communication error with backend"
3335 return False
3337 # --------------------------------------------------------------------------------------------------------
3339 def get_engine_driver_count(self):
3340 return 1
3342 def get_engine_driver_name(self, index):
3343 return "Plugin"
3345 def get_engine_driver_device_names(self, index):
3346 return []
3348 def get_engine_driver_device_info(self, index, name):
3349 return PyEngineDriverDeviceInfo
3351 def show_engine_driver_device_control_panel(self, index, name):
3352 return False
3354 def get_runtime_engine_info(self):
3355 return self.fRuntimeEngineInfo
3357 def get_runtime_engine_driver_device_info(self):
3358 return PyCarlaRuntimeEngineDriverDeviceInfo
3360 def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
3361 return False
3363 def show_engine_device_control_panel(self):
3364 return False
3366 def clear_engine_xruns(self):
3367 self.sendMsg(["clear_engine_xruns"])
3369 def cancel_engine_action(self):
3370 self.sendMsg(["cancel_engine_action"])
3372 def set_engine_callback(self, func):
3373 return # TODO
3375 def set_engine_option(self, option, value, valueStr):
3376 self.sendMsg(["set_engine_option", option, int(value), valueStr])
3378 def set_file_callback(self, func):
3379 return # TODO
3381 def load_file(self, filename):
3382 return self.sendMsgAndSetError(["load_file", filename])
3384 def load_project(self, filename):
3385 return self.sendMsgAndSetError(["load_project", filename])
3387 def save_project(self, filename):
3388 return self.sendMsgAndSetError(["save_project", filename])
3390 def clear_project_filename(self):
3391 return self.sendMsgAndSetError(["clear_project_filename"])
3393 def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
3394 return self.sendMsgAndSetError(["patchbay_connect", external, groupIdA, portIdA, groupIdB, portIdB])
3396 def patchbay_disconnect(self, external, connectionId):
3397 return self.sendMsgAndSetError(["patchbay_disconnect", external, connectionId])
3399 def patchbay_set_group_pos(self, external, groupId, x1, y1, x2, y2):
3400 return self.sendMsgAndSetError(["patchbay_set_group_pos", external, groupId, x1, y1, x2, y2])
3402 def patchbay_refresh(self, external):
3403 return self.sendMsgAndSetError(["patchbay_refresh", external])
3405 def transport_play(self):
3406 self.sendMsg(["transport_play"])
3408 def transport_pause(self):
3409 self.sendMsg(["transport_pause"])
3411 def transport_bpm(self, bpm):
3412 self.sendMsg(["transport_bpm", bpm])
3414 def transport_relocate(self, frame):
3415 self.sendMsg(["transport_relocate", frame])
3417 def get_current_transport_frame(self):
3418 return self.fTransportInfo['frame']
3420 def get_transport_info(self):
3421 return self.fTransportInfo
3423 def get_current_plugin_count(self):
3424 return len(self.fPluginsInfo)
3426 def get_max_plugin_number(self):
3427 return self.fMaxPluginNumber
3429 def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
3430 return self.sendMsgAndSetError(["add_plugin",
3431 btype, ptype,
3432 filename or "(null)",
3433 name or "(null)",
3434 label, uniqueId, options])
3436 def remove_plugin(self, pluginId):
3437 return self.sendMsgAndSetError(["remove_plugin", pluginId])
3439 def remove_all_plugins(self):
3440 return self.sendMsgAndSetError(["remove_all_plugins"])
3442 def rename_plugin(self, pluginId, newName):
3443 return self.sendMsgAndSetError(["rename_plugin", pluginId, newName])
3445 def clone_plugin(self, pluginId):
3446 return self.sendMsgAndSetError(["clone_plugin", pluginId])
3448 def replace_plugin(self, pluginId):
3449 return self.sendMsgAndSetError(["replace_plugin", pluginId])
3451 def switch_plugins(self, pluginIdA, pluginIdB):
3452 ret = self.sendMsgAndSetError(["switch_plugins", pluginIdA, pluginIdB])
3453 if ret:
3454 self._switchPlugins(pluginIdA, pluginIdB)
3455 return ret
3457 def load_plugin_state(self, pluginId, filename):
3458 return self.sendMsgAndSetError(["load_plugin_state", pluginId, filename])
3460 def save_plugin_state(self, pluginId, filename):
3461 return self.sendMsgAndSetError(["save_plugin_state", pluginId, filename])
3463 def export_plugin_lv2(self, pluginId, lv2path):
3464 self.fLastError = "Operation unavailable in plugin version"
3465 return False
3467 def get_plugin_info(self, pluginId):
3468 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).pluginInfo
3470 def get_audio_port_count_info(self, pluginId):
3471 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).audioCountInfo
3473 def get_midi_port_count_info(self, pluginId):
3474 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiCountInfo
3476 def get_parameter_count_info(self, pluginId):
3477 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterCountInfo
3479 def get_parameter_info(self, pluginId, parameterId):
3480 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterInfo[parameterId]
3482 def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
3483 return PyCarlaScalePointInfo
3485 def get_parameter_data(self, pluginId, parameterId):
3486 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterData[parameterId]
3488 def get_parameter_ranges(self, pluginId, parameterId):
3489 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterRanges[parameterId]
3491 def get_midi_program_data(self, pluginId, midiProgramId):
3492 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiProgramData[midiProgramId]
3494 def get_custom_data(self, pluginId, customDataId):
3495 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).customData[customDataId]
3497 def get_custom_data_value(self, pluginId, type_, key):
3498 plugin = self.fPluginsInfo.get(pluginId, None)
3499 if plugin is None:
3500 return ""
3501 for customData in plugin.customData:
3502 if customData['type'] == type_ and customData['key'] == key:
3503 return customData['value']
3504 return ""
3506 def get_chunk_data(self, pluginId):
3507 return ""
3509 def get_parameter_count(self, pluginId):
3510 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterCount
3512 def get_program_count(self, pluginId):
3513 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).programCount
3515 def get_midi_program_count(self, pluginId):
3516 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiProgramCount
3518 def get_custom_data_count(self, pluginId):
3519 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).customDataCount
3521 def get_parameter_text(self, pluginId, parameterId):
3522 return ""
3524 def get_program_name(self, pluginId, programId):
3525 return self.fPluginsInfo[pluginId].programNames[programId]
3527 def get_midi_program_name(self, pluginId, midiProgramId):
3528 return self.fPluginsInfo[pluginId].midiProgramData[midiProgramId]['label']
3530 def get_real_plugin_name(self, pluginId):
3531 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).pluginRealName
3533 def get_current_program_index(self, pluginId):
3534 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).programCurrent
3536 def get_current_midi_program_index(self, pluginId):
3537 return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiProgramCurrent
3539 def get_default_parameter_value(self, pluginId, parameterId):
3540 return self.fPluginsInfo[pluginId].parameterRanges[parameterId]['def']
3542 def get_current_parameter_value(self, pluginId, parameterId):
3543 return self.fPluginsInfo[pluginId].parameterValues[parameterId]
3545 def get_internal_parameter_value(self, pluginId, parameterId):
3546 if parameterId == PARAMETER_NULL or parameterId <= PARAMETER_MAX:
3547 return 0.0
3548 if parameterId < 0:
3549 return self.fPluginsInfo[pluginId].internalValues[abs(parameterId)-2]
3551 return self.fPluginsInfo[pluginId].parameterValues[parameterId]
3553 def get_input_peak_value(self, pluginId, isLeft):
3554 return self.fPluginsInfo[pluginId].peaks[0 if isLeft else 1]
3556 def get_output_peak_value(self, pluginId, isLeft):
3557 return self.fPluginsInfo[pluginId].peaks[2 if isLeft else 3]
3559 def render_inline_display(self, pluginId, width, height):
3560 return None
3562 def set_option(self, pluginId, option, yesNo):
3563 self.sendMsg(["set_option", pluginId, option, yesNo])
3565 def set_active(self, pluginId, onOff):
3566 self.sendMsg(["set_active", pluginId, onOff])
3567 self.fPluginsInfo[pluginId].internalValues[0] = 1.0 if onOff else 0.0
3569 def set_drywet(self, pluginId, value):
3570 self.sendMsg(["set_drywet", pluginId, value])
3571 self.fPluginsInfo[pluginId].internalValues[1] = value
3573 def set_volume(self, pluginId, value):
3574 self.sendMsg(["set_volume", pluginId, value])
3575 self.fPluginsInfo[pluginId].internalValues[2] = value
3577 def set_balance_left(self, pluginId, value):
3578 self.sendMsg(["set_balance_left", pluginId, value])
3579 self.fPluginsInfo[pluginId].internalValues[3] = value
3581 def set_balance_right(self, pluginId, value):
3582 self.sendMsg(["set_balance_right", pluginId, value])
3583 self.fPluginsInfo[pluginId].internalValues[4] = value
3585 def set_panning(self, pluginId, value):
3586 self.sendMsg(["set_panning", pluginId, value])
3587 self.fPluginsInfo[pluginId].internalValues[5] = value
3589 def set_ctrl_channel(self, pluginId, channel):
3590 self.sendMsg(["set_ctrl_channel", pluginId, channel])
3591 self.fPluginsInfo[pluginId].internalValues[6] = float(channel)
3593 def set_parameter_value(self, pluginId, parameterId, value):
3594 self.sendMsg(["set_parameter_value", pluginId, parameterId, value])
3595 self.fPluginsInfo[pluginId].parameterValues[parameterId] = value
3597 def set_parameter_midi_channel(self, pluginId, parameterId, channel):
3598 self.sendMsg(["set_parameter_midi_channel", pluginId, parameterId, channel])
3599 self.fPluginsInfo[pluginId].parameterData[parameterId]['midiChannel'] = channel
3601 def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
3602 self.sendMsg(["set_parameter_mapped_control_index", pluginId, parameterId, index])
3603 self.fPluginsInfo[pluginId].parameterData[parameterId]['mappedControlIndex'] = index
3605 def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
3606 self.sendMsg(["set_parameter_mapped_range", pluginId, parameterId, minimum, maximum])
3607 self.fPluginsInfo[pluginId].parameterData[parameterId]['mappedMinimum'] = minimum
3608 self.fPluginsInfo[pluginId].parameterData[parameterId]['mappedMaximum'] = maximum
3610 def set_parameter_touch(self, pluginId, parameterId, touch):
3611 self.sendMsg(["set_parameter_touch", pluginId, parameterId, touch])
3613 def set_program(self, pluginId, programId):
3614 self.sendMsg(["set_program", pluginId, programId])
3615 self.fPluginsInfo[pluginId].programCurrent = programId
3617 def set_midi_program(self, pluginId, midiProgramId):
3618 self.sendMsg(["set_midi_program", pluginId, midiProgramId])
3619 self.fPluginsInfo[pluginId].midiProgramCurrent = midiProgramId
3621 def set_custom_data(self, pluginId, type_, key, value):
3622 self.sendMsg(["set_custom_data", pluginId, type_, key, value])
3624 for cdata in self.fPluginsInfo[pluginId].customData:
3625 if cdata['type'] != type_:
3626 continue
3627 if cdata['key'] != key:
3628 continue
3629 cdata['value'] = value
3630 break
3632 def set_chunk_data(self, pluginId, chunkData):
3633 self.sendMsg(["set_chunk_data", pluginId, chunkData])
3635 def prepare_for_save(self, pluginId):
3636 self.sendMsg(["prepare_for_save", pluginId])
3638 def reset_parameters(self, pluginId):
3639 self.sendMsg(["reset_parameters", pluginId])
3641 def randomize_parameters(self, pluginId):
3642 self.sendMsg(["randomize_parameters", pluginId])
3644 def send_midi_note(self, pluginId, channel, note, velocity):
3645 self.sendMsg(["send_midi_note", pluginId, channel, note, velocity])
3647 def show_custom_ui(self, pluginId, yesNo):
3648 self.sendMsg(["show_custom_ui", pluginId, yesNo])
3650 def get_buffer_size(self):
3651 return self.fBufferSize
3653 def get_sample_rate(self):
3654 return self.fSampleRate
3656 def get_last_error(self):
3657 return self.fLastError
3659 def get_host_osc_url_tcp(self):
3660 return self.fOscTCP
3662 def get_host_osc_url_udp(self):
3663 return self.fOscUDP
3665 # --------------------------------------------------------------------------------------------------------
3667 def _set_runtime_info(self, load, xruns):
3668 self.fRuntimeEngineInfo = {
3669 "load": load,
3670 "xruns": xruns
3673 def _set_transport(self, playing, frame, bar, beat, tick, bpm):
3674 self.fTransportInfo = {
3675 "playing": playing,
3676 "frame": frame,
3677 "bar": bar,
3678 "beat": beat,
3679 "tick": tick,
3680 "bpm": bpm
3683 def _add(self, pluginId):
3684 self.fPluginsInfo[pluginId] = PluginStoreInfo()
3686 def _reset(self, maxPluginId):
3687 self.fPluginsInfo = {}
3688 for i in range(maxPluginId):
3689 self.fPluginsInfo[i] = PluginStoreInfo()
3691 def _allocateAsNeeded(self, pluginId):
3692 if pluginId < len(self.fPluginsInfo):
3693 return
3695 for pid in range(len(self.fPluginsInfo), pluginId+1):
3696 self.fPluginsInfo[pid] = PluginStoreInfo()
3698 def _set_pluginInfo(self, pluginId, info):
3699 plugin = self.fPluginsInfo.get(pluginId, None)
3700 if plugin is None:
3701 print("_set_pluginInfo failed for", pluginId)
3702 return
3703 plugin.pluginInfo = info
3705 def _set_pluginInfoUpdate(self, pluginId, info):
3706 plugin = self.fPluginsInfo.get(pluginId, None)
3707 if plugin is None:
3708 print("_set_pluginInfoUpdate failed for", pluginId)
3709 return
3710 plugin.pluginInfo.update(info)
3712 def _set_pluginName(self, pluginId, name):
3713 plugin = self.fPluginsInfo.get(pluginId, None)
3714 if plugin is None:
3715 print("_set_pluginName failed for", pluginId)
3716 return
3717 plugin.pluginInfo['name'] = name
3719 def _set_pluginRealName(self, pluginId, realName):
3720 plugin = self.fPluginsInfo.get(pluginId, None)
3721 if plugin is None:
3722 print("_set_pluginRealName failed for", pluginId)
3723 return
3724 plugin.pluginRealName = realName
3726 def _set_internalValue(self, pluginId, paramIndex, value):
3727 pluginInfo = self.fPluginsInfo.get(pluginId, None)
3728 if pluginInfo is None:
3729 print("_set_internalValue failed for", pluginId)
3730 return
3731 if PARAMETER_NULL > paramIndex > PARAMETER_MAX:
3732 pluginInfo.internalValues[abs(paramIndex)-2] = float(value)
3733 else:
3734 print("_set_internalValue failed for", pluginId, "with param", paramIndex)
3736 def _set_audioCountInfo(self, pluginId, info):
3737 plugin = self.fPluginsInfo.get(pluginId, None)
3738 if plugin is None:
3739 print("_set_audioCountInfo failed for", pluginId)
3740 return
3741 plugin.audioCountInfo = info
3743 def _set_midiCountInfo(self, pluginId, info):
3744 plugin = self.fPluginsInfo.get(pluginId, None)
3745 if plugin is None:
3746 print("_set_midiCountInfo failed for", pluginId)
3747 return
3748 plugin.midiCountInfo = info
3750 def _set_parameterCountInfo(self, pluginId, count, info):
3751 plugin = self.fPluginsInfo.get(pluginId, None)
3752 if plugin is None:
3753 print("_set_parameterCountInfo failed for", pluginId)
3754 return
3756 plugin.parameterCount = count
3757 plugin.parameterCountInfo = info
3759 # clear
3760 plugin.parameterInfo = []
3761 plugin.parameterData = []
3762 plugin.parameterRanges = []
3763 plugin.parameterValues = []
3765 # add placeholders
3766 for _ in range(count):
3767 plugin.parameterInfo.append(PyCarlaParameterInfo.copy())
3768 plugin.parameterData.append(PyParameterData.copy())
3769 plugin.parameterRanges.append(PyParameterRanges.copy())
3770 plugin.parameterValues.append(0.0)
3772 def _set_programCount(self, pluginId, count):
3773 plugin = self.fPluginsInfo.get(pluginId, None)
3774 if plugin is None:
3775 print("_set_internalValue failed for", pluginId)
3776 return
3778 plugin.programCount = count
3779 plugin.programNames = ["" for _ in range(count)]
3781 def _set_midiProgramCount(self, pluginId, count):
3782 plugin = self.fPluginsInfo.get(pluginId, None)
3783 if plugin is None:
3784 print("_set_internalValue failed for", pluginId)
3785 return
3787 plugin.midiProgramCount = count
3788 plugin.midiProgramData = [PyMidiProgramData.copy() for _ in range(count)]
3790 def _set_customDataCount(self, pluginId, count):
3791 plugin = self.fPluginsInfo.get(pluginId, None)
3792 if plugin is None:
3793 print("_set_internalValue failed for", pluginId)
3794 return
3796 plugin.customDataCount = count
3797 plugin.customData = [PyCustomData.copy() for _ in range(count)]
3799 def _set_parameterInfo(self, pluginId, paramIndex, info):
3800 plugin = self.fPluginsInfo.get(pluginId, None)
3801 if plugin is None:
3802 print("_set_parameterInfo failed for", pluginId)
3803 return
3804 if paramIndex < plugin.parameterCount:
3805 plugin.parameterInfo[paramIndex] = info
3806 else:
3807 print("_set_parameterInfo failed for", pluginId, "and index", paramIndex)
3809 def _set_parameterData(self, pluginId, paramIndex, data):
3810 plugin = self.fPluginsInfo.get(pluginId, None)
3811 if plugin is None:
3812 print("_set_parameterData failed for", pluginId)
3813 return
3814 if paramIndex < plugin.parameterCount:
3815 plugin.parameterData[paramIndex] = data
3816 else:
3817 print("_set_parameterData failed for", pluginId, "and index", paramIndex)
3819 def _set_parameterRanges(self, pluginId, paramIndex, ranges):
3820 plugin = self.fPluginsInfo.get(pluginId, None)
3821 if plugin is None:
3822 print("_set_parameterRanges failed for", pluginId)
3823 return
3824 if paramIndex < plugin.parameterCount:
3825 plugin.parameterRanges[paramIndex] = ranges
3826 else:
3827 print("_set_parameterRanges failed for", pluginId, "and index", paramIndex)
3829 def _set_parameterRangesUpdate(self, pluginId, paramIndex, ranges):
3830 plugin = self.fPluginsInfo.get(pluginId, None)
3831 if plugin is None:
3832 print("_set_parameterRangesUpdate failed for", pluginId)
3833 return
3834 if paramIndex < plugin.parameterCount:
3835 plugin.parameterRanges[paramIndex].update(ranges)
3836 else:
3837 print("_set_parameterRangesUpdate failed for", pluginId, "and index", paramIndex)
3839 def _set_parameterValue(self, pluginId, paramIndex, value):
3840 plugin = self.fPluginsInfo.get(pluginId, None)
3841 if plugin is None:
3842 print("_set_parameterValue failed for", pluginId)
3843 return
3844 if paramIndex < plugin.parameterCount:
3845 plugin.parameterValues[paramIndex] = value
3846 else:
3847 print("_set_parameterValue failed for", pluginId, "and index", paramIndex)
3849 def _set_parameterDefault(self, pluginId, paramIndex, value):
3850 plugin = self.fPluginsInfo.get(pluginId, None)
3851 if plugin is None:
3852 print("_set_parameterDefault failed for", pluginId)
3853 return
3854 if paramIndex < plugin.parameterCount:
3855 plugin.parameterRanges[paramIndex]['def'] = value
3856 else:
3857 print("_set_parameterDefault failed for", pluginId, "and index", paramIndex)
3859 def _set_parameterMappedControlIndex(self, pluginId, paramIndex, index):
3860 plugin = self.fPluginsInfo.get(pluginId, None)
3861 if plugin is None:
3862 print("_set_parameterMappedControlIndex failed for", pluginId)
3863 return
3864 if paramIndex < plugin.parameterCount:
3865 plugin.parameterData[paramIndex]['mappedControlIndex'] = index
3866 else:
3867 print("_set_parameterMappedControlIndex failed for", pluginId, "and index", paramIndex)
3869 def _set_parameterMappedRange(self, pluginId, paramIndex, minimum, maximum):
3870 plugin = self.fPluginsInfo.get(pluginId, None)
3871 if plugin is None:
3872 print("_set_parameterMappedRange failed for", pluginId)
3873 return
3874 if paramIndex < plugin.parameterCount:
3875 plugin.parameterData[paramIndex]['mappedMinimum'] = minimum
3876 plugin.parameterData[paramIndex]['mappedMaximum'] = maximum
3877 else:
3878 print("_set_parameterMappedRange failed for", pluginId, "and index", paramIndex)
3880 def _set_parameterMidiChannel(self, pluginId, paramIndex, channel):
3881 plugin = self.fPluginsInfo.get(pluginId, None)
3882 if plugin is None:
3883 print("_set_parameterMidiChannel failed for", pluginId)
3884 return
3885 if paramIndex < plugin.parameterCount:
3886 plugin.parameterData[paramIndex]['midiChannel'] = channel
3887 else:
3888 print("_set_parameterMidiChannel failed for", pluginId, "and index", paramIndex)
3890 def _set_currentProgram(self, pluginId, pIndex):
3891 plugin = self.fPluginsInfo.get(pluginId, None)
3892 if plugin is None:
3893 print("_set_currentProgram failed for", pluginId)
3894 return
3895 plugin.programCurrent = pIndex
3897 def _set_currentMidiProgram(self, pluginId, mpIndex):
3898 plugin = self.fPluginsInfo.get(pluginId, None)
3899 if plugin is None:
3900 print("_set_currentMidiProgram failed for", pluginId)
3901 return
3902 plugin.midiProgramCurrent = mpIndex
3904 def _set_programName(self, pluginId, pIndex, name):
3905 plugin = self.fPluginsInfo.get(pluginId, None)
3906 if plugin is None:
3907 print("_set_programName failed for", pluginId)
3908 return
3909 if pIndex < plugin.programCount:
3910 plugin.programNames[pIndex] = name
3911 else:
3912 print("_set_programName failed for", pluginId, "and index", pIndex)
3914 def _set_midiProgramData(self, pluginId, mpIndex, data):
3915 plugin = self.fPluginsInfo.get(pluginId, None)
3916 if plugin is None:
3917 print("_set_midiProgramData failed for", pluginId)
3918 return
3919 if mpIndex < plugin.midiProgramCount:
3920 plugin.midiProgramData[mpIndex] = data
3921 else:
3922 print("_set_midiProgramData failed for", pluginId, "and index", mpIndex)
3924 def _set_customData(self, pluginId, cdIndex, data):
3925 plugin = self.fPluginsInfo.get(pluginId, None)
3926 if plugin is None:
3927 print("_set_customData failed for", pluginId)
3928 return
3929 if cdIndex < plugin.customDataCount:
3930 plugin.customData[cdIndex] = data
3931 else:
3932 print("_set_customData failed for", pluginId, "and index", cdIndex)
3934 def _set_peaks(self, pluginId, in1, in2, out1, out2):
3935 pluginInfo = self.fPluginsInfo.get(pluginId, None)
3936 if pluginInfo is not None:
3937 pluginInfo.peaks = [in1, in2, out1, out2]
3939 def _removePlugin(self, pluginId):
3940 pluginCountM1 = len(self.fPluginsInfo)-1
3942 if pluginId >= pluginCountM1:
3943 self.fPluginsInfo[pluginId] = PluginStoreInfo()
3944 return
3946 # push all plugins 1 slot back starting from the plugin that got removed
3947 for i in range(pluginId, pluginCountM1):
3948 self.fPluginsInfo[i] = self.fPluginsInfo[i+1]
3950 self.fPluginsInfo[pluginCountM1] = PluginStoreInfo()
3952 def _switchPlugins(self, pluginIdA, pluginIdB):
3953 tmp = self.fPluginsInfo[pluginIdA]
3954 self.fPluginsInfo[pluginIdA] = self.fPluginsInfo[pluginIdB]
3955 self.fPluginsInfo[pluginIdB] = tmp
3957 def _setViaCallback(self, action, pluginId, value1, value2, value3, valuef, valueStr):
3958 if action == ENGINE_CALLBACK_ENGINE_STARTED:
3959 self.fBufferSize = value3
3960 self.fSampleRate = valuef
3961 if value1 == ENGINE_PROCESS_MODE_CONTINUOUS_RACK:
3962 maxPluginId = MAX_RACK_PLUGINS
3963 elif value1 == ENGINE_PROCESS_MODE_PATCHBAY:
3964 maxPluginId = MAX_PATCHBAY_PLUGINS
3965 else:
3966 maxPluginId = MAX_DEFAULT_PLUGINS
3967 self._reset(maxPluginId)
3969 elif action == ENGINE_CALLBACK_BUFFER_SIZE_CHANGED:
3970 self.fBufferSize = value1
3972 elif action == ENGINE_CALLBACK_SAMPLE_RATE_CHANGED:
3973 self.fSampleRate = valuef
3975 elif action == ENGINE_CALLBACK_PLUGIN_REMOVED:
3976 self._removePlugin(pluginId)
3978 elif action == ENGINE_CALLBACK_PLUGIN_RENAMED:
3979 self._set_pluginName(pluginId, valueStr)
3981 elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED:
3982 if value1 < 0:
3983 self._set_internalValue(pluginId, value1, valuef)
3984 else:
3985 self._set_parameterValue(pluginId, value1, valuef)
3987 elif action == ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED:
3988 self._set_parameterDefault(pluginId, value1, valuef)
3990 elif action == ENGINE_CALLBACK_PARAMETER_MAPPED_CONTROL_INDEX_CHANGED:
3991 self._set_parameterMappedControlIndex(pluginId, value1, value2)
3993 elif action == ENGINE_CALLBACK_PARAMETER_MAPPED_RANGE_CHANGED:
3994 minimum, maximum = (float(i) for i in valueStr.split(":"))
3995 self._set_parameterMappedRange(pluginId, value1, minimum, maximum)
3997 elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
3998 self._set_parameterMidiChannel(pluginId, value1, value2)
4000 elif action == ENGINE_CALLBACK_PROGRAM_CHANGED:
4001 self._set_currentProgram(pluginId, value1)
4003 elif action == ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED:
4004 self._set_currentMidiProgram(pluginId, value1)
4006 # ---------------------------------------------------------------------------------------------------------------------