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.

3329 lines
105KB

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