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.

3280 lines
103KB

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