Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3891 lines
124KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla Backend code
  4. # Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com>
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation; either version 2 of
  9. # the License, or any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # For a full copy of the GNU General Public License see the doc/GPL.txt file.
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Global)
  19. from abc import ABCMeta, abstractmethod
  20. from ctypes import *
  21. from platform import architecture
  22. from sys import platform, maxsize
  23. # ------------------------------------------------------------------------------------------------------------
  24. # 64bit check
  25. kIs64bit = bool(architecture()[0] == "64bit" and maxsize > 2**32)
  26. # ------------------------------------------------------------------------------------------------------------
  27. # Define custom types
  28. c_enum = c_int
  29. c_uintptr = c_uint64 if kIs64bit else c_uint32
  30. # ------------------------------------------------------------------------------------------------------------
  31. # Set Platform
  32. if platform == "darwin":
  33. HAIKU = False
  34. LINUX = False
  35. MACOS = True
  36. WINDOWS = False
  37. elif "haiku" in platform:
  38. HAIKU = True
  39. LINUX = False
  40. MACOS = False
  41. WINDOWS = False
  42. elif "linux" in platform:
  43. HAIKU = False
  44. LINUX = True
  45. MACOS = False
  46. WINDOWS = False
  47. elif platform in ("win32", "win64", "cygwin"):
  48. HAIKU = False
  49. LINUX = False
  50. MACOS = False
  51. WINDOWS = True
  52. else:
  53. HAIKU = False
  54. LINUX = False
  55. MACOS = False
  56. WINDOWS = False
  57. # ------------------------------------------------------------------------------------------------------------
  58. # Convert a ctypes c_char_p into a python string
  59. def charPtrToString(charPtr):
  60. if not charPtr:
  61. return ""
  62. if isinstance(charPtr, str):
  63. return charPtr
  64. return charPtr.decode("utf-8", errors="ignore")
  65. # ------------------------------------------------------------------------------------------------------------
  66. # Convert a ctypes POINTER(c_char_p) into a python string list
  67. def charPtrPtrToStringList(charPtrPtr):
  68. if not charPtrPtr:
  69. return []
  70. i = 0
  71. charPtr = charPtrPtr[0]
  72. strList = []
  73. while charPtr:
  74. strList.append(charPtr.decode("utf-8", errors="ignore"))
  75. i += 1
  76. charPtr = charPtrPtr[i]
  77. return strList
  78. # ------------------------------------------------------------------------------------------------------------
  79. # Convert a ctypes POINTER(c_<num>) into a python number list
  80. def numPtrToList(numPtr):
  81. if not numPtr:
  82. return []
  83. i = 0
  84. num = numPtr[0] #.value
  85. numList = []
  86. while num not in (0, 0.0):
  87. numList.append(num)
  88. i += 1
  89. num = numPtr[i] #.value
  90. return numList
  91. # ------------------------------------------------------------------------------------------------------------
  92. # Convert a ctypes value into a python one
  93. c_int_types = (c_int, c_int8, c_int16, c_int32, c_int64, c_uint, c_uint8, c_uint16, c_uint32, c_uint64, c_long, c_longlong)
  94. c_float_types = (c_float, c_double, c_longdouble)
  95. c_intp_types = tuple(POINTER(i) for i in c_int_types)
  96. c_floatp_types = tuple(POINTER(i) for i in c_float_types)
  97. def toPythonType(value, attr):
  98. if isinstance(value, (bool, int, float)):
  99. return value
  100. if isinstance(value, bytes):
  101. return charPtrToString(value)
  102. if isinstance(value, c_intp_types) or isinstance(value, c_floatp_types):
  103. return numPtrToList(value)
  104. if isinstance(value, POINTER(c_char_p)):
  105. return charPtrPtrToStringList(value)
  106. print("..............", attr, ".....................", value, ":", type(value))
  107. return value
  108. # ------------------------------------------------------------------------------------------------------------
  109. # Convert a ctypes struct into a python dict
  110. def structToDict(struct):
  111. return dict((attr, toPythonType(getattr(struct, attr), attr)) for attr, value in struct._fields_)
  112. # ------------------------------------------------------------------------------------------------------------
  113. # Carla Backend API (base definitions)
  114. # Maximum default number of loadable plugins.
  115. MAX_DEFAULT_PLUGINS = 99
  116. # Maximum number of loadable plugins in rack mode.
  117. MAX_RACK_PLUGINS = 16
  118. # Maximum number of loadable plugins in patchbay mode.
  119. MAX_PATCHBAY_PLUGINS = 255
  120. # Maximum default number of parameters allowed.
  121. # @see ENGINE_OPTION_MAX_PARAMETERS
  122. MAX_DEFAULT_PARAMETERS = 200
  123. # The "plugin Id" for the global Carla instance.
  124. # Currently only used for audio peaks.
  125. MAIN_CARLA_PLUGIN_ID = 0xFFFF
  126. # ------------------------------------------------------------------------------------------------------------
  127. # Engine Driver Device Hints
  128. # Various engine driver device hints.
  129. # @see carla_get_engine_driver_device_info()
  130. # Engine driver device has custom control-panel.
  131. ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1
  132. # Engine driver device can use a triple-buffer (3 number of periods instead of the usual 2).
  133. # @see ENGINE_OPTION_AUDIO_NUM_PERIODS
  134. ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2
  135. # Engine driver device can change buffer-size on the fly.
  136. # @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
  137. ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4
  138. # Engine driver device can change sample-rate on the fly.
  139. # @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
  140. ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8
  141. # ------------------------------------------------------------------------------------------------------------
  142. # Plugin Hints
  143. # Various plugin hints.
  144. # @see carla_get_plugin_info()
  145. # Plugin is a bridge.
  146. # This hint is required because "bridge" itself is not a plugin type.
  147. PLUGIN_IS_BRIDGE = 0x001
  148. # Plugin is hard real-time safe.
  149. PLUGIN_IS_RTSAFE = 0x002
  150. # Plugin is a synth (produces sound).
  151. PLUGIN_IS_SYNTH = 0x004
  152. # Plugin has its own custom UI.
  153. # @see carla_show_custom_ui()
  154. PLUGIN_HAS_CUSTOM_UI = 0x008
  155. # Plugin can use internal Dry/Wet control.
  156. PLUGIN_CAN_DRYWET = 0x010
  157. # Plugin can use internal Volume control.
  158. PLUGIN_CAN_VOLUME = 0x020
  159. # Plugin can use internal (Stereo) Balance controls.
  160. PLUGIN_CAN_BALANCE = 0x040
  161. # Plugin can use internal (Mono) Panning control.
  162. PLUGIN_CAN_PANNING = 0x080
  163. # Plugin needs a constant, fixed-size audio buffer.
  164. PLUGIN_NEEDS_FIXED_BUFFERS = 0x100
  165. # Plugin needs to receive all UI events in the main thread.
  166. PLUGIN_NEEDS_UI_MAIN_THREAD = 0x200
  167. # Plugin uses 1 program per MIDI channel.
  168. # @note: Only used in some internal plugins and sf2 files.
  169. PLUGIN_USES_MULTI_PROGS = 0x400
  170. # Plugin can make use of inline display API.
  171. PLUGIN_HAS_INLINE_DISPLAY = 0x800
  172. # ------------------------------------------------------------------------------------------------------------
  173. # Plugin Options
  174. # Various plugin options.
  175. # @see carla_get_plugin_info() and carla_set_option()
  176. # Use constant/fixed-size audio buffers.
  177. PLUGIN_OPTION_FIXED_BUFFERS = 0x001
  178. # Force mono plugin as stereo.
  179. PLUGIN_OPTION_FORCE_STEREO = 0x002
  180. # Map MIDI programs to plugin programs.
  181. PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004
  182. # Use chunks to save and restore data instead of parameter values.
  183. PLUGIN_OPTION_USE_CHUNKS = 0x008
  184. # Send MIDI control change events.
  185. PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010
  186. # Send MIDI channel pressure events.
  187. PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020
  188. # Send MIDI note after-touch events.
  189. PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040
  190. # Send MIDI pitch-bend events.
  191. PLUGIN_OPTION_SEND_PITCHBEND = 0x080
  192. # Send MIDI all-sounds/notes-off events, single note-offs otherwise.
  193. PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100
  194. # Send MIDI bank/program changes.
  195. # @note: This option conflicts with PLUGIN_OPTION_MAP_PROGRAM_CHANGES and cannot be used at the same time.
  196. PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200
  197. # Special flag to indicate that plugin options are not yet set.
  198. # This flag exists because 0x0 as an option value is a valid one, so we need something else to indicate "null-ness".
  199. PLUGIN_OPTIONS_NULL = 0x10000
  200. # ------------------------------------------------------------------------------------------------------------
  201. # Parameter Hints
  202. # Various parameter hints.
  203. # @see CarlaPlugin::getParameterData() and carla_get_parameter_data()
  204. # Parameter value is boolean.
  205. PARAMETER_IS_BOOLEAN = 0x001
  206. # Parameter value is integer.
  207. PARAMETER_IS_INTEGER = 0x002
  208. # Parameter value is logarithmic.
  209. PARAMETER_IS_LOGARITHMIC = 0x004
  210. # Parameter is enabled.
  211. # It can be viewed, changed and stored.
  212. PARAMETER_IS_ENABLED = 0x010
  213. # Parameter is automable (real-time safe).
  214. PARAMETER_IS_AUTOMABLE = 0x020
  215. # Parameter is read-only.
  216. # It cannot be changed.
  217. PARAMETER_IS_READ_ONLY = 0x040
  218. # Parameter needs sample rate to work.
  219. # Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
  220. PARAMETER_USES_SAMPLERATE = 0x100
  221. # Parameter uses scale points to define internal values in a meaningful way.
  222. PARAMETER_USES_SCALEPOINTS = 0x200
  223. # Parameter uses custom text for displaying its value.
  224. # @see carla_get_parameter_text()
  225. PARAMETER_USES_CUSTOM_TEXT = 0x400
  226. # Parameter can be turned into a CV control.
  227. PARAMETER_CAN_BE_CV_CONTROLLED = 0x800
  228. # ------------------------------------------------------------------------------------------------------------
  229. # Patchbay Port Hints
  230. # Various patchbay port hints.
  231. # Patchbay port is input.
  232. # When this hint is not set, port is assumed to be output.
  233. PATCHBAY_PORT_IS_INPUT = 0x01
  234. # Patchbay port is of Audio type.
  235. PATCHBAY_PORT_TYPE_AUDIO = 0x02
  236. # Patchbay port is of CV type (Control Voltage).
  237. PATCHBAY_PORT_TYPE_CV = 0x04
  238. # Patchbay port is of MIDI type.
  239. PATCHBAY_PORT_TYPE_MIDI = 0x08
  240. # Patchbay port is of OSC type.
  241. PATCHBAY_PORT_TYPE_OSC = 0x10
  242. # ------------------------------------------------------------------------------------------------------------
  243. # Patchbay Port Group Hints
  244. # Various patchbay port group hints.
  245. # Indicates that this group should be considered the "main" input.
  246. PATCHBAY_PORT_GROUP_MAIN_INPUT = 0x01
  247. # Indicates that this group should be considered the "main" output.
  248. PATCHBAY_PORT_GROUP_MAIN_OUTPUT = 0x02
  249. # A stereo port group, where the 1st port is left and the 2nd is right.
  250. PATCHBAY_PORT_GROUP_STEREO = 0x04
  251. # A mid-side stereo group, where the 1st port is center and the 2nd is side.
  252. PATCHBAY_PORT_GROUP_MID_SIDE = 0x08
  253. # ------------------------------------------------------------------------------------------------------------
  254. # Custom Data Types
  255. # These types define how the value in the CustomData struct is stored.
  256. # @see CustomData.type
  257. # Boolean string type URI.
  258. # Only "true" and "false" are valid values.
  259. CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean"
  260. # Chunk type URI.
  261. CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"
  262. # Property type URI.
  263. CUSTOM_DATA_TYPE_PROPERTY = "http://kxstudio.sf.net/ns/carla/property"
  264. # String type URI.
  265. CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string"
  266. # ------------------------------------------------------------------------------------------------------------
  267. # Custom Data Keys
  268. # Pre-defined keys used internally in Carla.
  269. # @see CustomData.key
  270. # Plugin options key.
  271. CUSTOM_DATA_KEY_PLUGIN_OPTIONS = "CarlaPluginOptions"
  272. # UI position key.
  273. CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition"
  274. # UI size key.
  275. CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize"
  276. # UI visible key.
  277. CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible"
  278. # ------------------------------------------------------------------------------------------------------------
  279. # Binary Type
  280. # The binary type of a plugin.
  281. # Null binary type.
  282. BINARY_NONE = 0
  283. # POSIX 32bit binary.
  284. BINARY_POSIX32 = 1
  285. # POSIX 64bit binary.
  286. BINARY_POSIX64 = 2
  287. # Windows 32bit binary.
  288. BINARY_WIN32 = 3
  289. # Windows 64bit binary.
  290. BINARY_WIN64 = 4
  291. # Other binary type.
  292. BINARY_OTHER = 5
  293. # ------------------------------------------------------------------------------------------------------------
  294. # File Type
  295. # File type.
  296. # Null file type.
  297. FILE_NONE = 0
  298. # Audio file.
  299. FILE_AUDIO = 1
  300. # MIDI file.
  301. FILE_MIDI = 2
  302. # ------------------------------------------------------------------------------------------------------------
  303. # Plugin Type
  304. # Plugin type.
  305. # Some files are handled as if they were plugins.
  306. # Null plugin type.
  307. PLUGIN_NONE = 0
  308. # Internal plugin.
  309. PLUGIN_INTERNAL = 1
  310. # LADSPA plugin.
  311. PLUGIN_LADSPA = 2
  312. # DSSI plugin.
  313. PLUGIN_DSSI = 3
  314. # LV2 plugin.
  315. PLUGIN_LV2 = 4
  316. # VST2 plugin.
  317. PLUGIN_VST2 = 5
  318. # VST3 plugin.
  319. # @note Windows and MacOS only
  320. PLUGIN_VST3 = 6
  321. # AU plugin.
  322. # @note MacOS only
  323. PLUGIN_AU = 7
  324. # DLS file.
  325. PLUGIN_DLS = 8
  326. # GIG file.
  327. PLUGIN_GIG = 9
  328. # SF2/3 file (SoundFont).
  329. PLUGIN_SF2 = 10
  330. # SFZ file.
  331. PLUGIN_SFZ = 11
  332. # JACK application.
  333. PLUGIN_JACK = 12
  334. # ------------------------------------------------------------------------------------------------------------
  335. # Plugin Category
  336. # Plugin category, which describes the functionality of a plugin.
  337. # Null plugin category.
  338. PLUGIN_CATEGORY_NONE = 0
  339. # A synthesizer or generator.
  340. PLUGIN_CATEGORY_SYNTH = 1
  341. # A delay or reverb.
  342. PLUGIN_CATEGORY_DELAY = 2
  343. # An equalizer.
  344. PLUGIN_CATEGORY_EQ = 3
  345. # A filter.
  346. PLUGIN_CATEGORY_FILTER = 4
  347. # A distortion plugin.
  348. PLUGIN_CATEGORY_DISTORTION = 5
  349. # A 'dynamic' plugin (amplifier, compressor, gate, etc).
  350. PLUGIN_CATEGORY_DYNAMICS = 6
  351. # A 'modulator' plugin (chorus, flanger, phaser, etc).
  352. PLUGIN_CATEGORY_MODULATOR = 7
  353. # An 'utility' plugin (analyzer, converter, mixer, etc).
  354. PLUGIN_CATEGORY_UTILITY = 8
  355. # Miscellaneous plugin (used to check if the plugin has a category).
  356. PLUGIN_CATEGORY_OTHER = 9
  357. # ------------------------------------------------------------------------------------------------------------
  358. # Parameter Type
  359. # Plugin parameter type.
  360. # Null parameter type.
  361. PARAMETER_UNKNOWN = 0
  362. # Input parameter.
  363. PARAMETER_INPUT = 1
  364. # Output parameter.
  365. PARAMETER_OUTPUT = 2
  366. # ------------------------------------------------------------------------------------------------------------
  367. # Internal Parameter Index
  368. # Special parameters used internally in Carla.
  369. # Plugins do not know about their existence.
  370. # Null parameter.
  371. PARAMETER_NULL = -1
  372. # Active parameter, boolean type.
  373. # Default is 'false'.
  374. PARAMETER_ACTIVE = -2
  375. # Dry/Wet parameter.
  376. # Range 0.0...1.0; default is 1.0.
  377. PARAMETER_DRYWET = -3
  378. # Volume parameter.
  379. # Range 0.0...1.27; default is 1.0.
  380. PARAMETER_VOLUME = -4
  381. # Stereo Balance-Left parameter.
  382. # Range -1.0...1.0; default is -1.0.
  383. PARAMETER_BALANCE_LEFT = -5
  384. # Stereo Balance-Right parameter.
  385. # Range -1.0...1.0; default is 1.0.
  386. PARAMETER_BALANCE_RIGHT = -6
  387. # Mono Panning parameter.
  388. # Range -1.0...1.0; default is 0.0.
  389. PARAMETER_PANNING = -7
  390. # MIDI Control channel, integer type.
  391. # Range -1...15 (-1 = off).
  392. PARAMETER_CTRL_CHANNEL = -8
  393. # Max value, defined only for convenience.
  394. PARAMETER_MAX = -9
  395. # ------------------------------------------------------------------------------------------------------------
  396. # Special Mapped Control Index
  397. # Specially designated mapped control indexes.
  398. # Values between 0 and 119 (0x77) are reserved for MIDI CC, which uses direct values.
  399. # @see ParameterData::mappedControlIndex
  400. # Unused control index, meaning no mapping is enabled.
  401. CONTROL_VALUE_NONE = -1
  402. # CV control index, meaning the parameter is exposed as CV port.
  403. CONTROL_VALUE_CV = 130
  404. # Special value to indicate MIDI pitchbend.
  405. CONTROL_VALUE_MIDI_PITCHBEND = 131
  406. # ------------------------------------------------------------------------------------------------------------
  407. # Engine Callback Opcode
  408. # Engine callback opcodes.
  409. # Front-ends must never block indefinitely during a callback.
  410. # @see EngineCallbackFunc and carla_set_engine_callback()
  411. # Debug.
  412. # This opcode is undefined and used only for testing purposes.
  413. ENGINE_CALLBACK_DEBUG = 0
  414. # A plugin has been added.
  415. # @a pluginId Plugin Id
  416. # @a valueStr Plugin name
  417. ENGINE_CALLBACK_PLUGIN_ADDED = 1
  418. # A plugin has been removed.
  419. # @a pluginId Plugin Id
  420. ENGINE_CALLBACK_PLUGIN_REMOVED = 2
  421. # A plugin has been renamed.
  422. # @a pluginId Plugin Id
  423. # @a valueStr New plugin name
  424. ENGINE_CALLBACK_PLUGIN_RENAMED = 3
  425. # A plugin has become unavailable.
  426. # @a pluginId Plugin Id
  427. # @a valueStr Related error string
  428. ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4
  429. # A parameter value has changed.
  430. # @a pluginId Plugin Id
  431. # @a value1 Parameter index
  432. # @a valuef New parameter value
  433. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5
  434. # A parameter default has changed.
  435. # @a pluginId Plugin Id
  436. # @a value1 Parameter index
  437. # @a valuef New default value
  438. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6
  439. # A parameter's mapped control index has changed.
  440. # @a pluginId Plugin Id
  441. # @a value1 Parameter index
  442. # @a value2 New control index
  443. ENGINE_CALLBACK_PARAMETER_MAPPED_CONTROL_INDEX_CHANGED = 7
  444. # A parameter's MIDI channel has changed.
  445. # @a pluginId Plugin Id
  446. # @a value1 Parameter index
  447. # @a value2 New MIDI channel
  448. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8
  449. # A plugin option has changed.
  450. # @a pluginId Plugin Id
  451. # @a value1 Option
  452. # @a value2 New on/off state (1 for on, 0 for off)
  453. # @see PluginOptions
  454. ENGINE_CALLBACK_OPTION_CHANGED = 9
  455. # The current program of a plugin has changed.
  456. # @a pluginId Plugin Id
  457. # @a value1 New program index
  458. ENGINE_CALLBACK_PROGRAM_CHANGED = 10
  459. # The current MIDI program of a plugin has changed.
  460. # @a pluginId Plugin Id
  461. # @a value1 New MIDI program index
  462. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11
  463. # A plugin's custom UI state has changed.
  464. # @a pluginId Plugin Id
  465. # @a value1 New state, as follows:
  466. # 0: UI is now hidden
  467. # 1: UI is now visible
  468. # -1: UI has crashed and should not be shown again
  469. ENGINE_CALLBACK_UI_STATE_CHANGED = 12
  470. # A note has been pressed.
  471. # @a pluginId Plugin Id
  472. # @a value1 Channel
  473. # @a value2 Note
  474. # @a value3 Velocity
  475. ENGINE_CALLBACK_NOTE_ON = 13
  476. # A note has been released.
  477. # @a pluginId Plugin Id
  478. # @a value1 Channel
  479. # @a value2 Note
  480. ENGINE_CALLBACK_NOTE_OFF = 14
  481. # A plugin needs update.
  482. # @a pluginId Plugin Id
  483. ENGINE_CALLBACK_UPDATE = 15
  484. # A plugin's data/information has changed.
  485. # @a pluginId Plugin Id
  486. ENGINE_CALLBACK_RELOAD_INFO = 16
  487. # A plugin's parameters have changed.
  488. # @a pluginId Plugin Id
  489. ENGINE_CALLBACK_RELOAD_PARAMETERS = 17
  490. # A plugin's programs have changed.
  491. # @a pluginId Plugin Id
  492. ENGINE_CALLBACK_RELOAD_PROGRAMS = 18
  493. # A plugin state has changed.
  494. # @a pluginId Plugin Id
  495. ENGINE_CALLBACK_RELOAD_ALL = 19
  496. # A patchbay client has been added.
  497. # @a pluginId Client Id
  498. # @a value1 Client icon
  499. # @a value2 Plugin Id (-1 if not a plugin)
  500. # @a valueStr Client name
  501. # @see PatchbayIcon
  502. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 20
  503. # A patchbay client has been removed.
  504. # @a pluginId Client Id
  505. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 21
  506. # A patchbay client has been renamed.
  507. # @a pluginId Client Id
  508. # @a valueStr New client name
  509. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 22
  510. # A patchbay client data has changed.
  511. # @a pluginId Client Id
  512. # @a value1 New icon
  513. # @a value2 New plugin Id (-1 if not a plugin)
  514. # @see PatchbayIcon
  515. ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23
  516. # A patchbay port has been added.
  517. # @a pluginId Client Id
  518. # @a value1 Port Id
  519. # @a value2 Port hints
  520. # @a value3 Port group Id (0 for none)
  521. # @a valueStr Port name
  522. # @see PatchbayPortHints
  523. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24
  524. # A patchbay port has been removed.
  525. # @a pluginId Client Id
  526. # @a value1 Port Id
  527. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25
  528. # A patchbay port has changed (like the name or group Id).
  529. # @a pluginId Client Id
  530. # @a value1 Port Id
  531. # @a value2 Port hints
  532. # @a value3 Port group Id (0 for none)
  533. # @a valueStr New port name
  534. ENGINE_CALLBACK_PATCHBAY_PORT_CHANGED = 26
  535. # A patchbay connection has been added.
  536. # @a pluginId Connection Id
  537. # @a valueStr Out group, port plus in group and port, in "og:op:ig:ip" syntax.
  538. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 27
  539. # A patchbay connection has been removed.
  540. # @a pluginId Connection Id
  541. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28
  542. # Engine started.
  543. # @a pluginId How many plugins are known to be running
  544. # @a value1 Process mode
  545. # @a value2 Transport mode
  546. # @a value3 Buffer size
  547. # @a valuef Sample rate
  548. # @a valuestr Engine driver
  549. # @see EngineProcessMode
  550. # @see EngineTransportMode
  551. ENGINE_CALLBACK_ENGINE_STARTED = 29
  552. # Engine stopped.
  553. ENGINE_CALLBACK_ENGINE_STOPPED = 30
  554. # Engine process mode has changed.
  555. # @a value1 New process mode
  556. # @see EngineProcessMode
  557. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 31
  558. # Engine transport mode has changed.
  559. # @a value1 New transport mode
  560. # @a valueStr New transport features enabled
  561. # @see EngineTransportMode
  562. ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32
  563. # Engine buffer-size changed.
  564. # @a value1 New buffer size
  565. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33
  566. # Engine sample-rate changed.
  567. # @a valuef New sample rate
  568. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34
  569. # A cancelable action has been started or stopped.
  570. # @a pluginId Plugin Id the action relates to, -1 for none
  571. # @a value1 1 for action started, 0 for stopped
  572. # @a valueStr Action name
  573. ENGINE_CALLBACK_CANCELABLE_ACTION = 35
  574. # Project has finished loading.
  575. ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 36
  576. # NSM callback.
  577. # Frontend must call carla_nsm_ready() with opcode as parameter as a response
  578. # @a value1 NSM opcode
  579. # @a value2 Integer value
  580. # @a valueStr String value
  581. # @see NsmCallbackOpcode
  582. ENGINE_CALLBACK_NSM = 37
  583. # Idle frontend.
  584. # This is used by the engine during long operations that might block the frontend,
  585. # giving it the possibility to idle while the operation is still in place.
  586. ENGINE_CALLBACK_IDLE = 38
  587. # Show a message as information.
  588. # @a valueStr The message
  589. ENGINE_CALLBACK_INFO = 39
  590. # Show a message as an error.
  591. # @a valueStr The message
  592. ENGINE_CALLBACK_ERROR = 40
  593. # The engine has crashed or malfunctioned and will no longer work.
  594. ENGINE_CALLBACK_QUIT = 41
  595. # A plugin requested for its inline display to be redrawn.
  596. # @a pluginId Plugin Id to redraw
  597. ENGINE_CALLBACK_INLINE_DISPLAY_REDRAW = 42
  598. # A patchbay port group has been added.
  599. # @a pluginId Client Id
  600. # @a value1 Group Id (unique within this client)
  601. # @a value2 Group hints
  602. # @a valueStr Group name
  603. # @see PatchbayPortGroupHints
  604. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_ADDED = 43
  605. # A patchbay port group has been removed.
  606. # @a pluginId Client Id
  607. # @a value1 Group Id (unique within this client)
  608. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_REMOVED = 44
  609. # A patchbay port group has changed.
  610. # @a pluginId Client Id
  611. # @a value1 Group Id (unique within this client)
  612. # @a value2 Group hints
  613. # @a valueStr Group name
  614. # @see PatchbayPortGroupHints
  615. ENGINE_CALLBACK_PATCHBAY_PORT_GROUP_CHANGED = 45
  616. # A parameter's mapped range has changed.
  617. # @a pluginId Plugin Id
  618. # @a value1 Parameter index
  619. # @a valueStr New mapped range as "%f:%f" syntax
  620. ENGINE_CALLBACK_PARAMETER_MAPPED_RANGE_CHANGED = 46
  621. # ------------------------------------------------------------------------------------------------------------
  622. # NSM Callback Opcode
  623. # NSM callback opcodes.
  624. # @see ENGINE_CALLBACK_NSM
  625. # NSM is available and initialized.
  626. NSM_CALLBACK_INIT = 0
  627. # Error from NSM side.
  628. # @a valueInt Error code
  629. # @a valueStr Error string
  630. NSM_CALLBACK_ERROR = 1
  631. # Announce message.
  632. # @a valueInt SM Flags (WIP, to be defined)
  633. # @a valueStr SM Name
  634. NSM_CALLBACK_ANNOUNCE = 2
  635. # Open message.
  636. # @a valueStr Project filename
  637. NSM_CALLBACK_OPEN = 3
  638. # Save message.
  639. NSM_CALLBACK_SAVE = 4
  640. # Session-is-loaded message.
  641. NSM_CALLBACK_SESSION_IS_LOADED = 5
  642. # Show-optional-gui message.
  643. NSM_CALLBACK_SHOW_OPTIONAL_GUI = 6
  644. # Hide-optional-gui message.
  645. NSM_CALLBACK_HIDE_OPTIONAL_GUI = 7
  646. # ------------------------------------------------------------------------------------------------------------
  647. # Engine Option
  648. # Engine options.
  649. # @see carla_set_engine_option()
  650. # Debug.
  651. # This option is undefined and used only for testing purposes.
  652. ENGINE_OPTION_DEBUG = 0
  653. # Set the engine processing mode.
  654. # Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_CONTINUOUS_RACK for all other OSes.
  655. # @see EngineProcessMode
  656. ENGINE_OPTION_PROCESS_MODE = 1
  657. # Set the engine transport mode.
  658. # Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
  659. # @see EngineTransportMode
  660. ENGINE_OPTION_TRANSPORT_MODE = 2
  661. # Force mono plugins as stereo, by running 2 instances at the same time.
  662. # Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
  663. # @note Not supported by all plugins
  664. # @see PLUGIN_OPTION_FORCE_STEREO
  665. ENGINE_OPTION_FORCE_STEREO = 3
  666. # Use plugin bridges whenever possible.
  667. # Default is no, EXPERIMENTAL.
  668. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4
  669. # Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
  670. # Default is yes.
  671. ENGINE_OPTION_PREFER_UI_BRIDGES = 5
  672. # Make custom plugin UIs always-on-top.
  673. # Default is yes.
  674. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6
  675. # Maximum number of parameters allowed.
  676. # Default is MAX_DEFAULT_PARAMETERS.
  677. ENGINE_OPTION_MAX_PARAMETERS = 7
  678. # Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  679. # Default is 4000 (4 seconds).
  680. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8
  681. # Audio buffer size.
  682. # Default is 512.
  683. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 9
  684. # Audio sample rate.
  685. # Default is 44100.
  686. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 10
  687. # Wherever to use 3 audio periods instead of the default 2.
  688. # Default is false.
  689. ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 11
  690. # Audio driver.
  691. # Default dppends on platform.
  692. ENGINE_OPTION_AUDIO_DRIVER = 12
  693. # Audio device (within a driver).
  694. # Default unset.
  695. ENGINE_OPTION_AUDIO_DEVICE = 13
  696. # Wherever to enable OSC support in the engine.
  697. ENGINE_OPTION_OSC_ENABLED = 14
  698. # The network TCP port to use for OSC.
  699. # A value of 0 means use a random port.
  700. # A value of < 0 means to not enable the TCP port for OSC.
  701. # @note Valid ports begin at 1024 and end at 32767 (inclusive)
  702. ENGINE_OPTION_OSC_PORT_TCP = 15
  703. # The network UDP port to use for OSC.
  704. # A value of 0 means use a random port.
  705. # A value of < 0 means to not enable the UDP port for OSC.
  706. # @note Disabling this option prevents DSSI UIs from working!
  707. # @note Valid ports begin at 1024 and end at 32767 (inclusive)
  708. ENGINE_OPTION_OSC_PORT_UDP = 16
  709. # Set path used for a specific file type.
  710. # Uses value as the file format, valueStr as actual path.
  711. ENGINE_OPTION_FILE_PATH = 17
  712. # Set path used for a specific plugin type.
  713. # Uses value as the plugin format, valueStr as actual path.
  714. # @see PluginType
  715. ENGINE_OPTION_PLUGIN_PATH = 18
  716. # Set path to the binary files.
  717. # Default unset.
  718. # @note Must be set for plugin and UI bridges to work
  719. ENGINE_OPTION_PATH_BINARIES = 19
  720. # Set path to the resource files.
  721. # Default unset.
  722. # @note Must be set for some internal plugins to work
  723. ENGINE_OPTION_PATH_RESOURCES = 20
  724. # Prevent bad plugin and UI behaviour.
  725. # @note: Linux only
  726. ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 21
  727. # Set UI scaling used in frontend, so backend can do the same for plugin UIs.
  728. ENGINE_OPTION_FRONTEND_UI_SCALE = 22
  729. # Set frontend winId, used to define as parent window for plugin UIs.
  730. ENGINE_OPTION_FRONTEND_WIN_ID = 23
  731. # Set path to wine executable.
  732. ENGINE_OPTION_WINE_EXECUTABLE = 24
  733. # Enable automatic wineprefix detection.
  734. ENGINE_OPTION_WINE_AUTO_PREFIX = 25
  735. # Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
  736. ENGINE_OPTION_WINE_FALLBACK_PREFIX = 26
  737. # Enable realtime priority for Wine application and server threads.
  738. ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 27
  739. # Base realtime priority for Wine threads.
  740. ENGINE_OPTION_WINE_BASE_RT_PRIO = 28
  741. # Wine server realtime priority.
  742. ENGINE_OPTION_WINE_SERVER_RT_PRIO = 29
  743. # Capture console output into debug callbacks
  744. ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 30
  745. # ------------------------------------------------------------------------------------------------------------
  746. # Engine Process Mode
  747. # Engine process mode.
  748. # @see ENGINE_OPTION_PROCESS_MODE
  749. # Single client mode.
  750. # Inputs and outputs are added dynamically as needed by plugins.
  751. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0
  752. # Multiple client mode.
  753. # It has 1 master client + 1 client per plugin.
  754. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1
  755. # Single client, 'rack' mode.
  756. # Processes plugins in order of Id, with forced stereo always on.
  757. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2
  758. # Single client, 'patchbay' mode.
  759. ENGINE_PROCESS_MODE_PATCHBAY = 3
  760. # Special mode, used in plugin-bridges only.
  761. ENGINE_PROCESS_MODE_BRIDGE = 4
  762. # ------------------------------------------------------------------------------------------------------------
  763. # Engine Transport Mode
  764. # Engine transport mode.
  765. # @see ENGINE_OPTION_TRANSPORT_MODE
  766. # No transport.
  767. ENGINE_TRANSPORT_MODE_DISABLED = 0
  768. # Internal transport mode.
  769. ENGINE_TRANSPORT_MODE_INTERNAL = 1
  770. # Transport from JACK.
  771. # Only available if driver name is "JACK".
  772. ENGINE_TRANSPORT_MODE_JACK = 2
  773. # Transport from host, used when Carla is a plugin.
  774. ENGINE_TRANSPORT_MODE_PLUGIN = 3
  775. # Special mode, used in plugin-bridges only.
  776. ENGINE_TRANSPORT_MODE_BRIDGE = 4
  777. # ------------------------------------------------------------------------------------------------------------
  778. # File Callback Opcode
  779. # File callback opcodes.
  780. # Front-ends must always block-wait for user input.
  781. # @see FileCallbackFunc and carla_set_file_callback()
  782. # Debug.
  783. # This opcode is undefined and used only for testing purposes.
  784. FILE_CALLBACK_DEBUG = 0
  785. # Open file or folder.
  786. FILE_CALLBACK_OPEN = 1
  787. # Save file or folder.
  788. FILE_CALLBACK_SAVE = 2
  789. # ------------------------------------------------------------------------------------------------------------
  790. # Patchbay Icon
  791. # The icon of a patchbay client/group.
  792. # Generic application icon.
  793. # Used for all non-plugin clients that don't have a specific icon.
  794. PATCHBAY_ICON_APPLICATION = 0
  795. # Plugin icon.
  796. # Used for all plugin clients that don't have a specific icon.
  797. PATCHBAY_ICON_PLUGIN = 1
  798. # Hardware icon.
  799. # Used for hardware (audio or MIDI) clients.
  800. PATCHBAY_ICON_HARDWARE = 2
  801. # Carla icon.
  802. # Used for the main app.
  803. PATCHBAY_ICON_CARLA = 3
  804. # DISTRHO icon.
  805. # Used for DISTRHO based plugins.
  806. PATCHBAY_ICON_DISTRHO = 4
  807. # File icon.
  808. # Used for file type plugins (like SF2 and SFZ).
  809. PATCHBAY_ICON_FILE = 5
  810. # ------------------------------------------------------------------------------------------------------------
  811. # Carla Backend API (C stuff)
  812. # Engine callback function.
  813. # Front-ends must never block indefinitely during a callback.
  814. # @see EngineCallbackOpcode and carla_set_engine_callback()
  815. EngineCallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_int, c_float, c_char_p)
  816. # File callback function.
  817. # @see FileCallbackOpcode
  818. FileCallbackFunc = CFUNCTYPE(c_char_p, c_void_p, c_enum, c_bool, c_char_p, c_char_p)
  819. # Parameter data.
  820. class ParameterData(Structure):
  821. _fields_ = [
  822. # This parameter type.
  823. ("type", c_enum),
  824. # This parameter hints.
  825. # @see ParameterHints
  826. ("hints", c_uint),
  827. # Index as seen by Carla.
  828. ("index", c_int32),
  829. # Real index as seen by plugins.
  830. ("rindex", c_int32),
  831. # Currently mapped MIDI channel.
  832. # Counts from 0 to 15.
  833. ("midiChannel", c_uint8),
  834. # Currently mapped index.
  835. # @see SpecialMappedControlIndex
  836. ("mappedControlIndex", c_int16),
  837. # Minimum value that this parameter maps to.
  838. ("mappedMinimum", c_uint8),
  839. # Maximum value that this parameter maps to.
  840. ("mappedMaximum", c_uint8)
  841. ]
  842. # Parameter ranges.
  843. class ParameterRanges(Structure):
  844. _fields_ = [
  845. # Default value.
  846. ("def", c_float),
  847. # Minimum value.
  848. ("min", c_float),
  849. # Maximum value.
  850. ("max", c_float),
  851. # Regular, single step value.
  852. ("step", c_float),
  853. # Small step value.
  854. ("stepSmall", c_float),
  855. # Large step value.
  856. ("stepLarge", c_float)
  857. ]
  858. # MIDI Program data.
  859. class MidiProgramData(Structure):
  860. _fields_ = [
  861. # MIDI bank.
  862. ("bank", c_uint32),
  863. # MIDI program.
  864. ("program", c_uint32),
  865. # MIDI program name.
  866. ("name", c_char_p)
  867. ]
  868. # Custom data, used for saving key:value 'dictionaries'.
  869. class CustomData(Structure):
  870. _fields_ = [
  871. # Value type, in URI form.
  872. # @see CustomDataTypes
  873. ("type", c_char_p),
  874. # Key.
  875. # @see CustomDataKeys
  876. ("key", c_char_p),
  877. # Value.
  878. ("value", c_char_p)
  879. ]
  880. # Engine driver device information.
  881. class EngineDriverDeviceInfo(Structure):
  882. _fields_ = [
  883. # This driver device hints.
  884. # @see EngineDriverHints
  885. ("hints", c_uint),
  886. # Available buffer sizes.
  887. # Terminated with 0.
  888. ("bufferSizes", POINTER(c_uint32)),
  889. # Available sample rates.
  890. # Terminated with 0.0.
  891. ("sampleRates", POINTER(c_double))
  892. ]
  893. # ------------------------------------------------------------------------------------------------------------
  894. # Carla Backend API (Python compatible stuff)
  895. # @see ParameterData
  896. PyParameterData = {
  897. 'type': PARAMETER_UNKNOWN,
  898. 'hints': 0x0,
  899. 'index': PARAMETER_NULL,
  900. 'rindex': -1,
  901. 'midiChannel': 0,
  902. 'mappedControlIndex': CONTROL_VALUE_NONE,
  903. 'mappedMinimum': 0.0,
  904. 'mappedMaximum': 1.0,
  905. }
  906. # @see ParameterRanges
  907. PyParameterRanges = {
  908. 'def': 0.0,
  909. 'min': 0.0,
  910. 'max': 1.0,
  911. 'step': 0.01,
  912. 'stepSmall': 0.0001,
  913. 'stepLarge': 0.1
  914. }
  915. # @see MidiProgramData
  916. PyMidiProgramData = {
  917. 'bank': 0,
  918. 'program': 0,
  919. 'name': None
  920. }
  921. # @see CustomData
  922. PyCustomData = {
  923. 'type': None,
  924. 'key': None,
  925. 'value': None
  926. }
  927. # @see EngineDriverDeviceInfo
  928. PyEngineDriverDeviceInfo = {
  929. 'hints': 0x0,
  930. 'bufferSizes': [],
  931. 'sampleRates': []
  932. }
  933. # ------------------------------------------------------------------------------------------------------------
  934. # Carla Host API (C stuff)
  935. # Information about a loaded plugin.
  936. # @see carla_get_plugin_info()
  937. class CarlaPluginInfo(Structure):
  938. _fields_ = [
  939. # Plugin type.
  940. ("type", c_enum),
  941. # Plugin category.
  942. ("category", c_enum),
  943. # Plugin hints.
  944. # @see PluginHints
  945. ("hints", c_uint),
  946. # Plugin options available for the user to change.
  947. # @see PluginOptions
  948. ("optionsAvailable", c_uint),
  949. # Plugin options currently enabled.
  950. # Some options are enabled but not available, which means they will always be on.
  951. # @see PluginOptions
  952. ("optionsEnabled", c_uint),
  953. # Plugin filename.
  954. # This can be the plugin binary or resource file.
  955. ("filename", c_char_p),
  956. # Plugin name.
  957. # This name is unique within a Carla instance.
  958. # @see carla_get_real_plugin_name()
  959. ("name", c_char_p),
  960. # Plugin label or URI.
  961. ("label", c_char_p),
  962. # Plugin author/maker.
  963. ("maker", c_char_p),
  964. # Plugin copyright/license.
  965. ("copyright", c_char_p),
  966. # Icon name for this plugin, in lowercase.
  967. # Default is "plugin".
  968. ("iconName", c_char_p),
  969. # Plugin unique Id.
  970. # This Id is dependent on the plugin type and may sometimes be 0.
  971. ("uniqueId", c_int64)
  972. ]
  973. # Port count information, used for Audio and MIDI ports and parameters.
  974. # @see carla_get_audio_port_count_info()
  975. # @see carla_get_midi_port_count_info()
  976. # @see carla_get_parameter_count_info()
  977. class CarlaPortCountInfo(Structure):
  978. _fields_ = [
  979. # Number of inputs.
  980. ("ins", c_uint32),
  981. # Number of outputs.
  982. ("outs", c_uint32)
  983. ]
  984. # Parameter information.
  985. # @see carla_get_parameter_info()
  986. class CarlaParameterInfo(Structure):
  987. _fields_ = [
  988. # Parameter name.
  989. ("name", c_char_p),
  990. # Parameter symbol.
  991. ("symbol", c_char_p),
  992. # Parameter unit.
  993. ("unit", c_char_p),
  994. # Parameter comment / documentation.
  995. ("comment", c_char_p),
  996. # Parameter group name.
  997. ("groupName", c_char_p),
  998. # Number of scale points.
  999. # @see CarlaScalePointInfo
  1000. ("scalePointCount", c_uint32)
  1001. ]
  1002. # Parameter scale point information.
  1003. # @see carla_get_parameter_scalepoint_info()
  1004. class CarlaScalePointInfo(Structure):
  1005. _fields_ = [
  1006. # Scale point value.
  1007. ("value", c_float),
  1008. # Scale point label.
  1009. ("label", c_char_p)
  1010. ]
  1011. # Transport information.
  1012. # @see carla_get_transport_info()
  1013. class CarlaTransportInfo(Structure):
  1014. _fields_ = [
  1015. # Wherever transport is playing.
  1016. ("playing", c_bool),
  1017. # Current transport frame.
  1018. ("frame", c_uint64),
  1019. # Bar
  1020. ("bar", c_int32),
  1021. # Beat
  1022. ("beat", c_int32),
  1023. # Tick
  1024. ("tick", c_int32),
  1025. # Beats per minute.
  1026. ("bpm", c_double)
  1027. ]
  1028. # Runtime engine information.
  1029. class CarlaRuntimeEngineInfo(Structure):
  1030. _fields_ = [
  1031. # DSP load.
  1032. ("load", c_float),
  1033. # Number of xruns.
  1034. ("xruns", c_uint32)
  1035. ]
  1036. # Runtime engine driver device information.
  1037. class CarlaRuntimeEngineDriverDeviceInfo(Structure):
  1038. _fields_ = [
  1039. # Name of the driver device.
  1040. ("name", c_char_p),
  1041. # This driver device hints.
  1042. # @see EngineDriverHints
  1043. ("hints", c_uint),
  1044. # Current buffer size.
  1045. ("bufferSize", c_uint32),
  1046. # Available buffer sizes.
  1047. # Terminated with 0.
  1048. ("bufferSizes", POINTER(c_uint32)),
  1049. # Current sample rate.
  1050. ("sampleRate", c_double),
  1051. # Available sample rates.
  1052. # Terminated with 0.0.
  1053. ("sampleRates", POINTER(c_double))
  1054. ]
  1055. # Image data for LV2 inline display API.
  1056. # raw image pixmap format is ARGB32,
  1057. class CarlaInlineDisplayImageSurface(Structure):
  1058. _fields_ = [
  1059. ("data", POINTER(c_ubyte)),
  1060. ("width", c_int),
  1061. ("height", c_int),
  1062. ("stride", c_int)
  1063. ]
  1064. # ------------------------------------------------------------------------------------------------------------
  1065. # Carla Host API (Python compatible stuff)
  1066. # @see CarlaPluginInfo
  1067. PyCarlaPluginInfo = {
  1068. 'type': PLUGIN_NONE,
  1069. 'category': PLUGIN_CATEGORY_NONE,
  1070. 'hints': 0x0,
  1071. 'optionsAvailable': 0x0,
  1072. 'optionsEnabled': 0x0,
  1073. 'filename': "",
  1074. 'name': "",
  1075. 'label': "",
  1076. 'maker': "",
  1077. 'copyright': "",
  1078. 'iconName': "",
  1079. 'uniqueId': 0
  1080. }
  1081. # @see CarlaPortCountInfo
  1082. PyCarlaPortCountInfo = {
  1083. 'ins': 0,
  1084. 'outs': 0
  1085. }
  1086. # @see CarlaParameterInfo
  1087. PyCarlaParameterInfo = {
  1088. 'name': "",
  1089. 'symbol': "",
  1090. 'unit': "",
  1091. 'comment': "",
  1092. 'groupName': "",
  1093. 'scalePointCount': 0,
  1094. }
  1095. # @see CarlaScalePointInfo
  1096. PyCarlaScalePointInfo = {
  1097. 'value': 0.0,
  1098. 'label': ""
  1099. }
  1100. # @see CarlaTransportInfo
  1101. PyCarlaTransportInfo = {
  1102. 'playing': False,
  1103. 'frame': 0,
  1104. 'bar': 0,
  1105. 'beat': 0,
  1106. 'tick': 0,
  1107. 'bpm': 0.0
  1108. }
  1109. # @see CarlaRuntimeEngineInfo
  1110. PyCarlaRuntimeEngineInfo = {
  1111. 'load': 0.0,
  1112. 'xruns': 0
  1113. }
  1114. # @see CarlaRuntimeEngineDriverDeviceInfo
  1115. PyCarlaRuntimeEngineDriverDeviceInfo = {
  1116. 'name': "",
  1117. 'hints': 0x0,
  1118. 'bufferSize': 0,
  1119. 'bufferSizes': [],
  1120. 'sampleRate': 0.0,
  1121. 'sampleRates': []
  1122. }
  1123. # ------------------------------------------------------------------------------------------------------------
  1124. # Set BINARY_NATIVE
  1125. if WINDOWS:
  1126. BINARY_NATIVE = BINARY_WIN64 if kIs64bit else BINARY_WIN32
  1127. else:
  1128. BINARY_NATIVE = BINARY_POSIX64 if kIs64bit else BINARY_POSIX32
  1129. # ------------------------------------------------------------------------------------------------------------
  1130. # Carla Host object (Meta)
  1131. class CarlaHostMeta(object):
  1132. #class CarlaHostMeta(object, metaclass=ABCMeta):
  1133. def __init__(self):
  1134. object.__init__(self)
  1135. # info about this host object
  1136. self.isControl = False
  1137. self.isPlugin = False
  1138. self.isRemote = False
  1139. self.nsmOK = False
  1140. # settings
  1141. self.processMode = ENGINE_PROCESS_MODE_PATCHBAY
  1142. self.transportMode = ENGINE_TRANSPORT_MODE_INTERNAL
  1143. self.transportExtra = ""
  1144. self.nextProcessMode = self.processMode
  1145. self.processModeForced = False
  1146. self.audioDriverForced = None
  1147. # settings
  1148. self.experimental = False
  1149. self.exportLV2 = False
  1150. self.forceStereo = False
  1151. self.manageUIs = False
  1152. self.maxParameters = 0
  1153. self.preferPluginBridges = False
  1154. self.preferUIBridges = False
  1155. self.preventBadBehaviour = False
  1156. self.showLogs = False
  1157. self.showPluginBridges = False
  1158. self.showWineBridges = False
  1159. self.uiBridgesTimeout = 0
  1160. self.uisAlwaysOnTop = False
  1161. # settings
  1162. self.pathBinaries = ""
  1163. self.pathResources = ""
  1164. # Get how many engine drivers are available.
  1165. @abstractmethod
  1166. def get_engine_driver_count(self):
  1167. raise NotImplementedError
  1168. # Get an engine driver name.
  1169. # @param index Driver index
  1170. @abstractmethod
  1171. def get_engine_driver_name(self, index):
  1172. raise NotImplementedError
  1173. # Get the device names of an engine driver.
  1174. # @param index Driver index
  1175. @abstractmethod
  1176. def get_engine_driver_device_names(self, index):
  1177. raise NotImplementedError
  1178. # Get information about a device driver.
  1179. # @param index Driver index
  1180. # @param name Device name
  1181. @abstractmethod
  1182. def get_engine_driver_device_info(self, index, name):
  1183. raise NotImplementedError
  1184. # Show a device custom control panel.
  1185. # @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL
  1186. # @param index Driver index
  1187. # @param name Device name
  1188. @abstractmethod
  1189. def show_engine_driver_device_control_panel(self, index, name):
  1190. raise NotImplementedError
  1191. # Initialize the engine.
  1192. # Make sure to call carla_engine_idle() at regular intervals afterwards.
  1193. # @param driverName Driver to use
  1194. # @param clientName Engine master client name
  1195. @abstractmethod
  1196. def engine_init(self, driverName, clientName):
  1197. raise NotImplementedError
  1198. # Close the engine.
  1199. # This function always closes the engine even if it returns false.
  1200. # In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
  1201. @abstractmethod
  1202. def engine_close(self):
  1203. raise NotImplementedError
  1204. # Idle the engine.
  1205. # Do not call this if the engine is not running.
  1206. @abstractmethod
  1207. def engine_idle(self):
  1208. raise NotImplementedError
  1209. # Check if the engine is running.
  1210. @abstractmethod
  1211. def is_engine_running(self):
  1212. raise NotImplementedError
  1213. # Get information about the currently running engine.
  1214. @abstractmethod
  1215. def get_runtime_engine_info(self):
  1216. raise NotImplementedError
  1217. # Get information about the currently running engine driver device.
  1218. @abstractmethod
  1219. def get_runtime_engine_driver_device_info(self):
  1220. raise NotImplementedError
  1221. # Dynamically change buffer size and/or sample rate while engine is running.
  1222. # @see ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE
  1223. # @see ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE
  1224. def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
  1225. raise NotImplementedError
  1226. # Show the custom control panel for the current engine device.
  1227. # @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL
  1228. def show_engine_device_control_panel(self):
  1229. raise NotImplementedError
  1230. # Clear the xrun count on the engine, so that the next time carla_get_runtime_engine_info() is called, it returns 0.
  1231. @abstractmethod
  1232. def clear_engine_xruns(self):
  1233. raise NotImplementedError
  1234. # Tell the engine to stop the current cancelable action.
  1235. # @see ENGINE_CALLBACK_CANCELABLE_ACTION
  1236. @abstractmethod
  1237. def cancel_engine_action(self):
  1238. raise NotImplementedError
  1239. # Tell the engine it's about to close.
  1240. # This is used to prevent the engine thread(s) from reactivating.
  1241. @abstractmethod
  1242. def set_engine_about_to_close(self):
  1243. raise NotImplementedError
  1244. # Set the engine callback function.
  1245. # @param func Callback function
  1246. @abstractmethod
  1247. def set_engine_callback(self, func):
  1248. raise NotImplementedError
  1249. # Set an engine option.
  1250. # @param option Option
  1251. # @param value Value as number
  1252. # @param valueStr Value as string
  1253. @abstractmethod
  1254. def set_engine_option(self, option, value, valueStr):
  1255. raise NotImplementedError
  1256. # Set the file callback function.
  1257. # @param func Callback function
  1258. # @param ptr Callback pointer
  1259. @abstractmethod
  1260. def set_file_callback(self, func):
  1261. raise NotImplementedError
  1262. # Load a file of any type.
  1263. # This will try to load a generic file as a plugin,
  1264. # either by direct handling (SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
  1265. # @see carla_get_supported_file_extensions()
  1266. @abstractmethod
  1267. def load_file(self, filename):
  1268. raise NotImplementedError
  1269. # Load a Carla project file.
  1270. # @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
  1271. @abstractmethod
  1272. def load_project(self, filename):
  1273. raise NotImplementedError
  1274. # Save current project to a file.
  1275. @abstractmethod
  1276. def save_project(self, filename):
  1277. raise NotImplementedError
  1278. # Clear the currently set project filename.
  1279. @abstractmethod
  1280. def clear_project_filename(self):
  1281. raise NotImplementedError
  1282. # Connect two patchbay ports.
  1283. # @param groupIdA Output group
  1284. # @param portIdA Output port
  1285. # @param groupIdB Input group
  1286. # @param portIdB Input port
  1287. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
  1288. @abstractmethod
  1289. def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
  1290. raise NotImplementedError
  1291. # Disconnect two patchbay ports.
  1292. # @param connectionId Connection Id
  1293. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
  1294. @abstractmethod
  1295. def patchbay_disconnect(self, external, connectionId):
  1296. raise NotImplementedError
  1297. # Force the engine to resend all patchbay clients, ports and connections again.
  1298. # @param external Wherever to show external/hardware ports instead of internal ones.
  1299. # Only valid in patchbay engine mode, other modes will ignore this.
  1300. @abstractmethod
  1301. def patchbay_refresh(self, external):
  1302. raise NotImplementedError
  1303. # Start playback of the engine transport.
  1304. @abstractmethod
  1305. def transport_play(self):
  1306. raise NotImplementedError
  1307. # Pause the engine transport.
  1308. @abstractmethod
  1309. def transport_pause(self):
  1310. raise NotImplementedError
  1311. # Pause the engine transport.
  1312. @abstractmethod
  1313. def transport_bpm(self, bpm):
  1314. raise NotImplementedError
  1315. # Relocate the engine transport to a specific frame.
  1316. @abstractmethod
  1317. def transport_relocate(self, frame):
  1318. raise NotImplementedError
  1319. # Get the current transport frame.
  1320. @abstractmethod
  1321. def get_current_transport_frame(self):
  1322. raise NotImplementedError
  1323. # Get the engine transport information.
  1324. @abstractmethod
  1325. def get_transport_info(self):
  1326. raise NotImplementedError
  1327. # Current number of plugins loaded.
  1328. @abstractmethod
  1329. def get_current_plugin_count(self):
  1330. raise NotImplementedError
  1331. # Maximum number of loadable plugins allowed.
  1332. # Returns 0 if engine is not started.
  1333. @abstractmethod
  1334. def get_max_plugin_number(self):
  1335. raise NotImplementedError
  1336. # Add a new plugin.
  1337. # If you don't know the binary type use the BINARY_NATIVE macro.
  1338. # @param btype Binary type
  1339. # @param ptype Plugin type
  1340. # @param filename Filename, if applicable
  1341. # @param name Name of the plugin, can be NULL
  1342. # @param label Plugin label, if applicable
  1343. # @param uniqueId Plugin unique Id, if applicable
  1344. # @param extraPtr Extra pointer, defined per plugin type
  1345. # @param options Initial plugin options
  1346. @abstractmethod
  1347. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  1348. raise NotImplementedError
  1349. # Remove a plugin.
  1350. # @param pluginId Plugin to remove.
  1351. @abstractmethod
  1352. def remove_plugin(self, pluginId):
  1353. raise NotImplementedError
  1354. # Remove all plugins.
  1355. @abstractmethod
  1356. def remove_all_plugins(self):
  1357. raise NotImplementedError
  1358. # Rename a plugin.
  1359. # Returns the new name, or NULL if the operation failed.
  1360. # @param pluginId Plugin to rename
  1361. # @param newName New plugin name
  1362. @abstractmethod
  1363. def rename_plugin(self, pluginId, newName):
  1364. raise NotImplementedError
  1365. # Clone a plugin.
  1366. # @param pluginId Plugin to clone
  1367. @abstractmethod
  1368. def clone_plugin(self, pluginId):
  1369. raise NotImplementedError
  1370. # Prepare replace of a plugin.
  1371. # The next call to carla_add_plugin() will use this id, replacing the current plugin.
  1372. # @param pluginId Plugin to replace
  1373. # @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  1374. @abstractmethod
  1375. def replace_plugin(self, pluginId):
  1376. raise NotImplementedError
  1377. # Switch two plugins positions.
  1378. # @param pluginIdA Plugin A
  1379. # @param pluginIdB Plugin B
  1380. @abstractmethod
  1381. def switch_plugins(self, pluginIdA, pluginIdB):
  1382. raise NotImplementedError
  1383. # Load a plugin state.
  1384. # @param pluginId Plugin
  1385. # @param filename Path to plugin state
  1386. # @see carla_save_plugin_state()
  1387. @abstractmethod
  1388. def load_plugin_state(self, pluginId, filename):
  1389. raise NotImplementedError
  1390. # Save a plugin state.
  1391. # @param pluginId Plugin
  1392. # @param filename Path to plugin state
  1393. # @see carla_load_plugin_state()
  1394. @abstractmethod
  1395. def save_plugin_state(self, pluginId, filename):
  1396. raise NotImplementedError
  1397. # Export plugin as LV2.
  1398. # @param pluginId Plugin
  1399. # @param lv2path Path to lv2 plugin folder
  1400. def export_plugin_lv2(self, pluginId, lv2path):
  1401. raise NotImplementedError
  1402. # Get information from a plugin.
  1403. # @param pluginId Plugin
  1404. @abstractmethod
  1405. def get_plugin_info(self, pluginId):
  1406. raise NotImplementedError
  1407. # Get audio port count information from a plugin.
  1408. # @param pluginId Plugin
  1409. @abstractmethod
  1410. def get_audio_port_count_info(self, pluginId):
  1411. raise NotImplementedError
  1412. # Get MIDI port count information from a plugin.
  1413. # @param pluginId Plugin
  1414. @abstractmethod
  1415. def get_midi_port_count_info(self, pluginId):
  1416. raise NotImplementedError
  1417. # Get parameter count information from a plugin.
  1418. # @param pluginId Plugin
  1419. @abstractmethod
  1420. def get_parameter_count_info(self, pluginId):
  1421. raise NotImplementedError
  1422. # Get parameter information from a plugin.
  1423. # @param pluginId Plugin
  1424. # @param parameterId Parameter index
  1425. # @see carla_get_parameter_count()
  1426. @abstractmethod
  1427. def get_parameter_info(self, pluginId, parameterId):
  1428. raise NotImplementedError
  1429. # Get parameter scale point information from a plugin.
  1430. # @param pluginId Plugin
  1431. # @param parameterId Parameter index
  1432. # @param scalePointId Parameter scale-point index
  1433. # @see CarlaParameterInfo::scalePointCount
  1434. @abstractmethod
  1435. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1436. raise NotImplementedError
  1437. # Get a plugin's parameter data.
  1438. # @param pluginId Plugin
  1439. # @param parameterId Parameter index
  1440. # @see carla_get_parameter_count()
  1441. @abstractmethod
  1442. def get_parameter_data(self, pluginId, parameterId):
  1443. raise NotImplementedError
  1444. # Get a plugin's parameter ranges.
  1445. # @param pluginId Plugin
  1446. # @param parameterId Parameter index
  1447. # @see carla_get_parameter_count()
  1448. @abstractmethod
  1449. def get_parameter_ranges(self, pluginId, parameterId):
  1450. raise NotImplementedError
  1451. # Get a plugin's MIDI program data.
  1452. # @param pluginId Plugin
  1453. # @param midiProgramId MIDI Program index
  1454. # @see carla_get_midi_program_count()
  1455. @abstractmethod
  1456. def get_midi_program_data(self, pluginId, midiProgramId):
  1457. raise NotImplementedError
  1458. # Get a plugin's custom data, using index.
  1459. # @param pluginId Plugin
  1460. # @param customDataId Custom data index
  1461. # @see carla_get_custom_data_count()
  1462. @abstractmethod
  1463. def get_custom_data(self, pluginId, customDataId):
  1464. raise NotImplementedError
  1465. # Get a plugin's custom data value, using type and key.
  1466. # @param pluginId Plugin
  1467. # @param type Custom data type
  1468. # @param key Custom data key
  1469. # @see carla_get_custom_data_count()
  1470. @abstractmethod
  1471. def get_custom_data_value(self, pluginId, type_, key):
  1472. raise NotImplementedError
  1473. # Get a plugin's chunk data.
  1474. # @param pluginId Plugin
  1475. # @see PLUGIN_OPTION_USE_CHUNKS
  1476. @abstractmethod
  1477. def get_chunk_data(self, pluginId):
  1478. raise NotImplementedError
  1479. # Get how many parameters a plugin has.
  1480. # @param pluginId Plugin
  1481. @abstractmethod
  1482. def get_parameter_count(self, pluginId):
  1483. raise NotImplementedError
  1484. # Get how many programs a plugin has.
  1485. # @param pluginId Plugin
  1486. # @see carla_get_program_name()
  1487. @abstractmethod
  1488. def get_program_count(self, pluginId):
  1489. raise NotImplementedError
  1490. # Get how many MIDI programs a plugin has.
  1491. # @param pluginId Plugin
  1492. # @see carla_get_midi_program_name() and carla_get_midi_program_data()
  1493. @abstractmethod
  1494. def get_midi_program_count(self, pluginId):
  1495. raise NotImplementedError
  1496. # Get how many custom data sets a plugin has.
  1497. # @param pluginId Plugin
  1498. # @see carla_get_custom_data()
  1499. @abstractmethod
  1500. def get_custom_data_count(self, pluginId):
  1501. raise NotImplementedError
  1502. # Get a plugin's parameter text (custom display of internal values).
  1503. # @param pluginId Plugin
  1504. # @param parameterId Parameter index
  1505. # @see PARAMETER_USES_CUSTOM_TEXT
  1506. @abstractmethod
  1507. def get_parameter_text(self, pluginId, parameterId):
  1508. raise NotImplementedError
  1509. # Get a plugin's program name.
  1510. # @param pluginId Plugin
  1511. # @param programId Program index
  1512. # @see carla_get_program_count()
  1513. @abstractmethod
  1514. def get_program_name(self, pluginId, programId):
  1515. raise NotImplementedError
  1516. # Get a plugin's MIDI program name.
  1517. # @param pluginId Plugin
  1518. # @param midiProgramId MIDI Program index
  1519. # @see carla_get_midi_program_count()
  1520. @abstractmethod
  1521. def get_midi_program_name(self, pluginId, midiProgramId):
  1522. raise NotImplementedError
  1523. # Get a plugin's real name.
  1524. # This is the name the plugin uses to identify itself; may not be unique.
  1525. # @param pluginId Plugin
  1526. @abstractmethod
  1527. def get_real_plugin_name(self, pluginId):
  1528. raise NotImplementedError
  1529. # Get a plugin's program index.
  1530. # @param pluginId Plugin
  1531. @abstractmethod
  1532. def get_current_program_index(self, pluginId):
  1533. raise NotImplementedError
  1534. # Get a plugin's midi program index.
  1535. # @param pluginId Plugin
  1536. @abstractmethod
  1537. def get_current_midi_program_index(self, pluginId):
  1538. raise NotImplementedError
  1539. # Get a plugin's default parameter value.
  1540. # @param pluginId Plugin
  1541. # @param parameterId Parameter index
  1542. @abstractmethod
  1543. def get_default_parameter_value(self, pluginId, parameterId):
  1544. raise NotImplementedError
  1545. # Get a plugin's current parameter value.
  1546. # @param pluginId Plugin
  1547. # @param parameterId Parameter index
  1548. @abstractmethod
  1549. def get_current_parameter_value(self, pluginId, parameterId):
  1550. raise NotImplementedError
  1551. # Get a plugin's internal parameter value.
  1552. # @param pluginId Plugin
  1553. # @param parameterId Parameter index, maybe be negative
  1554. # @see InternalParameterIndex
  1555. @abstractmethod
  1556. def get_internal_parameter_value(self, pluginId, parameterId):
  1557. raise NotImplementedError
  1558. # Get a plugin's input peak value.
  1559. # @param pluginId Plugin
  1560. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1561. @abstractmethod
  1562. def get_input_peak_value(self, pluginId, isLeft):
  1563. raise NotImplementedError
  1564. # Get a plugin's output peak value.
  1565. # @param pluginId Plugin
  1566. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1567. @abstractmethod
  1568. def get_output_peak_value(self, pluginId, isLeft):
  1569. raise NotImplementedError
  1570. # Render a plugin's inline display.
  1571. # @param pluginId Plugin
  1572. @abstractmethod
  1573. def render_inline_display(self, pluginId, width, height):
  1574. raise NotImplementedError
  1575. # Enable a plugin's option.
  1576. # @param pluginId Plugin
  1577. # @param option An option from PluginOptions
  1578. # @param yesNo New enabled state
  1579. @abstractmethod
  1580. def set_option(self, pluginId, option, yesNo):
  1581. raise NotImplementedError
  1582. # Enable or disable a plugin.
  1583. # @param pluginId Plugin
  1584. # @param onOff New active state
  1585. @abstractmethod
  1586. def set_active(self, pluginId, onOff):
  1587. raise NotImplementedError
  1588. # Change a plugin's internal dry/wet.
  1589. # @param pluginId Plugin
  1590. # @param value New dry/wet value
  1591. @abstractmethod
  1592. def set_drywet(self, pluginId, value):
  1593. raise NotImplementedError
  1594. # Change a plugin's internal volume.
  1595. # @param pluginId Plugin
  1596. # @param value New volume
  1597. @abstractmethod
  1598. def set_volume(self, pluginId, value):
  1599. raise NotImplementedError
  1600. # Change a plugin's internal stereo balance, left channel.
  1601. # @param pluginId Plugin
  1602. # @param value New value
  1603. @abstractmethod
  1604. def set_balance_left(self, pluginId, value):
  1605. raise NotImplementedError
  1606. # Change a plugin's internal stereo balance, right channel.
  1607. # @param pluginId Plugin
  1608. # @param value New value
  1609. @abstractmethod
  1610. def set_balance_right(self, pluginId, value):
  1611. raise NotImplementedError
  1612. # Change a plugin's internal mono panning value.
  1613. # @param pluginId Plugin
  1614. # @param value New value
  1615. @abstractmethod
  1616. def set_panning(self, pluginId, value):
  1617. raise NotImplementedError
  1618. # Change a plugin's internal control channel.
  1619. # @param pluginId Plugin
  1620. # @param channel New channel
  1621. @abstractmethod
  1622. def set_ctrl_channel(self, pluginId, channel):
  1623. raise NotImplementedError
  1624. # Change a plugin's parameter value.
  1625. # @param pluginId Plugin
  1626. # @param parameterId Parameter index
  1627. # @param value New value
  1628. @abstractmethod
  1629. def set_parameter_value(self, pluginId, parameterId, value):
  1630. raise NotImplementedError
  1631. # Change a plugin's parameter mapped control index.
  1632. # @param pluginId Plugin
  1633. # @param parameterId Parameter index
  1634. # @param cc New MIDI cc
  1635. @abstractmethod
  1636. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1637. raise NotImplementedError
  1638. # Change a plugin's parameter MIDI channel.
  1639. # @param pluginId Plugin
  1640. # @param parameterId Parameter index
  1641. # @param channel New control index
  1642. @abstractmethod
  1643. def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
  1644. raise NotImplementedError
  1645. # Change a plugin's parameter mapped range.
  1646. # @param pluginId Plugin
  1647. # @param parameterId Parameter index
  1648. # @param minimum New mapped minimum
  1649. # @param maximum New mapped maximum
  1650. @abstractmethod
  1651. def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
  1652. raise NotImplementedError
  1653. # Change a plugin's parameter in drag/touch mode state.
  1654. # Usually happens from a UI when the user is moving a parameter with a mouse or similar input.
  1655. # @param pluginId Plugin
  1656. # @param parameterId Parameter index
  1657. # @param touch New state
  1658. @abstractmethod
  1659. def set_parameter_touch(self, pluginId, parameterId, touch):
  1660. raise NotImplementedError
  1661. # Change a plugin's current program.
  1662. # @param pluginId Plugin
  1663. # @param programId New program
  1664. @abstractmethod
  1665. def set_program(self, pluginId, programId):
  1666. raise NotImplementedError
  1667. # Change a plugin's current MIDI program.
  1668. # @param pluginId Plugin
  1669. # @param midiProgramId New value
  1670. @abstractmethod
  1671. def set_midi_program(self, pluginId, midiProgramId):
  1672. raise NotImplementedError
  1673. # Set a plugin's custom data set.
  1674. # @param pluginId Plugin
  1675. # @param type Type
  1676. # @param key Key
  1677. # @param value New value
  1678. # @see CustomDataTypes and CustomDataKeys
  1679. @abstractmethod
  1680. def set_custom_data(self, pluginId, type_, key, value):
  1681. raise NotImplementedError
  1682. # Set a plugin's chunk data.
  1683. # @param pluginId Plugin
  1684. # @param chunkData New chunk data
  1685. # @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  1686. @abstractmethod
  1687. def set_chunk_data(self, pluginId, chunkData):
  1688. raise NotImplementedError
  1689. # Tell a plugin to prepare for save.
  1690. # This should be called before saving custom data sets.
  1691. # @param pluginId Plugin
  1692. @abstractmethod
  1693. def prepare_for_save(self, pluginId):
  1694. raise NotImplementedError
  1695. # Reset all plugin's parameters.
  1696. # @param pluginId Plugin
  1697. @abstractmethod
  1698. def reset_parameters(self, pluginId):
  1699. raise NotImplementedError
  1700. # Randomize all plugin's parameters.
  1701. # @param pluginId Plugin
  1702. @abstractmethod
  1703. def randomize_parameters(self, pluginId):
  1704. raise NotImplementedError
  1705. # Send a single note of a plugin.
  1706. # If velocity is 0, note-off is sent; note-on otherwise.
  1707. # @param pluginId Plugin
  1708. # @param channel Note channel
  1709. # @param note Note pitch
  1710. # @param velocity Note velocity
  1711. @abstractmethod
  1712. def send_midi_note(self, pluginId, channel, note, velocity):
  1713. raise NotImplementedError
  1714. # Tell a plugin to show its own custom UI.
  1715. # @param pluginId Plugin
  1716. # @param yesNo New UI state, visible or not
  1717. # @see PLUGIN_HAS_CUSTOM_UI
  1718. @abstractmethod
  1719. def show_custom_ui(self, pluginId, yesNo):
  1720. raise NotImplementedError
  1721. # Get the current engine buffer size.
  1722. @abstractmethod
  1723. def get_buffer_size(self):
  1724. raise NotImplementedError
  1725. # Get the current engine sample rate.
  1726. @abstractmethod
  1727. def get_sample_rate(self):
  1728. raise NotImplementedError
  1729. # Get the last error.
  1730. @abstractmethod
  1731. def get_last_error(self):
  1732. raise NotImplementedError
  1733. # Get the current engine OSC URL (TCP).
  1734. @abstractmethod
  1735. def get_host_osc_url_tcp(self):
  1736. raise NotImplementedError
  1737. # Get the current engine OSC URL (UDP).
  1738. @abstractmethod
  1739. def get_host_osc_url_udp(self):
  1740. raise NotImplementedError
  1741. # Initialize NSM (that is, announce ourselves to it).
  1742. # Must be called as early as possible in the program's lifecycle.
  1743. # Returns true if NSM is available and initialized correctly.
  1744. @abstractmethod
  1745. def nsm_init(self, pid, executableName):
  1746. raise NotImplementedError
  1747. # Respond to an NSM callback.
  1748. @abstractmethod
  1749. def nsm_ready(self, opcode):
  1750. raise NotImplementedError
  1751. # ------------------------------------------------------------------------------------------------------------
  1752. # Carla Host object (dummy/null, does nothing)
  1753. class CarlaHostNull(CarlaHostMeta):
  1754. def __init__(self):
  1755. CarlaHostMeta.__init__(self)
  1756. self.fEngineCallback = None
  1757. self.fFileCallback = None
  1758. self.fEngineRunning = False
  1759. def get_engine_driver_count(self):
  1760. return 0
  1761. def get_engine_driver_name(self, index):
  1762. return ""
  1763. def get_engine_driver_device_names(self, index):
  1764. return []
  1765. def get_engine_driver_device_info(self, index, name):
  1766. return PyEngineDriverDeviceInfo
  1767. def show_engine_driver_device_control_panel(self, index, name):
  1768. return False
  1769. def engine_init(self, driverName, clientName):
  1770. self.fEngineRunning = True
  1771. if self.fEngineCallback is not None:
  1772. self.fEngineCallback(None,
  1773. ENGINE_CALLBACK_ENGINE_STARTED,
  1774. 0,
  1775. self.processMode,
  1776. self.transportMode,
  1777. 0, 0.0,
  1778. driverName)
  1779. return True
  1780. def engine_close(self):
  1781. self.fEngineRunning = False
  1782. if self.fEngineCallback is not None:
  1783. self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0, 0.0, "")
  1784. return True
  1785. def engine_idle(self):
  1786. return
  1787. def is_engine_running(self):
  1788. return self.fEngineRunning
  1789. def get_runtime_engine_info(self):
  1790. return PyCarlaRuntimeEngineInfo
  1791. def get_runtime_engine_driver_device_info(self):
  1792. return PyCarlaRuntimeEngineDriverDeviceInfo
  1793. def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
  1794. return False
  1795. def show_engine_device_control_panel(self):
  1796. return False
  1797. def clear_engine_xruns(self):
  1798. return
  1799. def cancel_engine_action(self):
  1800. return
  1801. def set_engine_about_to_close(self):
  1802. return True
  1803. def set_engine_callback(self, func):
  1804. self.fEngineCallback = func
  1805. def set_engine_option(self, option, value, valueStr):
  1806. return
  1807. def set_file_callback(self, func):
  1808. self.fFileCallback = func
  1809. def load_file(self, filename):
  1810. return False
  1811. def load_project(self, filename):
  1812. return False
  1813. def save_project(self, filename):
  1814. return False
  1815. def clear_project_filename(self):
  1816. return
  1817. def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
  1818. return False
  1819. def patchbay_disconnect(self, external, connectionId):
  1820. return False
  1821. def patchbay_refresh(self, external):
  1822. return False
  1823. def transport_play(self):
  1824. return
  1825. def transport_pause(self):
  1826. return
  1827. def transport_bpm(self, bpm):
  1828. return
  1829. def transport_relocate(self, frame):
  1830. return
  1831. def get_current_transport_frame(self):
  1832. return 0
  1833. def get_transport_info(self):
  1834. return PyCarlaTransportInfo
  1835. def get_current_plugin_count(self):
  1836. return 0
  1837. def get_max_plugin_number(self):
  1838. return 0
  1839. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  1840. return False
  1841. def remove_plugin(self, pluginId):
  1842. return False
  1843. def remove_all_plugins(self):
  1844. return False
  1845. def rename_plugin(self, pluginId, newName):
  1846. return False
  1847. def clone_plugin(self, pluginId):
  1848. return False
  1849. def replace_plugin(self, pluginId):
  1850. return False
  1851. def switch_plugins(self, pluginIdA, pluginIdB):
  1852. return False
  1853. def load_plugin_state(self, pluginId, filename):
  1854. return False
  1855. def save_plugin_state(self, pluginId, filename):
  1856. return False
  1857. def export_plugin_lv2(self, pluginId, lv2path):
  1858. return False
  1859. def get_plugin_info(self, pluginId):
  1860. return PyCarlaPluginInfo
  1861. def get_audio_port_count_info(self, pluginId):
  1862. return PyCarlaPortCountInfo
  1863. def get_midi_port_count_info(self, pluginId):
  1864. return PyCarlaPortCountInfo
  1865. def get_parameter_count_info(self, pluginId):
  1866. return PyCarlaPortCountInfo
  1867. def get_parameter_info(self, pluginId, parameterId):
  1868. return PyCarlaParameterInfo
  1869. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1870. return PyCarlaScalePointInfo
  1871. def get_parameter_data(self, pluginId, parameterId):
  1872. return PyParameterData
  1873. def get_parameter_ranges(self, pluginId, parameterId):
  1874. return PyParameterRanges
  1875. def get_midi_program_data(self, pluginId, midiProgramId):
  1876. return PyMidiProgramData
  1877. def get_custom_data(self, pluginId, customDataId):
  1878. return PyCustomData
  1879. def get_custom_data_value(self, pluginId, type_, key):
  1880. return ""
  1881. def get_chunk_data(self, pluginId):
  1882. return ""
  1883. def get_parameter_count(self, pluginId):
  1884. return 0
  1885. def get_program_count(self, pluginId):
  1886. return 0
  1887. def get_midi_program_count(self, pluginId):
  1888. return 0
  1889. def get_custom_data_count(self, pluginId):
  1890. return 0
  1891. def get_parameter_text(self, pluginId, parameterId):
  1892. return ""
  1893. def get_program_name(self, pluginId, programId):
  1894. return ""
  1895. def get_midi_program_name(self, pluginId, midiProgramId):
  1896. return ""
  1897. def get_real_plugin_name(self, pluginId):
  1898. return ""
  1899. def get_current_program_index(self, pluginId):
  1900. return 0
  1901. def get_current_midi_program_index(self, pluginId):
  1902. return 0
  1903. def get_default_parameter_value(self, pluginId, parameterId):
  1904. return 0.0
  1905. def get_current_parameter_value(self, pluginId, parameterId):
  1906. return 0.0
  1907. def get_internal_parameter_value(self, pluginId, parameterId):
  1908. return 0.0
  1909. def get_input_peak_value(self, pluginId, isLeft):
  1910. return 0.0
  1911. def get_output_peak_value(self, pluginId, isLeft):
  1912. return 0.0
  1913. def render_inline_display(self, pluginId, width, height):
  1914. return None
  1915. def set_option(self, pluginId, option, yesNo):
  1916. return
  1917. def set_active(self, pluginId, onOff):
  1918. return
  1919. def set_drywet(self, pluginId, value):
  1920. return
  1921. def set_volume(self, pluginId, value):
  1922. return
  1923. def set_balance_left(self, pluginId, value):
  1924. return
  1925. def set_balance_right(self, pluginId, value):
  1926. return
  1927. def set_panning(self, pluginId, value):
  1928. return
  1929. def set_ctrl_channel(self, pluginId, channel):
  1930. return
  1931. def set_parameter_value(self, pluginId, parameterId, value):
  1932. return
  1933. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1934. return
  1935. def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
  1936. return
  1937. def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
  1938. return
  1939. def set_parameter_touch(self, pluginId, parameterId, touch):
  1940. return
  1941. def set_program(self, pluginId, programId):
  1942. return
  1943. def set_midi_program(self, pluginId, midiProgramId):
  1944. return
  1945. def set_custom_data(self, pluginId, type_, key, value):
  1946. return
  1947. def set_chunk_data(self, pluginId, chunkData):
  1948. return
  1949. def prepare_for_save(self, pluginId):
  1950. return
  1951. def reset_parameters(self, pluginId):
  1952. return
  1953. def randomize_parameters(self, pluginId):
  1954. return
  1955. def send_midi_note(self, pluginId, channel, note, velocity):
  1956. return
  1957. def show_custom_ui(self, pluginId, yesNo):
  1958. return
  1959. def get_buffer_size(self):
  1960. return 0
  1961. def get_sample_rate(self):
  1962. return 0.0
  1963. def get_last_error(self):
  1964. return ""
  1965. def get_host_osc_url_tcp(self):
  1966. return ""
  1967. def get_host_osc_url_udp(self):
  1968. return ""
  1969. def nsm_init(self, pid, executableName):
  1970. return False
  1971. def nsm_ready(self, opcode):
  1972. return
  1973. # ------------------------------------------------------------------------------------------------------------
  1974. # Carla Host object using a DLL
  1975. class CarlaHostDLL(CarlaHostMeta):
  1976. def __init__(self, libName, loadGlobal):
  1977. CarlaHostMeta.__init__(self)
  1978. # info about this host object
  1979. self.isPlugin = False
  1980. self.lib = CDLL(libName, RTLD_GLOBAL if loadGlobal else RTLD_LOCAL)
  1981. self.lib.carla_get_engine_driver_count.argtypes = None
  1982. self.lib.carla_get_engine_driver_count.restype = c_uint
  1983. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  1984. self.lib.carla_get_engine_driver_name.restype = c_char_p
  1985. self.lib.carla_get_engine_driver_device_names.argtypes = [c_uint]
  1986. self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)
  1987. self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p]
  1988. self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)
  1989. self.lib.carla_show_engine_driver_device_control_panel.argtypes = [c_uint, c_char_p]
  1990. self.lib.carla_show_engine_driver_device_control_panel.restype = c_bool
  1991. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  1992. self.lib.carla_engine_init.restype = c_bool
  1993. self.lib.carla_engine_close.argtypes = None
  1994. self.lib.carla_engine_close.restype = c_bool
  1995. self.lib.carla_engine_idle.argtypes = None
  1996. self.lib.carla_engine_idle.restype = None
  1997. self.lib.carla_is_engine_running.argtypes = None
  1998. self.lib.carla_is_engine_running.restype = c_bool
  1999. self.lib.carla_get_runtime_engine_info.argtypes = None
  2000. self.lib.carla_get_runtime_engine_info.restype = POINTER(CarlaRuntimeEngineInfo)
  2001. self.lib.carla_get_runtime_engine_driver_device_info.argtypes = None
  2002. self.lib.carla_get_runtime_engine_driver_device_info.restype = POINTER(CarlaRuntimeEngineDriverDeviceInfo)
  2003. self.lib.carla_set_engine_buffer_size_and_sample_rate.argtypes = [c_uint, c_double]
  2004. self.lib.carla_set_engine_buffer_size_and_sample_rate.restype = c_bool
  2005. self.lib.carla_show_engine_device_control_panel.argtypes = None
  2006. self.lib.carla_show_engine_device_control_panel.restype = c_bool
  2007. self.lib.carla_clear_engine_xruns.argtypes = None
  2008. self.lib.carla_clear_engine_xruns.restype = None
  2009. self.lib.carla_cancel_engine_action.argtypes = None
  2010. self.lib.carla_cancel_engine_action.restype = None
  2011. self.lib.carla_set_engine_about_to_close.argtypes = None
  2012. self.lib.carla_set_engine_about_to_close.restype = c_bool
  2013. self.lib.carla_set_engine_callback.argtypes = [EngineCallbackFunc, c_void_p]
  2014. self.lib.carla_set_engine_callback.restype = None
  2015. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  2016. self.lib.carla_set_engine_option.restype = None
  2017. self.lib.carla_set_file_callback.argtypes = [FileCallbackFunc, c_void_p]
  2018. self.lib.carla_set_file_callback.restype = None
  2019. self.lib.carla_load_file.argtypes = [c_char_p]
  2020. self.lib.carla_load_file.restype = c_bool
  2021. self.lib.carla_load_project.argtypes = [c_char_p]
  2022. self.lib.carla_load_project.restype = c_bool
  2023. self.lib.carla_save_project.argtypes = [c_char_p]
  2024. self.lib.carla_save_project.restype = c_bool
  2025. self.lib.carla_clear_project_filename.argtypes = None
  2026. self.lib.carla_clear_project_filename.restype = None
  2027. self.lib.carla_patchbay_connect.argtypes = [c_bool, c_uint, c_uint, c_uint, c_uint]
  2028. self.lib.carla_patchbay_connect.restype = c_bool
  2029. self.lib.carla_patchbay_disconnect.argtypes = [c_bool, c_uint]
  2030. self.lib.carla_patchbay_disconnect.restype = c_bool
  2031. self.lib.carla_patchbay_refresh.argtypes = [c_bool]
  2032. self.lib.carla_patchbay_refresh.restype = c_bool
  2033. self.lib.carla_transport_play.argtypes = None
  2034. self.lib.carla_transport_play.restype = None
  2035. self.lib.carla_transport_pause.argtypes = None
  2036. self.lib.carla_transport_pause.restype = None
  2037. self.lib.carla_transport_bpm.argtypes = [c_double]
  2038. self.lib.carla_transport_bpm.restype = None
  2039. self.lib.carla_transport_relocate.argtypes = [c_uint64]
  2040. self.lib.carla_transport_relocate.restype = None
  2041. self.lib.carla_get_current_transport_frame.argtypes = None
  2042. self.lib.carla_get_current_transport_frame.restype = c_uint64
  2043. self.lib.carla_get_transport_info.argtypes = None
  2044. self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
  2045. self.lib.carla_get_current_plugin_count.argtypes = None
  2046. self.lib.carla_get_current_plugin_count.restype = c_uint32
  2047. self.lib.carla_get_max_plugin_number.argtypes = None
  2048. self.lib.carla_get_max_plugin_number.restype = c_uint32
  2049. self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_int64, c_void_p, c_uint]
  2050. self.lib.carla_add_plugin.restype = c_bool
  2051. self.lib.carla_remove_plugin.argtypes = [c_uint]
  2052. self.lib.carla_remove_plugin.restype = c_bool
  2053. self.lib.carla_remove_all_plugins.argtypes = None
  2054. self.lib.carla_remove_all_plugins.restype = c_bool
  2055. self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
  2056. self.lib.carla_rename_plugin.restype = c_bool
  2057. self.lib.carla_clone_plugin.argtypes = [c_uint]
  2058. self.lib.carla_clone_plugin.restype = c_bool
  2059. self.lib.carla_replace_plugin.argtypes = [c_uint]
  2060. self.lib.carla_replace_plugin.restype = c_bool
  2061. self.lib.carla_switch_plugins.argtypes = [c_uint, c_uint]
  2062. self.lib.carla_switch_plugins.restype = c_bool
  2063. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  2064. self.lib.carla_load_plugin_state.restype = c_bool
  2065. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  2066. self.lib.carla_save_plugin_state.restype = c_bool
  2067. self.lib.carla_export_plugin_lv2.argtypes = [c_uint, c_char_p]
  2068. self.lib.carla_export_plugin_lv2.restype = c_bool
  2069. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  2070. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  2071. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  2072. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  2073. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  2074. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  2075. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  2076. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  2077. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  2078. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  2079. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  2080. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  2081. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  2082. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  2083. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  2084. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  2085. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  2086. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  2087. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  2088. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  2089. self.lib.carla_get_custom_data_value.argtypes = [c_uint, c_char_p, c_char_p]
  2090. self.lib.carla_get_custom_data_value.restype = c_char_p
  2091. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  2092. self.lib.carla_get_chunk_data.restype = c_char_p
  2093. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  2094. self.lib.carla_get_parameter_count.restype = c_uint32
  2095. self.lib.carla_get_program_count.argtypes = [c_uint]
  2096. self.lib.carla_get_program_count.restype = c_uint32
  2097. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  2098. self.lib.carla_get_midi_program_count.restype = c_uint32
  2099. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  2100. self.lib.carla_get_custom_data_count.restype = c_uint32
  2101. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
  2102. self.lib.carla_get_parameter_text.restype = c_char_p
  2103. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  2104. self.lib.carla_get_program_name.restype = c_char_p
  2105. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  2106. self.lib.carla_get_midi_program_name.restype = c_char_p
  2107. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  2108. self.lib.carla_get_real_plugin_name.restype = c_char_p
  2109. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  2110. self.lib.carla_get_current_program_index.restype = c_int32
  2111. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  2112. self.lib.carla_get_current_midi_program_index.restype = c_int32
  2113. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  2114. self.lib.carla_get_default_parameter_value.restype = c_float
  2115. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  2116. self.lib.carla_get_current_parameter_value.restype = c_float
  2117. self.lib.carla_get_internal_parameter_value.argtypes = [c_uint, c_int32]
  2118. self.lib.carla_get_internal_parameter_value.restype = c_float
  2119. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_bool]
  2120. self.lib.carla_get_input_peak_value.restype = c_float
  2121. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_bool]
  2122. self.lib.carla_get_output_peak_value.restype = c_float
  2123. self.lib.carla_render_inline_display.argtypes = [c_uint, c_uint, c_uint]
  2124. self.lib.carla_render_inline_display.restype = POINTER(CarlaInlineDisplayImageSurface)
  2125. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  2126. self.lib.carla_set_option.restype = None
  2127. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  2128. self.lib.carla_set_active.restype = None
  2129. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  2130. self.lib.carla_set_drywet.restype = None
  2131. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  2132. self.lib.carla_set_volume.restype = None
  2133. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  2134. self.lib.carla_set_balance_left.restype = None
  2135. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  2136. self.lib.carla_set_balance_right.restype = None
  2137. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  2138. self.lib.carla_set_panning.restype = None
  2139. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  2140. self.lib.carla_set_ctrl_channel.restype = None
  2141. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  2142. self.lib.carla_set_parameter_value.restype = None
  2143. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  2144. self.lib.carla_set_parameter_midi_channel.restype = None
  2145. self.lib.carla_set_parameter_mapped_control_index.argtypes = [c_uint, c_uint32, c_int16]
  2146. self.lib.carla_set_parameter_mapped_control_index.restype = None
  2147. self.lib.carla_set_parameter_mapped_range.argtypes = [c_uint, c_uint32, c_float, c_float]
  2148. self.lib.carla_set_parameter_mapped_range.restype = None
  2149. self.lib.carla_set_parameter_touch.argtypes = [c_uint, c_uint32, c_bool]
  2150. self.lib.carla_set_parameter_touch.restype = None
  2151. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  2152. self.lib.carla_set_program.restype = None
  2153. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  2154. self.lib.carla_set_midi_program.restype = None
  2155. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  2156. self.lib.carla_set_custom_data.restype = None
  2157. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  2158. self.lib.carla_set_chunk_data.restype = None
  2159. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  2160. self.lib.carla_prepare_for_save.restype = None
  2161. self.lib.carla_reset_parameters.argtypes = [c_uint]
  2162. self.lib.carla_reset_parameters.restype = None
  2163. self.lib.carla_randomize_parameters.argtypes = [c_uint]
  2164. self.lib.carla_randomize_parameters.restype = None
  2165. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  2166. self.lib.carla_send_midi_note.restype = None
  2167. self.lib.carla_show_custom_ui.argtypes = [c_uint, c_bool]
  2168. self.lib.carla_show_custom_ui.restype = None
  2169. self.lib.carla_get_buffer_size.argtypes = None
  2170. self.lib.carla_get_buffer_size.restype = c_uint32
  2171. self.lib.carla_get_sample_rate.argtypes = None
  2172. self.lib.carla_get_sample_rate.restype = c_double
  2173. self.lib.carla_get_last_error.argtypes = None
  2174. self.lib.carla_get_last_error.restype = c_char_p
  2175. self.lib.carla_get_host_osc_url_tcp.argtypes = None
  2176. self.lib.carla_get_host_osc_url_tcp.restype = c_char_p
  2177. self.lib.carla_get_host_osc_url_udp.argtypes = None
  2178. self.lib.carla_get_host_osc_url_udp.restype = c_char_p
  2179. self.lib.carla_nsm_init.argtypes = [c_uint64, c_char_p]
  2180. self.lib.carla_nsm_init.restype = c_bool
  2181. self.lib.carla_nsm_ready.argtypes = [c_int]
  2182. self.lib.carla_nsm_ready.restype = None
  2183. # --------------------------------------------------------------------------------------------------------
  2184. def get_engine_driver_count(self):
  2185. return int(self.lib.carla_get_engine_driver_count())
  2186. def get_engine_driver_name(self, index):
  2187. return charPtrToString(self.lib.carla_get_engine_driver_name(index))
  2188. def get_engine_driver_device_names(self, index):
  2189. return charPtrPtrToStringList(self.lib.carla_get_engine_driver_device_names(index))
  2190. def get_engine_driver_device_info(self, index, name):
  2191. return structToDict(self.lib.carla_get_engine_driver_device_info(index, name.encode("utf-8")).contents)
  2192. def show_engine_driver_device_control_panel(self, index, name):
  2193. return bool(self.lib.carla_show_engine_driver_device_control_panel(index, name.encode("utf-8")))
  2194. def engine_init(self, driverName, clientName):
  2195. return bool(self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8")))
  2196. def engine_close(self):
  2197. return bool(self.lib.carla_engine_close())
  2198. def engine_idle(self):
  2199. self.lib.carla_engine_idle()
  2200. def is_engine_running(self):
  2201. return bool(self.lib.carla_is_engine_running())
  2202. def get_runtime_engine_info(self):
  2203. return structToDict(self.lib.carla_get_runtime_engine_info().contents)
  2204. def get_runtime_engine_driver_device_info(self):
  2205. return structToDict(self.lib.carla_get_runtime_engine_driver_device_info().contents)
  2206. def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
  2207. return bool(self.lib.carla_set_engine_buffer_size_and_sample_rate(bufferSize, sampleRate))
  2208. def show_engine_device_control_panel(self):
  2209. return bool(self.lib.carla_show_engine_device_control_panel())
  2210. def clear_engine_xruns(self):
  2211. self.lib.carla_clear_engine_xruns()
  2212. def cancel_engine_action(self):
  2213. self.lib.carla_cancel_engine_action()
  2214. def set_engine_about_to_close(self):
  2215. return bool(self.lib.carla_set_engine_about_to_close())
  2216. def set_engine_callback(self, func):
  2217. self._engineCallback = EngineCallbackFunc(func)
  2218. self.lib.carla_set_engine_callback(self._engineCallback, None)
  2219. def set_engine_option(self, option, value, valueStr):
  2220. self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
  2221. def set_file_callback(self, func):
  2222. self._fileCallback = FileCallbackFunc(func)
  2223. self.lib.carla_set_file_callback(self._fileCallback, None)
  2224. def load_file(self, filename):
  2225. return bool(self.lib.carla_load_file(filename.encode("utf-8")))
  2226. def load_project(self, filename):
  2227. return bool(self.lib.carla_load_project(filename.encode("utf-8")))
  2228. def save_project(self, filename):
  2229. return bool(self.lib.carla_save_project(filename.encode("utf-8")))
  2230. def clear_project_filename(self):
  2231. self.lib.carla_clear_project_filename()
  2232. def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
  2233. return bool(self.lib.carla_patchbay_connect(external, groupIdA, portIdA, groupIdB, portIdB))
  2234. def patchbay_disconnect(self, external, connectionId):
  2235. return bool(self.lib.carla_patchbay_disconnect(external, connectionId))
  2236. def patchbay_refresh(self, external):
  2237. return bool(self.lib.carla_patchbay_refresh(external))
  2238. def transport_play(self):
  2239. self.lib.carla_transport_play()
  2240. def transport_pause(self):
  2241. self.lib.carla_transport_pause()
  2242. def transport_bpm(self, bpm):
  2243. self.lib.carla_transport_bpm(bpm)
  2244. def transport_relocate(self, frame):
  2245. self.lib.carla_transport_relocate(frame)
  2246. def get_current_transport_frame(self):
  2247. return int(self.lib.carla_get_current_transport_frame())
  2248. def get_transport_info(self):
  2249. return structToDict(self.lib.carla_get_transport_info().contents)
  2250. def get_current_plugin_count(self):
  2251. return int(self.lib.carla_get_current_plugin_count())
  2252. def get_max_plugin_number(self):
  2253. return int(self.lib.carla_get_max_plugin_number())
  2254. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  2255. cfilename = filename.encode("utf-8") if filename else None
  2256. cname = name.encode("utf-8") if name else None
  2257. clabel = label.encode("utf-8") if label else None
  2258. return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p), options))
  2259. def remove_plugin(self, pluginId):
  2260. return bool(self.lib.carla_remove_plugin(pluginId))
  2261. def remove_all_plugins(self):
  2262. return bool(self.lib.carla_remove_all_plugins())
  2263. def rename_plugin(self, pluginId, newName):
  2264. return bool(self.lib.carla_rename_plugin(pluginId, newName.encode("utf-8")))
  2265. def clone_plugin(self, pluginId):
  2266. return bool(self.lib.carla_clone_plugin(pluginId))
  2267. def replace_plugin(self, pluginId):
  2268. return bool(self.lib.carla_replace_plugin(pluginId))
  2269. def switch_plugins(self, pluginIdA, pluginIdB):
  2270. return bool(self.lib.carla_switch_plugins(pluginIdA, pluginIdB))
  2271. def load_plugin_state(self, pluginId, filename):
  2272. return bool(self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8")))
  2273. def save_plugin_state(self, pluginId, filename):
  2274. return bool(self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8")))
  2275. def export_plugin_lv2(self, pluginId, lv2path):
  2276. return bool(self.lib.carla_export_plugin_lv2(pluginId, lv2path.encode("utf-8")))
  2277. def get_plugin_info(self, pluginId):
  2278. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  2279. def get_audio_port_count_info(self, pluginId):
  2280. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  2281. def get_midi_port_count_info(self, pluginId):
  2282. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  2283. def get_parameter_count_info(self, pluginId):
  2284. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  2285. def get_parameter_info(self, pluginId, parameterId):
  2286. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  2287. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  2288. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  2289. def get_parameter_data(self, pluginId, parameterId):
  2290. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  2291. def get_parameter_ranges(self, pluginId, parameterId):
  2292. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  2293. def get_midi_program_data(self, pluginId, midiProgramId):
  2294. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  2295. def get_custom_data(self, pluginId, customDataId):
  2296. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  2297. def get_custom_data_value(self, pluginId, type_, key):
  2298. return charPtrToString(self.lib.carla_get_custom_data_value(pluginId, type_.encode("utf-8"), key.encode("utf-8")))
  2299. def get_chunk_data(self, pluginId):
  2300. return charPtrToString(self.lib.carla_get_chunk_data(pluginId))
  2301. def get_parameter_count(self, pluginId):
  2302. return int(self.lib.carla_get_parameter_count(pluginId))
  2303. def get_program_count(self, pluginId):
  2304. return int(self.lib.carla_get_program_count(pluginId))
  2305. def get_midi_program_count(self, pluginId):
  2306. return int(self.lib.carla_get_midi_program_count(pluginId))
  2307. def get_custom_data_count(self, pluginId):
  2308. return int(self.lib.carla_get_custom_data_count(pluginId))
  2309. def get_parameter_text(self, pluginId, parameterId):
  2310. return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId))
  2311. def get_program_name(self, pluginId, programId):
  2312. return charPtrToString(self.lib.carla_get_program_name(pluginId, programId))
  2313. def get_midi_program_name(self, pluginId, midiProgramId):
  2314. return charPtrToString(self.lib.carla_get_midi_program_name(pluginId, midiProgramId))
  2315. def get_real_plugin_name(self, pluginId):
  2316. return charPtrToString(self.lib.carla_get_real_plugin_name(pluginId))
  2317. def get_current_program_index(self, pluginId):
  2318. return int(self.lib.carla_get_current_program_index(pluginId))
  2319. def get_current_midi_program_index(self, pluginId):
  2320. return int(self.lib.carla_get_current_midi_program_index(pluginId))
  2321. def get_default_parameter_value(self, pluginId, parameterId):
  2322. return float(self.lib.carla_get_default_parameter_value(pluginId, parameterId))
  2323. def get_current_parameter_value(self, pluginId, parameterId):
  2324. return float(self.lib.carla_get_current_parameter_value(pluginId, parameterId))
  2325. def get_internal_parameter_value(self, pluginId, parameterId):
  2326. return float(self.lib.carla_get_internal_parameter_value(pluginId, parameterId))
  2327. def get_input_peak_value(self, pluginId, isLeft):
  2328. return float(self.lib.carla_get_input_peak_value(pluginId, isLeft))
  2329. def get_output_peak_value(self, pluginId, isLeft):
  2330. return float(self.lib.carla_get_output_peak_value(pluginId, isLeft))
  2331. def render_inline_display(self, pluginId, width, height):
  2332. ptr = self.lib.carla_render_inline_display(pluginId, width, height)
  2333. if not ptr or not ptr.contents:
  2334. return None
  2335. contents = ptr.contents
  2336. datalen = contents.height * contents.stride
  2337. databuf = tuple(contents.data[i] for i in range(datalen))
  2338. data = {
  2339. 'data': databuf,
  2340. 'width': contents.width,
  2341. 'height': contents.height,
  2342. 'stride': contents.stride,
  2343. }
  2344. return data
  2345. def set_option(self, pluginId, option, yesNo):
  2346. self.lib.carla_set_option(pluginId, option, yesNo)
  2347. def set_active(self, pluginId, onOff):
  2348. self.lib.carla_set_active(pluginId, onOff)
  2349. def set_drywet(self, pluginId, value):
  2350. self.lib.carla_set_drywet(pluginId, value)
  2351. def set_volume(self, pluginId, value):
  2352. self.lib.carla_set_volume(pluginId, value)
  2353. def set_balance_left(self, pluginId, value):
  2354. self.lib.carla_set_balance_left(pluginId, value)
  2355. def set_balance_right(self, pluginId, value):
  2356. self.lib.carla_set_balance_right(pluginId, value)
  2357. def set_panning(self, pluginId, value):
  2358. self.lib.carla_set_panning(pluginId, value)
  2359. def set_ctrl_channel(self, pluginId, channel):
  2360. self.lib.carla_set_ctrl_channel(pluginId, channel)
  2361. def set_parameter_value(self, pluginId, parameterId, value):
  2362. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  2363. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  2364. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  2365. def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
  2366. self.lib.carla_set_parameter_mapped_control_index(pluginId, parameterId, index)
  2367. def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
  2368. self.lib.carla_set_parameter_mapped_range(pluginId, parameterId, minimum, maximum)
  2369. def set_parameter_touch(self, pluginId, parameterId, touch):
  2370. self.lib.carla_set_parameter_touch(pluginId, parameterId, touch)
  2371. def set_program(self, pluginId, programId):
  2372. self.lib.carla_set_program(pluginId, programId)
  2373. def set_midi_program(self, pluginId, midiProgramId):
  2374. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  2375. def set_custom_data(self, pluginId, type_, key, value):
  2376. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  2377. def set_chunk_data(self, pluginId, chunkData):
  2378. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  2379. def prepare_for_save(self, pluginId):
  2380. self.lib.carla_prepare_for_save(pluginId)
  2381. def reset_parameters(self, pluginId):
  2382. self.lib.carla_reset_parameters(pluginId)
  2383. def randomize_parameters(self, pluginId):
  2384. self.lib.carla_randomize_parameters(pluginId)
  2385. def send_midi_note(self, pluginId, channel, note, velocity):
  2386. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  2387. def show_custom_ui(self, pluginId, yesNo):
  2388. self.lib.carla_show_custom_ui(pluginId, yesNo)
  2389. def get_buffer_size(self):
  2390. return int(self.lib.carla_get_buffer_size())
  2391. def get_sample_rate(self):
  2392. return float(self.lib.carla_get_sample_rate())
  2393. def get_last_error(self):
  2394. return charPtrToString(self.lib.carla_get_last_error())
  2395. def get_host_osc_url_tcp(self):
  2396. return charPtrToString(self.lib.carla_get_host_osc_url_tcp())
  2397. def get_host_osc_url_udp(self):
  2398. return charPtrToString(self.lib.carla_get_host_osc_url_udp())
  2399. def nsm_init(self, pid, executableName):
  2400. return bool(self.lib.carla_nsm_init(pid, executableName.encode("utf-8")))
  2401. def nsm_ready(self, opcode):
  2402. self.lib.carla_nsm_ready(opcode)
  2403. # ------------------------------------------------------------------------------------------------------------
  2404. # Helper object for CarlaHostPlugin
  2405. class PluginStoreInfo(object):
  2406. def __init__(self):
  2407. self.clear()
  2408. def clear(self):
  2409. self.pluginInfo = PyCarlaPluginInfo.copy()
  2410. self.pluginRealName = ""
  2411. self.internalValues = [0.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0]
  2412. self.audioCountInfo = PyCarlaPortCountInfo.copy()
  2413. self.midiCountInfo = PyCarlaPortCountInfo.copy()
  2414. self.parameterCount = 0
  2415. self.parameterCountInfo = PyCarlaPortCountInfo.copy()
  2416. self.parameterInfo = []
  2417. self.parameterData = []
  2418. self.parameterRanges = []
  2419. self.parameterValues = []
  2420. self.programCount = 0
  2421. self.programCurrent = -1
  2422. self.programNames = []
  2423. self.midiProgramCount = 0
  2424. self.midiProgramCurrent = -1
  2425. self.midiProgramData = []
  2426. self.customDataCount = 0
  2427. self.customData = []
  2428. self.peaks = [0.0, 0.0, 0.0, 0.0]
  2429. # ------------------------------------------------------------------------------------------------------------
  2430. # Carla Host object for plugins (using pipes)
  2431. class CarlaHostPlugin(CarlaHostMeta):
  2432. #class CarlaHostPlugin(CarlaHostMeta, metaclass=ABCMeta):
  2433. def __init__(self):
  2434. CarlaHostMeta.__init__(self)
  2435. # info about this host object
  2436. self.isPlugin = True
  2437. self.processModeForced = True
  2438. # text data to return when requested
  2439. self.fMaxPluginNumber = 0
  2440. self.fLastError = ""
  2441. # plugin info
  2442. self.fPluginsInfo = {}
  2443. self.fFallbackPluginInfo = PluginStoreInfo()
  2444. # runtime engine info
  2445. self.fRuntimeEngineInfo = {
  2446. "load": 0.0,
  2447. "xruns": 0
  2448. }
  2449. # transport info
  2450. self.fTransportInfo = {
  2451. "playing": False,
  2452. "frame": 0,
  2453. "bar": 0,
  2454. "beat": 0,
  2455. "tick": 0,
  2456. "bpm": 0.0
  2457. }
  2458. # some other vars
  2459. self.fBufferSize = 0
  2460. self.fSampleRate = 0.0
  2461. self.fOscTCP = ""
  2462. self.fOscUDP = ""
  2463. # --------------------------------------------------------------------------------------------------------
  2464. # Needs to be reimplemented
  2465. @abstractmethod
  2466. def sendMsg(self, lines):
  2467. raise NotImplementedError
  2468. # internal, sets error if sendMsg failed
  2469. def sendMsgAndSetError(self, lines):
  2470. if self.sendMsg(lines):
  2471. return True
  2472. self.fLastError = "Communication error with backend"
  2473. return False
  2474. # --------------------------------------------------------------------------------------------------------
  2475. def get_engine_driver_count(self):
  2476. return 1
  2477. def get_engine_driver_name(self, index):
  2478. return "Plugin"
  2479. def get_engine_driver_device_names(self, index):
  2480. return []
  2481. def get_engine_driver_device_info(self, index, name):
  2482. return PyEngineDriverDeviceInfo
  2483. def show_engine_driver_device_control_panel(self, index, name):
  2484. return False
  2485. def get_runtime_engine_info(self):
  2486. return self.fRuntimeEngineInfo
  2487. def get_runtime_engine_driver_device_info(self):
  2488. return PyCarlaRuntimeEngineDriverDeviceInfo
  2489. def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
  2490. return False
  2491. def show_engine_device_control_panel(self):
  2492. return False
  2493. def clear_engine_xruns(self):
  2494. self.sendMsg(["clear_engine_xruns"])
  2495. def cancel_engine_action(self):
  2496. self.sendMsg(["cancel_engine_action"])
  2497. def set_engine_callback(self, func):
  2498. return # TODO
  2499. def set_engine_option(self, option, value, valueStr):
  2500. self.sendMsg(["set_engine_option", option, int(value), valueStr])
  2501. def set_file_callback(self, func):
  2502. return # TODO
  2503. def load_file(self, filename):
  2504. return self.sendMsgAndSetError(["load_file", filename])
  2505. def load_project(self, filename):
  2506. return self.sendMsgAndSetError(["load_project", filename])
  2507. def save_project(self, filename):
  2508. return self.sendMsgAndSetError(["save_project", filename])
  2509. def clear_project_filename(self):
  2510. return self.sendMsgAndSetError(["clear_project_filename"])
  2511. def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
  2512. return self.sendMsgAndSetError(["patchbay_connect", external, groupIdA, portIdA, groupIdB, portIdB])
  2513. def patchbay_disconnect(self, external, connectionId):
  2514. return self.sendMsgAndSetError(["patchbay_disconnect", external, connectionId])
  2515. def patchbay_refresh(self, external):
  2516. return self.sendMsgAndSetError(["patchbay_refresh", external])
  2517. def transport_play(self):
  2518. self.sendMsg(["transport_play"])
  2519. def transport_pause(self):
  2520. self.sendMsg(["transport_pause"])
  2521. def transport_bpm(self, bpm):
  2522. self.sendMsg(["transport_bpm", bpm])
  2523. def transport_relocate(self, frame):
  2524. self.sendMsg(["transport_relocate", frame])
  2525. def get_current_transport_frame(self):
  2526. return self.fTransportInfo['frame']
  2527. def get_transport_info(self):
  2528. return self.fTransportInfo
  2529. def get_current_plugin_count(self):
  2530. return len(self.fPluginsInfo)
  2531. def get_max_plugin_number(self):
  2532. return self.fMaxPluginNumber
  2533. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  2534. return self.sendMsgAndSetError(["add_plugin",
  2535. btype, ptype,
  2536. filename or "(null)",
  2537. name or "(null)",
  2538. label, uniqueId, options])
  2539. def remove_plugin(self, pluginId):
  2540. return self.sendMsgAndSetError(["remove_plugin", pluginId])
  2541. def remove_all_plugins(self):
  2542. return self.sendMsgAndSetError(["remove_all_plugins"])
  2543. def rename_plugin(self, pluginId, newName):
  2544. return self.sendMsgAndSetError(["rename_plugin", pluginId, newName])
  2545. def clone_plugin(self, pluginId):
  2546. return self.sendMsgAndSetError(["clone_plugin", pluginId])
  2547. def replace_plugin(self, pluginId):
  2548. return self.sendMsgAndSetError(["replace_plugin", pluginId])
  2549. def switch_plugins(self, pluginIdA, pluginIdB):
  2550. ret = self.sendMsgAndSetError(["switch_plugins", pluginIdA, pluginIdB])
  2551. if ret:
  2552. self._switchPlugins(pluginIdA, pluginIdB)
  2553. return ret
  2554. def load_plugin_state(self, pluginId, filename):
  2555. return self.sendMsgAndSetError(["load_plugin_state", pluginId, filename])
  2556. def save_plugin_state(self, pluginId, filename):
  2557. return self.sendMsgAndSetError(["save_plugin_state", pluginId, filename])
  2558. def export_plugin_lv2(self, pluginId, lv2path):
  2559. self.fLastError = "Operation unavailable in plugin version"
  2560. return False
  2561. def get_plugin_info(self, pluginId):
  2562. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).pluginInfo
  2563. def get_audio_port_count_info(self, pluginId):
  2564. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).audioCountInfo
  2565. def get_midi_port_count_info(self, pluginId):
  2566. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiCountInfo
  2567. def get_parameter_count_info(self, pluginId):
  2568. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterCountInfo
  2569. def get_parameter_info(self, pluginId, parameterId):
  2570. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterInfo[parameterId]
  2571. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  2572. return PyCarlaScalePointInfo
  2573. def get_parameter_data(self, pluginId, parameterId):
  2574. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterData[parameterId]
  2575. def get_parameter_ranges(self, pluginId, parameterId):
  2576. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterRanges[parameterId]
  2577. def get_midi_program_data(self, pluginId, midiProgramId):
  2578. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiProgramData[midiProgramId]
  2579. def get_custom_data(self, pluginId, customDataId):
  2580. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).customData[customDataId]
  2581. def get_custom_data_value(self, pluginId, type_, key):
  2582. plugin = self.fPluginsInfo.get(pluginId, None)
  2583. if plugin is None:
  2584. return ""
  2585. for customData in plugin.customData:
  2586. if customData['type'] == type_ and customData['key'] == key:
  2587. return customData['value']
  2588. return ""
  2589. def get_chunk_data(self, pluginId):
  2590. return ""
  2591. def get_parameter_count(self, pluginId):
  2592. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterCount
  2593. def get_program_count(self, pluginId):
  2594. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).programCount
  2595. def get_midi_program_count(self, pluginId):
  2596. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiProgramCount
  2597. def get_custom_data_count(self, pluginId):
  2598. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).customDataCount
  2599. def get_parameter_text(self, pluginId, parameterId):
  2600. return ""
  2601. def get_program_name(self, pluginId, programId):
  2602. return self.fPluginsInfo[pluginId].programNames[programId]
  2603. def get_midi_program_name(self, pluginId, midiProgramId):
  2604. return self.fPluginsInfo[pluginId].midiProgramData[midiProgramId]['label']
  2605. def get_real_plugin_name(self, pluginId):
  2606. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).pluginRealName
  2607. def get_current_program_index(self, pluginId):
  2608. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).programCurrent
  2609. def get_current_midi_program_index(self, pluginId):
  2610. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiProgramCurrent
  2611. def get_default_parameter_value(self, pluginId, parameterId):
  2612. return self.fPluginsInfo[pluginId].parameterRanges[parameterId]['def']
  2613. def get_current_parameter_value(self, pluginId, parameterId):
  2614. return self.fPluginsInfo[pluginId].parameterValues[parameterId]
  2615. def get_internal_parameter_value(self, pluginId, parameterId):
  2616. if parameterId == PARAMETER_NULL or parameterId <= PARAMETER_MAX:
  2617. return 0.0
  2618. if parameterId < 0:
  2619. return self.fPluginsInfo[pluginId].internalValues[abs(parameterId)-2]
  2620. return self.fPluginsInfo[pluginId].parameterValues[parameterId]
  2621. def get_input_peak_value(self, pluginId, isLeft):
  2622. return self.fPluginsInfo[pluginId].peaks[0 if isLeft else 1]
  2623. def get_output_peak_value(self, pluginId, isLeft):
  2624. return self.fPluginsInfo[pluginId].peaks[2 if isLeft else 3]
  2625. def render_inline_display(self, pluginId, width, height):
  2626. return None
  2627. def set_option(self, pluginId, option, yesNo):
  2628. self.sendMsg(["set_option", pluginId, option, yesNo])
  2629. def set_active(self, pluginId, onOff):
  2630. self.sendMsg(["set_active", pluginId, onOff])
  2631. self.fPluginsInfo[pluginId].internalValues[0] = 1.0 if onOff else 0.0
  2632. def set_drywet(self, pluginId, value):
  2633. self.sendMsg(["set_drywet", pluginId, value])
  2634. self.fPluginsInfo[pluginId].internalValues[1] = value
  2635. def set_volume(self, pluginId, value):
  2636. self.sendMsg(["set_volume", pluginId, value])
  2637. self.fPluginsInfo[pluginId].internalValues[2] = value
  2638. def set_balance_left(self, pluginId, value):
  2639. self.sendMsg(["set_balance_left", pluginId, value])
  2640. self.fPluginsInfo[pluginId].internalValues[3] = value
  2641. def set_balance_right(self, pluginId, value):
  2642. self.sendMsg(["set_balance_right", pluginId, value])
  2643. self.fPluginsInfo[pluginId].internalValues[4] = value
  2644. def set_panning(self, pluginId, value):
  2645. self.sendMsg(["set_panning", pluginId, value])
  2646. self.fPluginsInfo[pluginId].internalValues[5] = value
  2647. def set_ctrl_channel(self, pluginId, channel):
  2648. self.sendMsg(["set_ctrl_channel", pluginId, channel])
  2649. self.fPluginsInfo[pluginId].internalValues[6] = float(channel)
  2650. def set_parameter_value(self, pluginId, parameterId, value):
  2651. self.sendMsg(["set_parameter_value", pluginId, parameterId, value])
  2652. self.fPluginsInfo[pluginId].parameterValues[parameterId] = value
  2653. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  2654. self.sendMsg(["set_parameter_midi_channel", pluginId, parameterId, channel])
  2655. self.fPluginsInfo[pluginId].parameterData[parameterId]['midiChannel'] = channel
  2656. def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
  2657. self.sendMsg(["set_parameter_mapped_control_index", pluginId, parameterId, index])
  2658. self.fPluginsInfo[pluginId].parameterData[parameterId]['mappedControlIndex'] = index
  2659. def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
  2660. self.sendMsg(["set_parameter_mapped_range", pluginId, parameterId, minimum, maximum])
  2661. self.fPluginsInfo[pluginId].parameterData[parameterId]['mappedMinimum'] = minimum
  2662. self.fPluginsInfo[pluginId].parameterData[parameterId]['mappedMaximum'] = maximum
  2663. def set_parameter_touch(self, pluginId, parameterId, touch):
  2664. self.sendMsg(["set_parameter_touch", pluginId, parameterId, touch])
  2665. def set_program(self, pluginId, programId):
  2666. self.sendMsg(["set_program", pluginId, programId])
  2667. self.fPluginsInfo[pluginId].programCurrent = programId
  2668. def set_midi_program(self, pluginId, midiProgramId):
  2669. self.sendMsg(["set_midi_program", pluginId, midiProgramId])
  2670. self.fPluginsInfo[pluginId].midiProgramCurrent = midiProgramId
  2671. def set_custom_data(self, pluginId, type_, key, value):
  2672. self.sendMsg(["set_custom_data", pluginId, type_, key, value])
  2673. for cdata in self.fPluginsInfo[pluginId].customData:
  2674. if cdata['type'] != type_:
  2675. continue
  2676. if cdata['key'] != key:
  2677. continue
  2678. cdata['value'] = value
  2679. break
  2680. def set_chunk_data(self, pluginId, chunkData):
  2681. self.sendMsg(["set_chunk_data", pluginId, chunkData])
  2682. def prepare_for_save(self, pluginId):
  2683. self.sendMsg(["prepare_for_save", pluginId])
  2684. def reset_parameters(self, pluginId):
  2685. self.sendMsg(["reset_parameters", pluginId])
  2686. def randomize_parameters(self, pluginId):
  2687. self.sendMsg(["randomize_parameters", pluginId])
  2688. def send_midi_note(self, pluginId, channel, note, velocity):
  2689. self.sendMsg(["send_midi_note", pluginId, channel, note, velocity])
  2690. def show_custom_ui(self, pluginId, yesNo):
  2691. self.sendMsg(["show_custom_ui", pluginId, yesNo])
  2692. def get_buffer_size(self):
  2693. return self.fBufferSize
  2694. def get_sample_rate(self):
  2695. return self.fSampleRate
  2696. def get_last_error(self):
  2697. return self.fLastError
  2698. def get_host_osc_url_tcp(self):
  2699. return self.fOscTCP
  2700. def get_host_osc_url_udp(self):
  2701. return self.fOscUDP
  2702. # --------------------------------------------------------------------------------------------------------
  2703. def _set_runtime_info(self, load, xruns):
  2704. self.fRuntimeEngineInfo = {
  2705. "load": load,
  2706. "xruns": xruns
  2707. }
  2708. def _set_transport(self, playing, frame, bar, beat, tick, bpm):
  2709. self.fTransportInfo = {
  2710. "playing": playing,
  2711. "frame": frame,
  2712. "bar": bar,
  2713. "beat": beat,
  2714. "tick": tick,
  2715. "bpm": bpm
  2716. }
  2717. def _add(self, pluginId):
  2718. self.fPluginsInfo[pluginId] = PluginStoreInfo()
  2719. def _allocateAsNeeded(self, pluginId):
  2720. if pluginId < len(self.fPluginsInfo):
  2721. return
  2722. for id in range(len(self.fPluginsInfo), pluginId+1):
  2723. self.fPluginsInfo[id] = PluginStoreInfo()
  2724. def _set_pluginInfo(self, pluginId, info):
  2725. plugin = self.fPluginsInfo.get(pluginId, None)
  2726. if plugin is None:
  2727. print("_set_pluginInfo failed for", pluginId)
  2728. return
  2729. plugin.pluginInfo = info
  2730. def _set_pluginInfoUpdate(self, pluginId, info):
  2731. plugin = self.fPluginsInfo.get(pluginId, None)
  2732. if plugin is None:
  2733. print("_set_pluginInfoUpdate failed for", pluginId)
  2734. return
  2735. plugin.pluginInfo.update(info)
  2736. def _set_pluginName(self, pluginId, name):
  2737. plugin = self.fPluginsInfo.get(pluginId, None)
  2738. if plugin is None:
  2739. print("_set_pluginName failed for", pluginId)
  2740. return
  2741. plugin.pluginInfo['name'] = name
  2742. def _set_pluginRealName(self, pluginId, realName):
  2743. plugin = self.fPluginsInfo.get(pluginId, None)
  2744. if plugin is None:
  2745. print("_set_pluginRealName failed for", pluginId)
  2746. return
  2747. plugin.pluginRealName = realName
  2748. def _set_internalValue(self, pluginId, paramIndex, value):
  2749. pluginInfo = self.fPluginsInfo.get(pluginId, None)
  2750. if pluginInfo is None:
  2751. print("_set_internalValue failed for", pluginId)
  2752. return
  2753. if PARAMETER_NULL > paramIndex > PARAMETER_MAX:
  2754. pluginInfo.internalValues[abs(paramIndex)-2] = float(value)
  2755. else:
  2756. print("_set_internalValue failed for", pluginId, "with param", paramIndex)
  2757. def _set_audioCountInfo(self, pluginId, info):
  2758. plugin = self.fPluginsInfo.get(pluginId, None)
  2759. if plugin is None:
  2760. print("_set_audioCountInfo failed for", pluginId)
  2761. return
  2762. plugin.audioCountInfo = info
  2763. def _set_midiCountInfo(self, pluginId, info):
  2764. plugin = self.fPluginsInfo.get(pluginId, None)
  2765. if plugin is None:
  2766. print("_set_midiCountInfo failed for", pluginId)
  2767. return
  2768. plugin.midiCountInfo = info
  2769. def _set_parameterCountInfo(self, pluginId, count, info):
  2770. plugin = self.fPluginsInfo.get(pluginId, None)
  2771. if plugin is None:
  2772. print("_set_parameterCountInfo failed for", pluginId)
  2773. return
  2774. plugin.parameterCount = count
  2775. plugin.parameterCountInfo = info
  2776. # clear
  2777. plugin.parameterInfo = []
  2778. plugin.parameterData = []
  2779. plugin.parameterRanges = []
  2780. plugin.parameterValues = []
  2781. # add placeholders
  2782. for x in range(count):
  2783. plugin.parameterInfo.append(PyCarlaParameterInfo.copy())
  2784. plugin.parameterData.append(PyParameterData.copy())
  2785. plugin.parameterRanges.append(PyParameterRanges.copy())
  2786. plugin.parameterValues.append(0.0)
  2787. def _set_programCount(self, pluginId, count):
  2788. plugin = self.fPluginsInfo.get(pluginId, None)
  2789. if plugin is None:
  2790. print("_set_internalValue failed for", pluginId)
  2791. return
  2792. plugin.programCount = count
  2793. plugin.programNames = ["" for x in range(count)]
  2794. def _set_midiProgramCount(self, pluginId, count):
  2795. plugin = self.fPluginsInfo.get(pluginId, None)
  2796. if plugin is None:
  2797. print("_set_internalValue failed for", pluginId)
  2798. return
  2799. plugin.midiProgramCount = count
  2800. plugin.midiProgramData = [PyMidiProgramData.copy() for x in range(count)]
  2801. def _set_customDataCount(self, pluginId, count):
  2802. plugin = self.fPluginsInfo.get(pluginId, None)
  2803. if plugin is None:
  2804. print("_set_internalValue failed for", pluginId)
  2805. return
  2806. plugin.customDataCount = count
  2807. plugin.customData = [PyCustomData.copy() for x in range(count)]
  2808. def _set_parameterInfo(self, pluginId, paramIndex, info):
  2809. plugin = self.fPluginsInfo.get(pluginId, None)
  2810. if plugin is None:
  2811. print("_set_parameterInfo failed for", pluginId)
  2812. return
  2813. if paramIndex < plugin.parameterCount:
  2814. plugin.parameterInfo[paramIndex] = info
  2815. else:
  2816. print("_set_parameterInfo failed for", pluginId, "and index", paramIndex)
  2817. def _set_parameterData(self, pluginId, paramIndex, data):
  2818. plugin = self.fPluginsInfo.get(pluginId, None)
  2819. if plugin is None:
  2820. print("_set_parameterData failed for", pluginId)
  2821. return
  2822. if paramIndex < plugin.parameterCount:
  2823. plugin.parameterData[paramIndex] = data
  2824. else:
  2825. print("_set_parameterData failed for", pluginId, "and index", paramIndex)
  2826. def _set_parameterRanges(self, pluginId, paramIndex, ranges):
  2827. plugin = self.fPluginsInfo.get(pluginId, None)
  2828. if plugin is None:
  2829. print("_set_parameterRanges failed for", pluginId)
  2830. return
  2831. if paramIndex < plugin.parameterCount:
  2832. plugin.parameterRanges[paramIndex] = ranges
  2833. else:
  2834. print("_set_parameterRanges failed for", pluginId, "and index", paramIndex)
  2835. def _set_parameterRangesUpdate(self, pluginId, paramIndex, ranges):
  2836. plugin = self.fPluginsInfo.get(pluginId, None)
  2837. if plugin is None:
  2838. print("_set_parameterRangesUpdate failed for", pluginId)
  2839. return
  2840. if paramIndex < plugin.parameterCount:
  2841. plugin.parameterRanges[paramIndex].update(ranges)
  2842. else:
  2843. print("_set_parameterRangesUpdate failed for", pluginId, "and index", paramIndex)
  2844. def _set_parameterValue(self, pluginId, paramIndex, value):
  2845. plugin = self.fPluginsInfo.get(pluginId, None)
  2846. if plugin is None:
  2847. print("_set_parameterValue failed for", pluginId)
  2848. return
  2849. if paramIndex < plugin.parameterCount:
  2850. plugin.parameterValues[paramIndex] = value
  2851. else:
  2852. print("_set_parameterValue failed for", pluginId, "and index", paramIndex)
  2853. def _set_parameterDefault(self, pluginId, paramIndex, value):
  2854. plugin = self.fPluginsInfo.get(pluginId, None)
  2855. if plugin is None:
  2856. print("_set_parameterDefault failed for", pluginId)
  2857. return
  2858. if paramIndex < plugin.parameterCount:
  2859. plugin.parameterRanges[paramIndex]['def'] = value
  2860. else:
  2861. print("_set_parameterDefault failed for", pluginId, "and index", paramIndex)
  2862. def _set_parameterMappedControlIndex(self, pluginId, paramIndex, index):
  2863. plugin = self.fPluginsInfo.get(pluginId, None)
  2864. if plugin is None:
  2865. print("_set_parameterMappedControlIndex failed for", pluginId)
  2866. return
  2867. if paramIndex < plugin.parameterCount:
  2868. plugin.parameterData[paramIndex]['mappedControlIndex'] = index
  2869. else:
  2870. print("_set_parameterMappedControlIndex failed for", pluginId, "and index", paramIndex)
  2871. def _set_parameterMappedRange(self, pluginId, paramIndex, minimum, maximum):
  2872. plugin = self.fPluginsInfo.get(pluginId, None)
  2873. if plugin is None:
  2874. print("_set_parameterMappedRange failed for", pluginId)
  2875. return
  2876. if paramIndex < plugin.parameterCount:
  2877. plugin.parameterData[paramIndex]['mappedMinimum'] = minimum
  2878. plugin.parameterData[paramIndex]['mappedMaximum'] = maximum
  2879. else:
  2880. print("_set_parameterMappedRange failed for", pluginId, "and index", paramIndex)
  2881. def _set_parameterMidiChannel(self, pluginId, paramIndex, channel):
  2882. plugin = self.fPluginsInfo.get(pluginId, None)
  2883. if plugin is None:
  2884. print("_set_parameterMidiChannel failed for", pluginId)
  2885. return
  2886. if paramIndex < plugin.parameterCount:
  2887. plugin.parameterData[paramIndex]['midiChannel'] = channel
  2888. else:
  2889. print("_set_parameterMidiChannel failed for", pluginId, "and index", paramIndex)
  2890. def _set_currentProgram(self, pluginId, pIndex):
  2891. plugin = self.fPluginsInfo.get(pluginId, None)
  2892. if plugin is None:
  2893. print("_set_currentProgram failed for", pluginId)
  2894. return
  2895. plugin.programCurrent = pIndex
  2896. def _set_currentMidiProgram(self, pluginId, mpIndex):
  2897. plugin = self.fPluginsInfo.get(pluginId, None)
  2898. if plugin is None:
  2899. print("_set_currentMidiProgram failed for", pluginId)
  2900. return
  2901. plugin.midiProgramCurrent = mpIndex
  2902. def _set_programName(self, pluginId, pIndex, name):
  2903. plugin = self.fPluginsInfo.get(pluginId, None)
  2904. if plugin is None:
  2905. print("_set_programName failed for", pluginId)
  2906. return
  2907. if pIndex < plugin.programCount:
  2908. plugin.programNames[pIndex] = name
  2909. else:
  2910. print("_set_programName failed for", pluginId, "and index", pIndex)
  2911. def _set_midiProgramData(self, pluginId, mpIndex, data):
  2912. plugin = self.fPluginsInfo.get(pluginId, None)
  2913. if plugin is None:
  2914. print("_set_midiProgramData failed for", pluginId)
  2915. return
  2916. if mpIndex < plugin.midiProgramCount:
  2917. plugin.midiProgramData[mpIndex] = data
  2918. else:
  2919. print("_set_midiProgramData failed for", pluginId, "and index", mpIndex)
  2920. def _set_customData(self, pluginId, cdIndex, data):
  2921. plugin = self.fPluginsInfo.get(pluginId, None)
  2922. if plugin is None:
  2923. print("_set_customData failed for", pluginId)
  2924. return
  2925. if cdIndex < plugin.customDataCount:
  2926. plugin.customData[cdIndex] = data
  2927. else:
  2928. print("_set_customData failed for", pluginId, "and index", cdIndex)
  2929. def _set_peaks(self, pluginId, in1, in2, out1, out2):
  2930. pluginInfo = self.fPluginsInfo.get(pluginId, None)
  2931. if pluginInfo is not None:
  2932. pluginInfo.peaks = [in1, in2, out1, out2]
  2933. def _switchPlugins(self, pluginIdA, pluginIdB):
  2934. tmp = self.fPluginsInfo[pluginIdA]
  2935. self.fPluginsInfo[pluginIdA] = self.fPluginsInfo[pluginIdB]
  2936. self.fPluginsInfo[pluginIdB] = tmp
  2937. def _setViaCallback(self, action, pluginId, value1, value2, value3, valuef, valueStr):
  2938. if action == ENGINE_CALLBACK_ENGINE_STARTED:
  2939. self._allocateAsNeeded(pluginId)
  2940. self.fBufferSize = value3
  2941. self.fSampleRate = valuef
  2942. elif ENGINE_CALLBACK_BUFFER_SIZE_CHANGED:
  2943. self.fBufferSize = value1
  2944. elif ENGINE_CALLBACK_SAMPLE_RATE_CHANGED:
  2945. self.fSampleRate = valuef
  2946. elif action == ENGINE_CALLBACK_PLUGIN_RENAMED:
  2947. self._set_pluginName(pluginId, valueStr)
  2948. elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED:
  2949. if value1 < 0:
  2950. self._set_internalValue(pluginId, value1, valuef)
  2951. else:
  2952. self._set_parameterValue(pluginId, value1, valuef)
  2953. elif action == ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED:
  2954. self._set_parameterDefault(pluginId, value1, valuef)
  2955. elif action == ENGINE_CALLBACK_PARAMETER_MAPPED_CONTROL_INDEX_CHANGED:
  2956. self._set_parameterMappedControlIndex(pluginId, value1, value2)
  2957. elif action == ENGINE_CALLBACK_PARAMETER_MAPPED_RANGE_CHANGED:
  2958. minimum, maximum = (float(i) for i in valueStr.split(":"))
  2959. self._set_parameterMappedRange(pluginId, value1, minimum, maximum)
  2960. elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
  2961. self._set_parameterMidiChannel(pluginId, value1, value2)
  2962. elif action == ENGINE_CALLBACK_PROGRAM_CHANGED:
  2963. self._set_currentProgram(pluginId, value1)
  2964. elif action == ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED:
  2965. self._set_currentMidiProgram(pluginId, value1)
  2966. # ------------------------------------------------------------------------------------------------------------