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.

3901 lines
125KB

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