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.

3292 lines
103KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla Backend code
  4. # Copyright (C) 2011-2014 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 (Config)
  19. from carla_config import *
  20. # ------------------------------------------------------------------------------------------------------------
  21. # Imports (Global)
  22. from abc import ABCMeta, abstractmethod
  23. from ctypes import *
  24. from os import environ
  25. from platform import architecture
  26. from sys import platform, maxsize
  27. if config_UseQt5:
  28. from PyQt5.QtCore import pyqtSignal, pyqtWrapperType, QObject
  29. else:
  30. from PyQt4.QtCore import pyqtSignal, pyqtWrapperType, QObject
  31. # ------------------------------------------------------------------------------------------------------------
  32. # 64bit check
  33. kIs64bit = bool(architecture()[0] == "64bit" and maxsize > 2**32)
  34. # ------------------------------------------------------------------------------------------------------------
  35. # Define custom types
  36. c_enum = c_int
  37. c_uintptr = c_uint64 if kIs64bit else c_uint32
  38. # ------------------------------------------------------------------------------------------------------------
  39. # Set Platform
  40. if platform == "darwin":
  41. HAIKU = False
  42. LINUX = False
  43. MACOS = True
  44. WINDOWS = False
  45. elif "haiku" in platform:
  46. HAIKU = True
  47. LINUX = False
  48. MACOS = False
  49. WINDOWS = False
  50. elif "linux" in platform:
  51. HAIKU = False
  52. LINUX = True
  53. MACOS = False
  54. WINDOWS = False
  55. elif platform in ("win32", "win64", "cygwin"):
  56. HAIKU = False
  57. LINUX = False
  58. MACOS = False
  59. WINDOWS = True
  60. else:
  61. HAIKU = False
  62. LINUX = False
  63. MACOS = False
  64. WINDOWS = False
  65. # ------------------------------------------------------------------------------------------------------------
  66. # Convert a ctypes c_char_p into a python string
  67. def charPtrToString(charPtr):
  68. if not charPtr:
  69. return ""
  70. if isinstance(charPtr, str):
  71. return charPtr
  72. return charPtr.decode("utf-8", errors="ignore")
  73. # ------------------------------------------------------------------------------------------------------------
  74. # Convert a ctypes POINTER(c_char_p) into a python string list
  75. def charPtrPtrToStringList(charPtrPtr):
  76. if not charPtrPtr:
  77. return []
  78. i = 0
  79. charPtr = charPtrPtr[0]
  80. strList = []
  81. while charPtr:
  82. strList.append(charPtr.decode("utf-8", errors="ignore"))
  83. i += 1
  84. charPtr = charPtrPtr[i]
  85. return strList
  86. # ------------------------------------------------------------------------------------------------------------
  87. # Convert a ctypes POINTER(c_<num>) into a python number list
  88. def numPtrToList(numPtr):
  89. if not numPtr:
  90. return []
  91. i = 0
  92. num = numPtr[0] #.value
  93. numList = []
  94. while num not in (0, 0.0):
  95. numList.append(num)
  96. i += 1
  97. num = numPtr[i] #.value
  98. return numList
  99. # ------------------------------------------------------------------------------------------------------------
  100. # Convert a ctypes value into a python one
  101. 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)
  102. c_float_types = (c_float, c_double, c_longdouble)
  103. c_intp_types = tuple(POINTER(i) for i in c_int_types)
  104. c_floatp_types = tuple(POINTER(i) for i in c_float_types)
  105. def toPythonType(value, attr):
  106. if isinstance(value, (bool, int, float)):
  107. return value
  108. if isinstance(value, bytes):
  109. return charPtrToString(value)
  110. if isinstance(value, c_intp_types) or isinstance(value, c_floatp_types):
  111. return numPtrToList(value)
  112. if isinstance(value, POINTER(c_char_p)):
  113. return charPtrPtrToStringList(value)
  114. print("..............", attr, ".....................", value, ":", type(value))
  115. return value
  116. # ------------------------------------------------------------------------------------------------------------
  117. # Convert a ctypes struct into a python dict
  118. def structToDict(struct):
  119. return dict((attr, toPythonType(getattr(struct, attr), attr)) for attr, value in struct._fields_)
  120. # ------------------------------------------------------------------------------------------------------------
  121. # Carla Backend API (base definitions)
  122. # Maximum default number of loadable plugins.
  123. MAX_DEFAULT_PLUGINS = 99
  124. # Maximum number of loadable plugins in rack mode.
  125. MAX_RACK_PLUGINS = 16
  126. # Maximum number of loadable plugins in patchbay mode.
  127. MAX_PATCHBAY_PLUGINS = 255
  128. # Maximum default number of parameters allowed.
  129. # @see ENGINE_OPTION_MAX_PARAMETERS
  130. MAX_DEFAULT_PARAMETERS = 200
  131. # ------------------------------------------------------------------------------------------------------------
  132. # Engine Driver Device Hints
  133. # Various engine driver device hints.
  134. # @see carla_get_engine_driver_device_info()
  135. # Engine driver device has custom control-panel.
  136. ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1
  137. # Engine driver device can use a triple-buffer (3 number of periods instead of the usual 2).
  138. # @see ENGINE_OPTION_AUDIO_NUM_PERIODS
  139. ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2
  140. # Engine driver device can change buffer-size on the fly.
  141. # @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
  142. ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4
  143. # Engine driver device can change sample-rate on the fly.
  144. # @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
  145. ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8
  146. # ------------------------------------------------------------------------------------------------------------
  147. # Plugin Hints
  148. # Various plugin hints.
  149. # @see carla_get_plugin_info()
  150. # Plugin is a bridge.
  151. # This hint is required because "bridge" itself is not a plugin type.
  152. PLUGIN_IS_BRIDGE = 0x001
  153. # Plugin is hard real-time safe.
  154. PLUGIN_IS_RTSAFE = 0x002
  155. # Plugin is a synth (produces sound).
  156. PLUGIN_IS_SYNTH = 0x004
  157. # Plugin has its own custom UI.
  158. # @see carla_show_custom_ui()
  159. PLUGIN_HAS_CUSTOM_UI = 0x008
  160. # Plugin can use internal Dry/Wet control.
  161. PLUGIN_CAN_DRYWET = 0x010
  162. # Plugin can use internal Volume control.
  163. PLUGIN_CAN_VOLUME = 0x020
  164. # Plugin can use internal (Stereo) Balance controls.
  165. PLUGIN_CAN_BALANCE = 0x040
  166. # Plugin can use internal (Mono) Panning control.
  167. PLUGIN_CAN_PANNING = 0x080
  168. # Plugin needs a constant, fixed-size audio buffer.
  169. PLUGIN_NEEDS_FIXED_BUFFERS = 0x100
  170. # Plugin needs all UI events in a single/main thread.
  171. PLUGIN_NEEDS_SINGLE_THREAD = 0x200
  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. # ------------------------------------------------------------------------------------------------------------
  198. # Parameter Hints
  199. # Various parameter hints.
  200. # @see CarlaPlugin::getParameterData() and carla_get_parameter_data()
  201. # Parameter value is boolean.
  202. PARAMETER_IS_BOOLEAN = 0x001
  203. # Parameter value is integer.
  204. PARAMETER_IS_INTEGER = 0x002
  205. # Parameter value is logarithmic.
  206. PARAMETER_IS_LOGARITHMIC = 0x004
  207. # Parameter is enabled.
  208. # It can be viewed, changed and stored.
  209. PARAMETER_IS_ENABLED = 0x010
  210. # Parameter is automable (real-time safe).
  211. PARAMETER_IS_AUTOMABLE = 0x020
  212. # Parameter is read-only.
  213. # It cannot be changed.
  214. PARAMETER_IS_READ_ONLY = 0x040
  215. # Parameter needs sample rate to work.
  216. # Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
  217. PARAMETER_USES_SAMPLERATE = 0x100
  218. # Parameter uses scale points to define internal values in a meaningful way.
  219. PARAMETER_USES_SCALEPOINTS = 0x200
  220. # Parameter uses custom text for displaying its value.
  221. # @see carla_get_parameter_text()
  222. PARAMETER_USES_CUSTOM_TEXT = 0x400
  223. # ------------------------------------------------------------------------------------------------------------
  224. # Patchbay Port Hints
  225. # Various patchbay port hints.
  226. # Patchbay port is input.
  227. # When this hint is not set, port is assumed to be output.
  228. PATCHBAY_PORT_IS_INPUT = 0x1
  229. # Patchbay port is of Audio type.
  230. PATCHBAY_PORT_TYPE_AUDIO = 0x2
  231. # Patchbay port is of CV type (Control Voltage).
  232. PATCHBAY_PORT_TYPE_CV = 0x4
  233. # Patchbay port is of MIDI type.
  234. PATCHBAY_PORT_TYPE_MIDI = 0x8
  235. # ------------------------------------------------------------------------------------------------------------
  236. # Custom Data Types
  237. # These types define how the value in the CustomData struct is stored.
  238. # @see CustomData.type
  239. # Boolean string type URI.
  240. # Only "true" and "false" are valid values.
  241. CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean"
  242. # Chunk type URI.
  243. CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"
  244. # String type URI.
  245. CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string"
  246. # ------------------------------------------------------------------------------------------------------------
  247. # Custom Data Keys
  248. # Pre-defined keys used internally in Carla.
  249. # @see CustomData.key
  250. # Plugin options key.
  251. CUSTOM_DATA_KEY_PLUGIN_OPTIONS = "CarlaPluginOptions"
  252. # UI position key.
  253. CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition"
  254. # UI size key.
  255. CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize"
  256. # UI visible key.
  257. CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible"
  258. # ------------------------------------------------------------------------------------------------------------
  259. # Binary Type
  260. # The binary type of a plugin.
  261. # Null binary type.
  262. BINARY_NONE = 0
  263. # POSIX 32bit binary.
  264. BINARY_POSIX32 = 1
  265. # POSIX 64bit binary.
  266. BINARY_POSIX64 = 2
  267. # Windows 32bit binary.
  268. BINARY_WIN32 = 3
  269. # Windows 64bit binary.
  270. BINARY_WIN64 = 4
  271. # Other binary type.
  272. BINARY_OTHER = 5
  273. # ------------------------------------------------------------------------------------------------------------
  274. # Plugin Type
  275. # Plugin type.
  276. # Some files are handled as if they were plugins.
  277. # Null plugin type.
  278. PLUGIN_NONE = 0
  279. # Internal plugin.
  280. PLUGIN_INTERNAL = 1
  281. # LADSPA plugin.
  282. PLUGIN_LADSPA = 2
  283. # DSSI plugin.
  284. PLUGIN_DSSI = 3
  285. # LV2 plugin.
  286. PLUGIN_LV2 = 4
  287. # VST plugin.
  288. PLUGIN_VST = 5
  289. # VST3 plugin.
  290. PLUGIN_VST3 = 6
  291. # AU plugin.
  292. # @note MacOS only
  293. PLUGIN_AU = 7
  294. # GIG file.
  295. PLUGIN_GIG = 8
  296. # SF2 file (SoundFont).
  297. PLUGIN_SF2 = 9
  298. # SFZ file.
  299. PLUGIN_SFZ = 10
  300. # ------------------------------------------------------------------------------------------------------------
  301. # Plugin Category
  302. # Plugin category, which describes the functionality of a plugin.
  303. # Null plugin category.
  304. PLUGIN_CATEGORY_NONE = 0
  305. # A synthesizer or generator.
  306. PLUGIN_CATEGORY_SYNTH = 1
  307. # A delay or reverb.
  308. PLUGIN_CATEGORY_DELAY = 2
  309. # An equalizer.
  310. PLUGIN_CATEGORY_EQ = 3
  311. # A filter.
  312. PLUGIN_CATEGORY_FILTER = 4
  313. # A distortion plugin.
  314. PLUGIN_CATEGORY_DISTORTION = 5
  315. # A 'dynamic' plugin (amplifier, compressor, gate, etc).
  316. PLUGIN_CATEGORY_DYNAMICS = 6
  317. # A 'modulator' plugin (chorus, flanger, phaser, etc).
  318. PLUGIN_CATEGORY_MODULATOR = 7
  319. # An 'utility' plugin (analyzer, converter, mixer, etc).
  320. PLUGIN_CATEGORY_UTILITY = 8
  321. # Miscellaneous plugin (used to check if the plugin has a category).
  322. PLUGIN_CATEGORY_OTHER = 9
  323. # ------------------------------------------------------------------------------------------------------------
  324. # Parameter Type
  325. # Plugin parameter type.
  326. # Null parameter type.
  327. PARAMETER_UNKNOWN = 0
  328. # Input parameter.
  329. PARAMETER_INPUT = 1
  330. # Ouput parameter.
  331. PARAMETER_OUTPUT = 2
  332. # ------------------------------------------------------------------------------------------------------------
  333. # Internal Parameter Index
  334. # Special parameters used internally in Carla.
  335. # Plugins do not know about their existence.
  336. # Null parameter.
  337. PARAMETER_NULL = -1
  338. # Active parameter, boolean type.
  339. # Default is 'false'.
  340. PARAMETER_ACTIVE = -2
  341. # Dry/Wet parameter.
  342. # Range 0.0...1.0; default is 1.0.
  343. PARAMETER_DRYWET = -3
  344. # Volume parameter.
  345. # Range 0.0...1.27; default is 1.0.
  346. PARAMETER_VOLUME = -4
  347. # Stereo Balance-Left parameter.
  348. # Range -1.0...1.0; default is -1.0.
  349. PARAMETER_BALANCE_LEFT = -5
  350. # Stereo Balance-Right parameter.
  351. # Range -1.0...1.0; default is 1.0.
  352. PARAMETER_BALANCE_RIGHT = -6
  353. # Mono Panning parameter.
  354. # Range -1.0...1.0; default is 0.0.
  355. PARAMETER_PANNING = -7
  356. # MIDI Control channel, integer type.
  357. # Range -1...15 (-1 = off).
  358. PARAMETER_CTRL_CHANNEL = -8
  359. # Max value, defined only for convenience.
  360. PARAMETER_MAX = -9
  361. # ------------------------------------------------------------------------------------------------------------
  362. # Engine Callback Opcode
  363. # Engine callback opcodes.
  364. # Front-ends must never block indefinitely during a callback.
  365. # @see EngineCallbackFunc and carla_set_engine_callback()
  366. # Debug.
  367. # This opcode is undefined and used only for testing purposes.
  368. ENGINE_CALLBACK_DEBUG = 0
  369. # A plugin has been added.
  370. # @a pluginId Plugin Id
  371. # @a valueStr Plugin name
  372. ENGINE_CALLBACK_PLUGIN_ADDED = 1
  373. # A plugin has been removed.
  374. # @a pluginId Plugin Id
  375. ENGINE_CALLBACK_PLUGIN_REMOVED = 2
  376. # A plugin has been renamed.
  377. # @a pluginId Plugin Id
  378. # @a valueStr New plugin name
  379. ENGINE_CALLBACK_PLUGIN_RENAMED = 3
  380. # A plugin has become unavailable.
  381. # @a pluginId Plugin Id
  382. # @a valueStr Related error string
  383. ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4
  384. # A parameter value has changed.
  385. # @a pluginId Plugin Id
  386. # @a value1 Parameter index
  387. # @a value3 New parameter value
  388. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5
  389. # A parameter default has changed.
  390. # @a pluginId Plugin Id
  391. # @a value1 Parameter index
  392. # @a value3 New default value
  393. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6
  394. # A parameter's MIDI CC has changed.
  395. # @a pluginId Plugin Id
  396. # @a value1 Parameter index
  397. # @a value2 New MIDI CC
  398. ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED = 7
  399. # A parameter's MIDI channel has changed.
  400. # @a pluginId Plugin Id
  401. # @a value1 Parameter index
  402. # @a value2 New MIDI channel
  403. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8
  404. # A plugin option has changed.
  405. # @a pluginId Plugin Id
  406. # @a value1 Option
  407. # @a value2 New on/off state (1 for on, 0 for off)
  408. # @see PluginOptions
  409. ENGINE_CALLBACK_OPTION_CHANGED = 9
  410. # The current program of a plugin has changed.
  411. # @a pluginId Plugin Id
  412. # @a value1 New program index
  413. ENGINE_CALLBACK_PROGRAM_CHANGED = 10
  414. # The current MIDI program of a plugin has changed.
  415. # @a pluginId Plugin Id
  416. # @a value1 New MIDI program index
  417. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11
  418. # A plugin's custom UI state has changed.
  419. # @a pluginId Plugin Id
  420. # @a value1 New state, as follows:
  421. # 0: UI is now hidden
  422. # 1: UI is now visible
  423. # -1: UI has crashed and should not be shown again
  424. ENGINE_CALLBACK_UI_STATE_CHANGED = 12
  425. # A note has been pressed.
  426. # @a pluginId Plugin Id
  427. # @a value1 Channel
  428. # @a value2 Note
  429. # @a value3 Velocity
  430. ENGINE_CALLBACK_NOTE_ON = 13
  431. # A note has been released.
  432. # @a pluginId Plugin Id
  433. # @a value1 Channel
  434. # @a value2 Note
  435. ENGINE_CALLBACK_NOTE_OFF = 14
  436. # A plugin needs update.
  437. # @a pluginId Plugin Id
  438. ENGINE_CALLBACK_UPDATE = 15
  439. # A plugin's data/information has changed.
  440. # @a pluginId Plugin Id
  441. ENGINE_CALLBACK_RELOAD_INFO = 16
  442. # A plugin's parameters have changed.
  443. # @a pluginId Plugin Id
  444. ENGINE_CALLBACK_RELOAD_PARAMETERS = 17
  445. # A plugin's programs have changed.
  446. # @a pluginId Plugin Id
  447. ENGINE_CALLBACK_RELOAD_PROGRAMS = 18
  448. # A plugin state has changed.
  449. # @a pluginId Plugin Id
  450. ENGINE_CALLBACK_RELOAD_ALL = 19
  451. # A patchbay client has been added.
  452. # @a pluginId Client Id
  453. # @a value1 Client icon
  454. # @a value2 Plugin Id (-1 if not a plugin)
  455. # @a valueStr Client name
  456. # @see PatchbayIcon
  457. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 20
  458. # A patchbay client has been removed.
  459. # @a pluginId Client Id
  460. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 21
  461. # A patchbay client has been renamed.
  462. # @a pluginId Client Id
  463. # @a valueStr New client name
  464. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 22
  465. # A patchbay client data has changed.
  466. # @a pluginId Client Id
  467. # @a value1 New icon
  468. # @a value2 New plugin Id (-1 if not a plugin)
  469. # @see PatchbayIcon
  470. ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23
  471. # A patchbay port has been added.
  472. # @a pluginId Client Id
  473. # @a value1 Port Id
  474. # @a value2 Port hints
  475. # @a valueStr Port name
  476. # @see PatchbayPortHints
  477. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24
  478. # A patchbay port has been removed.
  479. # @a pluginId Client Id
  480. # @a value1 Port Id
  481. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25
  482. # A patchbay port has been renamed.
  483. # @a pluginId Client Id
  484. # @a value1 Port Id
  485. # @a valueStr New port name
  486. ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED = 26
  487. # A patchbay connection has been added.
  488. # @a pluginId Connection Id
  489. # @a valueStr Out group, port plus in group and port, in "og:op:ig:ip" syntax.
  490. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 27
  491. # A patchbay connection has been removed.
  492. # @a pluginId Connection Id
  493. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28
  494. # Engine started.
  495. # @a value1 Process mode
  496. # @a value2 Transport mode
  497. # @a valuestr Engine driver
  498. # @see EngineProcessMode
  499. # @see EngineTransportMode
  500. ENGINE_CALLBACK_ENGINE_STARTED = 29
  501. # Engine stopped.
  502. ENGINE_CALLBACK_ENGINE_STOPPED = 30
  503. # Engine process mode has changed.
  504. # @a value1 New process mode
  505. # @see EngineProcessMode
  506. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 31
  507. # Engine transport mode has changed.
  508. # @a value1 New transport mode
  509. # @see EngineTransportMode
  510. ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32
  511. # Engine buffer-size changed.
  512. # @a value1 New buffer size
  513. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33
  514. # Engine sample-rate changed.
  515. # @a value3 New sample rate
  516. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34
  517. # Idle frontend.
  518. # This is used by the engine during long operations that might block the frontend,
  519. # giving it the possibility to idle while the operation is still in place.
  520. ENGINE_CALLBACK_IDLE = 35
  521. # Show a message as information.
  522. # @a valueStr The message
  523. ENGINE_CALLBACK_INFO = 36
  524. # Show a message as an error.
  525. # @a valueStr The message
  526. ENGINE_CALLBACK_ERROR = 37
  527. # The engine has crashed or malfunctioned and will no longer work.
  528. ENGINE_CALLBACK_QUIT = 38
  529. # ------------------------------------------------------------------------------------------------------------
  530. # Engine Option
  531. # Engine options.
  532. # @see carla_set_engine_option()
  533. # Debug.
  534. # This option is undefined and used only for testing purposes.
  535. ENGINE_OPTION_DEBUG = 0
  536. # Set the engine processing mode.
  537. # Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_CONTINUOUS_RACK for all other OSes.
  538. # @see EngineProcessMode
  539. ENGINE_OPTION_PROCESS_MODE = 1
  540. # Set the engine transport mode.
  541. # Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
  542. # @see EngineTransportMode
  543. ENGINE_OPTION_TRANSPORT_MODE = 2
  544. # Force mono plugins as stereo, by running 2 instances at the same time.
  545. # Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
  546. # @note Not supported by all plugins
  547. # @see PLUGIN_OPTION_FORCE_STEREO
  548. ENGINE_OPTION_FORCE_STEREO = 3
  549. # Use plugin bridges whenever possible.
  550. # Default is no, EXPERIMENTAL.
  551. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4
  552. # Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
  553. # Default is yes.
  554. ENGINE_OPTION_PREFER_UI_BRIDGES = 5
  555. # Make custom plugin UIs always-on-top.
  556. # Default is yes.
  557. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6
  558. # Maximum number of parameters allowed.
  559. # Default is MAX_DEFAULT_PARAMETERS.
  560. ENGINE_OPTION_MAX_PARAMETERS = 7
  561. # Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  562. # Default is 4000 (4 seconds).
  563. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8
  564. # Number of audio periods.
  565. # Default is 2.
  566. ENGINE_OPTION_AUDIO_NUM_PERIODS = 9
  567. # Audio buffer size.
  568. # Default is 512.
  569. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10
  570. # Audio sample rate.
  571. # Default is 44100.
  572. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11
  573. # Audio device (within a driver).
  574. # Default unset.
  575. ENGINE_OPTION_AUDIO_DEVICE = 12
  576. # Set data needed for NSM support.
  577. ENGINE_OPTION_NSM_INIT = 13
  578. # Set path used for a specific plugin type.
  579. # Uses value as the plugin format, valueStr as actual path.
  580. # @see PluginType
  581. ENGINE_OPTION_PLUGIN_PATH = 14
  582. # Set path to the binary files.
  583. # Default unset.
  584. # @note Must be set for plugin and UI bridges to work
  585. ENGINE_OPTION_PATH_BINARIES = 15
  586. # Set path to the resource files.
  587. # Default unset.
  588. # @note Must be set for some internal plugins to work
  589. ENGINE_OPTION_PATH_RESOURCES = 16
  590. # Prevent bad plugin and UI behaviour.
  591. # @note: Linux only
  592. ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 17
  593. # Set frontend winId, used to define as parent window for plugin UIs.
  594. ENGINE_OPTION_FRONTEND_WIN_ID = 18
  595. # ------------------------------------------------------------------------------------------------------------
  596. # Engine Process Mode
  597. # Engine process mode.
  598. # @see ENGINE_OPTION_PROCESS_MODE
  599. # Single client mode.
  600. # Inputs and outputs are added dynamically as needed by plugins.
  601. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0
  602. # Multiple client mode.
  603. # It has 1 master client + 1 client per plugin.
  604. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1
  605. # Single client, 'rack' mode.
  606. # Processes plugins in order of Id, with forced stereo always on.
  607. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2
  608. # Single client, 'patchbay' mode.
  609. ENGINE_PROCESS_MODE_PATCHBAY = 3
  610. # Special mode, used in plugin-bridges only.
  611. ENGINE_PROCESS_MODE_BRIDGE = 4
  612. # ------------------------------------------------------------------------------------------------------------
  613. # Engine Transport Mode
  614. # Engine transport mode.
  615. # @see ENGINE_OPTION_TRANSPORT_MODE
  616. # Internal transport mode.
  617. ENGINE_TRANSPORT_MODE_INTERNAL = 0
  618. # Transport from JACK.
  619. # Only available if driver name is "JACK".
  620. ENGINE_TRANSPORT_MODE_JACK = 1
  621. # Transport from host, used when Carla is a plugin.
  622. ENGINE_TRANSPORT_MODE_PLUGIN = 2
  623. # Special mode, used in plugin-bridges only.
  624. ENGINE_TRANSPORT_MODE_BRIDGE = 3
  625. # ------------------------------------------------------------------------------------------------------------
  626. # File Callback Opcode
  627. # File callback opcodes.
  628. # Front-ends must always block-wait for user input.
  629. # @see FileCallbackFunc and carla_set_file_callback()
  630. # Debug.
  631. # This opcode is undefined and used only for testing purposes.
  632. FILE_CALLBACK_DEBUG = 0
  633. # Open file or folder.
  634. FILE_CALLBACK_OPEN = 1
  635. # Save file or folder.
  636. FILE_CALLBACK_SAVE = 2
  637. # ------------------------------------------------------------------------------------------------------------
  638. # Patchbay Icon
  639. # The icon of a patchbay client/group.
  640. # Generic application icon.
  641. # Used for all non-plugin clients that don't have a specific icon.
  642. PATCHBAY_ICON_APPLICATION = 0
  643. # Plugin icon.
  644. # Used for all plugin clients that don't have a specific icon.
  645. PATCHBAY_ICON_PLUGIN = 1
  646. # Hardware icon.
  647. # Used for hardware (audio or MIDI) clients.
  648. PATCHBAY_ICON_HARDWARE = 2
  649. # Carla icon.
  650. # Used for the main app.
  651. PATCHBAY_ICON_CARLA = 3
  652. # DISTRHO icon.
  653. # Used for DISTRHO based plugins.
  654. PATCHBAY_ICON_DISTRHO = 4
  655. # File icon.
  656. # Used for file type plugins (like GIG and SF2).
  657. PATCHBAY_ICON_FILE = 5
  658. # ------------------------------------------------------------------------------------------------------------
  659. # Carla Backend API (C stuff)
  660. # Engine callback function.
  661. # Front-ends must never block indefinitely during a callback.
  662. # @see EngineCallbackOpcode and carla_set_engine_callback()
  663. EngineCallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_float, c_char_p)
  664. # File callback function.
  665. # @see FileCallbackOpcode
  666. FileCallbackFunc = CFUNCTYPE(c_char_p, c_void_p, c_enum, c_bool, c_char_p, c_char_p)
  667. # Parameter data.
  668. class ParameterData(Structure):
  669. _fields_ = [
  670. # This parameter type.
  671. ("type", c_enum),
  672. # This parameter hints.
  673. # @see ParameterHints
  674. ("hints", c_uint),
  675. # Index as seen by Carla.
  676. ("index", c_int32),
  677. # Real index as seen by plugins.
  678. ("rindex", c_int32),
  679. # Currently mapped MIDI CC.
  680. # A value lower than 0 means invalid or unused.
  681. # Maximum allowed value is 95 (0x5F).
  682. ("midiCC", c_int16),
  683. # Currently mapped MIDI channel.
  684. # Counts from 0 to 15.
  685. ("midiChannel", c_uint8)
  686. ]
  687. # Parameter ranges.
  688. class ParameterRanges(Structure):
  689. _fields_ = [
  690. # Default value.
  691. ("def", c_float),
  692. # Minimum value.
  693. ("min", c_float),
  694. # Maximum value.
  695. ("max", c_float),
  696. # Regular, single step value.
  697. ("step", c_float),
  698. # Small step value.
  699. ("stepSmall", c_float),
  700. # Large step value.
  701. ("stepLarge", c_float)
  702. ]
  703. # MIDI Program data.
  704. class MidiProgramData(Structure):
  705. _fields_ = [
  706. # MIDI bank.
  707. ("bank", c_uint32),
  708. # MIDI program.
  709. ("program", c_uint32),
  710. # MIDI program name.
  711. ("name", c_char_p)
  712. ]
  713. # Custom data, used for saving key:value 'dictionaries'.
  714. class CustomData(Structure):
  715. _fields_ = [
  716. # Value type, in URI form.
  717. # @see CustomDataTypes
  718. ("type", c_char_p),
  719. # Key.
  720. # @see CustomDataKeys
  721. ("key", c_char_p),
  722. # Value.
  723. ("value", c_char_p)
  724. ]
  725. # Engine driver device information.
  726. class EngineDriverDeviceInfo(Structure):
  727. _fields_ = [
  728. # This driver device hints.
  729. # @see EngineDriverHints
  730. ("hints", c_uint),
  731. # Available buffer sizes.
  732. # Terminated with 0.
  733. ("bufferSizes", POINTER(c_uint32)),
  734. # Available sample rates.
  735. # Terminated with 0.0.
  736. ("sampleRates", POINTER(c_double))
  737. ]
  738. # ------------------------------------------------------------------------------------------------------------
  739. # Carla Backend API (Python compatible stuff)
  740. # @see ParameterData
  741. PyParameterData = {
  742. 'type': PARAMETER_UNKNOWN,
  743. 'hints': 0x0,
  744. 'index': PARAMETER_NULL,
  745. 'rindex': -1,
  746. 'midiCC': -1,
  747. 'midiChannel': 0
  748. }
  749. # @see ParameterRanges
  750. PyParameterRanges = {
  751. 'def': 0.0,
  752. 'min': 0.0,
  753. 'max': 1.0,
  754. 'step': 0.01,
  755. 'stepSmall': 0.0001,
  756. 'stepLarge': 0.1
  757. }
  758. # @see MidiProgramData
  759. PyMidiProgramData = {
  760. 'bank': 0,
  761. 'program': 0,
  762. 'name': None
  763. }
  764. # @see CustomData
  765. PyCustomData = {
  766. 'type': None,
  767. 'key': None,
  768. 'value': None
  769. }
  770. # @see EngineDriverDeviceInfo
  771. PyEngineDriverDeviceInfo = {
  772. 'hints': 0x0,
  773. 'bufferSizes': [],
  774. 'sampleRates': []
  775. }
  776. # ------------------------------------------------------------------------------------------------------------
  777. # Carla Host API (C stuff)
  778. # Information about a loaded plugin.
  779. # @see carla_get_plugin_info()
  780. class CarlaPluginInfo(Structure):
  781. _fields_ = [
  782. # Plugin type.
  783. ("type", c_enum),
  784. # Plugin category.
  785. ("category", c_enum),
  786. # Plugin hints.
  787. # @see PluginHints
  788. ("hints", c_uint),
  789. # Plugin options available for the user to change.
  790. # @see PluginOptions
  791. ("optionsAvailable", c_uint),
  792. # Plugin options currently enabled.
  793. # Some options are enabled but not available, which means they will always be on.
  794. # @see PluginOptions
  795. ("optionsEnabled", c_uint),
  796. # Plugin filename.
  797. # This can be the plugin binary or resource file.
  798. ("filename", c_char_p),
  799. # Plugin name.
  800. # This name is unique within a Carla instance.
  801. # @see carla_get_real_plugin_name()
  802. ("name", c_char_p),
  803. # Plugin label or URI.
  804. ("label", c_char_p),
  805. # Plugin author/maker.
  806. ("maker", c_char_p),
  807. # Plugin copyright/license.
  808. ("copyright", c_char_p),
  809. # Icon name for this plugin, in lowercase.
  810. # Default is "plugin".
  811. ("iconName", c_char_p),
  812. # Plugin unique Id.
  813. # This Id is dependant on the plugin type and may sometimes be 0.
  814. ("uniqueId", c_int64)
  815. ]
  816. # Information about an internal Carla plugin.
  817. # @see carla_get_internal_plugin_info()
  818. class CarlaNativePluginInfo(Structure):
  819. _fields_ = [
  820. # Plugin category.
  821. ("category", c_enum),
  822. # Plugin hints.
  823. # @see PluginHints
  824. ("hints", c_uint),
  825. # Number of audio inputs.
  826. ("audioIns", c_uint32),
  827. # Number of audio outputs.
  828. ("audioOuts", c_uint32),
  829. # Number of MIDI inputs.
  830. ("midiIns", c_uint32),
  831. # Number of MIDI outputs.
  832. ("midiOuts", c_uint32),
  833. # Number of input parameters.
  834. ("parameterIns", c_uint32),
  835. # Number of output parameters.
  836. ("parameterOuts", c_uint32),
  837. # Plugin name.
  838. ("name", c_char_p),
  839. # Plugin label.
  840. ("label", c_char_p),
  841. # Plugin author/maker.
  842. ("maker", c_char_p),
  843. # Plugin copyright/license.
  844. ("copyright", c_char_p)
  845. ]
  846. # Port count information, used for Audio and MIDI ports and parameters.
  847. # @see carla_get_audio_port_count_info()
  848. # @see carla_get_midi_port_count_info()
  849. # @see carla_get_parameter_count_info()
  850. class CarlaPortCountInfo(Structure):
  851. _fields_ = [
  852. # Number of inputs.
  853. ("ins", c_uint32),
  854. # Number of outputs.
  855. ("outs", c_uint32)
  856. ]
  857. # Parameter information.
  858. # @see carla_get_parameter_info()
  859. class CarlaParameterInfo(Structure):
  860. _fields_ = [
  861. # Parameter name.
  862. ("name", c_char_p),
  863. # Parameter symbol.
  864. ("symbol", c_char_p),
  865. # Parameter unit.
  866. ("unit", c_char_p),
  867. # Number of scale points.
  868. # @see CarlaScalePointInfo
  869. ("scalePointCount", c_uint32)
  870. ]
  871. # Parameter scale point information.
  872. # @see carla_get_parameter_scalepoint_info()
  873. class CarlaScalePointInfo(Structure):
  874. _fields_ = [
  875. # Scale point value.
  876. ("value", c_float),
  877. # Scale point label.
  878. ("label", c_char_p)
  879. ]
  880. # Transport information.
  881. # @see carla_get_transport_info()
  882. class CarlaTransportInfo(Structure):
  883. _fields_ = [
  884. # Wherever transport is playing.
  885. ("playing", c_bool),
  886. # Current transport frame.
  887. ("frame", c_uint64),
  888. # Bar
  889. ("bar", c_int32),
  890. # Beat
  891. ("beat", c_int32),
  892. # Tick
  893. ("tick", c_int32),
  894. # Beats per minute.
  895. ("bpm", c_double)
  896. ]
  897. # ------------------------------------------------------------------------------------------------------------
  898. # Carla Host API (Python compatible stuff)
  899. # @see CarlaPluginInfo
  900. PyCarlaPluginInfo = {
  901. 'type': PLUGIN_NONE,
  902. 'category': PLUGIN_CATEGORY_NONE,
  903. 'hints': 0x0,
  904. 'optionsAvailable': 0x0,
  905. 'optionsEnabled': 0x0,
  906. 'filename': None,
  907. 'name': None,
  908. 'label': None,
  909. 'maker': None,
  910. 'copyright': None,
  911. 'iconName': None,
  912. 'uniqueId': 0
  913. }
  914. # @see CarlaNativePluginInfo
  915. PyCarlaNativePluginInfo = {
  916. 'category': PLUGIN_CATEGORY_NONE,
  917. 'hints': 0x0,
  918. 'audioIns': 0,
  919. 'audioOuts': 0,
  920. 'midiIns': 0,
  921. 'midiOuts': 0,
  922. 'parameterIns': 0,
  923. 'parameterOuts': 0,
  924. 'name': None,
  925. 'label': None,
  926. 'maker': None,
  927. 'copyright': None
  928. }
  929. # @see CarlaPortCountInfo
  930. PyCarlaPortCountInfo = {
  931. 'ins': 0,
  932. 'outs': 0
  933. }
  934. # @see CarlaParameterInfo
  935. PyCarlaParameterInfo = {
  936. 'name': None,
  937. 'symbol': None,
  938. 'unit': None,
  939. 'scalePointCount': 0,
  940. }
  941. # @see CarlaScalePointInfo
  942. PyCarlaScalePointInfo = {
  943. 'value': 0.0,
  944. 'label': None
  945. }
  946. # @see CarlaTransportInfo
  947. PyCarlaTransportInfo = {
  948. "playing": False,
  949. "frame": 0,
  950. "bar": 0,
  951. "beat": 0,
  952. "tick": 0,
  953. "bpm": 0.0
  954. }
  955. # ------------------------------------------------------------------------------------------------------------
  956. # Set BINARY_NATIVE
  957. if HAIKU or LINUX or MACOS:
  958. BINARY_NATIVE = BINARY_POSIX64 if kIs64bit else BINARY_POSIX32
  959. elif WINDOWS:
  960. BINARY_NATIVE = BINARY_WIN64 if kIs64bit else BINARY_WIN32
  961. else:
  962. BINARY_NATIVE = BINARY_OTHER
  963. # ------------------------------------------------------------------------------------------------------------
  964. # An empty class used to resolve metaclass conflicts between ABC and PyQt modules
  965. class PyQtMetaClass(pyqtWrapperType, ABCMeta):
  966. pass
  967. # ------------------------------------------------------------------------------------------------------------
  968. # Carla Host object (Meta)
  969. class CarlaHostMeta(QObject):
  970. #class CarlaHostMeta(QObject, metaclass=PyQtMetaClass):
  971. # signals
  972. DebugCallback = pyqtSignal(int, int, int, float, str)
  973. PluginAddedCallback = pyqtSignal(int, str)
  974. PluginRemovedCallback = pyqtSignal(int)
  975. PluginRenamedCallback = pyqtSignal(int, str)
  976. PluginUnavailableCallback = pyqtSignal(int, str)
  977. ParameterValueChangedCallback = pyqtSignal(int, int, float)
  978. ParameterDefaultChangedCallback = pyqtSignal(int, int, float)
  979. ParameterMidiCcChangedCallback = pyqtSignal(int, int, int)
  980. ParameterMidiChannelChangedCallback = pyqtSignal(int, int, int)
  981. ProgramChangedCallback = pyqtSignal(int, int)
  982. MidiProgramChangedCallback = pyqtSignal(int, int)
  983. OptionChangedCallback = pyqtSignal(int, int, bool)
  984. UiStateChangedCallback = pyqtSignal(int, int)
  985. NoteOnCallback = pyqtSignal(int, int, int, int)
  986. NoteOffCallback = pyqtSignal(int, int, int)
  987. UpdateCallback = pyqtSignal(int)
  988. ReloadInfoCallback = pyqtSignal(int)
  989. ReloadParametersCallback = pyqtSignal(int)
  990. ReloadProgramsCallback = pyqtSignal(int)
  991. ReloadAllCallback = pyqtSignal(int)
  992. PatchbayClientAddedCallback = pyqtSignal(int, int, int, str)
  993. PatchbayClientRemovedCallback = pyqtSignal(int)
  994. PatchbayClientRenamedCallback = pyqtSignal(int, str)
  995. PatchbayClientDataChangedCallback = pyqtSignal(int, int, int)
  996. PatchbayPortAddedCallback = pyqtSignal(int, int, int, str)
  997. PatchbayPortRemovedCallback = pyqtSignal(int, int)
  998. PatchbayPortRenamedCallback = pyqtSignal(int, int, str)
  999. PatchbayConnectionAddedCallback = pyqtSignal(int, int, int, int, int)
  1000. PatchbayConnectionRemovedCallback = pyqtSignal(int, int, int)
  1001. EngineStartedCallback = pyqtSignal(int, int, str)
  1002. EngineStoppedCallback = pyqtSignal()
  1003. ProcessModeChangedCallback = pyqtSignal(int)
  1004. TransportModeChangedCallback = pyqtSignal(int)
  1005. BufferSizeChangedCallback = pyqtSignal(int)
  1006. SampleRateChangedCallback = pyqtSignal(float)
  1007. InfoCallback = pyqtSignal(str)
  1008. ErrorCallback = pyqtSignal(str)
  1009. QuitCallback = pyqtSignal()
  1010. def __init__(self):
  1011. QObject.__init__(self)
  1012. # info about this host object
  1013. self.isControl = False
  1014. self.isPlugin = False
  1015. # settings
  1016. self.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK
  1017. self.transportMode = ENGINE_TRANSPORT_MODE_INTERNAL
  1018. self.processModeForced = False
  1019. # settings
  1020. self.forceStereo = False
  1021. self.preferPluginBridges = False
  1022. self.preferUIBridges = False
  1023. self.preventBadBehaviour = False
  1024. self.uisAlwaysOnTop = False
  1025. self.maxParameters = 0
  1026. self.uiBridgesTimeout = 0
  1027. # settings
  1028. self.pathBinaries = ""
  1029. self.pathResources = ""
  1030. # use _putenv on windows
  1031. if not WINDOWS:
  1032. self.msvcrt = None
  1033. return
  1034. self.msvcrt = cdll.msvcrt
  1035. self.msvcrt._putenv.argtypes = [c_char_p]
  1036. self.msvcrt._putenv.restype = None
  1037. # set environment variable
  1038. def setenv(self, key, value):
  1039. environ[key] = value
  1040. if WINDOWS:
  1041. keyvalue = "%s=%s" % (key, value)
  1042. self.msvcrt._putenv(keyvalue.encode("utf-8"))
  1043. # unset environment variable
  1044. def unsetenv(self, key):
  1045. environ.pop(key)
  1046. if WINDOWS:
  1047. keyrm = "%s=" % key
  1048. self.msvcrt._putenv(keyrm.encode("utf-8"))
  1049. # Get the complete license text of used third-party code and features.
  1050. # Returned string is in basic html format.
  1051. @abstractmethod
  1052. def get_complete_license_text(self):
  1053. raise NotImplementedError
  1054. # Get the juce version used in the current Carla build.
  1055. @abstractmethod
  1056. def get_juce_version(self):
  1057. raise NotImplementedError
  1058. # Get all the supported file extensions in carla_load_file().
  1059. # Returned string uses this syntax:
  1060. # @code
  1061. # "*.ext1;*.ext2;*.ext3"
  1062. # @endcode
  1063. @abstractmethod
  1064. def get_supported_file_extensions(self):
  1065. raise NotImplementedError
  1066. # Get how many engine drivers are available.
  1067. @abstractmethod
  1068. def get_engine_driver_count(self):
  1069. raise NotImplementedError
  1070. # Get an engine driver name.
  1071. # @param index Driver index
  1072. @abstractmethod
  1073. def get_engine_driver_name(self, index):
  1074. raise NotImplementedError
  1075. # Get the device names of an engine driver.
  1076. # @param index Driver index
  1077. @abstractmethod
  1078. def get_engine_driver_device_names(self, index):
  1079. raise NotImplementedError
  1080. # Get information about a device driver.
  1081. # @param index Driver index
  1082. # @param name Device name
  1083. @abstractmethod
  1084. def get_engine_driver_device_info(self, index, name):
  1085. raise NotImplementedError
  1086. # Get how many internal plugins are available.
  1087. @abstractmethod
  1088. def get_internal_plugin_count(self):
  1089. raise NotImplementedError
  1090. # Get information about an internal plugin.
  1091. # @param index Internal plugin Id
  1092. @abstractmethod
  1093. def get_internal_plugin_info(self, index):
  1094. raise NotImplementedError
  1095. # Initialize the engine.
  1096. # Make sure to call carla_engine_idle() at regular intervals afterwards.
  1097. # @param driverName Driver to use
  1098. # @param clientName Engine master client name
  1099. @abstractmethod
  1100. def engine_init(self, driverName, clientName):
  1101. raise NotImplementedError
  1102. # Close the engine.
  1103. # This function always closes the engine even if it returns false.
  1104. # In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
  1105. @abstractmethod
  1106. def engine_close(self):
  1107. raise NotImplementedError
  1108. # Idle the engine.
  1109. # Do not call this if the engine is not running.
  1110. @abstractmethod
  1111. def engine_idle(self):
  1112. raise NotImplementedError
  1113. # Check if the engine is running.
  1114. @abstractmethod
  1115. def is_engine_running(self):
  1116. raise NotImplementedError
  1117. # Tell the engine it's about to close.
  1118. # This is used to prevent the engine thread(s) from reactivating.
  1119. @abstractmethod
  1120. def set_engine_about_to_close(self):
  1121. raise NotImplementedError
  1122. # Set the engine callback function.
  1123. # @param func Callback function
  1124. @abstractmethod
  1125. def set_engine_callback(self, func):
  1126. raise NotImplementedError
  1127. # Set an engine option.
  1128. # @param option Option
  1129. # @param value Value as number
  1130. # @param valueStr Value as string
  1131. @abstractmethod
  1132. def set_engine_option(self, option, value, valueStr):
  1133. raise NotImplementedError
  1134. # Set the file callback function.
  1135. # @param func Callback function
  1136. # @param ptr Callback pointer
  1137. @abstractmethod
  1138. def set_file_callback(self, func):
  1139. raise NotImplementedError
  1140. # Load a file of any type.
  1141. # This will try to load a generic file as a plugin,
  1142. # either by direct handling (GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
  1143. # @see carla_get_supported_file_extensions()
  1144. @abstractmethod
  1145. def load_file(self, filename):
  1146. raise NotImplementedError
  1147. # Load a Carla project file.
  1148. # @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
  1149. @abstractmethod
  1150. def load_project(self, filename):
  1151. raise NotImplementedError
  1152. # Save current project to a file.
  1153. @abstractmethod
  1154. def save_project(self, filename):
  1155. raise NotImplementedError
  1156. # Connect two patchbay ports.
  1157. # @param groupIdA Output group
  1158. # @param portIdA Output port
  1159. # @param groupIdB Input group
  1160. # @param portIdB Input port
  1161. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
  1162. @abstractmethod
  1163. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  1164. raise NotImplementedError
  1165. # Disconnect two patchbay ports.
  1166. # @param connectionId Connection Id
  1167. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
  1168. @abstractmethod
  1169. def patchbay_disconnect(self, connectionId):
  1170. raise NotImplementedError
  1171. # Force the engine to resend all patchbay clients, ports and connections again.
  1172. # @param external Wherever to show external/hardware ports instead of internal ones.
  1173. # Only valid in patchbay engine mode, other modes will ignore this.
  1174. @abstractmethod
  1175. def patchbay_refresh(self, external):
  1176. raise NotImplementedError
  1177. # Start playback of the engine transport.
  1178. @abstractmethod
  1179. def transport_play(self):
  1180. raise NotImplementedError
  1181. # Pause the engine transport.
  1182. @abstractmethod
  1183. def transport_pause(self):
  1184. raise NotImplementedError
  1185. # Relocate the engine transport to a specific frame.
  1186. @abstractmethod
  1187. def transport_relocate(self, frame):
  1188. raise NotImplementedError
  1189. # Get the current transport frame.
  1190. @abstractmethod
  1191. def get_current_transport_frame(self):
  1192. raise NotImplementedError
  1193. # Get the engine transport information.
  1194. @abstractmethod
  1195. def get_transport_info(self):
  1196. raise NotImplementedError
  1197. # Current number of plugins loaded.
  1198. @abstractmethod
  1199. def get_current_plugin_count(self):
  1200. raise NotImplementedError
  1201. # Maximum number of loadable plugins allowed.
  1202. # Returns 0 if engine is not started.
  1203. @abstractmethod
  1204. def get_max_plugin_number(self):
  1205. raise NotImplementedError
  1206. # Add a new plugin.
  1207. # If you don't know the binary type use the BINARY_NATIVE macro.
  1208. # @param btype Binary type
  1209. # @param ptype Plugin type
  1210. # @param filename Filename, if applicable
  1211. # @param name Name of the plugin, can be NULL
  1212. # @param label Plugin label, if applicable
  1213. # @param uniqueId Plugin unique Id, if applicable
  1214. # @param extraPtr Extra pointer, defined per plugin type
  1215. @abstractmethod
  1216. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr):
  1217. raise NotImplementedError
  1218. # Remove a plugin.
  1219. # @param pluginId Plugin to remove.
  1220. @abstractmethod
  1221. def remove_plugin(self, pluginId):
  1222. raise NotImplementedError
  1223. # Remove all plugins.
  1224. @abstractmethod
  1225. def remove_all_plugins(self):
  1226. raise NotImplementedError
  1227. # Rename a plugin.
  1228. # Returns the new name, or NULL if the operation failed.
  1229. # @param pluginId Plugin to rename
  1230. # @param newName New plugin name
  1231. @abstractmethod
  1232. def rename_plugin(self, pluginId, newName):
  1233. raise NotImplementedError
  1234. # Clone a plugin.
  1235. # @param pluginId Plugin to clone
  1236. @abstractmethod
  1237. def clone_plugin(self, pluginId):
  1238. raise NotImplementedError
  1239. # Prepare replace of a plugin.
  1240. # The next call to carla_add_plugin() will use this id, replacing the current plugin.
  1241. # @param pluginId Plugin to replace
  1242. # @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  1243. @abstractmethod
  1244. def replace_plugin(self, pluginId):
  1245. raise NotImplementedError
  1246. # Switch two plugins positions.
  1247. # @param pluginIdA Plugin A
  1248. # @param pluginIdB Plugin B
  1249. @abstractmethod
  1250. def switch_plugins(self, pluginIdA, pluginIdB):
  1251. raise NotImplementedError
  1252. # Load a plugin state.
  1253. # @param pluginId Plugin
  1254. # @param filename Path to plugin state
  1255. # @see carla_save_plugin_state()
  1256. @abstractmethod
  1257. def load_plugin_state(self, pluginId, filename):
  1258. raise NotImplementedError
  1259. # Save a plugin state.
  1260. # @param pluginId Plugin
  1261. # @param filename Path to plugin state
  1262. # @see carla_load_plugin_state()
  1263. @abstractmethod
  1264. def save_plugin_state(self, pluginId, filename):
  1265. raise NotImplementedError
  1266. # Get information from a plugin.
  1267. # @param pluginId Plugin
  1268. @abstractmethod
  1269. def get_plugin_info(self, pluginId):
  1270. raise NotImplementedError
  1271. # Get audio port count information from a plugin.
  1272. # @param pluginId Plugin
  1273. @abstractmethod
  1274. def get_audio_port_count_info(self, pluginId):
  1275. raise NotImplementedError
  1276. # Get MIDI port count information from a plugin.
  1277. # @param pluginId Plugin
  1278. @abstractmethod
  1279. def get_midi_port_count_info(self, pluginId):
  1280. raise NotImplementedError
  1281. # Get parameter count information from a plugin.
  1282. # @param pluginId Plugin
  1283. @abstractmethod
  1284. def get_parameter_count_info(self, pluginId):
  1285. raise NotImplementedError
  1286. # Get parameter information from a plugin.
  1287. # @param pluginId Plugin
  1288. # @param parameterId Parameter index
  1289. # @see carla_get_parameter_count()
  1290. @abstractmethod
  1291. def get_parameter_info(self, pluginId, parameterId):
  1292. raise NotImplementedError
  1293. # Get parameter scale point information from a plugin.
  1294. # @param pluginId Plugin
  1295. # @param parameterId Parameter index
  1296. # @param scalePointId Parameter scale-point index
  1297. # @see CarlaParameterInfo::scalePointCount
  1298. @abstractmethod
  1299. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1300. raise NotImplementedError
  1301. # Get a plugin's parameter data.
  1302. # @param pluginId Plugin
  1303. # @param parameterId Parameter index
  1304. # @see carla_get_parameter_count()
  1305. @abstractmethod
  1306. def get_parameter_data(self, pluginId, parameterId):
  1307. raise NotImplementedError
  1308. # Get a plugin's parameter ranges.
  1309. # @param pluginId Plugin
  1310. # @param parameterId Parameter index
  1311. # @see carla_get_parameter_count()
  1312. @abstractmethod
  1313. def get_parameter_ranges(self, pluginId, parameterId):
  1314. raise NotImplementedError
  1315. # Get a plugin's MIDI program data.
  1316. # @param pluginId Plugin
  1317. # @param midiProgramId MIDI Program index
  1318. # @see carla_get_midi_program_count()
  1319. @abstractmethod
  1320. def get_midi_program_data(self, pluginId, midiProgramId):
  1321. raise NotImplementedError
  1322. # Get a plugin's custom data.
  1323. # @param pluginId Plugin
  1324. # @param customDataId Custom data index
  1325. # @see carla_get_custom_data_count()
  1326. @abstractmethod
  1327. def get_custom_data(self, pluginId, customDataId):
  1328. raise NotImplementedError
  1329. # Get a plugin's chunk data.
  1330. # @param pluginId Plugin
  1331. # @see PLUGIN_OPTION_USE_CHUNKS
  1332. @abstractmethod
  1333. def get_chunk_data(self, pluginId):
  1334. raise NotImplementedError
  1335. # Get how many parameters a plugin has.
  1336. # @param pluginId Plugin
  1337. @abstractmethod
  1338. def get_parameter_count(self, pluginId):
  1339. raise NotImplementedError
  1340. # Get how many programs a plugin has.
  1341. # @param pluginId Plugin
  1342. # @see carla_get_program_name()
  1343. @abstractmethod
  1344. def get_program_count(self, pluginId):
  1345. raise NotImplementedError
  1346. # Get how many MIDI programs a plugin has.
  1347. # @param pluginId Plugin
  1348. # @see carla_get_midi_program_name() and carla_get_midi_program_data()
  1349. @abstractmethod
  1350. def get_midi_program_count(self, pluginId):
  1351. raise NotImplementedError
  1352. # Get how many custom data sets a plugin has.
  1353. # @param pluginId Plugin
  1354. # @see carla_get_custom_data()
  1355. @abstractmethod
  1356. def get_custom_data_count(self, pluginId):
  1357. raise NotImplementedError
  1358. # Get a plugin's parameter text (custom display of internal values).
  1359. # @param pluginId Plugin
  1360. # @param parameterId Parameter index
  1361. # @see PARAMETER_USES_CUSTOM_TEXT
  1362. @abstractmethod
  1363. def get_parameter_text(self, pluginId, parameterId):
  1364. raise NotImplementedError
  1365. # Get a plugin's program name.
  1366. # @param pluginId Plugin
  1367. # @param programId Program index
  1368. # @see carla_get_program_count()
  1369. @abstractmethod
  1370. def get_program_name(self, pluginId, programId):
  1371. raise NotImplementedError
  1372. # Get a plugin's MIDI program name.
  1373. # @param pluginId Plugin
  1374. # @param midiProgramId MIDI Program index
  1375. # @see carla_get_midi_program_count()
  1376. @abstractmethod
  1377. def get_midi_program_name(self, pluginId, midiProgramId):
  1378. raise NotImplementedError
  1379. # Get a plugin's real name.
  1380. # This is the name the plugin uses to identify itself; may not be unique.
  1381. # @param pluginId Plugin
  1382. @abstractmethod
  1383. def get_real_plugin_name(self, pluginId):
  1384. raise NotImplementedError
  1385. # Get a plugin's program index.
  1386. # @param pluginId Plugin
  1387. @abstractmethod
  1388. def get_current_program_index(self, pluginId):
  1389. raise NotImplementedError
  1390. # Get a plugin's midi program index.
  1391. # @param pluginId Plugin
  1392. @abstractmethod
  1393. def get_current_midi_program_index(self, pluginId):
  1394. raise NotImplementedError
  1395. # Get a plugin's default parameter value.
  1396. # @param pluginId Plugin
  1397. # @param parameterId Parameter index
  1398. @abstractmethod
  1399. def get_default_parameter_value(self, pluginId, parameterId):
  1400. raise NotImplementedError
  1401. # Get a plugin's current parameter value.
  1402. # @param pluginId Plugin
  1403. # @param parameterId Parameter index
  1404. @abstractmethod
  1405. def get_current_parameter_value(self, pluginId, parameterId):
  1406. raise NotImplementedError
  1407. # Get a plugin's internal parameter value.
  1408. # @param pluginId Plugin
  1409. # @param parameterId Parameter index, maybe be negative
  1410. # @see InternalParameterIndex
  1411. @abstractmethod
  1412. def get_internal_parameter_value(self, pluginId, parameterId):
  1413. raise NotImplementedError
  1414. # Get a plugin's input peak value.
  1415. # @param pluginId Plugin
  1416. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1417. @abstractmethod
  1418. def get_input_peak_value(self, pluginId, isLeft):
  1419. raise NotImplementedError
  1420. # Get a plugin's output peak value.
  1421. # @param pluginId Plugin
  1422. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1423. @abstractmethod
  1424. def get_output_peak_value(self, pluginId, isLeft):
  1425. raise NotImplementedError
  1426. # Enable a plugin's option.
  1427. # @param pluginId Plugin
  1428. # @param option An option from PluginOptions
  1429. # @param yesNo New enabled state
  1430. @abstractmethod
  1431. def set_option(self, pluginId, option, yesNo):
  1432. raise NotImplementedError
  1433. # Enable or disable a plugin.
  1434. # @param pluginId Plugin
  1435. # @param onOff New active state
  1436. @abstractmethod
  1437. def set_active(self, pluginId, onOff):
  1438. raise NotImplementedError
  1439. # Change a plugin's internal dry/wet.
  1440. # @param pluginId Plugin
  1441. # @param value New dry/wet value
  1442. @abstractmethod
  1443. def set_drywet(self, pluginId, value):
  1444. raise NotImplementedError
  1445. # Change a plugin's internal volume.
  1446. # @param pluginId Plugin
  1447. # @param value New volume
  1448. @abstractmethod
  1449. def set_volume(self, pluginId, value):
  1450. raise NotImplementedError
  1451. # Change a plugin's internal stereo balance, left channel.
  1452. # @param pluginId Plugin
  1453. # @param value New value
  1454. @abstractmethod
  1455. def set_balance_left(self, pluginId, value):
  1456. raise NotImplementedError
  1457. # Change a plugin's internal stereo balance, right channel.
  1458. # @param pluginId Plugin
  1459. # @param value New value
  1460. @abstractmethod
  1461. def set_balance_right(self, pluginId, value):
  1462. raise NotImplementedError
  1463. # Change a plugin's internal mono panning value.
  1464. # @param pluginId Plugin
  1465. # @param value New value
  1466. @abstractmethod
  1467. def set_panning(self, pluginId, value):
  1468. raise NotImplementedError
  1469. # Change a plugin's internal control channel.
  1470. # @param pluginId Plugin
  1471. # @param channel New channel
  1472. @abstractmethod
  1473. def set_ctrl_channel(self, pluginId, channel):
  1474. raise NotImplementedError
  1475. # Change a plugin's parameter value.
  1476. # @param pluginId Plugin
  1477. # @param parameterId Parameter index
  1478. # @param value New value
  1479. @abstractmethod
  1480. def set_parameter_value(self, pluginId, parameterId, value):
  1481. raise NotImplementedError
  1482. # Change a plugin's parameter MIDI cc.
  1483. # @param pluginId Plugin
  1484. # @param parameterId Parameter index
  1485. # @param cc New MIDI cc
  1486. @abstractmethod
  1487. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1488. raise NotImplementedError
  1489. # Change a plugin's parameter MIDI channel.
  1490. # @param pluginId Plugin
  1491. # @param parameterId Parameter index
  1492. # @param channel New MIDI channel
  1493. @abstractmethod
  1494. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  1495. raise NotImplementedError
  1496. # Change a plugin's current program.
  1497. # @param pluginId Plugin
  1498. # @param programId New program
  1499. @abstractmethod
  1500. def set_program(self, pluginId, programId):
  1501. raise NotImplementedError
  1502. # Change a plugin's current MIDI program.
  1503. # @param pluginId Plugin
  1504. # @param midiProgramId New value
  1505. @abstractmethod
  1506. def set_midi_program(self, pluginId, midiProgramId):
  1507. raise NotImplementedError
  1508. # Set a plugin's custom data set.
  1509. # @param pluginId Plugin
  1510. # @param type Type
  1511. # @param key Key
  1512. # @param value New value
  1513. # @see CustomDataTypes and CustomDataKeys
  1514. @abstractmethod
  1515. def set_custom_data(self, pluginId, type_, key, value):
  1516. raise NotImplementedError
  1517. # Set a plugin's chunk data.
  1518. # @param pluginId Plugin
  1519. # @param chunkData New chunk data
  1520. # @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  1521. @abstractmethod
  1522. def set_chunk_data(self, pluginId, chunkData):
  1523. raise NotImplementedError
  1524. # Tell a plugin to prepare for save.
  1525. # This should be called before saving custom data sets.
  1526. # @param pluginId Plugin
  1527. @abstractmethod
  1528. def prepare_for_save(self, pluginId):
  1529. raise NotImplementedError
  1530. # Reset all plugin's parameters.
  1531. # @param pluginId Plugin
  1532. @abstractmethod
  1533. def reset_parameters(self, pluginId):
  1534. raise NotImplementedError
  1535. # Randomize all plugin's parameters.
  1536. # @param pluginId Plugin
  1537. @abstractmethod
  1538. def randomize_parameters(self, pluginId):
  1539. raise NotImplementedError
  1540. # Send a single note of a plugin.
  1541. # If velocity is 0, note-off is sent; note-on otherwise.
  1542. # @param pluginId Plugin
  1543. # @param channel Note channel
  1544. # @param note Note pitch
  1545. # @param velocity Note velocity
  1546. @abstractmethod
  1547. def send_midi_note(self, pluginId, channel, note, velocity):
  1548. raise NotImplementedError
  1549. # Tell a plugin to show its own custom UI.
  1550. # @param pluginId Plugin
  1551. # @param yesNo New UI state, visible or not
  1552. # @see PLUGIN_HAS_CUSTOM_UI
  1553. @abstractmethod
  1554. def show_custom_ui(self, pluginId, yesNo):
  1555. raise NotImplementedError
  1556. # Get the current engine buffer size.
  1557. @abstractmethod
  1558. def get_buffer_size(self):
  1559. raise NotImplementedError
  1560. # Get the current engine sample rate.
  1561. @abstractmethod
  1562. def get_sample_rate(self):
  1563. raise NotImplementedError
  1564. # Get the last error.
  1565. @abstractmethod
  1566. def get_last_error(self):
  1567. raise NotImplementedError
  1568. # Get the current engine OSC URL (TCP).
  1569. @abstractmethod
  1570. def get_host_osc_url_tcp(self):
  1571. raise NotImplementedError
  1572. # Get the current engine OSC URL (UDP).
  1573. @abstractmethod
  1574. def get_host_osc_url_udp(self):
  1575. raise NotImplementedError
  1576. # ------------------------------------------------------------------------------------------------------------
  1577. # Carla Host object (dummy/null, does nothing)
  1578. class CarlaHostNull(CarlaHostMeta):
  1579. def __init__(self):
  1580. CarlaHostMeta.__init__(self)
  1581. self.fEngineCallback = None
  1582. self.fEngineRunning = False
  1583. def get_complete_license_text(self):
  1584. return ""
  1585. def get_juce_version(self):
  1586. return ""
  1587. def get_supported_file_extensions(self):
  1588. return ""
  1589. def get_engine_driver_count(self):
  1590. return 0
  1591. def get_engine_driver_name(self, index):
  1592. return ""
  1593. def get_engine_driver_device_names(self, index):
  1594. return []
  1595. def get_engine_driver_device_info(self, index, name):
  1596. return PyEngineDriverDeviceInfo
  1597. def get_internal_plugin_count(self):
  1598. return 0
  1599. def get_internal_plugin_info(self, index):
  1600. return PyCarlaNativePluginInfo
  1601. def engine_init(self, driverName, clientName):
  1602. self.fEngineRunning = True
  1603. if self.fEngineCallback is not None:
  1604. self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STARTED, 0, self.processMode, self.transportMode, 0.0, driverName)
  1605. return True
  1606. def engine_close(self):
  1607. self.fEngineRunning = False
  1608. if self.fEngineCallback is not None:
  1609. self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0.0, "")
  1610. return True
  1611. def engine_idle(self):
  1612. return
  1613. def is_engine_running(self):
  1614. return False
  1615. def set_engine_about_to_close(self):
  1616. return
  1617. def set_engine_callback(self, func):
  1618. self.fEngineCallback = func
  1619. def set_engine_option(self, option, value, valueStr):
  1620. return
  1621. def set_file_callback(self, func):
  1622. return
  1623. def load_file(self, filename):
  1624. return False
  1625. def load_project(self, filename):
  1626. return False
  1627. def save_project(self, filename):
  1628. return False
  1629. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  1630. return False
  1631. def patchbay_disconnect(self, connectionId):
  1632. return False
  1633. def patchbay_refresh(self, external):
  1634. return False
  1635. def transport_play(self):
  1636. return
  1637. def transport_pause(self):
  1638. return
  1639. def transport_relocate(self, frame):
  1640. return
  1641. def get_current_transport_frame(self):
  1642. return 0
  1643. def get_transport_info(self):
  1644. return PyCarlaTransportInfo
  1645. def get_current_plugin_count(self):
  1646. return 0
  1647. def get_max_plugin_number(self):
  1648. return 0
  1649. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr):
  1650. return False
  1651. def remove_plugin(self, pluginId):
  1652. return False
  1653. def remove_all_plugins(self):
  1654. return False
  1655. def rename_plugin(self, pluginId, newName):
  1656. return ""
  1657. def clone_plugin(self, pluginId):
  1658. return False
  1659. def replace_plugin(self, pluginId):
  1660. return False
  1661. def switch_plugins(self, pluginIdA, pluginIdB):
  1662. return False
  1663. def load_plugin_state(self, pluginId, filename):
  1664. return False
  1665. def save_plugin_state(self, pluginId, filename):
  1666. return False
  1667. def get_plugin_info(self, pluginId):
  1668. return PyCarlaPluginInfo
  1669. def get_audio_port_count_info(self, pluginId):
  1670. return PyCarlaPortCountInfo
  1671. def get_midi_port_count_info(self, pluginId):
  1672. return PyCarlaPortCountInfo
  1673. def get_parameter_count_info(self, pluginId):
  1674. return PyCarlaPortCountInfo
  1675. def get_parameter_info(self, pluginId, parameterId):
  1676. return PyCarlaParameterInfo
  1677. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1678. return PyCarlaScalePointInfo
  1679. def get_parameter_data(self, pluginId, parameterId):
  1680. return PyParameterData
  1681. def get_parameter_ranges(self, pluginId, parameterId):
  1682. return PyParameterRanges
  1683. def get_midi_program_data(self, pluginId, midiProgramId):
  1684. return PyMidiProgramData
  1685. def get_custom_data(self, pluginId, customDataId):
  1686. return PyCustomData
  1687. def get_chunk_data(self, pluginId):
  1688. return ""
  1689. def get_parameter_count(self, pluginId):
  1690. return 0
  1691. def get_program_count(self, pluginId):
  1692. return 0
  1693. def get_midi_program_count(self, pluginId):
  1694. return 0
  1695. def get_custom_data_count(self, pluginId):
  1696. return 0
  1697. def get_parameter_text(self, pluginId, parameterId):
  1698. return ""
  1699. def get_program_name(self, pluginId, programId):
  1700. return ""
  1701. def get_midi_program_name(self, pluginId, midiProgramId):
  1702. return ""
  1703. def get_real_plugin_name(self, pluginId):
  1704. return ""
  1705. def get_current_program_index(self, pluginId):
  1706. return 0
  1707. def get_current_midi_program_index(self, pluginId):
  1708. return 0
  1709. def get_default_parameter_value(self, pluginId, parameterId):
  1710. return 0.0
  1711. def get_current_parameter_value(self, pluginId, parameterId):
  1712. return 0.0
  1713. def get_internal_parameter_value(self, pluginId, parameterId):
  1714. return 0.0
  1715. def get_input_peak_value(self, pluginId, isLeft):
  1716. return 0.0
  1717. def get_output_peak_value(self, pluginId, isLeft):
  1718. return 0.0
  1719. def set_option(self, pluginId, option, yesNo):
  1720. return
  1721. def set_active(self, pluginId, onOff):
  1722. return
  1723. def set_drywet(self, pluginId, value):
  1724. return
  1725. def set_volume(self, pluginId, value):
  1726. return
  1727. def set_balance_left(self, pluginId, value):
  1728. return
  1729. def set_balance_right(self, pluginId, value):
  1730. return
  1731. def set_panning(self, pluginId, value):
  1732. return
  1733. def set_ctrl_channel(self, pluginId, channel):
  1734. return
  1735. def set_parameter_value(self, pluginId, parameterId, value):
  1736. return
  1737. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1738. return
  1739. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  1740. return
  1741. def set_program(self, pluginId, programId):
  1742. return
  1743. def set_midi_program(self, pluginId, midiProgramId):
  1744. return
  1745. def set_custom_data(self, pluginId, type_, key, value):
  1746. return
  1747. def set_chunk_data(self, pluginId, chunkData):
  1748. return
  1749. def prepare_for_save(self, pluginId):
  1750. return
  1751. def reset_parameters(self, pluginId):
  1752. return
  1753. def randomize_parameters(self, pluginId):
  1754. return
  1755. def send_midi_note(self, pluginId, channel, note, velocity):
  1756. return
  1757. def show_custom_ui(self, pluginId, yesNo):
  1758. return
  1759. def get_buffer_size(self):
  1760. return 0
  1761. def get_sample_rate(self):
  1762. return 0.0
  1763. def get_last_error(self):
  1764. return ""
  1765. def get_host_osc_url_tcp(self):
  1766. return ""
  1767. def get_host_osc_url_udp(self):
  1768. return ""
  1769. # ------------------------------------------------------------------------------------------------------------
  1770. # Carla Host object using a DLL
  1771. class CarlaHostDLL(CarlaHostMeta):
  1772. def __init__(self, libName):
  1773. CarlaHostMeta.__init__(self)
  1774. # info about this host object
  1775. self.isPlugin = False
  1776. self.lib = cdll.LoadLibrary(libName)
  1777. self.lib.carla_get_complete_license_text.argtypes = None
  1778. self.lib.carla_get_complete_license_text.restype = c_char_p
  1779. self.lib.carla_get_juce_version.argtypes = None
  1780. self.lib.carla_get_juce_version.restype = c_char_p
  1781. self.lib.carla_get_supported_file_extensions.argtypes = None
  1782. self.lib.carla_get_supported_file_extensions.restype = c_char_p
  1783. self.lib.carla_get_engine_driver_count.argtypes = None
  1784. self.lib.carla_get_engine_driver_count.restype = c_uint
  1785. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  1786. self.lib.carla_get_engine_driver_name.restype = c_char_p
  1787. self.lib.carla_get_engine_driver_device_names.argtypes = [c_uint]
  1788. self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)
  1789. self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p]
  1790. self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)
  1791. self.lib.carla_get_internal_plugin_count.argtypes = None
  1792. self.lib.carla_get_internal_plugin_count.restype = c_uint
  1793. self.lib.carla_get_internal_plugin_info.argtypes = [c_uint]
  1794. self.lib.carla_get_internal_plugin_info.restype = POINTER(CarlaNativePluginInfo)
  1795. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  1796. self.lib.carla_engine_init.restype = c_bool
  1797. self.lib.carla_engine_close.argtypes = None
  1798. self.lib.carla_engine_close.restype = c_bool
  1799. self.lib.carla_engine_idle.argtypes = None
  1800. self.lib.carla_engine_idle.restype = None
  1801. self.lib.carla_is_engine_running.argtypes = None
  1802. self.lib.carla_is_engine_running.restype = c_bool
  1803. self.lib.carla_set_engine_about_to_close.argtypes = None
  1804. self.lib.carla_set_engine_about_to_close.restype = None
  1805. self.lib.carla_set_engine_callback.argtypes = [EngineCallbackFunc, c_void_p]
  1806. self.lib.carla_set_engine_callback.restype = None
  1807. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  1808. self.lib.carla_set_engine_option.restype = None
  1809. self.lib.carla_set_file_callback.argtypes = [FileCallbackFunc, c_void_p]
  1810. self.lib.carla_set_file_callback.restype = None
  1811. self.lib.carla_load_file.argtypes = [c_char_p]
  1812. self.lib.carla_load_file.restype = c_bool
  1813. self.lib.carla_load_project.argtypes = [c_char_p]
  1814. self.lib.carla_load_project.restype = c_bool
  1815. self.lib.carla_save_project.argtypes = [c_char_p]
  1816. self.lib.carla_save_project.restype = c_bool
  1817. self.lib.carla_patchbay_connect.argtypes = [c_uint, c_uint, c_uint, c_uint]
  1818. self.lib.carla_patchbay_connect.restype = c_bool
  1819. self.lib.carla_patchbay_disconnect.argtypes = [c_uint]
  1820. self.lib.carla_patchbay_disconnect.restype = c_bool
  1821. self.lib.carla_patchbay_refresh.argtypes = [c_bool]
  1822. self.lib.carla_patchbay_refresh.restype = c_bool
  1823. self.lib.carla_transport_play.argtypes = None
  1824. self.lib.carla_transport_play.restype = None
  1825. self.lib.carla_transport_pause.argtypes = None
  1826. self.lib.carla_transport_pause.restype = None
  1827. self.lib.carla_transport_relocate.argtypes = [c_uint64]
  1828. self.lib.carla_transport_relocate.restype = None
  1829. self.lib.carla_get_current_transport_frame.argtypes = None
  1830. self.lib.carla_get_current_transport_frame.restype = c_uint64
  1831. self.lib.carla_get_transport_info.argtypes = None
  1832. self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
  1833. self.lib.carla_get_current_plugin_count.argtypes = None
  1834. self.lib.carla_get_current_plugin_count.restype = c_uint32
  1835. self.lib.carla_get_max_plugin_number.argtypes = None
  1836. self.lib.carla_get_max_plugin_number.restype = c_uint32
  1837. self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_int64, c_void_p]
  1838. self.lib.carla_add_plugin.restype = c_bool
  1839. self.lib.carla_remove_plugin.argtypes = [c_uint]
  1840. self.lib.carla_remove_plugin.restype = c_bool
  1841. self.lib.carla_remove_all_plugins.argtypes = None
  1842. self.lib.carla_remove_all_plugins.restype = c_bool
  1843. self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
  1844. self.lib.carla_rename_plugin.restype = c_char_p
  1845. self.lib.carla_clone_plugin.argtypes = [c_uint]
  1846. self.lib.carla_clone_plugin.restype = c_bool
  1847. self.lib.carla_replace_plugin.argtypes = [c_uint]
  1848. self.lib.carla_replace_plugin.restype = c_bool
  1849. self.lib.carla_switch_plugins.argtypes = [c_uint, c_uint]
  1850. self.lib.carla_switch_plugins.restype = c_bool
  1851. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  1852. self.lib.carla_load_plugin_state.restype = c_bool
  1853. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  1854. self.lib.carla_save_plugin_state.restype = c_bool
  1855. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  1856. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  1857. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  1858. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1859. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  1860. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1861. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  1862. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  1863. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  1864. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  1865. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  1866. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  1867. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  1868. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  1869. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  1870. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  1871. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  1872. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  1873. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  1874. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  1875. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  1876. self.lib.carla_get_chunk_data.restype = c_char_p
  1877. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  1878. self.lib.carla_get_parameter_count.restype = c_uint32
  1879. self.lib.carla_get_program_count.argtypes = [c_uint]
  1880. self.lib.carla_get_program_count.restype = c_uint32
  1881. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  1882. self.lib.carla_get_midi_program_count.restype = c_uint32
  1883. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  1884. self.lib.carla_get_custom_data_count.restype = c_uint32
  1885. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
  1886. self.lib.carla_get_parameter_text.restype = c_char_p
  1887. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  1888. self.lib.carla_get_program_name.restype = c_char_p
  1889. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  1890. self.lib.carla_get_midi_program_name.restype = c_char_p
  1891. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  1892. self.lib.carla_get_real_plugin_name.restype = c_char_p
  1893. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  1894. self.lib.carla_get_current_program_index.restype = c_int32
  1895. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  1896. self.lib.carla_get_current_midi_program_index.restype = c_int32
  1897. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  1898. self.lib.carla_get_default_parameter_value.restype = c_float
  1899. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  1900. self.lib.carla_get_current_parameter_value.restype = c_float
  1901. self.lib.carla_get_internal_parameter_value.argtypes = [c_uint, c_int32]
  1902. self.lib.carla_get_internal_parameter_value.restype = c_float
  1903. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_bool]
  1904. self.lib.carla_get_input_peak_value.restype = c_float
  1905. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_bool]
  1906. self.lib.carla_get_output_peak_value.restype = c_float
  1907. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  1908. self.lib.carla_set_option.restype = None
  1909. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  1910. self.lib.carla_set_active.restype = None
  1911. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  1912. self.lib.carla_set_drywet.restype = None
  1913. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  1914. self.lib.carla_set_volume.restype = None
  1915. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  1916. self.lib.carla_set_balance_left.restype = None
  1917. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  1918. self.lib.carla_set_balance_right.restype = None
  1919. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  1920. self.lib.carla_set_panning.restype = None
  1921. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  1922. self.lib.carla_set_ctrl_channel.restype = None
  1923. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  1924. self.lib.carla_set_parameter_value.restype = None
  1925. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  1926. self.lib.carla_set_parameter_midi_channel.restype = None
  1927. self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
  1928. self.lib.carla_set_parameter_midi_cc.restype = None
  1929. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  1930. self.lib.carla_set_program.restype = None
  1931. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  1932. self.lib.carla_set_midi_program.restype = None
  1933. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  1934. self.lib.carla_set_custom_data.restype = None
  1935. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  1936. self.lib.carla_set_chunk_data.restype = None
  1937. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  1938. self.lib.carla_prepare_for_save.restype = None
  1939. self.lib.carla_reset_parameters.argtypes = [c_uint]
  1940. self.lib.carla_reset_parameters.restype = None
  1941. self.lib.carla_randomize_parameters.argtypes = [c_uint]
  1942. self.lib.carla_randomize_parameters.restype = None
  1943. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  1944. self.lib.carla_send_midi_note.restype = None
  1945. self.lib.carla_show_custom_ui.argtypes = [c_uint, c_bool]
  1946. self.lib.carla_show_custom_ui.restype = None
  1947. self.lib.carla_get_buffer_size.argtypes = None
  1948. self.lib.carla_get_buffer_size.restype = c_uint32
  1949. self.lib.carla_get_sample_rate.argtypes = None
  1950. self.lib.carla_get_sample_rate.restype = c_double
  1951. self.lib.carla_get_last_error.argtypes = None
  1952. self.lib.carla_get_last_error.restype = c_char_p
  1953. self.lib.carla_get_host_osc_url_tcp.argtypes = None
  1954. self.lib.carla_get_host_osc_url_tcp.restype = c_char_p
  1955. self.lib.carla_get_host_osc_url_udp.argtypes = None
  1956. self.lib.carla_get_host_osc_url_udp.restype = c_char_p
  1957. # --------------------------------------------------------------------------------------------------------
  1958. def get_complete_license_text(self):
  1959. return charPtrToString(self.lib.carla_get_complete_license_text())
  1960. def get_juce_version(self):
  1961. return charPtrToString(self.lib.carla_get_juce_version())
  1962. def get_supported_file_extensions(self):
  1963. return charPtrToString(self.lib.carla_get_supported_file_extensions())
  1964. def get_engine_driver_count(self):
  1965. return int(self.lib.carla_get_engine_driver_count())
  1966. def get_engine_driver_name(self, index):
  1967. return charPtrToString(self.lib.carla_get_engine_driver_name(index))
  1968. def get_engine_driver_device_names(self, index):
  1969. return charPtrPtrToStringList(self.lib.carla_get_engine_driver_device_names(index))
  1970. def get_engine_driver_device_info(self, index, name):
  1971. return structToDict(self.lib.carla_get_engine_driver_device_info(index, name.encode("utf-8")).contents)
  1972. def get_internal_plugin_count(self):
  1973. return int(self.lib.carla_get_internal_plugin_count())
  1974. def get_internal_plugin_info(self, index):
  1975. return structToDict(self.lib.carla_get_internal_plugin_info(index).contents)
  1976. def engine_init(self, driverName, clientName):
  1977. return bool(self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8")))
  1978. def engine_close(self):
  1979. return bool(self.lib.carla_engine_close())
  1980. def engine_idle(self):
  1981. self.lib.carla_engine_idle()
  1982. def is_engine_running(self):
  1983. return bool(self.lib.carla_is_engine_running())
  1984. def set_engine_about_to_close(self):
  1985. self.lib.carla_set_engine_about_to_close()
  1986. def set_engine_callback(self, func):
  1987. self._engineCallback = EngineCallbackFunc(func)
  1988. self.lib.carla_set_engine_callback(self._engineCallback, None)
  1989. def set_engine_option(self, option, value, valueStr):
  1990. self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
  1991. def set_file_callback(self, func):
  1992. self._fileCallback = FileCallbackFunc(func)
  1993. self.lib.carla_set_file_callback(self._fileCallback, None)
  1994. def load_file(self, filename):
  1995. return bool(self.lib.carla_load_file(filename.encode("utf-8")))
  1996. def load_project(self, filename):
  1997. return bool(self.lib.carla_load_project(filename.encode("utf-8")))
  1998. def save_project(self, filename):
  1999. return bool(self.lib.carla_save_project(filename.encode("utf-8")))
  2000. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  2001. return bool(self.lib.carla_patchbay_connect(groupIdA, portIdA, groupIdB, portIdB))
  2002. def patchbay_disconnect(self, connectionId):
  2003. return bool(self.lib.carla_patchbay_disconnect(connectionId))
  2004. def patchbay_refresh(self, external):
  2005. return bool(self.lib.carla_patchbay_refresh(external))
  2006. def transport_play(self):
  2007. self.lib.carla_transport_play()
  2008. def transport_pause(self):
  2009. self.lib.carla_transport_pause()
  2010. def transport_relocate(self, frame):
  2011. self.lib.carla_transport_relocate(frame)
  2012. def get_current_transport_frame(self):
  2013. return int(self.lib.carla_get_current_transport_frame())
  2014. def get_transport_info(self):
  2015. return structToDict(self.lib.carla_get_transport_info().contents)
  2016. def get_current_plugin_count(self):
  2017. return int(self.lib.carla_get_current_plugin_count())
  2018. def get_max_plugin_number(self):
  2019. return int(self.lib.carla_get_max_plugin_number())
  2020. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr):
  2021. cfilename = filename.encode("utf-8") if filename else None
  2022. cname = name.encode("utf-8") if name else None
  2023. clabel = label.encode("utf-8") if label else None
  2024. return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p)))
  2025. def remove_plugin(self, pluginId):
  2026. return bool(self.lib.carla_remove_plugin(pluginId))
  2027. def remove_all_plugins(self):
  2028. return bool(self.lib.carla_remove_all_plugins())
  2029. def rename_plugin(self, pluginId, newName):
  2030. return charPtrToString(self.lib.carla_rename_plugin(pluginId, newName.encode("utf-8")))
  2031. def clone_plugin(self, pluginId):
  2032. return bool(self.lib.carla_clone_plugin(pluginId))
  2033. def replace_plugin(self, pluginId):
  2034. return bool(self.lib.carla_replace_plugin(pluginId))
  2035. def switch_plugins(self, pluginIdA, pluginIdB):
  2036. return bool(self.lib.carla_switch_plugins(pluginIdA, pluginIdB))
  2037. def load_plugin_state(self, pluginId, filename):
  2038. return bool(self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8")))
  2039. def save_plugin_state(self, pluginId, filename):
  2040. return bool(self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8")))
  2041. def get_plugin_info(self, pluginId):
  2042. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  2043. def get_audio_port_count_info(self, pluginId):
  2044. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  2045. def get_midi_port_count_info(self, pluginId):
  2046. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  2047. def get_parameter_count_info(self, pluginId):
  2048. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  2049. def get_parameter_info(self, pluginId, parameterId):
  2050. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  2051. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  2052. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  2053. def get_parameter_data(self, pluginId, parameterId):
  2054. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  2055. def get_parameter_ranges(self, pluginId, parameterId):
  2056. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  2057. def get_midi_program_data(self, pluginId, midiProgramId):
  2058. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  2059. def get_custom_data(self, pluginId, customDataId):
  2060. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  2061. def get_chunk_data(self, pluginId):
  2062. return charPtrToString(self.lib.carla_get_chunk_data(pluginId))
  2063. def get_parameter_count(self, pluginId):
  2064. return int(self.lib.carla_get_parameter_count(pluginId))
  2065. def get_program_count(self, pluginId):
  2066. return int(self.lib.carla_get_program_count(pluginId))
  2067. def get_midi_program_count(self, pluginId):
  2068. return int(self.lib.carla_get_midi_program_count(pluginId))
  2069. def get_custom_data_count(self, pluginId):
  2070. return int(self.lib.carla_get_custom_data_count(pluginId))
  2071. def get_parameter_text(self, pluginId, parameterId):
  2072. return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId))
  2073. def get_program_name(self, pluginId, programId):
  2074. return charPtrToString(self.lib.carla_get_program_name(pluginId, programId))
  2075. def get_midi_program_name(self, pluginId, midiProgramId):
  2076. return charPtrToString(self.lib.carla_get_midi_program_name(pluginId, midiProgramId))
  2077. def get_real_plugin_name(self, pluginId):
  2078. return charPtrToString(self.lib.carla_get_real_plugin_name(pluginId))
  2079. def get_current_program_index(self, pluginId):
  2080. return int(self.lib.carla_get_current_program_index(pluginId))
  2081. def get_current_midi_program_index(self, pluginId):
  2082. return int(self.lib.carla_get_current_midi_program_index(pluginId))
  2083. def get_default_parameter_value(self, pluginId, parameterId):
  2084. return float(self.lib.carla_get_default_parameter_value(pluginId, parameterId))
  2085. def get_current_parameter_value(self, pluginId, parameterId):
  2086. return float(self.lib.carla_get_current_parameter_value(pluginId, parameterId))
  2087. def get_internal_parameter_value(self, pluginId, parameterId):
  2088. return float(self.lib.carla_get_internal_parameter_value(pluginId, parameterId))
  2089. def get_input_peak_value(self, pluginId, isLeft):
  2090. return float(self.lib.carla_get_input_peak_value(pluginId, isLeft))
  2091. def get_output_peak_value(self, pluginId, isLeft):
  2092. return float(self.lib.carla_get_output_peak_value(pluginId, isLeft))
  2093. def set_option(self, pluginId, option, yesNo):
  2094. self.lib.carla_set_option(pluginId, option, yesNo)
  2095. def set_active(self, pluginId, onOff):
  2096. self.lib.carla_set_active(pluginId, onOff)
  2097. def set_drywet(self, pluginId, value):
  2098. self.lib.carla_set_drywet(pluginId, value)
  2099. def set_volume(self, pluginId, value):
  2100. self.lib.carla_set_volume(pluginId, value)
  2101. def set_balance_left(self, pluginId, value):
  2102. self.lib.carla_set_balance_left(pluginId, value)
  2103. def set_balance_right(self, pluginId, value):
  2104. self.lib.carla_set_balance_right(pluginId, value)
  2105. def set_panning(self, pluginId, value):
  2106. self.lib.carla_set_panning(pluginId, value)
  2107. def set_ctrl_channel(self, pluginId, channel):
  2108. self.lib.carla_set_ctrl_channel(pluginId, channel)
  2109. def set_parameter_value(self, pluginId, parameterId, value):
  2110. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  2111. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  2112. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  2113. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  2114. self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)
  2115. def set_program(self, pluginId, programId):
  2116. self.lib.carla_set_program(pluginId, programId)
  2117. def set_midi_program(self, pluginId, midiProgramId):
  2118. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  2119. def set_custom_data(self, pluginId, type_, key, value):
  2120. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  2121. def set_chunk_data(self, pluginId, chunkData):
  2122. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  2123. def prepare_for_save(self, pluginId):
  2124. self.lib.carla_prepare_for_save(pluginId)
  2125. def reset_parameters(self, pluginId):
  2126. self.lib.carla_reset_parameters(pluginId)
  2127. def randomize_parameters(self, pluginId):
  2128. self.lib.carla_randomize_parameters(pluginId)
  2129. def send_midi_note(self, pluginId, channel, note, velocity):
  2130. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  2131. def show_custom_ui(self, pluginId, yesNo):
  2132. self.lib.carla_show_custom_ui(pluginId, yesNo)
  2133. def get_buffer_size(self):
  2134. return int(self.lib.carla_get_buffer_size())
  2135. def get_sample_rate(self):
  2136. return float(self.lib.carla_get_sample_rate())
  2137. def get_last_error(self):
  2138. return charPtrToString(self.lib.carla_get_last_error())
  2139. def get_host_osc_url_tcp(self):
  2140. return charPtrToString(self.lib.carla_get_host_osc_url_tcp())
  2141. def get_host_osc_url_udp(self):
  2142. return charPtrToString(self.lib.carla_get_host_osc_url_udp())
  2143. # ------------------------------------------------------------------------------------------------------------
  2144. # Helper object for CarlaHostPlugin
  2145. class PluginStoreInfo(object):
  2146. __slots__ = [
  2147. 'pluginInfo',
  2148. 'pluginRealName',
  2149. 'internalValues',
  2150. 'audioCountInfo',
  2151. 'midiCountInfo',
  2152. 'parameterCount',
  2153. 'parameterCountInfo',
  2154. 'parameterInfo',
  2155. 'parameterData',
  2156. 'parameterRanges',
  2157. 'parameterValues',
  2158. 'programCount',
  2159. 'programCurrent',
  2160. 'programNames',
  2161. 'midiProgramCount',
  2162. 'midiProgramCurrent',
  2163. 'midiProgramData',
  2164. 'peaks'
  2165. ]
  2166. # ------------------------------------------------------------------------------------------------------------
  2167. # Carla Host object for plugins (using pipes)
  2168. class CarlaHostPlugin(CarlaHostMeta):
  2169. #class CarlaHostPlugin(CarlaHostMeta, metaclass=PyQtMetaClass):
  2170. def __init__(self):
  2171. CarlaHostMeta.__init__(self)
  2172. # info about this host object
  2173. self.isPlugin = True
  2174. self.processModeForced = True
  2175. # text data to return when requested
  2176. self.fCompleteLicentText = ""
  2177. self.fJuceVersion = ""
  2178. self.fSupportedFileExts = ""
  2179. self.fLastError = ""
  2180. self.fOscUrlTCP = ""
  2181. self.fOscUrlUDP = ""
  2182. # plugin info
  2183. self.fPluginsInfo = []
  2184. # transport info
  2185. self.fTransportInfo = {
  2186. "playing": False,
  2187. "frame": 0,
  2188. "bar": 0,
  2189. "beat": 0,
  2190. "tick": 0,
  2191. "bpm": 0.0
  2192. }
  2193. # some other vars
  2194. self.fHostName = ""
  2195. self.fBufferSize = 0
  2196. self.fSampleRate = 0.0
  2197. # --------------------------------------------------------------------------------------------------------
  2198. # Needs to be reimplemented
  2199. @abstractmethod
  2200. def sendMsg(self, lines):
  2201. raise NotImplementedError
  2202. # internal, sets error if sendMsg failed
  2203. def sendMsgAndSetError(self, lines):
  2204. if self.sendMsg(lines):
  2205. return True
  2206. self.fLastError = "Communication error with backend"
  2207. return False
  2208. # --------------------------------------------------------------------------------------------------------
  2209. def get_complete_license_text(self):
  2210. return self.fCompleteLicentText
  2211. def get_juce_version(self):
  2212. return self.fJuceVersion
  2213. def get_supported_file_extensions(self):
  2214. return self.fSupportedFileExts
  2215. def get_engine_driver_count(self):
  2216. return 1
  2217. def get_engine_driver_name(self, index):
  2218. return "Plugin"
  2219. def get_engine_driver_device_names(self, index):
  2220. return [self.fHostName]
  2221. def get_engine_driver_device_info(self, index, name):
  2222. return PyEngineDriverDeviceInfo
  2223. def get_internal_plugin_count(self):
  2224. return 0
  2225. def get_internal_plugin_info(self, index):
  2226. return PyCarlaNativePluginInfo
  2227. def set_engine_callback(self, func):
  2228. return # TODO
  2229. def set_engine_option(self, option, value, valueStr):
  2230. self.sendMsg(["set_engine_option", option, value, valueStr])
  2231. def set_file_callback(self, func):
  2232. return # TODO
  2233. def load_file(self, filename):
  2234. return self.sendMsgAndSetError(["load_file", filename])
  2235. def load_project(self, filename):
  2236. return self.sendMsgAndSetError(["load_project", filename])
  2237. def save_project(self, filename):
  2238. return self.sendMsgAndSetError(["save_project", filename])
  2239. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  2240. return self.sendMsgAndSetError(["patchbay_connect", groupIdA, portIdA, groupIdB, portIdB])
  2241. def patchbay_disconnect(self, connectionId):
  2242. return self.sendMsgAndSetError(["patchbay_disconnect", connectionId])
  2243. def patchbay_refresh(self, external):
  2244. # don't send external param, never used in plugins
  2245. return self.sendMsgAndSetError(["patchbay_refresh"])
  2246. def transport_play(self):
  2247. self.sendMsg(["transport_play"])
  2248. def transport_pause(self):
  2249. self.sendMsg(["transport_pause"])
  2250. def transport_relocate(self, frame):
  2251. self.sendMsg(["transport_relocate"])
  2252. def get_current_transport_frame(self):
  2253. return self.fTransportInfo['frame']
  2254. def get_transport_info(self):
  2255. return self.fTransportInfo
  2256. def get_current_plugin_count(self):
  2257. return len(self.fPluginsInfo)
  2258. def get_max_plugin_number(self):
  2259. return 0 # TODO
  2260. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr):
  2261. return self.sendMsgAndSetError(["add_plugin", btype, ptype, filename, name, label, uniqueId])
  2262. def remove_plugin(self, pluginId):
  2263. return self.sendMsgAndSetError(["remove_plugin", pluginId])
  2264. def remove_all_plugins(self):
  2265. return self.sendMsgAndSetError(["remove_all_plugins"])
  2266. def rename_plugin(self, pluginId, newName):
  2267. if self.sendMsg(["rename_plugin", pluginId, newName]):
  2268. return newName
  2269. self.fLastError = "Communication error with backend"
  2270. return ""
  2271. def clone_plugin(self, pluginId):
  2272. return self.sendMsgAndSetError(["clone_plugin", pluginId])
  2273. def replace_plugin(self, pluginId):
  2274. return self.sendMsgAndSetError(["replace_plugin", pluginId])
  2275. def switch_plugins(self, pluginIdA, pluginIdB):
  2276. return self.sendMsgAndSetError(["switch_plugins", pluginIdA, pluginIdB])
  2277. def load_plugin_state(self, pluginId, filename):
  2278. return self.sendMsgAndSetError(["load_plugin_state", pluginId, filename])
  2279. def save_plugin_state(self, pluginId, filename):
  2280. return self.sendMsgAndSetError(["save_plugin_state", pluginId, filename])
  2281. def get_plugin_info(self, pluginId):
  2282. return self.fPluginsInfo[pluginId].pluginInfo
  2283. def get_audio_port_count_info(self, pluginId):
  2284. return self.fPluginsInfo[pluginId].audioCountInfo
  2285. def get_midi_port_count_info(self, pluginId):
  2286. return self.fPluginsInfo[pluginId].midiCountInfo
  2287. def get_parameter_count_info(self, pluginId):
  2288. return self.fPluginsInfo[pluginId].parameterCountInfo
  2289. def get_parameter_info(self, pluginId, parameterId):
  2290. return self.fPluginsInfo[pluginId].parameterInfo[parameterId]
  2291. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  2292. return PyCarlaScalePointInfo
  2293. def get_parameter_data(self, pluginId, parameterId):
  2294. return self.fPluginsInfo[pluginId].parameterData[parameterId]
  2295. def get_parameter_ranges(self, pluginId, parameterId):
  2296. return self.fPluginsInfo[pluginId].parameterRanges[parameterId]
  2297. def get_midi_program_data(self, pluginId, midiProgramId):
  2298. return self.fPluginsInfo[pluginId].midiProgramData[midiProgramId]
  2299. def get_custom_data(self, pluginId, customDataId):
  2300. return PyCustomData
  2301. def get_chunk_data(self, pluginId):
  2302. return ""
  2303. def get_parameter_count(self, pluginId):
  2304. return self.fPluginsInfo[pluginId].parameterCount
  2305. def get_program_count(self, pluginId):
  2306. return self.fPluginsInfo[pluginId].programCount
  2307. def get_midi_program_count(self, pluginId):
  2308. return self.fPluginsInfo[pluginId].midiProgramCount
  2309. def get_custom_data_count(self, pluginId):
  2310. return 0
  2311. def get_parameter_text(self, pluginId, parameterId):
  2312. return ""
  2313. def get_program_name(self, pluginId, programId):
  2314. return self.fPluginsInfo[pluginId].programNames[programId]
  2315. def get_midi_program_name(self, pluginId, midiProgramId):
  2316. return self.fPluginsInfo[pluginId].midiProgramData[midiProgramId]['label']
  2317. def get_real_plugin_name(self, pluginId):
  2318. return self.fPluginsInfo[pluginId].pluginRealName
  2319. def get_current_program_index(self, pluginId):
  2320. return self.fPluginsInfo[pluginId].programCurrent
  2321. def get_current_midi_program_index(self, pluginId):
  2322. return self.fPluginsInfo[pluginId].midiProgramCurrent
  2323. def get_default_parameter_value(self, pluginId, parameterId):
  2324. return self.fPluginsInfo[pluginId].parameterRanges[parameterId]['def']
  2325. def get_current_parameter_value(self, pluginId, parameterId):
  2326. return self.fPluginsInfo[pluginId].parameterValues[parameterId]
  2327. def get_internal_parameter_value(self, pluginId, parameterId):
  2328. if parameterId == PARAMETER_NULL or parameterId <= PARAMETER_MAX:
  2329. return 0.0
  2330. if parameterId < 0:
  2331. return self.fPluginsInfo[pluginId].internalValues[abs(parameterId)-2]
  2332. return self.fPluginsInfo[pluginId].parameterValues[parameterId]
  2333. def get_input_peak_value(self, pluginId, isLeft):
  2334. return self.fPluginsInfo[pluginId].peaks[0 if isLeft else 1]
  2335. def get_output_peak_value(self, pluginId, isLeft):
  2336. return self.fPluginsInfo[pluginId].peaks[2 if isLeft else 3]
  2337. def set_option(self, pluginId, option, yesNo):
  2338. self.sendMsg(["set_option", pluginId, option, yesNo])
  2339. def set_active(self, pluginId, onOff):
  2340. self.sendMsg(["set_active", pluginId, onOff])
  2341. def set_drywet(self, pluginId, value):
  2342. self.sendMsg(["set_drywet", pluginId, value])
  2343. def set_volume(self, pluginId, value):
  2344. self.sendMsg(["set_volume", pluginId, value])
  2345. def set_balance_left(self, pluginId, value):
  2346. self.sendMsg(["set_balance_left", pluginId, value])
  2347. def set_balance_right(self, pluginId, value):
  2348. self.sendMsg(["set_balance_right", pluginId, value])
  2349. def set_panning(self, pluginId, value):
  2350. self.sendMsg(["set_panning", pluginId, value])
  2351. def set_ctrl_channel(self, pluginId, channel):
  2352. self.sendMsg(["set_ctrl_channel", pluginId, channel])
  2353. def set_parameter_value(self, pluginId, parameterId, value):
  2354. self.sendMsg(["set_parameter_value", pluginId, parameterId, value])
  2355. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  2356. self.sendMsg(["set_parameter_midi_channel", pluginId, parameterId, channel])
  2357. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  2358. self.sendMsg(["set_parameter_midi_cc", pluginId, parameterId, cc])
  2359. def set_program(self, pluginId, programId):
  2360. self.sendMsg(["set_program", pluginId, programId])
  2361. def set_midi_program(self, pluginId, midiProgramId):
  2362. self.sendMsg(["set_midi_program", pluginId, midiProgramId])
  2363. def set_custom_data(self, pluginId, type_, key, value):
  2364. self.sendMsg(["set_custom_data", pluginId, type_, key, value])
  2365. def set_chunk_data(self, pluginId, chunkData):
  2366. self.sendMsg(["set_chunk_data", pluginId, chunkData])
  2367. def prepare_for_save(self, pluginId):
  2368. self.sendMsg(["prepare_for_save", pluginId])
  2369. def reset_parameters(self, pluginId):
  2370. self.sendMsg(["reset_parameters", pluginId])
  2371. def randomize_parameters(self, pluginId):
  2372. self.sendMsg(["randomize_parameters", pluginId])
  2373. def send_midi_note(self, pluginId, channel, note, velocity):
  2374. self.sendMsg(["send_midi_note", pluginId, channel, note, velocity])
  2375. def show_custom_ui(self, pluginId, yesNo):
  2376. self.sendMsg(["show_custom_ui", pluginId, yesNo])
  2377. def get_buffer_size(self):
  2378. return self.fBufferSize
  2379. def get_sample_rate(self):
  2380. return self.fSampleRate
  2381. def get_last_error(self):
  2382. return self.fLastError
  2383. def get_host_osc_url_tcp(self):
  2384. return self.fOscUrlTCP
  2385. def get_host_osc_url_udp(self):
  2386. return self.fOscUrlUDP
  2387. # --------------------------------------------------------------------------------------------------------
  2388. def _add(self, pluginId):
  2389. if len(self.fPluginsInfo) != pluginId:
  2390. return
  2391. info = PluginStoreInfo()
  2392. info.pluginInfo = PyCarlaPluginInfo
  2393. info.pluginRealName = ""
  2394. info.internalValues = [0.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0]
  2395. info.audioCountInfo = PyCarlaPortCountInfo
  2396. info.midiCountInfo = PyCarlaPortCountInfo
  2397. info.parameterCount = 0
  2398. info.parameterCountInfo = PyCarlaPortCountInfo
  2399. info.parameterInfo = []
  2400. info.parameterData = []
  2401. info.parameterRanges = []
  2402. info.parameterValues = []
  2403. info.programCount = 0
  2404. info.programCurrent = -1
  2405. info.programNames = []
  2406. info.midiProgramCount = 0
  2407. info.midiProgramCurrent = -1
  2408. info.midiProgramData = []
  2409. info.peaks = [0.0, 0.0, 0.0, 0.0]
  2410. self.fPluginsInfo.append(info)
  2411. def _set_pluginInfo(self, pluginId, info):
  2412. self.fPluginsInfo[pluginId].pluginInfo = info
  2413. def _set_pluginName(self, pluginId, name):
  2414. self.fPluginsInfo[pluginId].pluginInfo['name'] = name
  2415. def _set_pluginRealName(self, pluginId, realName):
  2416. self.fPluginsInfo[pluginId].pluginRealName = realName
  2417. def _set_internalValue(self, pluginId, paramIndex, value):
  2418. if pluginId < len(self.fPluginsInfo) and PARAMETER_NULL > paramIndex > PARAMETER_MAX:
  2419. self.fPluginsInfo[pluginId].internalValues[abs(paramIndex)-2] = float(value)
  2420. def _set_audioCountInfo(self, pluginId, info):
  2421. self.fPluginsInfo[pluginId].audioCountInfo = info
  2422. def _set_midiCountInfo(self, pluginId, info):
  2423. self.fPluginsInfo[pluginId].midiCountInfo = info
  2424. def _set_parameterCountInfo(self, pluginId, count, info):
  2425. self.fPluginsInfo[pluginId].parameterCount = count
  2426. self.fPluginsInfo[pluginId].parameterCountInfo = info
  2427. # clear
  2428. self.fPluginsInfo[pluginId].parameterInfo = []
  2429. self.fPluginsInfo[pluginId].parameterData = []
  2430. self.fPluginsInfo[pluginId].parameterRanges = []
  2431. self.fPluginsInfo[pluginId].parameterValues = []
  2432. # add placeholders
  2433. for x in range(count):
  2434. self.fPluginsInfo[pluginId].parameterInfo.append(PyCarlaParameterInfo)
  2435. self.fPluginsInfo[pluginId].parameterData.append(PyParameterData)
  2436. self.fPluginsInfo[pluginId].parameterRanges.append(PyParameterRanges)
  2437. self.fPluginsInfo[pluginId].parameterValues.append(0.0)
  2438. def _set_programCount(self, pluginId, count):
  2439. self.fPluginsInfo[pluginId].programCount = count
  2440. # clear
  2441. self.fPluginsInfo[pluginId].programNames = []
  2442. # add placeholders
  2443. for x in range(count):
  2444. self.fPluginsInfo[pluginId].programNames.append("")
  2445. def _set_midiProgramCount(self, pluginId, count):
  2446. self.fPluginsInfo[pluginId].midiProgramCount = count
  2447. # clear
  2448. self.fPluginsInfo[pluginId].midiProgramData = []
  2449. # add placeholders
  2450. for x in range(count):
  2451. self.fPluginsInfo[pluginId].midiProgramData.append(PyMidiProgramData)
  2452. def _set_parameterInfo(self, pluginId, paramIndex, info):
  2453. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2454. self.fPluginsInfo[pluginId].parameterInfo[paramIndex] = info
  2455. def _set_parameterData(self, pluginId, paramIndex, data):
  2456. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2457. self.fPluginsInfo[pluginId].parameterData[paramIndex] = data
  2458. def _set_parameterRanges(self, pluginId, paramIndex, ranges):
  2459. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2460. self.fPluginsInfo[pluginId].parameterRanges[paramIndex] = ranges
  2461. def _set_parameterValue(self, pluginId, paramIndex, value):
  2462. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2463. self.fPluginsInfo[pluginId].parameterValues[paramIndex] = value
  2464. def _set_parameterDefault(self, pluginId, paramIndex, value):
  2465. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2466. self.fPluginsInfo[pluginId].parameterRanges[paramIndex]['def'] = value
  2467. def _set_parameterMidiChannel(self, pluginId, paramIndex, channel):
  2468. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2469. self.fPluginsInfo[pluginId].parameterData[paramIndex]['midiChannel'] = channel
  2470. def _set_parameterMidiCC(self, pluginId, paramIndex, cc):
  2471. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2472. self.fPluginsInfo[pluginId].parameterData[paramIndex]['midiCC'] = cc
  2473. def _set_currentProgram(self, pluginId, pIndex):
  2474. self.fPluginsInfo[pluginId].programCurrent = pIndex
  2475. def _set_currentMidiProgram(self, pluginId, mpIndex):
  2476. self.fPluginsInfo[pluginId].midiProgramCurrent = mpIndex
  2477. def _set_programName(self, pluginId, pIndex, name):
  2478. if pIndex < self.fPluginsInfo[pluginId].programCount:
  2479. self.fPluginsInfo[pluginId].programNames[pIndex] = name
  2480. def _set_midiProgramData(self, pluginId, mpIndex, data):
  2481. if mpIndex < self.fPluginsInfo[pluginId].midiProgramCount:
  2482. self.fPluginsInfo[pluginId].midiProgramData[mpIndex] = data
  2483. def _set_peaks(self, pluginId, in1, in2, out1, out2):
  2484. self.fPluginsInfo[pluginId].peaks = [in1, in2, out1, out2]
  2485. # ------------------------------------------------------------------------------------------------------------