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.

3895 lines
124KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla Backend code
  4. # Copyright (C) 2011-2020 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. # Reset Xrun counter after project load.
  679. ENGINE_OPTION_RESET_XRUNS = 8
  680. # Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  681. # Default is 4000 (4 seconds).
  682. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 9
  683. # Audio buffer size.
  684. # Default is 512.
  685. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10
  686. # Audio sample rate.
  687. # Default is 44100.
  688. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11
  689. # Wherever to use 3 audio periods instead of the default 2.
  690. # Default is false.
  691. ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 12
  692. # Audio driver.
  693. # Default dppends on platform.
  694. ENGINE_OPTION_AUDIO_DRIVER = 13
  695. # Audio device (within a driver).
  696. # Default unset.
  697. ENGINE_OPTION_AUDIO_DEVICE = 14
  698. # Wherever to enable OSC support in the engine.
  699. ENGINE_OPTION_OSC_ENABLED = 15
  700. # The network TCP port to use for OSC.
  701. # A value of 0 means use a random port.
  702. # A value of < 0 means to not enable the TCP port for OSC.
  703. # @note Valid ports begin at 1024 and end at 32767 (inclusive)
  704. ENGINE_OPTION_OSC_PORT_TCP = 16
  705. # The network UDP port to use for OSC.
  706. # A value of 0 means use a random port.
  707. # A value of < 0 means to not enable the UDP port for OSC.
  708. # @note Disabling this option prevents DSSI UIs from working!
  709. # @note Valid ports begin at 1024 and end at 32767 (inclusive)
  710. ENGINE_OPTION_OSC_PORT_UDP = 17
  711. # Set path used for a specific file type.
  712. # Uses value as the file format, valueStr as actual path.
  713. ENGINE_OPTION_FILE_PATH = 18
  714. # Set path used for a specific plugin type.
  715. # Uses value as the plugin format, valueStr as actual path.
  716. # @see PluginType
  717. ENGINE_OPTION_PLUGIN_PATH = 19
  718. # Set path to the binary files.
  719. # Default unset.
  720. # @note Must be set for plugin and UI bridges to work
  721. ENGINE_OPTION_PATH_BINARIES = 20
  722. # Set path to the resource files.
  723. # Default unset.
  724. # @note Must be set for some internal plugins to work
  725. ENGINE_OPTION_PATH_RESOURCES = 21
  726. # Prevent bad plugin and UI behaviour.
  727. # @note: Linux only
  728. ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 22
  729. # Set UI scaling used in frontend, so backend can do the same for plugin UIs.
  730. ENGINE_OPTION_FRONTEND_UI_SCALE = 23
  731. # Set frontend winId, used to define as parent window for plugin UIs.
  732. ENGINE_OPTION_FRONTEND_WIN_ID = 24
  733. # Set path to wine executable.
  734. ENGINE_OPTION_WINE_EXECUTABLE = 25
  735. # Enable automatic wineprefix detection.
  736. ENGINE_OPTION_WINE_AUTO_PREFIX = 26
  737. # Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
  738. ENGINE_OPTION_WINE_FALLBACK_PREFIX = 27
  739. # Enable realtime priority for Wine application and server threads.
  740. ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 28
  741. # Base realtime priority for Wine threads.
  742. ENGINE_OPTION_WINE_BASE_RT_PRIO = 29
  743. # Wine server realtime priority.
  744. ENGINE_OPTION_WINE_SERVER_RT_PRIO = 30
  745. # Capture console output into debug callbacks
  746. ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 31
  747. # ------------------------------------------------------------------------------------------------------------
  748. # Engine Process Mode
  749. # Engine process mode.
  750. # @see ENGINE_OPTION_PROCESS_MODE
  751. # Single client mode.
  752. # Inputs and outputs are added dynamically as needed by plugins.
  753. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0
  754. # Multiple client mode.
  755. # It has 1 master client + 1 client per plugin.
  756. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1
  757. # Single client, 'rack' mode.
  758. # Processes plugins in order of Id, with forced stereo always on.
  759. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2
  760. # Single client, 'patchbay' mode.
  761. ENGINE_PROCESS_MODE_PATCHBAY = 3
  762. # Special mode, used in plugin-bridges only.
  763. ENGINE_PROCESS_MODE_BRIDGE = 4
  764. # ------------------------------------------------------------------------------------------------------------
  765. # Engine Transport Mode
  766. # Engine transport mode.
  767. # @see ENGINE_OPTION_TRANSPORT_MODE
  768. # No transport.
  769. ENGINE_TRANSPORT_MODE_DISABLED = 0
  770. # Internal transport mode.
  771. ENGINE_TRANSPORT_MODE_INTERNAL = 1
  772. # Transport from JACK.
  773. # Only available if driver name is "JACK".
  774. ENGINE_TRANSPORT_MODE_JACK = 2
  775. # Transport from host, used when Carla is a plugin.
  776. ENGINE_TRANSPORT_MODE_PLUGIN = 3
  777. # Special mode, used in plugin-bridges only.
  778. ENGINE_TRANSPORT_MODE_BRIDGE = 4
  779. # ------------------------------------------------------------------------------------------------------------
  780. # File Callback Opcode
  781. # File callback opcodes.
  782. # Front-ends must always block-wait for user input.
  783. # @see FileCallbackFunc and carla_set_file_callback()
  784. # Debug.
  785. # This opcode is undefined and used only for testing purposes.
  786. FILE_CALLBACK_DEBUG = 0
  787. # Open file or folder.
  788. FILE_CALLBACK_OPEN = 1
  789. # Save file or folder.
  790. FILE_CALLBACK_SAVE = 2
  791. # ------------------------------------------------------------------------------------------------------------
  792. # Patchbay Icon
  793. # The icon of a patchbay client/group.
  794. # Generic application icon.
  795. # Used for all non-plugin clients that don't have a specific icon.
  796. PATCHBAY_ICON_APPLICATION = 0
  797. # Plugin icon.
  798. # Used for all plugin clients that don't have a specific icon.
  799. PATCHBAY_ICON_PLUGIN = 1
  800. # Hardware icon.
  801. # Used for hardware (audio or MIDI) clients.
  802. PATCHBAY_ICON_HARDWARE = 2
  803. # Carla icon.
  804. # Used for the main app.
  805. PATCHBAY_ICON_CARLA = 3
  806. # DISTRHO icon.
  807. # Used for DISTRHO based plugins.
  808. PATCHBAY_ICON_DISTRHO = 4
  809. # File icon.
  810. # Used for file type plugins (like SF2 and SFZ).
  811. PATCHBAY_ICON_FILE = 5
  812. # ------------------------------------------------------------------------------------------------------------
  813. # Carla Backend API (C stuff)
  814. # Engine callback function.
  815. # Front-ends must never block indefinitely during a callback.
  816. # @see EngineCallbackOpcode and carla_set_engine_callback()
  817. EngineCallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_int, c_float, c_char_p)
  818. # File callback function.
  819. # @see FileCallbackOpcode
  820. FileCallbackFunc = CFUNCTYPE(c_char_p, c_void_p, c_enum, c_bool, c_char_p, c_char_p)
  821. # Parameter data.
  822. class ParameterData(Structure):
  823. _fields_ = [
  824. # This parameter type.
  825. ("type", c_enum),
  826. # This parameter hints.
  827. # @see ParameterHints
  828. ("hints", c_uint),
  829. # Index as seen by Carla.
  830. ("index", c_int32),
  831. # Real index as seen by plugins.
  832. ("rindex", c_int32),
  833. # Currently mapped MIDI channel.
  834. # Counts from 0 to 15.
  835. ("midiChannel", c_uint8),
  836. # Currently mapped index.
  837. # @see SpecialMappedControlIndex
  838. ("mappedControlIndex", c_int16),
  839. # Minimum value that this parameter maps to.
  840. ("mappedMinimum", c_float),
  841. # Maximum value that this parameter maps to.
  842. ("mappedMaximum", c_float)
  843. ]
  844. # Parameter ranges.
  845. class ParameterRanges(Structure):
  846. _fields_ = [
  847. # Default value.
  848. ("def", c_float),
  849. # Minimum value.
  850. ("min", c_float),
  851. # Maximum value.
  852. ("max", c_float),
  853. # Regular, single step value.
  854. ("step", c_float),
  855. # Small step value.
  856. ("stepSmall", c_float),
  857. # Large step value.
  858. ("stepLarge", c_float)
  859. ]
  860. # MIDI Program data.
  861. class MidiProgramData(Structure):
  862. _fields_ = [
  863. # MIDI bank.
  864. ("bank", c_uint32),
  865. # MIDI program.
  866. ("program", c_uint32),
  867. # MIDI program name.
  868. ("name", c_char_p)
  869. ]
  870. # Custom data, used for saving key:value 'dictionaries'.
  871. class CustomData(Structure):
  872. _fields_ = [
  873. # Value type, in URI form.
  874. # @see CustomDataTypes
  875. ("type", c_char_p),
  876. # Key.
  877. # @see CustomDataKeys
  878. ("key", c_char_p),
  879. # Value.
  880. ("value", c_char_p)
  881. ]
  882. # Engine driver device information.
  883. class EngineDriverDeviceInfo(Structure):
  884. _fields_ = [
  885. # This driver device hints.
  886. # @see EngineDriverHints
  887. ("hints", c_uint),
  888. # Available buffer sizes.
  889. # Terminated with 0.
  890. ("bufferSizes", POINTER(c_uint32)),
  891. # Available sample rates.
  892. # Terminated with 0.0.
  893. ("sampleRates", POINTER(c_double))
  894. ]
  895. # ------------------------------------------------------------------------------------------------------------
  896. # Carla Backend API (Python compatible stuff)
  897. # @see ParameterData
  898. PyParameterData = {
  899. 'type': PARAMETER_UNKNOWN,
  900. 'hints': 0x0,
  901. 'index': PARAMETER_NULL,
  902. 'rindex': -1,
  903. 'midiChannel': 0,
  904. 'mappedControlIndex': CONTROL_VALUE_NONE,
  905. 'mappedMinimum': 0.0,
  906. 'mappedMaximum': 0.0,
  907. }
  908. # @see ParameterRanges
  909. PyParameterRanges = {
  910. 'def': 0.0,
  911. 'min': 0.0,
  912. 'max': 1.0,
  913. 'step': 0.01,
  914. 'stepSmall': 0.0001,
  915. 'stepLarge': 0.1
  916. }
  917. # @see MidiProgramData
  918. PyMidiProgramData = {
  919. 'bank': 0,
  920. 'program': 0,
  921. 'name': None
  922. }
  923. # @see CustomData
  924. PyCustomData = {
  925. 'type': None,
  926. 'key': None,
  927. 'value': None
  928. }
  929. # @see EngineDriverDeviceInfo
  930. PyEngineDriverDeviceInfo = {
  931. 'hints': 0x0,
  932. 'bufferSizes': [],
  933. 'sampleRates': []
  934. }
  935. # ------------------------------------------------------------------------------------------------------------
  936. # Carla Host API (C stuff)
  937. # Information about a loaded plugin.
  938. # @see carla_get_plugin_info()
  939. class CarlaPluginInfo(Structure):
  940. _fields_ = [
  941. # Plugin type.
  942. ("type", c_enum),
  943. # Plugin category.
  944. ("category", c_enum),
  945. # Plugin hints.
  946. # @see PluginHints
  947. ("hints", c_uint),
  948. # Plugin options available for the user to change.
  949. # @see PluginOptions
  950. ("optionsAvailable", c_uint),
  951. # Plugin options currently enabled.
  952. # Some options are enabled but not available, which means they will always be on.
  953. # @see PluginOptions
  954. ("optionsEnabled", c_uint),
  955. # Plugin filename.
  956. # This can be the plugin binary or resource file.
  957. ("filename", c_char_p),
  958. # Plugin name.
  959. # This name is unique within a Carla instance.
  960. # @see carla_get_real_plugin_name()
  961. ("name", c_char_p),
  962. # Plugin label or URI.
  963. ("label", c_char_p),
  964. # Plugin author/maker.
  965. ("maker", c_char_p),
  966. # Plugin copyright/license.
  967. ("copyright", c_char_p),
  968. # Icon name for this plugin, in lowercase.
  969. # Default is "plugin".
  970. ("iconName", c_char_p),
  971. # Plugin unique Id.
  972. # This Id is dependent on the plugin type and may sometimes be 0.
  973. ("uniqueId", c_int64)
  974. ]
  975. # Port count information, used for Audio and MIDI ports and parameters.
  976. # @see carla_get_audio_port_count_info()
  977. # @see carla_get_midi_port_count_info()
  978. # @see carla_get_parameter_count_info()
  979. class CarlaPortCountInfo(Structure):
  980. _fields_ = [
  981. # Number of inputs.
  982. ("ins", c_uint32),
  983. # Number of outputs.
  984. ("outs", c_uint32)
  985. ]
  986. # Parameter information.
  987. # @see carla_get_parameter_info()
  988. class CarlaParameterInfo(Structure):
  989. _fields_ = [
  990. # Parameter name.
  991. ("name", c_char_p),
  992. # Parameter symbol.
  993. ("symbol", c_char_p),
  994. # Parameter unit.
  995. ("unit", c_char_p),
  996. # Parameter comment / documentation.
  997. ("comment", c_char_p),
  998. # Parameter group name.
  999. ("groupName", c_char_p),
  1000. # Number of scale points.
  1001. # @see CarlaScalePointInfo
  1002. ("scalePointCount", c_uint32)
  1003. ]
  1004. # Parameter scale point information.
  1005. # @see carla_get_parameter_scalepoint_info()
  1006. class CarlaScalePointInfo(Structure):
  1007. _fields_ = [
  1008. # Scale point value.
  1009. ("value", c_float),
  1010. # Scale point label.
  1011. ("label", c_char_p)
  1012. ]
  1013. # Transport information.
  1014. # @see carla_get_transport_info()
  1015. class CarlaTransportInfo(Structure):
  1016. _fields_ = [
  1017. # Wherever transport is playing.
  1018. ("playing", c_bool),
  1019. # Current transport frame.
  1020. ("frame", c_uint64),
  1021. # Bar
  1022. ("bar", c_int32),
  1023. # Beat
  1024. ("beat", c_int32),
  1025. # Tick
  1026. ("tick", c_int32),
  1027. # Beats per minute.
  1028. ("bpm", c_double)
  1029. ]
  1030. # Runtime engine information.
  1031. class CarlaRuntimeEngineInfo(Structure):
  1032. _fields_ = [
  1033. # DSP load.
  1034. ("load", c_float),
  1035. # Number of xruns.
  1036. ("xruns", c_uint32)
  1037. ]
  1038. # Runtime engine driver device information.
  1039. class CarlaRuntimeEngineDriverDeviceInfo(Structure):
  1040. _fields_ = [
  1041. # Name of the driver device.
  1042. ("name", c_char_p),
  1043. # This driver device hints.
  1044. # @see EngineDriverHints
  1045. ("hints", c_uint),
  1046. # Current buffer size.
  1047. ("bufferSize", c_uint32),
  1048. # Available buffer sizes.
  1049. # Terminated with 0.
  1050. ("bufferSizes", POINTER(c_uint32)),
  1051. # Current sample rate.
  1052. ("sampleRate", c_double),
  1053. # Available sample rates.
  1054. # Terminated with 0.0.
  1055. ("sampleRates", POINTER(c_double))
  1056. ]
  1057. # Image data for LV2 inline display API.
  1058. # raw image pixmap format is ARGB32,
  1059. class CarlaInlineDisplayImageSurface(Structure):
  1060. _fields_ = [
  1061. ("data", POINTER(c_ubyte)),
  1062. ("width", c_int),
  1063. ("height", c_int),
  1064. ("stride", c_int)
  1065. ]
  1066. # ------------------------------------------------------------------------------------------------------------
  1067. # Carla Host API (Python compatible stuff)
  1068. # @see CarlaPluginInfo
  1069. PyCarlaPluginInfo = {
  1070. 'type': PLUGIN_NONE,
  1071. 'category': PLUGIN_CATEGORY_NONE,
  1072. 'hints': 0x0,
  1073. 'optionsAvailable': 0x0,
  1074. 'optionsEnabled': 0x0,
  1075. 'filename': "",
  1076. 'name': "",
  1077. 'label': "",
  1078. 'maker': "",
  1079. 'copyright': "",
  1080. 'iconName': "",
  1081. 'uniqueId': 0
  1082. }
  1083. # @see CarlaPortCountInfo
  1084. PyCarlaPortCountInfo = {
  1085. 'ins': 0,
  1086. 'outs': 0
  1087. }
  1088. # @see CarlaParameterInfo
  1089. PyCarlaParameterInfo = {
  1090. 'name': "",
  1091. 'symbol': "",
  1092. 'unit': "",
  1093. 'comment': "",
  1094. 'groupName': "",
  1095. 'scalePointCount': 0,
  1096. }
  1097. # @see CarlaScalePointInfo
  1098. PyCarlaScalePointInfo = {
  1099. 'value': 0.0,
  1100. 'label': ""
  1101. }
  1102. # @see CarlaTransportInfo
  1103. PyCarlaTransportInfo = {
  1104. 'playing': False,
  1105. 'frame': 0,
  1106. 'bar': 0,
  1107. 'beat': 0,
  1108. 'tick': 0,
  1109. 'bpm': 0.0
  1110. }
  1111. # @see CarlaRuntimeEngineInfo
  1112. PyCarlaRuntimeEngineInfo = {
  1113. 'load': 0.0,
  1114. 'xruns': 0
  1115. }
  1116. # @see CarlaRuntimeEngineDriverDeviceInfo
  1117. PyCarlaRuntimeEngineDriverDeviceInfo = {
  1118. 'name': "",
  1119. 'hints': 0x0,
  1120. 'bufferSize': 0,
  1121. 'bufferSizes': [],
  1122. 'sampleRate': 0.0,
  1123. 'sampleRates': []
  1124. }
  1125. # ------------------------------------------------------------------------------------------------------------
  1126. # Set BINARY_NATIVE
  1127. if WINDOWS:
  1128. BINARY_NATIVE = BINARY_WIN64 if kIs64bit else BINARY_WIN32
  1129. else:
  1130. BINARY_NATIVE = BINARY_POSIX64 if kIs64bit else BINARY_POSIX32
  1131. # ------------------------------------------------------------------------------------------------------------
  1132. # Carla Host object (Meta)
  1133. class CarlaHostMeta(object):
  1134. #class CarlaHostMeta(object, metaclass=ABCMeta):
  1135. def __init__(self):
  1136. object.__init__(self)
  1137. # info about this host object
  1138. self.isControl = False
  1139. self.isPlugin = False
  1140. self.isRemote = False
  1141. self.nsmOK = False
  1142. # settings
  1143. self.processMode = ENGINE_PROCESS_MODE_PATCHBAY
  1144. self.transportMode = ENGINE_TRANSPORT_MODE_INTERNAL
  1145. self.transportExtra = ""
  1146. self.nextProcessMode = self.processMode
  1147. self.processModeForced = False
  1148. self.audioDriverForced = None
  1149. # settings
  1150. self.experimental = False
  1151. self.exportLV2 = False
  1152. self.forceStereo = False
  1153. self.manageUIs = False
  1154. self.maxParameters = 0
  1155. self.resetXruns = False
  1156. self.preferPluginBridges = False
  1157. self.preferUIBridges = False
  1158. self.preventBadBehaviour = False
  1159. self.showLogs = False
  1160. self.showPluginBridges = False
  1161. self.showWineBridges = False
  1162. self.uiBridgesTimeout = 0
  1163. self.uisAlwaysOnTop = False
  1164. # settings
  1165. self.pathBinaries = ""
  1166. self.pathResources = ""
  1167. # Get how many engine drivers are available.
  1168. @abstractmethod
  1169. def get_engine_driver_count(self):
  1170. raise NotImplementedError
  1171. # Get an engine driver name.
  1172. # @param index Driver index
  1173. @abstractmethod
  1174. def get_engine_driver_name(self, index):
  1175. raise NotImplementedError
  1176. # Get the device names of an engine driver.
  1177. # @param index Driver index
  1178. @abstractmethod
  1179. def get_engine_driver_device_names(self, index):
  1180. raise NotImplementedError
  1181. # Get information about a device driver.
  1182. # @param index Driver index
  1183. # @param name Device name
  1184. @abstractmethod
  1185. def get_engine_driver_device_info(self, index, name):
  1186. raise NotImplementedError
  1187. # Show a device custom control panel.
  1188. # @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL
  1189. # @param index Driver index
  1190. # @param name Device name
  1191. @abstractmethod
  1192. def show_engine_driver_device_control_panel(self, index, name):
  1193. raise NotImplementedError
  1194. # Initialize the engine.
  1195. # Make sure to call carla_engine_idle() at regular intervals afterwards.
  1196. # @param driverName Driver to use
  1197. # @param clientName Engine master client name
  1198. @abstractmethod
  1199. def engine_init(self, driverName, clientName):
  1200. raise NotImplementedError
  1201. # Close the engine.
  1202. # This function always closes the engine even if it returns false.
  1203. # In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
  1204. @abstractmethod
  1205. def engine_close(self):
  1206. raise NotImplementedError
  1207. # Idle the engine.
  1208. # Do not call this if the engine is not running.
  1209. @abstractmethod
  1210. def engine_idle(self):
  1211. raise NotImplementedError
  1212. # Check if the engine is running.
  1213. @abstractmethod
  1214. def is_engine_running(self):
  1215. raise NotImplementedError
  1216. # Get information about the currently running engine.
  1217. @abstractmethod
  1218. def get_runtime_engine_info(self):
  1219. raise NotImplementedError
  1220. # Get information about the currently running engine driver device.
  1221. @abstractmethod
  1222. def get_runtime_engine_driver_device_info(self):
  1223. raise NotImplementedError
  1224. # Dynamically change buffer size and/or sample rate while engine is running.
  1225. # @see ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE
  1226. # @see ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE
  1227. def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
  1228. raise NotImplementedError
  1229. # Show the custom control panel for the current engine device.
  1230. # @see ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL
  1231. def show_engine_device_control_panel(self):
  1232. raise NotImplementedError
  1233. # Clear the xrun count on the engine, so that the next time carla_get_runtime_engine_info() is called, it returns 0.
  1234. @abstractmethod
  1235. def clear_engine_xruns(self):
  1236. raise NotImplementedError
  1237. # Tell the engine to stop the current cancelable action.
  1238. # @see ENGINE_CALLBACK_CANCELABLE_ACTION
  1239. @abstractmethod
  1240. def cancel_engine_action(self):
  1241. raise NotImplementedError
  1242. # Tell the engine it's about to close.
  1243. # This is used to prevent the engine thread(s) from reactivating.
  1244. @abstractmethod
  1245. def set_engine_about_to_close(self):
  1246. raise NotImplementedError
  1247. # Set the engine callback function.
  1248. # @param func Callback function
  1249. @abstractmethod
  1250. def set_engine_callback(self, func):
  1251. raise NotImplementedError
  1252. # Set an engine option.
  1253. # @param option Option
  1254. # @param value Value as number
  1255. # @param valueStr Value as string
  1256. @abstractmethod
  1257. def set_engine_option(self, option, value, valueStr):
  1258. raise NotImplementedError
  1259. # Set the file callback function.
  1260. # @param func Callback function
  1261. # @param ptr Callback pointer
  1262. @abstractmethod
  1263. def set_file_callback(self, func):
  1264. raise NotImplementedError
  1265. # Load a file of any type.
  1266. # This will try to load a generic file as a plugin,
  1267. # either by direct handling (SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
  1268. # @see carla_get_supported_file_extensions()
  1269. @abstractmethod
  1270. def load_file(self, filename):
  1271. raise NotImplementedError
  1272. # Load a Carla project file.
  1273. # @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
  1274. @abstractmethod
  1275. def load_project(self, filename):
  1276. raise NotImplementedError
  1277. # Save current project to a file.
  1278. @abstractmethod
  1279. def save_project(self, filename):
  1280. raise NotImplementedError
  1281. # Clear the currently set project filename.
  1282. @abstractmethod
  1283. def clear_project_filename(self):
  1284. raise NotImplementedError
  1285. # Connect two patchbay ports.
  1286. # @param groupIdA Output group
  1287. # @param portIdA Output port
  1288. # @param groupIdB Input group
  1289. # @param portIdB Input port
  1290. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
  1291. @abstractmethod
  1292. def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
  1293. raise NotImplementedError
  1294. # Disconnect two patchbay ports.
  1295. # @param connectionId Connection Id
  1296. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
  1297. @abstractmethod
  1298. def patchbay_disconnect(self, external, connectionId):
  1299. raise NotImplementedError
  1300. # Force the engine to resend all patchbay clients, ports and connections again.
  1301. # @param external Wherever to show external/hardware ports instead of internal ones.
  1302. # Only valid in patchbay engine mode, other modes will ignore this.
  1303. @abstractmethod
  1304. def patchbay_refresh(self, external):
  1305. raise NotImplementedError
  1306. # Start playback of the engine transport.
  1307. @abstractmethod
  1308. def transport_play(self):
  1309. raise NotImplementedError
  1310. # Pause the engine transport.
  1311. @abstractmethod
  1312. def transport_pause(self):
  1313. raise NotImplementedError
  1314. # Pause the engine transport.
  1315. @abstractmethod
  1316. def transport_bpm(self, bpm):
  1317. raise NotImplementedError
  1318. # Relocate the engine transport to a specific frame.
  1319. @abstractmethod
  1320. def transport_relocate(self, frame):
  1321. raise NotImplementedError
  1322. # Get the current transport frame.
  1323. @abstractmethod
  1324. def get_current_transport_frame(self):
  1325. raise NotImplementedError
  1326. # Get the engine transport information.
  1327. @abstractmethod
  1328. def get_transport_info(self):
  1329. raise NotImplementedError
  1330. # Current number of plugins loaded.
  1331. @abstractmethod
  1332. def get_current_plugin_count(self):
  1333. raise NotImplementedError
  1334. # Maximum number of loadable plugins allowed.
  1335. # Returns 0 if engine is not started.
  1336. @abstractmethod
  1337. def get_max_plugin_number(self):
  1338. raise NotImplementedError
  1339. # Add a new plugin.
  1340. # If you don't know the binary type use the BINARY_NATIVE macro.
  1341. # @param btype Binary type
  1342. # @param ptype Plugin type
  1343. # @param filename Filename, if applicable
  1344. # @param name Name of the plugin, can be NULL
  1345. # @param label Plugin label, if applicable
  1346. # @param uniqueId Plugin unique Id, if applicable
  1347. # @param extraPtr Extra pointer, defined per plugin type
  1348. # @param options Initial plugin options
  1349. @abstractmethod
  1350. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  1351. raise NotImplementedError
  1352. # Remove a plugin.
  1353. # @param pluginId Plugin to remove.
  1354. @abstractmethod
  1355. def remove_plugin(self, pluginId):
  1356. raise NotImplementedError
  1357. # Remove all plugins.
  1358. @abstractmethod
  1359. def remove_all_plugins(self):
  1360. raise NotImplementedError
  1361. # Rename a plugin.
  1362. # Returns the new name, or NULL if the operation failed.
  1363. # @param pluginId Plugin to rename
  1364. # @param newName New plugin name
  1365. @abstractmethod
  1366. def rename_plugin(self, pluginId, newName):
  1367. raise NotImplementedError
  1368. # Clone a plugin.
  1369. # @param pluginId Plugin to clone
  1370. @abstractmethod
  1371. def clone_plugin(self, pluginId):
  1372. raise NotImplementedError
  1373. # Prepare replace of a plugin.
  1374. # The next call to carla_add_plugin() will use this id, replacing the current plugin.
  1375. # @param pluginId Plugin to replace
  1376. # @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  1377. @abstractmethod
  1378. def replace_plugin(self, pluginId):
  1379. raise NotImplementedError
  1380. # Switch two plugins positions.
  1381. # @param pluginIdA Plugin A
  1382. # @param pluginIdB Plugin B
  1383. @abstractmethod
  1384. def switch_plugins(self, pluginIdA, pluginIdB):
  1385. raise NotImplementedError
  1386. # Load a plugin state.
  1387. # @param pluginId Plugin
  1388. # @param filename Path to plugin state
  1389. # @see carla_save_plugin_state()
  1390. @abstractmethod
  1391. def load_plugin_state(self, pluginId, filename):
  1392. raise NotImplementedError
  1393. # Save a plugin state.
  1394. # @param pluginId Plugin
  1395. # @param filename Path to plugin state
  1396. # @see carla_load_plugin_state()
  1397. @abstractmethod
  1398. def save_plugin_state(self, pluginId, filename):
  1399. raise NotImplementedError
  1400. # Export plugin as LV2.
  1401. # @param pluginId Plugin
  1402. # @param lv2path Path to lv2 plugin folder
  1403. def export_plugin_lv2(self, pluginId, lv2path):
  1404. raise NotImplementedError
  1405. # Get information from a plugin.
  1406. # @param pluginId Plugin
  1407. @abstractmethod
  1408. def get_plugin_info(self, pluginId):
  1409. raise NotImplementedError
  1410. # Get audio port count information from a plugin.
  1411. # @param pluginId Plugin
  1412. @abstractmethod
  1413. def get_audio_port_count_info(self, pluginId):
  1414. raise NotImplementedError
  1415. # Get MIDI port count information from a plugin.
  1416. # @param pluginId Plugin
  1417. @abstractmethod
  1418. def get_midi_port_count_info(self, pluginId):
  1419. raise NotImplementedError
  1420. # Get parameter count information from a plugin.
  1421. # @param pluginId Plugin
  1422. @abstractmethod
  1423. def get_parameter_count_info(self, pluginId):
  1424. raise NotImplementedError
  1425. # Get parameter information from a plugin.
  1426. # @param pluginId Plugin
  1427. # @param parameterId Parameter index
  1428. # @see carla_get_parameter_count()
  1429. @abstractmethod
  1430. def get_parameter_info(self, pluginId, parameterId):
  1431. raise NotImplementedError
  1432. # Get parameter scale point information from a plugin.
  1433. # @param pluginId Plugin
  1434. # @param parameterId Parameter index
  1435. # @param scalePointId Parameter scale-point index
  1436. # @see CarlaParameterInfo::scalePointCount
  1437. @abstractmethod
  1438. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1439. raise NotImplementedError
  1440. # Get a plugin's parameter data.
  1441. # @param pluginId Plugin
  1442. # @param parameterId Parameter index
  1443. # @see carla_get_parameter_count()
  1444. @abstractmethod
  1445. def get_parameter_data(self, pluginId, parameterId):
  1446. raise NotImplementedError
  1447. # Get a plugin's parameter ranges.
  1448. # @param pluginId Plugin
  1449. # @param parameterId Parameter index
  1450. # @see carla_get_parameter_count()
  1451. @abstractmethod
  1452. def get_parameter_ranges(self, pluginId, parameterId):
  1453. raise NotImplementedError
  1454. # Get a plugin's MIDI program data.
  1455. # @param pluginId Plugin
  1456. # @param midiProgramId MIDI Program index
  1457. # @see carla_get_midi_program_count()
  1458. @abstractmethod
  1459. def get_midi_program_data(self, pluginId, midiProgramId):
  1460. raise NotImplementedError
  1461. # Get a plugin's custom data, using index.
  1462. # @param pluginId Plugin
  1463. # @param customDataId Custom data index
  1464. # @see carla_get_custom_data_count()
  1465. @abstractmethod
  1466. def get_custom_data(self, pluginId, customDataId):
  1467. raise NotImplementedError
  1468. # Get a plugin's custom data value, using type and key.
  1469. # @param pluginId Plugin
  1470. # @param type Custom data type
  1471. # @param key Custom data key
  1472. # @see carla_get_custom_data_count()
  1473. @abstractmethod
  1474. def get_custom_data_value(self, pluginId, type_, key):
  1475. raise NotImplementedError
  1476. # Get a plugin's chunk data.
  1477. # @param pluginId Plugin
  1478. # @see PLUGIN_OPTION_USE_CHUNKS
  1479. @abstractmethod
  1480. def get_chunk_data(self, pluginId):
  1481. raise NotImplementedError
  1482. # Get how many parameters a plugin has.
  1483. # @param pluginId Plugin
  1484. @abstractmethod
  1485. def get_parameter_count(self, pluginId):
  1486. raise NotImplementedError
  1487. # Get how many programs a plugin has.
  1488. # @param pluginId Plugin
  1489. # @see carla_get_program_name()
  1490. @abstractmethod
  1491. def get_program_count(self, pluginId):
  1492. raise NotImplementedError
  1493. # Get how many MIDI programs a plugin has.
  1494. # @param pluginId Plugin
  1495. # @see carla_get_midi_program_name() and carla_get_midi_program_data()
  1496. @abstractmethod
  1497. def get_midi_program_count(self, pluginId):
  1498. raise NotImplementedError
  1499. # Get how many custom data sets a plugin has.
  1500. # @param pluginId Plugin
  1501. # @see carla_get_custom_data()
  1502. @abstractmethod
  1503. def get_custom_data_count(self, pluginId):
  1504. raise NotImplementedError
  1505. # Get a plugin's parameter text (custom display of internal values).
  1506. # @param pluginId Plugin
  1507. # @param parameterId Parameter index
  1508. # @see PARAMETER_USES_CUSTOM_TEXT
  1509. @abstractmethod
  1510. def get_parameter_text(self, pluginId, parameterId):
  1511. raise NotImplementedError
  1512. # Get a plugin's program name.
  1513. # @param pluginId Plugin
  1514. # @param programId Program index
  1515. # @see carla_get_program_count()
  1516. @abstractmethod
  1517. def get_program_name(self, pluginId, programId):
  1518. raise NotImplementedError
  1519. # Get a plugin's MIDI program name.
  1520. # @param pluginId Plugin
  1521. # @param midiProgramId MIDI Program index
  1522. # @see carla_get_midi_program_count()
  1523. @abstractmethod
  1524. def get_midi_program_name(self, pluginId, midiProgramId):
  1525. raise NotImplementedError
  1526. # Get a plugin's real name.
  1527. # This is the name the plugin uses to identify itself; may not be unique.
  1528. # @param pluginId Plugin
  1529. @abstractmethod
  1530. def get_real_plugin_name(self, pluginId):
  1531. raise NotImplementedError
  1532. # Get a plugin's program index.
  1533. # @param pluginId Plugin
  1534. @abstractmethod
  1535. def get_current_program_index(self, pluginId):
  1536. raise NotImplementedError
  1537. # Get a plugin's midi program index.
  1538. # @param pluginId Plugin
  1539. @abstractmethod
  1540. def get_current_midi_program_index(self, pluginId):
  1541. raise NotImplementedError
  1542. # Get a plugin's default parameter value.
  1543. # @param pluginId Plugin
  1544. # @param parameterId Parameter index
  1545. @abstractmethod
  1546. def get_default_parameter_value(self, pluginId, parameterId):
  1547. raise NotImplementedError
  1548. # Get a plugin's current parameter value.
  1549. # @param pluginId Plugin
  1550. # @param parameterId Parameter index
  1551. @abstractmethod
  1552. def get_current_parameter_value(self, pluginId, parameterId):
  1553. raise NotImplementedError
  1554. # Get a plugin's internal parameter value.
  1555. # @param pluginId Plugin
  1556. # @param parameterId Parameter index, maybe be negative
  1557. # @see InternalParameterIndex
  1558. @abstractmethod
  1559. def get_internal_parameter_value(self, pluginId, parameterId):
  1560. raise NotImplementedError
  1561. # Get a plugin's input peak value.
  1562. # @param pluginId Plugin
  1563. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1564. @abstractmethod
  1565. def get_input_peak_value(self, pluginId, isLeft):
  1566. raise NotImplementedError
  1567. # Get a plugin's output peak value.
  1568. # @param pluginId Plugin
  1569. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1570. @abstractmethod
  1571. def get_output_peak_value(self, pluginId, isLeft):
  1572. raise NotImplementedError
  1573. # Render a plugin's inline display.
  1574. # @param pluginId Plugin
  1575. @abstractmethod
  1576. def render_inline_display(self, pluginId, width, height):
  1577. raise NotImplementedError
  1578. # Enable a plugin's option.
  1579. # @param pluginId Plugin
  1580. # @param option An option from PluginOptions
  1581. # @param yesNo New enabled state
  1582. @abstractmethod
  1583. def set_option(self, pluginId, option, yesNo):
  1584. raise NotImplementedError
  1585. # Enable or disable a plugin.
  1586. # @param pluginId Plugin
  1587. # @param onOff New active state
  1588. @abstractmethod
  1589. def set_active(self, pluginId, onOff):
  1590. raise NotImplementedError
  1591. # Change a plugin's internal dry/wet.
  1592. # @param pluginId Plugin
  1593. # @param value New dry/wet value
  1594. @abstractmethod
  1595. def set_drywet(self, pluginId, value):
  1596. raise NotImplementedError
  1597. # Change a plugin's internal volume.
  1598. # @param pluginId Plugin
  1599. # @param value New volume
  1600. @abstractmethod
  1601. def set_volume(self, pluginId, value):
  1602. raise NotImplementedError
  1603. # Change a plugin's internal stereo balance, left channel.
  1604. # @param pluginId Plugin
  1605. # @param value New value
  1606. @abstractmethod
  1607. def set_balance_left(self, pluginId, value):
  1608. raise NotImplementedError
  1609. # Change a plugin's internal stereo balance, right channel.
  1610. # @param pluginId Plugin
  1611. # @param value New value
  1612. @abstractmethod
  1613. def set_balance_right(self, pluginId, value):
  1614. raise NotImplementedError
  1615. # Change a plugin's internal mono panning value.
  1616. # @param pluginId Plugin
  1617. # @param value New value
  1618. @abstractmethod
  1619. def set_panning(self, pluginId, value):
  1620. raise NotImplementedError
  1621. # Change a plugin's internal control channel.
  1622. # @param pluginId Plugin
  1623. # @param channel New channel
  1624. @abstractmethod
  1625. def set_ctrl_channel(self, pluginId, channel):
  1626. raise NotImplementedError
  1627. # Change a plugin's parameter value.
  1628. # @param pluginId Plugin
  1629. # @param parameterId Parameter index
  1630. # @param value New value
  1631. @abstractmethod
  1632. def set_parameter_value(self, pluginId, parameterId, value):
  1633. raise NotImplementedError
  1634. # Change a plugin's parameter mapped control index.
  1635. # @param pluginId Plugin
  1636. # @param parameterId Parameter index
  1637. # @param cc New MIDI cc
  1638. @abstractmethod
  1639. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1640. raise NotImplementedError
  1641. # Change a plugin's parameter MIDI channel.
  1642. # @param pluginId Plugin
  1643. # @param parameterId Parameter index
  1644. # @param channel New control index
  1645. @abstractmethod
  1646. def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
  1647. raise NotImplementedError
  1648. # Change a plugin's parameter mapped range.
  1649. # @param pluginId Plugin
  1650. # @param parameterId Parameter index
  1651. # @param minimum New mapped minimum
  1652. # @param maximum New mapped maximum
  1653. @abstractmethod
  1654. def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
  1655. raise NotImplementedError
  1656. # Change a plugin's parameter in drag/touch mode state.
  1657. # Usually happens from a UI when the user is moving a parameter with a mouse or similar input.
  1658. # @param pluginId Plugin
  1659. # @param parameterId Parameter index
  1660. # @param touch New state
  1661. @abstractmethod
  1662. def set_parameter_touch(self, pluginId, parameterId, touch):
  1663. raise NotImplementedError
  1664. # Change a plugin's current program.
  1665. # @param pluginId Plugin
  1666. # @param programId New program
  1667. @abstractmethod
  1668. def set_program(self, pluginId, programId):
  1669. raise NotImplementedError
  1670. # Change a plugin's current MIDI program.
  1671. # @param pluginId Plugin
  1672. # @param midiProgramId New value
  1673. @abstractmethod
  1674. def set_midi_program(self, pluginId, midiProgramId):
  1675. raise NotImplementedError
  1676. # Set a plugin's custom data set.
  1677. # @param pluginId Plugin
  1678. # @param type Type
  1679. # @param key Key
  1680. # @param value New value
  1681. # @see CustomDataTypes and CustomDataKeys
  1682. @abstractmethod
  1683. def set_custom_data(self, pluginId, type_, key, value):
  1684. raise NotImplementedError
  1685. # Set a plugin's chunk data.
  1686. # @param pluginId Plugin
  1687. # @param chunkData New chunk data
  1688. # @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  1689. @abstractmethod
  1690. def set_chunk_data(self, pluginId, chunkData):
  1691. raise NotImplementedError
  1692. # Tell a plugin to prepare for save.
  1693. # This should be called before saving custom data sets.
  1694. # @param pluginId Plugin
  1695. @abstractmethod
  1696. def prepare_for_save(self, pluginId):
  1697. raise NotImplementedError
  1698. # Reset all plugin's parameters.
  1699. # @param pluginId Plugin
  1700. @abstractmethod
  1701. def reset_parameters(self, pluginId):
  1702. raise NotImplementedError
  1703. # Randomize all plugin's parameters.
  1704. # @param pluginId Plugin
  1705. @abstractmethod
  1706. def randomize_parameters(self, pluginId):
  1707. raise NotImplementedError
  1708. # Send a single note of a plugin.
  1709. # If velocity is 0, note-off is sent; note-on otherwise.
  1710. # @param pluginId Plugin
  1711. # @param channel Note channel
  1712. # @param note Note pitch
  1713. # @param velocity Note velocity
  1714. @abstractmethod
  1715. def send_midi_note(self, pluginId, channel, note, velocity):
  1716. raise NotImplementedError
  1717. # Tell a plugin to show its own custom UI.
  1718. # @param pluginId Plugin
  1719. # @param yesNo New UI state, visible or not
  1720. # @see PLUGIN_HAS_CUSTOM_UI
  1721. @abstractmethod
  1722. def show_custom_ui(self, pluginId, yesNo):
  1723. raise NotImplementedError
  1724. # Get the current engine buffer size.
  1725. @abstractmethod
  1726. def get_buffer_size(self):
  1727. raise NotImplementedError
  1728. # Get the current engine sample rate.
  1729. @abstractmethod
  1730. def get_sample_rate(self):
  1731. raise NotImplementedError
  1732. # Get the last error.
  1733. @abstractmethod
  1734. def get_last_error(self):
  1735. raise NotImplementedError
  1736. # Get the current engine OSC URL (TCP).
  1737. @abstractmethod
  1738. def get_host_osc_url_tcp(self):
  1739. raise NotImplementedError
  1740. # Get the current engine OSC URL (UDP).
  1741. @abstractmethod
  1742. def get_host_osc_url_udp(self):
  1743. raise NotImplementedError
  1744. # Initialize NSM (that is, announce ourselves to it).
  1745. # Must be called as early as possible in the program's lifecycle.
  1746. # Returns true if NSM is available and initialized correctly.
  1747. @abstractmethod
  1748. def nsm_init(self, pid, executableName):
  1749. raise NotImplementedError
  1750. # Respond to an NSM callback.
  1751. @abstractmethod
  1752. def nsm_ready(self, opcode):
  1753. raise NotImplementedError
  1754. # ------------------------------------------------------------------------------------------------------------
  1755. # Carla Host object (dummy/null, does nothing)
  1756. class CarlaHostNull(CarlaHostMeta):
  1757. def __init__(self):
  1758. CarlaHostMeta.__init__(self)
  1759. self.fEngineCallback = None
  1760. self.fFileCallback = None
  1761. self.fEngineRunning = False
  1762. def get_engine_driver_count(self):
  1763. return 0
  1764. def get_engine_driver_name(self, index):
  1765. return ""
  1766. def get_engine_driver_device_names(self, index):
  1767. return []
  1768. def get_engine_driver_device_info(self, index, name):
  1769. return PyEngineDriverDeviceInfo
  1770. def show_engine_driver_device_control_panel(self, index, name):
  1771. return False
  1772. def engine_init(self, driverName, clientName):
  1773. self.fEngineRunning = True
  1774. if self.fEngineCallback is not None:
  1775. self.fEngineCallback(None,
  1776. ENGINE_CALLBACK_ENGINE_STARTED,
  1777. 0,
  1778. self.processMode,
  1779. self.transportMode,
  1780. 0, 0.0,
  1781. driverName)
  1782. return True
  1783. def engine_close(self):
  1784. self.fEngineRunning = False
  1785. if self.fEngineCallback is not None:
  1786. self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0, 0.0, "")
  1787. return True
  1788. def engine_idle(self):
  1789. return
  1790. def is_engine_running(self):
  1791. return self.fEngineRunning
  1792. def get_runtime_engine_info(self):
  1793. return PyCarlaRuntimeEngineInfo
  1794. def get_runtime_engine_driver_device_info(self):
  1795. return PyCarlaRuntimeEngineDriverDeviceInfo
  1796. def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
  1797. return False
  1798. def show_engine_device_control_panel(self):
  1799. return False
  1800. def clear_engine_xruns(self):
  1801. return
  1802. def cancel_engine_action(self):
  1803. return
  1804. def set_engine_about_to_close(self):
  1805. return True
  1806. def set_engine_callback(self, func):
  1807. self.fEngineCallback = func
  1808. def set_engine_option(self, option, value, valueStr):
  1809. return
  1810. def set_file_callback(self, func):
  1811. self.fFileCallback = func
  1812. def load_file(self, filename):
  1813. return False
  1814. def load_project(self, filename):
  1815. return False
  1816. def save_project(self, filename):
  1817. return False
  1818. def clear_project_filename(self):
  1819. return
  1820. def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
  1821. return False
  1822. def patchbay_disconnect(self, external, connectionId):
  1823. return False
  1824. def patchbay_refresh(self, external):
  1825. return False
  1826. def transport_play(self):
  1827. return
  1828. def transport_pause(self):
  1829. return
  1830. def transport_bpm(self, bpm):
  1831. return
  1832. def transport_relocate(self, frame):
  1833. return
  1834. def get_current_transport_frame(self):
  1835. return 0
  1836. def get_transport_info(self):
  1837. return PyCarlaTransportInfo
  1838. def get_current_plugin_count(self):
  1839. return 0
  1840. def get_max_plugin_number(self):
  1841. return 0
  1842. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  1843. return False
  1844. def remove_plugin(self, pluginId):
  1845. return False
  1846. def remove_all_plugins(self):
  1847. return False
  1848. def rename_plugin(self, pluginId, newName):
  1849. return False
  1850. def clone_plugin(self, pluginId):
  1851. return False
  1852. def replace_plugin(self, pluginId):
  1853. return False
  1854. def switch_plugins(self, pluginIdA, pluginIdB):
  1855. return False
  1856. def load_plugin_state(self, pluginId, filename):
  1857. return False
  1858. def save_plugin_state(self, pluginId, filename):
  1859. return False
  1860. def export_plugin_lv2(self, pluginId, lv2path):
  1861. return False
  1862. def get_plugin_info(self, pluginId):
  1863. return PyCarlaPluginInfo
  1864. def get_audio_port_count_info(self, pluginId):
  1865. return PyCarlaPortCountInfo
  1866. def get_midi_port_count_info(self, pluginId):
  1867. return PyCarlaPortCountInfo
  1868. def get_parameter_count_info(self, pluginId):
  1869. return PyCarlaPortCountInfo
  1870. def get_parameter_info(self, pluginId, parameterId):
  1871. return PyCarlaParameterInfo
  1872. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1873. return PyCarlaScalePointInfo
  1874. def get_parameter_data(self, pluginId, parameterId):
  1875. return PyParameterData
  1876. def get_parameter_ranges(self, pluginId, parameterId):
  1877. return PyParameterRanges
  1878. def get_midi_program_data(self, pluginId, midiProgramId):
  1879. return PyMidiProgramData
  1880. def get_custom_data(self, pluginId, customDataId):
  1881. return PyCustomData
  1882. def get_custom_data_value(self, pluginId, type_, key):
  1883. return ""
  1884. def get_chunk_data(self, pluginId):
  1885. return ""
  1886. def get_parameter_count(self, pluginId):
  1887. return 0
  1888. def get_program_count(self, pluginId):
  1889. return 0
  1890. def get_midi_program_count(self, pluginId):
  1891. return 0
  1892. def get_custom_data_count(self, pluginId):
  1893. return 0
  1894. def get_parameter_text(self, pluginId, parameterId):
  1895. return ""
  1896. def get_program_name(self, pluginId, programId):
  1897. return ""
  1898. def get_midi_program_name(self, pluginId, midiProgramId):
  1899. return ""
  1900. def get_real_plugin_name(self, pluginId):
  1901. return ""
  1902. def get_current_program_index(self, pluginId):
  1903. return 0
  1904. def get_current_midi_program_index(self, pluginId):
  1905. return 0
  1906. def get_default_parameter_value(self, pluginId, parameterId):
  1907. return 0.0
  1908. def get_current_parameter_value(self, pluginId, parameterId):
  1909. return 0.0
  1910. def get_internal_parameter_value(self, pluginId, parameterId):
  1911. return 0.0
  1912. def get_input_peak_value(self, pluginId, isLeft):
  1913. return 0.0
  1914. def get_output_peak_value(self, pluginId, isLeft):
  1915. return 0.0
  1916. def render_inline_display(self, pluginId, width, height):
  1917. return None
  1918. def set_option(self, pluginId, option, yesNo):
  1919. return
  1920. def set_active(self, pluginId, onOff):
  1921. return
  1922. def set_drywet(self, pluginId, value):
  1923. return
  1924. def set_volume(self, pluginId, value):
  1925. return
  1926. def set_balance_left(self, pluginId, value):
  1927. return
  1928. def set_balance_right(self, pluginId, value):
  1929. return
  1930. def set_panning(self, pluginId, value):
  1931. return
  1932. def set_ctrl_channel(self, pluginId, channel):
  1933. return
  1934. def set_parameter_value(self, pluginId, parameterId, value):
  1935. return
  1936. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1937. return
  1938. def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
  1939. return
  1940. def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
  1941. return
  1942. def set_parameter_touch(self, pluginId, parameterId, touch):
  1943. return
  1944. def set_program(self, pluginId, programId):
  1945. return
  1946. def set_midi_program(self, pluginId, midiProgramId):
  1947. return
  1948. def set_custom_data(self, pluginId, type_, key, value):
  1949. return
  1950. def set_chunk_data(self, pluginId, chunkData):
  1951. return
  1952. def prepare_for_save(self, pluginId):
  1953. return
  1954. def reset_parameters(self, pluginId):
  1955. return
  1956. def randomize_parameters(self, pluginId):
  1957. return
  1958. def send_midi_note(self, pluginId, channel, note, velocity):
  1959. return
  1960. def show_custom_ui(self, pluginId, yesNo):
  1961. return
  1962. def get_buffer_size(self):
  1963. return 0
  1964. def get_sample_rate(self):
  1965. return 0.0
  1966. def get_last_error(self):
  1967. return ""
  1968. def get_host_osc_url_tcp(self):
  1969. return ""
  1970. def get_host_osc_url_udp(self):
  1971. return ""
  1972. def nsm_init(self, pid, executableName):
  1973. return False
  1974. def nsm_ready(self, opcode):
  1975. return
  1976. # ------------------------------------------------------------------------------------------------------------
  1977. # Carla Host object using a DLL
  1978. class CarlaHostDLL(CarlaHostMeta):
  1979. def __init__(self, libName, loadGlobal):
  1980. CarlaHostMeta.__init__(self)
  1981. # info about this host object
  1982. self.isPlugin = False
  1983. self.lib = CDLL(libName, RTLD_GLOBAL if loadGlobal else RTLD_LOCAL)
  1984. self.lib.carla_get_engine_driver_count.argtypes = None
  1985. self.lib.carla_get_engine_driver_count.restype = c_uint
  1986. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  1987. self.lib.carla_get_engine_driver_name.restype = c_char_p
  1988. self.lib.carla_get_engine_driver_device_names.argtypes = [c_uint]
  1989. self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)
  1990. self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p]
  1991. self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)
  1992. self.lib.carla_show_engine_driver_device_control_panel.argtypes = [c_uint, c_char_p]
  1993. self.lib.carla_show_engine_driver_device_control_panel.restype = c_bool
  1994. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  1995. self.lib.carla_engine_init.restype = c_bool
  1996. self.lib.carla_engine_close.argtypes = None
  1997. self.lib.carla_engine_close.restype = c_bool
  1998. self.lib.carla_engine_idle.argtypes = None
  1999. self.lib.carla_engine_idle.restype = None
  2000. self.lib.carla_is_engine_running.argtypes = None
  2001. self.lib.carla_is_engine_running.restype = c_bool
  2002. self.lib.carla_get_runtime_engine_info.argtypes = None
  2003. self.lib.carla_get_runtime_engine_info.restype = POINTER(CarlaRuntimeEngineInfo)
  2004. self.lib.carla_get_runtime_engine_driver_device_info.argtypes = None
  2005. self.lib.carla_get_runtime_engine_driver_device_info.restype = POINTER(CarlaRuntimeEngineDriverDeviceInfo)
  2006. self.lib.carla_set_engine_buffer_size_and_sample_rate.argtypes = [c_uint, c_double]
  2007. self.lib.carla_set_engine_buffer_size_and_sample_rate.restype = c_bool
  2008. self.lib.carla_show_engine_device_control_panel.argtypes = None
  2009. self.lib.carla_show_engine_device_control_panel.restype = c_bool
  2010. self.lib.carla_clear_engine_xruns.argtypes = None
  2011. self.lib.carla_clear_engine_xruns.restype = None
  2012. self.lib.carla_cancel_engine_action.argtypes = None
  2013. self.lib.carla_cancel_engine_action.restype = None
  2014. self.lib.carla_set_engine_about_to_close.argtypes = None
  2015. self.lib.carla_set_engine_about_to_close.restype = c_bool
  2016. self.lib.carla_set_engine_callback.argtypes = [EngineCallbackFunc, c_void_p]
  2017. self.lib.carla_set_engine_callback.restype = None
  2018. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  2019. self.lib.carla_set_engine_option.restype = None
  2020. self.lib.carla_set_file_callback.argtypes = [FileCallbackFunc, c_void_p]
  2021. self.lib.carla_set_file_callback.restype = None
  2022. self.lib.carla_load_file.argtypes = [c_char_p]
  2023. self.lib.carla_load_file.restype = c_bool
  2024. self.lib.carla_load_project.argtypes = [c_char_p]
  2025. self.lib.carla_load_project.restype = c_bool
  2026. self.lib.carla_save_project.argtypes = [c_char_p]
  2027. self.lib.carla_save_project.restype = c_bool
  2028. self.lib.carla_clear_project_filename.argtypes = None
  2029. self.lib.carla_clear_project_filename.restype = None
  2030. self.lib.carla_patchbay_connect.argtypes = [c_bool, c_uint, c_uint, c_uint, c_uint]
  2031. self.lib.carla_patchbay_connect.restype = c_bool
  2032. self.lib.carla_patchbay_disconnect.argtypes = [c_bool, c_uint]
  2033. self.lib.carla_patchbay_disconnect.restype = c_bool
  2034. self.lib.carla_patchbay_refresh.argtypes = [c_bool]
  2035. self.lib.carla_patchbay_refresh.restype = c_bool
  2036. self.lib.carla_transport_play.argtypes = None
  2037. self.lib.carla_transport_play.restype = None
  2038. self.lib.carla_transport_pause.argtypes = None
  2039. self.lib.carla_transport_pause.restype = None
  2040. self.lib.carla_transport_bpm.argtypes = [c_double]
  2041. self.lib.carla_transport_bpm.restype = None
  2042. self.lib.carla_transport_relocate.argtypes = [c_uint64]
  2043. self.lib.carla_transport_relocate.restype = None
  2044. self.lib.carla_get_current_transport_frame.argtypes = None
  2045. self.lib.carla_get_current_transport_frame.restype = c_uint64
  2046. self.lib.carla_get_transport_info.argtypes = None
  2047. self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
  2048. self.lib.carla_get_current_plugin_count.argtypes = None
  2049. self.lib.carla_get_current_plugin_count.restype = c_uint32
  2050. self.lib.carla_get_max_plugin_number.argtypes = None
  2051. self.lib.carla_get_max_plugin_number.restype = c_uint32
  2052. 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]
  2053. self.lib.carla_add_plugin.restype = c_bool
  2054. self.lib.carla_remove_plugin.argtypes = [c_uint]
  2055. self.lib.carla_remove_plugin.restype = c_bool
  2056. self.lib.carla_remove_all_plugins.argtypes = None
  2057. self.lib.carla_remove_all_plugins.restype = c_bool
  2058. self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
  2059. self.lib.carla_rename_plugin.restype = c_bool
  2060. self.lib.carla_clone_plugin.argtypes = [c_uint]
  2061. self.lib.carla_clone_plugin.restype = c_bool
  2062. self.lib.carla_replace_plugin.argtypes = [c_uint]
  2063. self.lib.carla_replace_plugin.restype = c_bool
  2064. self.lib.carla_switch_plugins.argtypes = [c_uint, c_uint]
  2065. self.lib.carla_switch_plugins.restype = c_bool
  2066. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  2067. self.lib.carla_load_plugin_state.restype = c_bool
  2068. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  2069. self.lib.carla_save_plugin_state.restype = c_bool
  2070. self.lib.carla_export_plugin_lv2.argtypes = [c_uint, c_char_p]
  2071. self.lib.carla_export_plugin_lv2.restype = c_bool
  2072. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  2073. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  2074. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  2075. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  2076. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  2077. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  2078. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  2079. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  2080. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  2081. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  2082. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  2083. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  2084. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  2085. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  2086. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  2087. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  2088. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  2089. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  2090. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  2091. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  2092. self.lib.carla_get_custom_data_value.argtypes = [c_uint, c_char_p, c_char_p]
  2093. self.lib.carla_get_custom_data_value.restype = c_char_p
  2094. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  2095. self.lib.carla_get_chunk_data.restype = c_char_p
  2096. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  2097. self.lib.carla_get_parameter_count.restype = c_uint32
  2098. self.lib.carla_get_program_count.argtypes = [c_uint]
  2099. self.lib.carla_get_program_count.restype = c_uint32
  2100. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  2101. self.lib.carla_get_midi_program_count.restype = c_uint32
  2102. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  2103. self.lib.carla_get_custom_data_count.restype = c_uint32
  2104. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
  2105. self.lib.carla_get_parameter_text.restype = c_char_p
  2106. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  2107. self.lib.carla_get_program_name.restype = c_char_p
  2108. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  2109. self.lib.carla_get_midi_program_name.restype = c_char_p
  2110. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  2111. self.lib.carla_get_real_plugin_name.restype = c_char_p
  2112. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  2113. self.lib.carla_get_current_program_index.restype = c_int32
  2114. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  2115. self.lib.carla_get_current_midi_program_index.restype = c_int32
  2116. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  2117. self.lib.carla_get_default_parameter_value.restype = c_float
  2118. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  2119. self.lib.carla_get_current_parameter_value.restype = c_float
  2120. self.lib.carla_get_internal_parameter_value.argtypes = [c_uint, c_int32]
  2121. self.lib.carla_get_internal_parameter_value.restype = c_float
  2122. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_bool]
  2123. self.lib.carla_get_input_peak_value.restype = c_float
  2124. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_bool]
  2125. self.lib.carla_get_output_peak_value.restype = c_float
  2126. self.lib.carla_render_inline_display.argtypes = [c_uint, c_uint, c_uint]
  2127. self.lib.carla_render_inline_display.restype = POINTER(CarlaInlineDisplayImageSurface)
  2128. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  2129. self.lib.carla_set_option.restype = None
  2130. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  2131. self.lib.carla_set_active.restype = None
  2132. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  2133. self.lib.carla_set_drywet.restype = None
  2134. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  2135. self.lib.carla_set_volume.restype = None
  2136. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  2137. self.lib.carla_set_balance_left.restype = None
  2138. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  2139. self.lib.carla_set_balance_right.restype = None
  2140. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  2141. self.lib.carla_set_panning.restype = None
  2142. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  2143. self.lib.carla_set_ctrl_channel.restype = None
  2144. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  2145. self.lib.carla_set_parameter_value.restype = None
  2146. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  2147. self.lib.carla_set_parameter_midi_channel.restype = None
  2148. self.lib.carla_set_parameter_mapped_control_index.argtypes = [c_uint, c_uint32, c_int16]
  2149. self.lib.carla_set_parameter_mapped_control_index.restype = None
  2150. self.lib.carla_set_parameter_mapped_range.argtypes = [c_uint, c_uint32, c_float, c_float]
  2151. self.lib.carla_set_parameter_mapped_range.restype = None
  2152. self.lib.carla_set_parameter_touch.argtypes = [c_uint, c_uint32, c_bool]
  2153. self.lib.carla_set_parameter_touch.restype = None
  2154. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  2155. self.lib.carla_set_program.restype = None
  2156. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  2157. self.lib.carla_set_midi_program.restype = None
  2158. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  2159. self.lib.carla_set_custom_data.restype = None
  2160. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  2161. self.lib.carla_set_chunk_data.restype = None
  2162. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  2163. self.lib.carla_prepare_for_save.restype = None
  2164. self.lib.carla_reset_parameters.argtypes = [c_uint]
  2165. self.lib.carla_reset_parameters.restype = None
  2166. self.lib.carla_randomize_parameters.argtypes = [c_uint]
  2167. self.lib.carla_randomize_parameters.restype = None
  2168. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  2169. self.lib.carla_send_midi_note.restype = None
  2170. self.lib.carla_show_custom_ui.argtypes = [c_uint, c_bool]
  2171. self.lib.carla_show_custom_ui.restype = None
  2172. self.lib.carla_get_buffer_size.argtypes = None
  2173. self.lib.carla_get_buffer_size.restype = c_uint32
  2174. self.lib.carla_get_sample_rate.argtypes = None
  2175. self.lib.carla_get_sample_rate.restype = c_double
  2176. self.lib.carla_get_last_error.argtypes = None
  2177. self.lib.carla_get_last_error.restype = c_char_p
  2178. self.lib.carla_get_host_osc_url_tcp.argtypes = None
  2179. self.lib.carla_get_host_osc_url_tcp.restype = c_char_p
  2180. self.lib.carla_get_host_osc_url_udp.argtypes = None
  2181. self.lib.carla_get_host_osc_url_udp.restype = c_char_p
  2182. self.lib.carla_nsm_init.argtypes = [c_uint64, c_char_p]
  2183. self.lib.carla_nsm_init.restype = c_bool
  2184. self.lib.carla_nsm_ready.argtypes = [c_int]
  2185. self.lib.carla_nsm_ready.restype = None
  2186. # --------------------------------------------------------------------------------------------------------
  2187. def get_engine_driver_count(self):
  2188. return int(self.lib.carla_get_engine_driver_count())
  2189. def get_engine_driver_name(self, index):
  2190. return charPtrToString(self.lib.carla_get_engine_driver_name(index))
  2191. def get_engine_driver_device_names(self, index):
  2192. return charPtrPtrToStringList(self.lib.carla_get_engine_driver_device_names(index))
  2193. def get_engine_driver_device_info(self, index, name):
  2194. return structToDict(self.lib.carla_get_engine_driver_device_info(index, name.encode("utf-8")).contents)
  2195. def show_engine_driver_device_control_panel(self, index, name):
  2196. return bool(self.lib.carla_show_engine_driver_device_control_panel(index, name.encode("utf-8")))
  2197. def engine_init(self, driverName, clientName):
  2198. return bool(self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8")))
  2199. def engine_close(self):
  2200. return bool(self.lib.carla_engine_close())
  2201. def engine_idle(self):
  2202. self.lib.carla_engine_idle()
  2203. def is_engine_running(self):
  2204. return bool(self.lib.carla_is_engine_running())
  2205. def get_runtime_engine_info(self):
  2206. return structToDict(self.lib.carla_get_runtime_engine_info().contents)
  2207. def get_runtime_engine_driver_device_info(self):
  2208. return structToDict(self.lib.carla_get_runtime_engine_driver_device_info().contents)
  2209. def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
  2210. return bool(self.lib.carla_set_engine_buffer_size_and_sample_rate(bufferSize, sampleRate))
  2211. def show_engine_device_control_panel(self):
  2212. return bool(self.lib.carla_show_engine_device_control_panel())
  2213. def clear_engine_xruns(self):
  2214. self.lib.carla_clear_engine_xruns()
  2215. def cancel_engine_action(self):
  2216. self.lib.carla_cancel_engine_action()
  2217. def set_engine_about_to_close(self):
  2218. return bool(self.lib.carla_set_engine_about_to_close())
  2219. def set_engine_callback(self, func):
  2220. self._engineCallback = EngineCallbackFunc(func)
  2221. self.lib.carla_set_engine_callback(self._engineCallback, None)
  2222. def set_engine_option(self, option, value, valueStr):
  2223. self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
  2224. def set_file_callback(self, func):
  2225. self._fileCallback = FileCallbackFunc(func)
  2226. self.lib.carla_set_file_callback(self._fileCallback, None)
  2227. def load_file(self, filename):
  2228. return bool(self.lib.carla_load_file(filename.encode("utf-8")))
  2229. def load_project(self, filename):
  2230. return bool(self.lib.carla_load_project(filename.encode("utf-8")))
  2231. def save_project(self, filename):
  2232. return bool(self.lib.carla_save_project(filename.encode("utf-8")))
  2233. def clear_project_filename(self):
  2234. self.lib.carla_clear_project_filename()
  2235. def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
  2236. return bool(self.lib.carla_patchbay_connect(external, groupIdA, portIdA, groupIdB, portIdB))
  2237. def patchbay_disconnect(self, external, connectionId):
  2238. return bool(self.lib.carla_patchbay_disconnect(external, connectionId))
  2239. def patchbay_refresh(self, external):
  2240. return bool(self.lib.carla_patchbay_refresh(external))
  2241. def transport_play(self):
  2242. self.lib.carla_transport_play()
  2243. def transport_pause(self):
  2244. self.lib.carla_transport_pause()
  2245. def transport_bpm(self, bpm):
  2246. self.lib.carla_transport_bpm(bpm)
  2247. def transport_relocate(self, frame):
  2248. self.lib.carla_transport_relocate(frame)
  2249. def get_current_transport_frame(self):
  2250. return int(self.lib.carla_get_current_transport_frame())
  2251. def get_transport_info(self):
  2252. return structToDict(self.lib.carla_get_transport_info().contents)
  2253. def get_current_plugin_count(self):
  2254. return int(self.lib.carla_get_current_plugin_count())
  2255. def get_max_plugin_number(self):
  2256. return int(self.lib.carla_get_max_plugin_number())
  2257. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  2258. cfilename = filename.encode("utf-8") if filename else None
  2259. cname = name.encode("utf-8") if name else None
  2260. clabel = label.encode("utf-8") if label else None
  2261. return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p), options))
  2262. def remove_plugin(self, pluginId):
  2263. return bool(self.lib.carla_remove_plugin(pluginId))
  2264. def remove_all_plugins(self):
  2265. return bool(self.lib.carla_remove_all_plugins())
  2266. def rename_plugin(self, pluginId, newName):
  2267. return bool(self.lib.carla_rename_plugin(pluginId, newName.encode("utf-8")))
  2268. def clone_plugin(self, pluginId):
  2269. return bool(self.lib.carla_clone_plugin(pluginId))
  2270. def replace_plugin(self, pluginId):
  2271. return bool(self.lib.carla_replace_plugin(pluginId))
  2272. def switch_plugins(self, pluginIdA, pluginIdB):
  2273. return bool(self.lib.carla_switch_plugins(pluginIdA, pluginIdB))
  2274. def load_plugin_state(self, pluginId, filename):
  2275. return bool(self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8")))
  2276. def save_plugin_state(self, pluginId, filename):
  2277. return bool(self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8")))
  2278. def export_plugin_lv2(self, pluginId, lv2path):
  2279. return bool(self.lib.carla_export_plugin_lv2(pluginId, lv2path.encode("utf-8")))
  2280. def get_plugin_info(self, pluginId):
  2281. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  2282. def get_audio_port_count_info(self, pluginId):
  2283. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  2284. def get_midi_port_count_info(self, pluginId):
  2285. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  2286. def get_parameter_count_info(self, pluginId):
  2287. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  2288. def get_parameter_info(self, pluginId, parameterId):
  2289. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  2290. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  2291. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  2292. def get_parameter_data(self, pluginId, parameterId):
  2293. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  2294. def get_parameter_ranges(self, pluginId, parameterId):
  2295. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  2296. def get_midi_program_data(self, pluginId, midiProgramId):
  2297. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  2298. def get_custom_data(self, pluginId, customDataId):
  2299. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  2300. def get_custom_data_value(self, pluginId, type_, key):
  2301. return charPtrToString(self.lib.carla_get_custom_data_value(pluginId, type_.encode("utf-8"), key.encode("utf-8")))
  2302. def get_chunk_data(self, pluginId):
  2303. return charPtrToString(self.lib.carla_get_chunk_data(pluginId))
  2304. def get_parameter_count(self, pluginId):
  2305. return int(self.lib.carla_get_parameter_count(pluginId))
  2306. def get_program_count(self, pluginId):
  2307. return int(self.lib.carla_get_program_count(pluginId))
  2308. def get_midi_program_count(self, pluginId):
  2309. return int(self.lib.carla_get_midi_program_count(pluginId))
  2310. def get_custom_data_count(self, pluginId):
  2311. return int(self.lib.carla_get_custom_data_count(pluginId))
  2312. def get_parameter_text(self, pluginId, parameterId):
  2313. return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId))
  2314. def get_program_name(self, pluginId, programId):
  2315. return charPtrToString(self.lib.carla_get_program_name(pluginId, programId))
  2316. def get_midi_program_name(self, pluginId, midiProgramId):
  2317. return charPtrToString(self.lib.carla_get_midi_program_name(pluginId, midiProgramId))
  2318. def get_real_plugin_name(self, pluginId):
  2319. return charPtrToString(self.lib.carla_get_real_plugin_name(pluginId))
  2320. def get_current_program_index(self, pluginId):
  2321. return int(self.lib.carla_get_current_program_index(pluginId))
  2322. def get_current_midi_program_index(self, pluginId):
  2323. return int(self.lib.carla_get_current_midi_program_index(pluginId))
  2324. def get_default_parameter_value(self, pluginId, parameterId):
  2325. return float(self.lib.carla_get_default_parameter_value(pluginId, parameterId))
  2326. def get_current_parameter_value(self, pluginId, parameterId):
  2327. return float(self.lib.carla_get_current_parameter_value(pluginId, parameterId))
  2328. def get_internal_parameter_value(self, pluginId, parameterId):
  2329. return float(self.lib.carla_get_internal_parameter_value(pluginId, parameterId))
  2330. def get_input_peak_value(self, pluginId, isLeft):
  2331. return float(self.lib.carla_get_input_peak_value(pluginId, isLeft))
  2332. def get_output_peak_value(self, pluginId, isLeft):
  2333. return float(self.lib.carla_get_output_peak_value(pluginId, isLeft))
  2334. def render_inline_display(self, pluginId, width, height):
  2335. ptr = self.lib.carla_render_inline_display(pluginId, width, height)
  2336. if not ptr or not ptr.contents:
  2337. return None
  2338. contents = ptr.contents
  2339. datalen = contents.height * contents.stride
  2340. databuf = tuple(contents.data[i] for i in range(datalen))
  2341. data = {
  2342. 'data': databuf,
  2343. 'width': contents.width,
  2344. 'height': contents.height,
  2345. 'stride': contents.stride,
  2346. }
  2347. return data
  2348. def set_option(self, pluginId, option, yesNo):
  2349. self.lib.carla_set_option(pluginId, option, yesNo)
  2350. def set_active(self, pluginId, onOff):
  2351. self.lib.carla_set_active(pluginId, onOff)
  2352. def set_drywet(self, pluginId, value):
  2353. self.lib.carla_set_drywet(pluginId, value)
  2354. def set_volume(self, pluginId, value):
  2355. self.lib.carla_set_volume(pluginId, value)
  2356. def set_balance_left(self, pluginId, value):
  2357. self.lib.carla_set_balance_left(pluginId, value)
  2358. def set_balance_right(self, pluginId, value):
  2359. self.lib.carla_set_balance_right(pluginId, value)
  2360. def set_panning(self, pluginId, value):
  2361. self.lib.carla_set_panning(pluginId, value)
  2362. def set_ctrl_channel(self, pluginId, channel):
  2363. self.lib.carla_set_ctrl_channel(pluginId, channel)
  2364. def set_parameter_value(self, pluginId, parameterId, value):
  2365. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  2366. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  2367. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  2368. def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
  2369. self.lib.carla_set_parameter_mapped_control_index(pluginId, parameterId, index)
  2370. def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
  2371. self.lib.carla_set_parameter_mapped_range(pluginId, parameterId, minimum, maximum)
  2372. def set_parameter_touch(self, pluginId, parameterId, touch):
  2373. self.lib.carla_set_parameter_touch(pluginId, parameterId, touch)
  2374. def set_program(self, pluginId, programId):
  2375. self.lib.carla_set_program(pluginId, programId)
  2376. def set_midi_program(self, pluginId, midiProgramId):
  2377. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  2378. def set_custom_data(self, pluginId, type_, key, value):
  2379. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  2380. def set_chunk_data(self, pluginId, chunkData):
  2381. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  2382. def prepare_for_save(self, pluginId):
  2383. self.lib.carla_prepare_for_save(pluginId)
  2384. def reset_parameters(self, pluginId):
  2385. self.lib.carla_reset_parameters(pluginId)
  2386. def randomize_parameters(self, pluginId):
  2387. self.lib.carla_randomize_parameters(pluginId)
  2388. def send_midi_note(self, pluginId, channel, note, velocity):
  2389. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  2390. def show_custom_ui(self, pluginId, yesNo):
  2391. self.lib.carla_show_custom_ui(pluginId, yesNo)
  2392. def get_buffer_size(self):
  2393. return int(self.lib.carla_get_buffer_size())
  2394. def get_sample_rate(self):
  2395. return float(self.lib.carla_get_sample_rate())
  2396. def get_last_error(self):
  2397. return charPtrToString(self.lib.carla_get_last_error())
  2398. def get_host_osc_url_tcp(self):
  2399. return charPtrToString(self.lib.carla_get_host_osc_url_tcp())
  2400. def get_host_osc_url_udp(self):
  2401. return charPtrToString(self.lib.carla_get_host_osc_url_udp())
  2402. def nsm_init(self, pid, executableName):
  2403. return bool(self.lib.carla_nsm_init(pid, executableName.encode("utf-8")))
  2404. def nsm_ready(self, opcode):
  2405. self.lib.carla_nsm_ready(opcode)
  2406. # ------------------------------------------------------------------------------------------------------------
  2407. # Helper object for CarlaHostPlugin
  2408. class PluginStoreInfo(object):
  2409. def __init__(self):
  2410. self.clear()
  2411. def clear(self):
  2412. self.pluginInfo = PyCarlaPluginInfo.copy()
  2413. self.pluginRealName = ""
  2414. self.internalValues = [0.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0]
  2415. self.audioCountInfo = PyCarlaPortCountInfo.copy()
  2416. self.midiCountInfo = PyCarlaPortCountInfo.copy()
  2417. self.parameterCount = 0
  2418. self.parameterCountInfo = PyCarlaPortCountInfo.copy()
  2419. self.parameterInfo = []
  2420. self.parameterData = []
  2421. self.parameterRanges = []
  2422. self.parameterValues = []
  2423. self.programCount = 0
  2424. self.programCurrent = -1
  2425. self.programNames = []
  2426. self.midiProgramCount = 0
  2427. self.midiProgramCurrent = -1
  2428. self.midiProgramData = []
  2429. self.customDataCount = 0
  2430. self.customData = []
  2431. self.peaks = [0.0, 0.0, 0.0, 0.0]
  2432. # ------------------------------------------------------------------------------------------------------------
  2433. # Carla Host object for plugins (using pipes)
  2434. class CarlaHostPlugin(CarlaHostMeta):
  2435. #class CarlaHostPlugin(CarlaHostMeta, metaclass=ABCMeta):
  2436. def __init__(self):
  2437. CarlaHostMeta.__init__(self)
  2438. # info about this host object
  2439. self.isPlugin = True
  2440. self.processModeForced = True
  2441. # text data to return when requested
  2442. self.fMaxPluginNumber = 0
  2443. self.fLastError = ""
  2444. # plugin info
  2445. self.fPluginsInfo = {}
  2446. self.fFallbackPluginInfo = PluginStoreInfo()
  2447. # runtime engine info
  2448. self.fRuntimeEngineInfo = {
  2449. "load": 0.0,
  2450. "xruns": 0
  2451. }
  2452. # transport info
  2453. self.fTransportInfo = {
  2454. "playing": False,
  2455. "frame": 0,
  2456. "bar": 0,
  2457. "beat": 0,
  2458. "tick": 0,
  2459. "bpm": 0.0
  2460. }
  2461. # some other vars
  2462. self.fBufferSize = 0
  2463. self.fSampleRate = 0.0
  2464. self.fOscTCP = ""
  2465. self.fOscUDP = ""
  2466. # --------------------------------------------------------------------------------------------------------
  2467. # Needs to be reimplemented
  2468. @abstractmethod
  2469. def sendMsg(self, lines):
  2470. raise NotImplementedError
  2471. # internal, sets error if sendMsg failed
  2472. def sendMsgAndSetError(self, lines):
  2473. if self.sendMsg(lines):
  2474. return True
  2475. self.fLastError = "Communication error with backend"
  2476. return False
  2477. # --------------------------------------------------------------------------------------------------------
  2478. def get_engine_driver_count(self):
  2479. return 1
  2480. def get_engine_driver_name(self, index):
  2481. return "Plugin"
  2482. def get_engine_driver_device_names(self, index):
  2483. return []
  2484. def get_engine_driver_device_info(self, index, name):
  2485. return PyEngineDriverDeviceInfo
  2486. def show_engine_driver_device_control_panel(self, index, name):
  2487. return False
  2488. def get_runtime_engine_info(self):
  2489. return self.fRuntimeEngineInfo
  2490. def get_runtime_engine_driver_device_info(self):
  2491. return PyCarlaRuntimeEngineDriverDeviceInfo
  2492. def set_engine_buffer_size_and_sample_rate(self, bufferSize, sampleRate):
  2493. return False
  2494. def show_engine_device_control_panel(self):
  2495. return False
  2496. def clear_engine_xruns(self):
  2497. self.sendMsg(["clear_engine_xruns"])
  2498. def cancel_engine_action(self):
  2499. self.sendMsg(["cancel_engine_action"])
  2500. def set_engine_callback(self, func):
  2501. return # TODO
  2502. def set_engine_option(self, option, value, valueStr):
  2503. self.sendMsg(["set_engine_option", option, int(value), valueStr])
  2504. def set_file_callback(self, func):
  2505. return # TODO
  2506. def load_file(self, filename):
  2507. return self.sendMsgAndSetError(["load_file", filename])
  2508. def load_project(self, filename):
  2509. return self.sendMsgAndSetError(["load_project", filename])
  2510. def save_project(self, filename):
  2511. return self.sendMsgAndSetError(["save_project", filename])
  2512. def clear_project_filename(self):
  2513. return self.sendMsgAndSetError(["clear_project_filename"])
  2514. def patchbay_connect(self, external, groupIdA, portIdA, groupIdB, portIdB):
  2515. return self.sendMsgAndSetError(["patchbay_connect", external, groupIdA, portIdA, groupIdB, portIdB])
  2516. def patchbay_disconnect(self, external, connectionId):
  2517. return self.sendMsgAndSetError(["patchbay_disconnect", external, connectionId])
  2518. def patchbay_refresh(self, external):
  2519. return self.sendMsgAndSetError(["patchbay_refresh", external])
  2520. def transport_play(self):
  2521. self.sendMsg(["transport_play"])
  2522. def transport_pause(self):
  2523. self.sendMsg(["transport_pause"])
  2524. def transport_bpm(self, bpm):
  2525. self.sendMsg(["transport_bpm", bpm])
  2526. def transport_relocate(self, frame):
  2527. self.sendMsg(["transport_relocate", frame])
  2528. def get_current_transport_frame(self):
  2529. return self.fTransportInfo['frame']
  2530. def get_transport_info(self):
  2531. return self.fTransportInfo
  2532. def get_current_plugin_count(self):
  2533. return len(self.fPluginsInfo)
  2534. def get_max_plugin_number(self):
  2535. return self.fMaxPluginNumber
  2536. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  2537. return self.sendMsgAndSetError(["add_plugin",
  2538. btype, ptype,
  2539. filename or "(null)",
  2540. name or "(null)",
  2541. label, uniqueId, options])
  2542. def remove_plugin(self, pluginId):
  2543. return self.sendMsgAndSetError(["remove_plugin", pluginId])
  2544. def remove_all_plugins(self):
  2545. return self.sendMsgAndSetError(["remove_all_plugins"])
  2546. def rename_plugin(self, pluginId, newName):
  2547. return self.sendMsgAndSetError(["rename_plugin", pluginId, newName])
  2548. def clone_plugin(self, pluginId):
  2549. return self.sendMsgAndSetError(["clone_plugin", pluginId])
  2550. def replace_plugin(self, pluginId):
  2551. return self.sendMsgAndSetError(["replace_plugin", pluginId])
  2552. def switch_plugins(self, pluginIdA, pluginIdB):
  2553. ret = self.sendMsgAndSetError(["switch_plugins", pluginIdA, pluginIdB])
  2554. if ret:
  2555. self._switchPlugins(pluginIdA, pluginIdB)
  2556. return ret
  2557. def load_plugin_state(self, pluginId, filename):
  2558. return self.sendMsgAndSetError(["load_plugin_state", pluginId, filename])
  2559. def save_plugin_state(self, pluginId, filename):
  2560. return self.sendMsgAndSetError(["save_plugin_state", pluginId, filename])
  2561. def export_plugin_lv2(self, pluginId, lv2path):
  2562. self.fLastError = "Operation unavailable in plugin version"
  2563. return False
  2564. def get_plugin_info(self, pluginId):
  2565. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).pluginInfo
  2566. def get_audio_port_count_info(self, pluginId):
  2567. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).audioCountInfo
  2568. def get_midi_port_count_info(self, pluginId):
  2569. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiCountInfo
  2570. def get_parameter_count_info(self, pluginId):
  2571. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterCountInfo
  2572. def get_parameter_info(self, pluginId, parameterId):
  2573. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterInfo[parameterId]
  2574. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  2575. return PyCarlaScalePointInfo
  2576. def get_parameter_data(self, pluginId, parameterId):
  2577. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterData[parameterId]
  2578. def get_parameter_ranges(self, pluginId, parameterId):
  2579. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterRanges[parameterId]
  2580. def get_midi_program_data(self, pluginId, midiProgramId):
  2581. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiProgramData[midiProgramId]
  2582. def get_custom_data(self, pluginId, customDataId):
  2583. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).customData[customDataId]
  2584. def get_custom_data_value(self, pluginId, type_, key):
  2585. plugin = self.fPluginsInfo.get(pluginId, None)
  2586. if plugin is None:
  2587. return ""
  2588. for customData in plugin.customData:
  2589. if customData['type'] == type_ and customData['key'] == key:
  2590. return customData['value']
  2591. return ""
  2592. def get_chunk_data(self, pluginId):
  2593. return ""
  2594. def get_parameter_count(self, pluginId):
  2595. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).parameterCount
  2596. def get_program_count(self, pluginId):
  2597. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).programCount
  2598. def get_midi_program_count(self, pluginId):
  2599. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiProgramCount
  2600. def get_custom_data_count(self, pluginId):
  2601. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).customDataCount
  2602. def get_parameter_text(self, pluginId, parameterId):
  2603. return ""
  2604. def get_program_name(self, pluginId, programId):
  2605. return self.fPluginsInfo[pluginId].programNames[programId]
  2606. def get_midi_program_name(self, pluginId, midiProgramId):
  2607. return self.fPluginsInfo[pluginId].midiProgramData[midiProgramId]['label']
  2608. def get_real_plugin_name(self, pluginId):
  2609. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).pluginRealName
  2610. def get_current_program_index(self, pluginId):
  2611. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).programCurrent
  2612. def get_current_midi_program_index(self, pluginId):
  2613. return self.fPluginsInfo.get(pluginId, self.fFallbackPluginInfo).midiProgramCurrent
  2614. def get_default_parameter_value(self, pluginId, parameterId):
  2615. return self.fPluginsInfo[pluginId].parameterRanges[parameterId]['def']
  2616. def get_current_parameter_value(self, pluginId, parameterId):
  2617. return self.fPluginsInfo[pluginId].parameterValues[parameterId]
  2618. def get_internal_parameter_value(self, pluginId, parameterId):
  2619. if parameterId == PARAMETER_NULL or parameterId <= PARAMETER_MAX:
  2620. return 0.0
  2621. if parameterId < 0:
  2622. return self.fPluginsInfo[pluginId].internalValues[abs(parameterId)-2]
  2623. return self.fPluginsInfo[pluginId].parameterValues[parameterId]
  2624. def get_input_peak_value(self, pluginId, isLeft):
  2625. return self.fPluginsInfo[pluginId].peaks[0 if isLeft else 1]
  2626. def get_output_peak_value(self, pluginId, isLeft):
  2627. return self.fPluginsInfo[pluginId].peaks[2 if isLeft else 3]
  2628. def render_inline_display(self, pluginId, width, height):
  2629. return None
  2630. def set_option(self, pluginId, option, yesNo):
  2631. self.sendMsg(["set_option", pluginId, option, yesNo])
  2632. def set_active(self, pluginId, onOff):
  2633. self.sendMsg(["set_active", pluginId, onOff])
  2634. self.fPluginsInfo[pluginId].internalValues[0] = 1.0 if onOff else 0.0
  2635. def set_drywet(self, pluginId, value):
  2636. self.sendMsg(["set_drywet", pluginId, value])
  2637. self.fPluginsInfo[pluginId].internalValues[1] = value
  2638. def set_volume(self, pluginId, value):
  2639. self.sendMsg(["set_volume", pluginId, value])
  2640. self.fPluginsInfo[pluginId].internalValues[2] = value
  2641. def set_balance_left(self, pluginId, value):
  2642. self.sendMsg(["set_balance_left", pluginId, value])
  2643. self.fPluginsInfo[pluginId].internalValues[3] = value
  2644. def set_balance_right(self, pluginId, value):
  2645. self.sendMsg(["set_balance_right", pluginId, value])
  2646. self.fPluginsInfo[pluginId].internalValues[4] = value
  2647. def set_panning(self, pluginId, value):
  2648. self.sendMsg(["set_panning", pluginId, value])
  2649. self.fPluginsInfo[pluginId].internalValues[5] = value
  2650. def set_ctrl_channel(self, pluginId, channel):
  2651. self.sendMsg(["set_ctrl_channel", pluginId, channel])
  2652. self.fPluginsInfo[pluginId].internalValues[6] = float(channel)
  2653. def set_parameter_value(self, pluginId, parameterId, value):
  2654. self.sendMsg(["set_parameter_value", pluginId, parameterId, value])
  2655. self.fPluginsInfo[pluginId].parameterValues[parameterId] = value
  2656. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  2657. self.sendMsg(["set_parameter_midi_channel", pluginId, parameterId, channel])
  2658. self.fPluginsInfo[pluginId].parameterData[parameterId]['midiChannel'] = channel
  2659. def set_parameter_mapped_control_index(self, pluginId, parameterId, index):
  2660. self.sendMsg(["set_parameter_mapped_control_index", pluginId, parameterId, index])
  2661. self.fPluginsInfo[pluginId].parameterData[parameterId]['mappedControlIndex'] = index
  2662. def set_parameter_mapped_range(self, pluginId, parameterId, minimum, maximum):
  2663. self.sendMsg(["set_parameter_mapped_range", pluginId, parameterId, minimum, maximum])
  2664. self.fPluginsInfo[pluginId].parameterData[parameterId]['mappedMinimum'] = minimum
  2665. self.fPluginsInfo[pluginId].parameterData[parameterId]['mappedMaximum'] = maximum
  2666. def set_parameter_touch(self, pluginId, parameterId, touch):
  2667. self.sendMsg(["set_parameter_touch", pluginId, parameterId, touch])
  2668. def set_program(self, pluginId, programId):
  2669. self.sendMsg(["set_program", pluginId, programId])
  2670. self.fPluginsInfo[pluginId].programCurrent = programId
  2671. def set_midi_program(self, pluginId, midiProgramId):
  2672. self.sendMsg(["set_midi_program", pluginId, midiProgramId])
  2673. self.fPluginsInfo[pluginId].midiProgramCurrent = midiProgramId
  2674. def set_custom_data(self, pluginId, type_, key, value):
  2675. self.sendMsg(["set_custom_data", pluginId, type_, key, value])
  2676. for cdata in self.fPluginsInfo[pluginId].customData:
  2677. if cdata['type'] != type_:
  2678. continue
  2679. if cdata['key'] != key:
  2680. continue
  2681. cdata['value'] = value
  2682. break
  2683. def set_chunk_data(self, pluginId, chunkData):
  2684. self.sendMsg(["set_chunk_data", pluginId, chunkData])
  2685. def prepare_for_save(self, pluginId):
  2686. self.sendMsg(["prepare_for_save", pluginId])
  2687. def reset_parameters(self, pluginId):
  2688. self.sendMsg(["reset_parameters", pluginId])
  2689. def randomize_parameters(self, pluginId):
  2690. self.sendMsg(["randomize_parameters", pluginId])
  2691. def send_midi_note(self, pluginId, channel, note, velocity):
  2692. self.sendMsg(["send_midi_note", pluginId, channel, note, velocity])
  2693. def show_custom_ui(self, pluginId, yesNo):
  2694. self.sendMsg(["show_custom_ui", pluginId, yesNo])
  2695. def get_buffer_size(self):
  2696. return self.fBufferSize
  2697. def get_sample_rate(self):
  2698. return self.fSampleRate
  2699. def get_last_error(self):
  2700. return self.fLastError
  2701. def get_host_osc_url_tcp(self):
  2702. return self.fOscTCP
  2703. def get_host_osc_url_udp(self):
  2704. return self.fOscUDP
  2705. # --------------------------------------------------------------------------------------------------------
  2706. def _set_runtime_info(self, load, xruns):
  2707. self.fRuntimeEngineInfo = {
  2708. "load": load,
  2709. "xruns": xruns
  2710. }
  2711. def _set_transport(self, playing, frame, bar, beat, tick, bpm):
  2712. self.fTransportInfo = {
  2713. "playing": playing,
  2714. "frame": frame,
  2715. "bar": bar,
  2716. "beat": beat,
  2717. "tick": tick,
  2718. "bpm": bpm
  2719. }
  2720. def _add(self, pluginId):
  2721. self.fPluginsInfo[pluginId] = PluginStoreInfo()
  2722. def _allocateAsNeeded(self, pluginId):
  2723. if pluginId < len(self.fPluginsInfo):
  2724. return
  2725. for id in range(len(self.fPluginsInfo), pluginId+1):
  2726. self.fPluginsInfo[id] = PluginStoreInfo()
  2727. def _set_pluginInfo(self, pluginId, info):
  2728. plugin = self.fPluginsInfo.get(pluginId, None)
  2729. if plugin is None:
  2730. print("_set_pluginInfo failed for", pluginId)
  2731. return
  2732. plugin.pluginInfo = info
  2733. def _set_pluginInfoUpdate(self, pluginId, info):
  2734. plugin = self.fPluginsInfo.get(pluginId, None)
  2735. if plugin is None:
  2736. print("_set_pluginInfoUpdate failed for", pluginId)
  2737. return
  2738. plugin.pluginInfo.update(info)
  2739. def _set_pluginName(self, pluginId, name):
  2740. plugin = self.fPluginsInfo.get(pluginId, None)
  2741. if plugin is None:
  2742. print("_set_pluginName failed for", pluginId)
  2743. return
  2744. plugin.pluginInfo['name'] = name
  2745. def _set_pluginRealName(self, pluginId, realName):
  2746. plugin = self.fPluginsInfo.get(pluginId, None)
  2747. if plugin is None:
  2748. print("_set_pluginRealName failed for", pluginId)
  2749. return
  2750. plugin.pluginRealName = realName
  2751. def _set_internalValue(self, pluginId, paramIndex, value):
  2752. pluginInfo = self.fPluginsInfo.get(pluginId, None)
  2753. if pluginInfo is None:
  2754. print("_set_internalValue failed for", pluginId)
  2755. return
  2756. if PARAMETER_NULL > paramIndex > PARAMETER_MAX:
  2757. pluginInfo.internalValues[abs(paramIndex)-2] = float(value)
  2758. else:
  2759. print("_set_internalValue failed for", pluginId, "with param", paramIndex)
  2760. def _set_audioCountInfo(self, pluginId, info):
  2761. plugin = self.fPluginsInfo.get(pluginId, None)
  2762. if plugin is None:
  2763. print("_set_audioCountInfo failed for", pluginId)
  2764. return
  2765. plugin.audioCountInfo = info
  2766. def _set_midiCountInfo(self, pluginId, info):
  2767. plugin = self.fPluginsInfo.get(pluginId, None)
  2768. if plugin is None:
  2769. print("_set_midiCountInfo failed for", pluginId)
  2770. return
  2771. plugin.midiCountInfo = info
  2772. def _set_parameterCountInfo(self, pluginId, count, info):
  2773. plugin = self.fPluginsInfo.get(pluginId, None)
  2774. if plugin is None:
  2775. print("_set_parameterCountInfo failed for", pluginId)
  2776. return
  2777. plugin.parameterCount = count
  2778. plugin.parameterCountInfo = info
  2779. # clear
  2780. plugin.parameterInfo = []
  2781. plugin.parameterData = []
  2782. plugin.parameterRanges = []
  2783. plugin.parameterValues = []
  2784. # add placeholders
  2785. for x in range(count):
  2786. plugin.parameterInfo.append(PyCarlaParameterInfo.copy())
  2787. plugin.parameterData.append(PyParameterData.copy())
  2788. plugin.parameterRanges.append(PyParameterRanges.copy())
  2789. plugin.parameterValues.append(0.0)
  2790. def _set_programCount(self, pluginId, count):
  2791. plugin = self.fPluginsInfo.get(pluginId, None)
  2792. if plugin is None:
  2793. print("_set_internalValue failed for", pluginId)
  2794. return
  2795. plugin.programCount = count
  2796. plugin.programNames = ["" for x in range(count)]
  2797. def _set_midiProgramCount(self, pluginId, count):
  2798. plugin = self.fPluginsInfo.get(pluginId, None)
  2799. if plugin is None:
  2800. print("_set_internalValue failed for", pluginId)
  2801. return
  2802. plugin.midiProgramCount = count
  2803. plugin.midiProgramData = [PyMidiProgramData.copy() for x in range(count)]
  2804. def _set_customDataCount(self, pluginId, count):
  2805. plugin = self.fPluginsInfo.get(pluginId, None)
  2806. if plugin is None:
  2807. print("_set_internalValue failed for", pluginId)
  2808. return
  2809. plugin.customDataCount = count
  2810. plugin.customData = [PyCustomData.copy() for x in range(count)]
  2811. def _set_parameterInfo(self, pluginId, paramIndex, info):
  2812. plugin = self.fPluginsInfo.get(pluginId, None)
  2813. if plugin is None:
  2814. print("_set_parameterInfo failed for", pluginId)
  2815. return
  2816. if paramIndex < plugin.parameterCount:
  2817. plugin.parameterInfo[paramIndex] = info
  2818. else:
  2819. print("_set_parameterInfo failed for", pluginId, "and index", paramIndex)
  2820. def _set_parameterData(self, pluginId, paramIndex, data):
  2821. plugin = self.fPluginsInfo.get(pluginId, None)
  2822. if plugin is None:
  2823. print("_set_parameterData failed for", pluginId)
  2824. return
  2825. if paramIndex < plugin.parameterCount:
  2826. plugin.parameterData[paramIndex] = data
  2827. else:
  2828. print("_set_parameterData failed for", pluginId, "and index", paramIndex)
  2829. def _set_parameterRanges(self, pluginId, paramIndex, ranges):
  2830. plugin = self.fPluginsInfo.get(pluginId, None)
  2831. if plugin is None:
  2832. print("_set_parameterRanges failed for", pluginId)
  2833. return
  2834. if paramIndex < plugin.parameterCount:
  2835. plugin.parameterRanges[paramIndex] = ranges
  2836. else:
  2837. print("_set_parameterRanges failed for", pluginId, "and index", paramIndex)
  2838. def _set_parameterRangesUpdate(self, pluginId, paramIndex, ranges):
  2839. plugin = self.fPluginsInfo.get(pluginId, None)
  2840. if plugin is None:
  2841. print("_set_parameterRangesUpdate failed for", pluginId)
  2842. return
  2843. if paramIndex < plugin.parameterCount:
  2844. plugin.parameterRanges[paramIndex].update(ranges)
  2845. else:
  2846. print("_set_parameterRangesUpdate failed for", pluginId, "and index", paramIndex)
  2847. def _set_parameterValue(self, pluginId, paramIndex, value):
  2848. plugin = self.fPluginsInfo.get(pluginId, None)
  2849. if plugin is None:
  2850. print("_set_parameterValue failed for", pluginId)
  2851. return
  2852. if paramIndex < plugin.parameterCount:
  2853. plugin.parameterValues[paramIndex] = value
  2854. else:
  2855. print("_set_parameterValue failed for", pluginId, "and index", paramIndex)
  2856. def _set_parameterDefault(self, pluginId, paramIndex, value):
  2857. plugin = self.fPluginsInfo.get(pluginId, None)
  2858. if plugin is None:
  2859. print("_set_parameterDefault failed for", pluginId)
  2860. return
  2861. if paramIndex < plugin.parameterCount:
  2862. plugin.parameterRanges[paramIndex]['def'] = value
  2863. else:
  2864. print("_set_parameterDefault failed for", pluginId, "and index", paramIndex)
  2865. def _set_parameterMappedControlIndex(self, pluginId, paramIndex, index):
  2866. plugin = self.fPluginsInfo.get(pluginId, None)
  2867. if plugin is None:
  2868. print("_set_parameterMappedControlIndex failed for", pluginId)
  2869. return
  2870. if paramIndex < plugin.parameterCount:
  2871. plugin.parameterData[paramIndex]['mappedControlIndex'] = index
  2872. else:
  2873. print("_set_parameterMappedControlIndex failed for", pluginId, "and index", paramIndex)
  2874. def _set_parameterMappedRange(self, pluginId, paramIndex, minimum, maximum):
  2875. plugin = self.fPluginsInfo.get(pluginId, None)
  2876. if plugin is None:
  2877. print("_set_parameterMappedRange failed for", pluginId)
  2878. return
  2879. if paramIndex < plugin.parameterCount:
  2880. plugin.parameterData[paramIndex]['mappedMinimum'] = minimum
  2881. plugin.parameterData[paramIndex]['mappedMaximum'] = maximum
  2882. else:
  2883. print("_set_parameterMappedRange failed for", pluginId, "and index", paramIndex)
  2884. def _set_parameterMidiChannel(self, pluginId, paramIndex, channel):
  2885. plugin = self.fPluginsInfo.get(pluginId, None)
  2886. if plugin is None:
  2887. print("_set_parameterMidiChannel failed for", pluginId)
  2888. return
  2889. if paramIndex < plugin.parameterCount:
  2890. plugin.parameterData[paramIndex]['midiChannel'] = channel
  2891. else:
  2892. print("_set_parameterMidiChannel failed for", pluginId, "and index", paramIndex)
  2893. def _set_currentProgram(self, pluginId, pIndex):
  2894. plugin = self.fPluginsInfo.get(pluginId, None)
  2895. if plugin is None:
  2896. print("_set_currentProgram failed for", pluginId)
  2897. return
  2898. plugin.programCurrent = pIndex
  2899. def _set_currentMidiProgram(self, pluginId, mpIndex):
  2900. plugin = self.fPluginsInfo.get(pluginId, None)
  2901. if plugin is None:
  2902. print("_set_currentMidiProgram failed for", pluginId)
  2903. return
  2904. plugin.midiProgramCurrent = mpIndex
  2905. def _set_programName(self, pluginId, pIndex, name):
  2906. plugin = self.fPluginsInfo.get(pluginId, None)
  2907. if plugin is None:
  2908. print("_set_programName failed for", pluginId)
  2909. return
  2910. if pIndex < plugin.programCount:
  2911. plugin.programNames[pIndex] = name
  2912. else:
  2913. print("_set_programName failed for", pluginId, "and index", pIndex)
  2914. def _set_midiProgramData(self, pluginId, mpIndex, data):
  2915. plugin = self.fPluginsInfo.get(pluginId, None)
  2916. if plugin is None:
  2917. print("_set_midiProgramData failed for", pluginId)
  2918. return
  2919. if mpIndex < plugin.midiProgramCount:
  2920. plugin.midiProgramData[mpIndex] = data
  2921. else:
  2922. print("_set_midiProgramData failed for", pluginId, "and index", mpIndex)
  2923. def _set_customData(self, pluginId, cdIndex, data):
  2924. plugin = self.fPluginsInfo.get(pluginId, None)
  2925. if plugin is None:
  2926. print("_set_customData failed for", pluginId)
  2927. return
  2928. if cdIndex < plugin.customDataCount:
  2929. plugin.customData[cdIndex] = data
  2930. else:
  2931. print("_set_customData failed for", pluginId, "and index", cdIndex)
  2932. def _set_peaks(self, pluginId, in1, in2, out1, out2):
  2933. pluginInfo = self.fPluginsInfo.get(pluginId, None)
  2934. if pluginInfo is not None:
  2935. pluginInfo.peaks = [in1, in2, out1, out2]
  2936. def _switchPlugins(self, pluginIdA, pluginIdB):
  2937. tmp = self.fPluginsInfo[pluginIdA]
  2938. self.fPluginsInfo[pluginIdA] = self.fPluginsInfo[pluginIdB]
  2939. self.fPluginsInfo[pluginIdB] = tmp
  2940. def _setViaCallback(self, action, pluginId, value1, value2, value3, valuef, valueStr):
  2941. if action == ENGINE_CALLBACK_ENGINE_STARTED:
  2942. self._allocateAsNeeded(pluginId)
  2943. self.fBufferSize = value3
  2944. self.fSampleRate = valuef
  2945. elif ENGINE_CALLBACK_BUFFER_SIZE_CHANGED:
  2946. self.fBufferSize = value1
  2947. elif ENGINE_CALLBACK_SAMPLE_RATE_CHANGED:
  2948. self.fSampleRate = valuef
  2949. elif action == ENGINE_CALLBACK_PLUGIN_RENAMED:
  2950. self._set_pluginName(pluginId, valueStr)
  2951. elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED:
  2952. if value1 < 0:
  2953. self._set_internalValue(pluginId, value1, valuef)
  2954. else:
  2955. self._set_parameterValue(pluginId, value1, valuef)
  2956. elif action == ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED:
  2957. self._set_parameterDefault(pluginId, value1, valuef)
  2958. elif action == ENGINE_CALLBACK_PARAMETER_MAPPED_CONTROL_INDEX_CHANGED:
  2959. self._set_parameterMappedControlIndex(pluginId, value1, value2)
  2960. elif action == ENGINE_CALLBACK_PARAMETER_MAPPED_RANGE_CHANGED:
  2961. minimum, maximum = (float(i) for i in valueStr.split(":"))
  2962. self._set_parameterMappedRange(pluginId, value1, minimum, maximum)
  2963. elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED:
  2964. self._set_parameterMidiChannel(pluginId, value1, value2)
  2965. elif action == ENGINE_CALLBACK_PROGRAM_CHANGED:
  2966. self._set_currentProgram(pluginId, value1)
  2967. elif action == ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED:
  2968. self._set_currentMidiProgram(pluginId, value1)
  2969. # ------------------------------------------------------------------------------------------------------------