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.

1944 lines
61KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla Backend code
  4. # Copyright (C) 2011-2013 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 ctypes import *
  20. from platform import architecture
  21. from sys import platform, maxsize
  22. # ------------------------------------------------------------------------------------------------------------
  23. # 64bit check
  24. kIs64bit = bool(architecture()[0] == "64bit" and maxsize > 2**32)
  25. # ------------------------------------------------------------------------------------------------------------
  26. # Define enum type (integer)
  27. c_enum = c_int
  28. # ------------------------------------------------------------------------------------------------------------
  29. # Set Platform
  30. if platform == "darwin":
  31. HAIKU = False
  32. LINUX = False
  33. MACOS = True
  34. WINDOWS = False
  35. elif "haiku" in platform:
  36. HAIKU = True
  37. LINUX = False
  38. MACOS = False
  39. WINDOWS = False
  40. elif "linux" in platform:
  41. HAIKU = False
  42. LINUX = True
  43. MACOS = False
  44. WINDOWS = False
  45. elif platform in ("win32", "win64", "cygwin"):
  46. HAIKU = False
  47. LINUX = False
  48. MACOS = False
  49. WINDOWS = True
  50. else:
  51. HAIKU = False
  52. LINUX = False
  53. MACOS = False
  54. WINDOWS = False
  55. # ------------------------------------------------------------------------------------------------------------
  56. # Convert a ctypes c_char_p into a python string
  57. def charPtrToString(value):
  58. if not value:
  59. return ""
  60. if isinstance(value, str):
  61. return value
  62. return value.decode("utf-8", errors="ignore")
  63. # ------------------------------------------------------------------------------------------------------------
  64. # Convert a ctypes POINTER(c_char_p) into a python string list
  65. def charPtrPtrToStringList(charPtrPtr):
  66. if not charPtrPtr:
  67. return []
  68. i = 0
  69. charPtr = charPtrPtr[0]
  70. strList = []
  71. while charPtr:
  72. strList.append(charPtr.decode("utf-8", errors="ignore"))
  73. i += 1
  74. charPtr = charPtrPtr[i]
  75. return strList
  76. # ------------------------------------------------------------------------------------------------------------
  77. # Convert a ctypes POINTER(c_<num>) into a python number list
  78. def numPtrToList(numPtr):
  79. if not numPtr:
  80. return []
  81. i = 0
  82. num = numPtr[0].value
  83. numList = []
  84. while num not in (0, 0.0):
  85. numList.append(num)
  86. i += 1
  87. num = numPtr[i].value
  88. return numList
  89. # ------------------------------------------------------------------------------------------------------------
  90. # Convert a ctypes struct into a python dict
  91. def structToDict(struct):
  92. return dict((attr, getattr(struct, attr)) for attr, value in struct._fields_)
  93. # ------------------------------------------------------------------------------------------------------------
  94. # Carla Backend API (base definitions)
  95. # Maximum default number of loadable plugins.
  96. MAX_DEFAULT_PLUGINS = 99
  97. # Maximum number of loadable plugins in rack mode.
  98. MAX_RACK_PLUGINS = 16
  99. # Maximum number of loadable plugins in patchbay mode.
  100. MAX_PATCHBAY_PLUGINS = 255
  101. # Maximum default number of parameters allowed.
  102. # @see ENGINE_OPTION_MAX_PARAMETERS
  103. MAX_DEFAULT_PARAMETERS = 200
  104. # ------------------------------------------------------------------------------------------------------------
  105. # Engine Driver Device Hints
  106. # Various engine driver device hints.
  107. # @see carla_get_engine_driver_device_info()
  108. # Engine driver device has custom control-panel.
  109. ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1
  110. # Engine driver device can change buffer-size on the fly.
  111. # @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
  112. ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x2
  113. # Engine driver device can change sample-rate on the fly.
  114. # @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
  115. ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x4
  116. # ------------------------------------------------------------------------------------------------------------
  117. # Plugin Hints
  118. # Various plugin hints.
  119. # @see carla_get_plugin_info()
  120. # Plugin is a bridge.
  121. # This hint is required because "bridge" itself is not a plugin type.
  122. PLUGIN_IS_BRIDGE = 0x001
  123. # Plugin is hard real-time safe.
  124. PLUGIN_IS_RTSAFE = 0x002
  125. # Plugin is a synth (produces sound).
  126. PLUGIN_IS_SYNTH = 0x004
  127. # Plugin has its own custom UI.
  128. # @see carla_show_custom_ui()
  129. PLUGIN_HAS_CUSTOM_UI = 0x008
  130. # Plugin can use internal Dry/Wet control.
  131. PLUGIN_CAN_DRYWET = 0x010
  132. # Plugin can use internal Volume control.
  133. PLUGIN_CAN_VOLUME = 0x020
  134. # Plugin can use internal (Stereo) Balance controls.
  135. PLUGIN_CAN_BALANCE = 0x040
  136. # Plugin can use internal (Mono) Panning control.
  137. PLUGIN_CAN_PANNING = 0x080
  138. # Plugin needs a constant, fixed-size audio buffer.
  139. PLUGIN_NEEDS_FIXED_BUFFERS = 0x100
  140. # Plugin needs all UI events in a single/main thread.
  141. PLUGIN_NEEDS_SINGLE_THREAD = 0x200
  142. # ------------------------------------------------------------------------------------------------------------
  143. # Plugin Options
  144. # Various plugin options.
  145. # @see carla_get_plugin_info() and carla_set_option()
  146. # Use constant/fixed-size audio buffers.
  147. PLUGIN_OPTION_FIXED_BUFFERS = 0x001
  148. # Force mono plugin as stereo.
  149. PLUGIN_OPTION_FORCE_STEREO = 0x002
  150. # Map MIDI programs to plugin programs.
  151. PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004
  152. # Use chunks to save and restore data.
  153. PLUGIN_OPTION_USE_CHUNKS = 0x008
  154. # Send MIDI control change events.
  155. PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010
  156. # Send MIDI channel pressure events.
  157. PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020
  158. # Send MIDI note after-touch events.
  159. PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040
  160. # Send MIDI pitch-bend events.
  161. PLUGIN_OPTION_SEND_PITCHBEND = 0x080
  162. # Send MIDI all-sounds/notes-off events, single note-offs otherwise.
  163. PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100
  164. # ------------------------------------------------------------------------------------------------------------
  165. # Parameter Hints
  166. # Various parameter hints.
  167. # @see CarlaPlugin::getParameterData() and carla_get_parameter_data()
  168. # Parameter value is boolean.
  169. PARAMETER_IS_BOOLEAN = 0x001
  170. # Parameter value is integer.
  171. PARAMETER_IS_INTEGER = 0x002
  172. # Parameter value is logarithmic.
  173. PARAMETER_IS_LOGARITHMIC = 0x004
  174. # Parameter is enabled.
  175. # It can be viewed, changed and stored.
  176. PARAMETER_IS_ENABLED = 0x010
  177. # Parameter is automable (real-time safe).
  178. PARAMETER_IS_AUTOMABLE = 0x020
  179. # Parameter is read-only.
  180. # It cannot be changed.
  181. PARAMETER_IS_READ_ONLY = 0x040
  182. # Parameter needs sample rate to work.
  183. # Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
  184. PARAMETER_USES_SAMPLERATE = 0x100
  185. # Parameter uses scale points to define internal values in a meaningful way.
  186. PARAMETER_USES_SCALEPOINTS = 0x200
  187. # Parameter uses custom text for displaying its value.
  188. # @see carla_get_parameter_text()
  189. PARAMETER_USES_CUSTOM_TEXT = 0x400
  190. # ------------------------------------------------------------------------------------------------------------
  191. # Patchbay Port Hints
  192. # Various patchbay port hints.
  193. # Patchbay port is input.
  194. # When this hint is not set, port is assumed to be output.
  195. PATCHBAY_PORT_IS_INPUT = 0x1
  196. # Patchbay port is of Audio type.
  197. PATCHBAY_PORT_TYPE_AUDIO = 0x2
  198. # Patchbay port is of CV type (Control Voltage).
  199. PATCHBAY_PORT_TYPE_CV = 0x4
  200. # Patchbay port is of MIDI type.
  201. PATCHBAY_PORT_TYPE_MIDI = 0x8
  202. # ------------------------------------------------------------------------------------------------------------
  203. # Custom Data Types
  204. # These types define how the value in the CustomData struct is stored.
  205. # @see CustomData.type
  206. # Boolean string type URI.
  207. # Only "true" and "false" are valid values.
  208. CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean"
  209. # Chunk type URI.
  210. CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"
  211. # String type URI.
  212. CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string"
  213. # ------------------------------------------------------------------------------------------------------------
  214. # Custom Data Keys
  215. # Pre-defined keys used internally in Carla.
  216. # @see CustomData.key
  217. # Plugin options key.
  218. CUSTOM_DATA_KEY_PLUGIN_OPTIONS = "CarlaPluginOptions"
  219. # UI position key.
  220. CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition"
  221. # UI size key.
  222. CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize"
  223. # UI visible key.
  224. CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible"
  225. # ------------------------------------------------------------------------------------------------------------
  226. # Binary Type
  227. # The binary type of a plugin.
  228. # Null binary type.
  229. BINARY_NONE = 0
  230. # POSIX 32bit binary.
  231. BINARY_POSIX32 = 1
  232. # POSIX 64bit binary.
  233. BINARY_POSIX64 = 2
  234. # Windows 32bit binary.
  235. BINARY_WIN32 = 3
  236. # Windows 64bit binary.
  237. BINARY_WIN64 = 4
  238. # Other binary type.
  239. BINARY_OTHER = 5
  240. # ------------------------------------------------------------------------------------------------------------
  241. # Plugin Type
  242. # Plugin type.
  243. # Some files are handled as if they were plugins.
  244. # Null plugin type.
  245. PLUGIN_NONE = 0
  246. # Internal plugin.
  247. PLUGIN_INTERNAL = 1
  248. # LADSPA plugin.
  249. PLUGIN_LADSPA = 2
  250. # DSSI plugin.
  251. PLUGIN_DSSI = 3
  252. # LV2 plugin.
  253. PLUGIN_LV2 = 4
  254. # VST plugin.
  255. PLUGIN_VST = 5
  256. # AU plugin.
  257. # @note MacOS only
  258. PLUGIN_AU = 6
  259. # Csound file.
  260. PLUGIN_CSOUND = 7
  261. # GIG file.
  262. PLUGIN_GIG = 8
  263. # SF2 file (also known as SoundFont).
  264. PLUGIN_SF2 = 9
  265. # SFZ file.
  266. PLUGIN_SFZ = 10
  267. # ------------------------------------------------------------------------------------------------------------
  268. # Plugin Category
  269. # Plugin category, which describes the functionality of a plugin.
  270. # Null plugin category.
  271. PLUGIN_CATEGORY_NONE = 0
  272. # A synthesizer or generator.
  273. PLUGIN_CATEGORY_SYNTH = 1
  274. # A delay or reverb.
  275. PLUGIN_CATEGORY_DELAY = 2
  276. # An equalizer.
  277. PLUGIN_CATEGORY_EQ = 3
  278. # A filter.
  279. PLUGIN_CATEGORY_FILTER = 4
  280. # A distortion plugin.
  281. PLUGIN_CATEGORY_DISTORTION = 5
  282. # A 'dynamic' plugin (amplifier, compressor, gate, etc).
  283. PLUGIN_CATEGORY_DYNAMICS = 6
  284. # A 'modulator' plugin (chorus, flanger, phaser, etc).
  285. PLUGIN_CATEGORY_MODULATOR = 7
  286. # An 'utility' plugin (analyzer, converter, mixer, etc).
  287. PLUGIN_CATEGORY_UTILITY = 8
  288. # Miscellaneous plugin (used to check if the plugin has a category).
  289. PLUGIN_CATEGORY_OTHER = 9
  290. # ------------------------------------------------------------------------------------------------------------
  291. # Parameter Type
  292. # Plugin parameter type.
  293. # Null parameter type.
  294. PARAMETER_UNKNOWN = 0
  295. # Input parameter.
  296. PARAMETER_INPUT = 1
  297. # Ouput parameter.
  298. PARAMETER_OUTPUT = 2
  299. # Special (hidden) parameter.
  300. PARAMETER_SPECIAL = 3
  301. # ------------------------------------------------------------------------------------------------------------
  302. # Internal Parameter Index
  303. # Special parameters used internally in Carla.
  304. # Plugins do not know about their existence.
  305. # Null parameter.
  306. PARAMETER_NULL = -1
  307. # Active parameter, boolean type.
  308. # Default is 'false'.
  309. PARAMETER_ACTIVE = -2
  310. # Dry/Wet parameter.
  311. # Range 0.0...1.0; default is 1.0.
  312. PARAMETER_DRYWET = -3
  313. # Volume parameter.
  314. # Range 0.0...1.27; default is 1.0.
  315. PARAMETER_VOLUME = -4
  316. # Stereo Balance-Left parameter.
  317. # Range -1.0...1.0; default is -1.0.
  318. PARAMETER_BALANCE_LEFT = -5
  319. # Stereo Balance-Right parameter.
  320. # Range -1.0...1.0; default is 1.0.
  321. PARAMETER_BALANCE_RIGHT = -6
  322. # Mono Panning parameter.
  323. # Range -1.0...1.0; default is 0.0.
  324. PARAMETER_PANNING = -7
  325. # MIDI Control channel, integer type.
  326. # Range -1...15 (-1 = off).
  327. PARAMETER_CTRL_CHANNEL = -8
  328. # Max value, defined only for convenience.
  329. PARAMETER_MAX = -9
  330. # ------------------------------------------------------------------------------------------------------------
  331. # Engine Callback Opcode
  332. # Engine callback opcodes.
  333. # Front-ends must never block indefinitely during a callback.
  334. # @see EngineCallbackFunc and carla_set_engine_callback()
  335. # Debug.
  336. # This opcode is undefined and used only for testing purposes.
  337. ENGINE_CALLBACK_DEBUG = 0
  338. # A plugin has been added.
  339. # @param pluginId Plugin Id
  340. # @param valueStr Plugin name
  341. ENGINE_CALLBACK_PLUGIN_ADDED = 1
  342. # A plugin has been removed.
  343. # @param pluginId Plugin Id
  344. ENGINE_CALLBACK_PLUGIN_REMOVED = 2
  345. # A plugin has been renamed.
  346. # @param pluginId Plugin Id
  347. # @param valueStr New plugin name
  348. ENGINE_CALLBACK_PLUGIN_RENAMED = 3
  349. # A plugin has become unavailable.
  350. # @param pluginId Plugin Id
  351. # @param valueStr Related error string
  352. ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4
  353. # A parameter value has changed.
  354. # @param pluginId Plugin Id
  355. # @param value1 Parameter index
  356. # @param value3 New parameter value
  357. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5
  358. # A parameter default has changed.
  359. # @param pluginId Plugin Id
  360. # @param value1 Parameter index
  361. # @param value3 New default value
  362. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6
  363. # A parameter's MIDI CC has changed.
  364. # @param pluginId Plugin Id
  365. # @param value1 Parameter index
  366. # @param value2 New MIDI CC
  367. ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED = 7
  368. # A parameter's MIDI channel has changed.
  369. # @param pluginId Plugin Id
  370. # @param value1 Parameter index
  371. # @param value2 New MIDI channel
  372. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8
  373. # The current program of a plugin has changed.
  374. # @param pluginId Plugin Id
  375. # @param value1 New program index
  376. ENGINE_CALLBACK_PROGRAM_CHANGED = 9
  377. # The current MIDI program of a plugin has changed.
  378. # @param pluginId Plugin Id
  379. # @param value1 New MIDI program index
  380. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 10
  381. # A plugin's custom UI state has changed.
  382. # @param pluginId Plugin Id
  383. # @param value1 New state, as follows:
  384. # 0: UI is now hidden
  385. # 1: UI is now visible
  386. # -1: UI has crashed and should not be shown again
  387. ENGINE_CALLBACK_UI_STATE_CHANGED = 11
  388. # A note has been pressed.
  389. # @param pluginId Plugin Id
  390. # @param value1 Channel
  391. # @param value2 Note
  392. # @param value3 Velocity
  393. ENGINE_CALLBACK_NOTE_ON = 12
  394. # A note has been released.
  395. # @param pluginId Plugin Id
  396. # @param value1 Channel
  397. # @param value2 Note
  398. ENGINE_CALLBACK_NOTE_OFF = 13
  399. # A plugin needs update.
  400. # @param pluginId Plugin Id
  401. ENGINE_CALLBACK_UPDATE = 14
  402. # A plugin's data/information has changed.
  403. # @param pluginId Plugin Id
  404. ENGINE_CALLBACK_RELOAD_INFO = 15
  405. # A plugin's parameters have changed.
  406. # @param pluginId Plugin Id
  407. ENGINE_CALLBACK_RELOAD_PARAMETERS = 16
  408. # A plugin's programs have changed.
  409. # @param pluginId Plugin Id
  410. ENGINE_CALLBACK_RELOAD_PROGRAMS = 17
  411. # A plugin state has changed.
  412. # @param pluginId Plugin Id
  413. ENGINE_CALLBACK_RELOAD_ALL = 18
  414. # A patchbay client has been added.
  415. # @param pluginId Client Id
  416. # @param value1 Client icon
  417. # @param valueStr Client name
  418. # @see PatchbayIcon
  419. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 19
  420. # A patchbay client has been removed.
  421. # @param pluginId Client Id
  422. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 20
  423. # A patchbay client has been renamed.
  424. # @param pluginId Client Id
  425. # @param valueStr New client name
  426. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 21
  427. # A patchbay client icon has changed.
  428. # @param pluginId Client Id
  429. # @param value1 New icon
  430. # @see PatchbayIcon
  431. ENGINE_CALLBACK_PATCHBAY_CLIENT_ICON_CHANGED = 22
  432. # A patchbay port has been added.
  433. # @param pluginId Client Id
  434. # @param value1 Port Id
  435. # @param value2 Port hints
  436. # @param valueStr Port name
  437. # @see PatchbayPortHints
  438. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 23
  439. # A patchbay port has been removed.
  440. # @param pluginId Client Id
  441. # @param value1 Port Id
  442. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 24
  443. # A patchbay port has been renamed.
  444. # @param pluginId Client Id
  445. # @param value1 Port Id
  446. # @param valueStr New port name
  447. ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED = 25
  448. # A patchbay connection has been added.
  449. # @param pluginId Connection Id
  450. # @param value1 Output port Id
  451. # @param value2 Input port Id
  452. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 26
  453. # A patchbay connection has been removed.
  454. # @param pluginId Connection Id
  455. # @param value1 Output port Id
  456. # @param value2 Input port Id
  457. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 27
  458. # Engine started.
  459. # @param value1 Process mode
  460. # @param value2 Transport mode
  461. # @param valuestr Engine driver
  462. # @see EngineProcessMode
  463. # @see EngineTransportMode
  464. ENGINE_CALLBACK_ENGINE_STARTED = 28
  465. # Engine stopped.
  466. ENGINE_CALLBACK_ENGINE_STOPPED = 29
  467. # Engine process mode has changed.
  468. # @param value1 New process mode
  469. # @see EngineProcessMode
  470. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 30
  471. # Engine transport mode has changed.
  472. # @param value1 New transport mode
  473. # @see EngineTransportMode
  474. ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 31
  475. # Engine buffer-size changed.
  476. # @param value1 New buffer size
  477. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 32
  478. # Engine sample-rate changed.
  479. # @param value3 New sample rate
  480. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 33
  481. # Show a message as information.
  482. # @param valueStr The message
  483. ENGINE_CALLBACK_INFO = 34
  484. # Show a message as an error.
  485. # @param valueStr The message
  486. ENGINE_CALLBACK_ERROR = 35
  487. # The engine has crashed or malfunctioned and will no longer work.
  488. ENGINE_CALLBACK_QUIT = 36
  489. # ------------------------------------------------------------------------------------------------------------
  490. # Engine Option
  491. # Engine options.
  492. # @see carla_set_engine_option()
  493. # Debug.
  494. # This option is undefined and used only for testing purposes.
  495. ENGINE_OPTION_DEBUG = 0
  496. # Set the engine processing mode.
  497. # Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_CONTINUOUS_RACK for all other OSes.
  498. # @see EngineProcessMode
  499. ENGINE_OPTION_PROCESS_MODE = 1
  500. # Set the engine transport mode.
  501. # Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
  502. # @see EngineTransportMode
  503. ENGINE_OPTION_TRANSPORT_MODE = 2
  504. # Force mono plugins as stereo, by running 2 instances at the same time.
  505. # Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
  506. # @note Not supported by all plugins
  507. # @see PLUGIN_OPTION_FORCE_STEREO
  508. ENGINE_OPTION_FORCE_STEREO = 3
  509. # Use plugin bridges whenever possible.
  510. # Default is no, EXPERIMENTAL.
  511. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4
  512. # Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
  513. # Default is yes.
  514. ENGINE_OPTION_PREFER_UI_BRIDGES = 5
  515. # Make custom plugin UIs always-on-top.
  516. # Default is yes.
  517. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6
  518. # Maximum number of parameters allowed.
  519. # Default is MAX_DEFAULT_PARAMETERS.
  520. ENGINE_OPTION_MAX_PARAMETERS = 7
  521. # Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  522. # Default is 4000 (4 seconds).
  523. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8
  524. # Audio number of periods.
  525. # Default is 2.
  526. ENGINE_OPTION_AUDIO_NUM_PERIODS = 9
  527. # Audio buffer size.
  528. # Default is 512.
  529. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10
  530. # Audio sample rate.
  531. # Default is 44100.
  532. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11
  533. # Audio device (within a driver).
  534. # Default unset.
  535. ENGINE_OPTION_AUDIO_DEVICE = 12
  536. # Set path to the binary files.
  537. # Default unset.
  538. # @note Must be set for plugin and UI bridges to work
  539. ENGINE_OPTION_PATH_BINARIES = 13
  540. # Set path to the resource files.
  541. # Default unset.
  542. # @note Must be set for some internal plugins to work
  543. ENGINE_OPTION_PATH_RESOURCES = 14
  544. # ------------------------------------------------------------------------------------------------------------
  545. # Engine Process Mode
  546. # Engine process mode.
  547. # @see ENGINE_OPTION_PROCESS_MODE
  548. # Single client mode.
  549. # Inputs and outputs are added dynamically as needed by plugins.
  550. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0
  551. # Multiple client mode.
  552. # It has 1 master client + 1 client per plugin.
  553. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1
  554. # Single client, 'rack' mode.
  555. # Processes plugins in order of Id, with forced stereo always on.
  556. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2
  557. # Single client, 'patchbay' mode.
  558. ENGINE_PROCESS_MODE_PATCHBAY = 3
  559. # Special mode, used in plugin-bridges only.
  560. ENGINE_PROCESS_MODE_BRIDGE = 4
  561. # ------------------------------------------------------------------------------------------------------------
  562. # Engine Transport Mode
  563. # Engine transport mode.
  564. # @see ENGINE_OPTION_TRANSPORT_MODE
  565. # Internal transport mode.
  566. ENGINE_TRANSPORT_MODE_INTERNAL = 0
  567. # Transport from JACK.
  568. # Only available if driver name is "JACK".
  569. ENGINE_TRANSPORT_MODE_JACK = 1
  570. # Transport from host, used when Carla is a plugin.
  571. ENGINE_TRANSPORT_MODE_PLUGIN = 2
  572. # Special mode, used in plugin-bridges only.
  573. ENGINE_TRANSPORT_MODE_BRIDGE = 3
  574. # ------------------------------------------------------------------------------------------------------------
  575. # Patchbay Icon
  576. # The icon of a patchbay client/group.
  577. # Generic application icon.
  578. # Used for all non-plugin clients that don't have a specific icon.
  579. PATCHBAY_ICON_APPLICATION = 0
  580. # Plugin icon.
  581. # Used for all plugin clients that don't have a specific icon.
  582. PATCHBAY_ICON_PLUGIN = 1
  583. # Hardware icon.
  584. # Used for hardware (audio or MIDI) clients.
  585. PATCHBAY_ICON_HARDWARE = 2
  586. # Carla icon.
  587. # Used for the main app.
  588. PATCHBAY_ICON_CARLA = 3
  589. # DISTRHO icon.
  590. # Used for DISTRHO based plugins.
  591. PATCHBAY_ICON_DISTRHO = 4
  592. # File icon.
  593. # Used for file type plugins (like GIG and SF2).
  594. PATCHBAY_ICON_FILE = 5
  595. # ------------------------------------------------------------------------------------------------------------
  596. # Carla Backend API (C stuff)
  597. # Engine callback function.
  598. # Front-ends must never block indefinitely during a callback.
  599. # @see EngineCallbackOpcode and carla_set_engine_callback()
  600. EngineCallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_float, c_char_p)
  601. # Parameter data.
  602. class ParameterData(Structure):
  603. _fields_ = [
  604. # This parameter type.
  605. ("type", c_enum),
  606. # This parameter hints.
  607. # @see ParameterHints
  608. ("hints", c_uint),
  609. # Index as seen by Carla.
  610. ("index", c_int32),
  611. # Real index as seen by plugins.
  612. ("rindex", c_int32),
  613. # Currently mapped MIDI CC.
  614. # A value lower than 0 means invalid or unused.
  615. # Maximum allowed value is 95 (0x5F).
  616. ("midiCC", c_int16),
  617. # Currently mapped MIDI channel.
  618. # Counts from 0 to 15.
  619. ("midiChannel", c_uint8)
  620. ]
  621. # Parameter ranges.
  622. class ParameterRanges(Structure):
  623. _fields_ = [
  624. # Default value.
  625. ("def", c_float),
  626. # Minimum value.
  627. ("min", c_float),
  628. # Maximum value.
  629. ("max", c_float),
  630. # Regular, single step value.
  631. ("step", c_float),
  632. # Small step value.
  633. ("stepSmall", c_float),
  634. # Large step value.
  635. ("stepLarge", c_float)
  636. ]
  637. # MIDI Program data.
  638. class MidiProgramData(Structure):
  639. _fields_ = [
  640. # MIDI bank.
  641. ("bank", c_uint32),
  642. # MIDI program.
  643. ("program", c_uint32),
  644. # MIDI program name.
  645. ("name", c_char_p)
  646. ]
  647. # Custom data, used for saving key:value 'dictionaries'.
  648. class CustomData(Structure):
  649. _fields_ = [
  650. # Value type, in URI form.
  651. # @see CustomDataTypes
  652. ("type", c_char_p),
  653. # Key.
  654. # @see CustomDataKeys
  655. ("key", c_char_p),
  656. # Value.
  657. ("value", c_char_p)
  658. ]
  659. # Engine driver device information.
  660. class EngineDriverDeviceInfo(Structure):
  661. _fields_ = [
  662. # This driver device hints.
  663. # @see EngineDriverHints
  664. ("hints", c_uint),
  665. # Available buffer sizes.
  666. # Terminated with 0.
  667. ("bufferSizes", POINTER(c_uint32)),
  668. # Available sample rates.
  669. # Terminated with 0.0.
  670. ("sampleRates", POINTER(c_double))
  671. ]
  672. # ------------------------------------------------------------------------------------------------------------
  673. # Carla Backend API (Python compatible stuff)
  674. # @see ParameterData
  675. PyParameterData = {
  676. 'type': PARAMETER_UNKNOWN,
  677. 'hints': 0x0,
  678. 'index': PARAMETER_NULL,
  679. 'rindex': -1,
  680. 'midiCC': -1,
  681. 'midiChannel': 0
  682. }
  683. # @see ParameterRanges
  684. PyParameterRanges = {
  685. 'def': 0.0,
  686. 'min': 0.0,
  687. 'max': 1.0,
  688. 'step': 0.01,
  689. 'stepSmall': 0.0001,
  690. 'stepLarge': 0.1
  691. }
  692. # @see MidiProgramData
  693. PyMidiProgramData = {
  694. 'bank': 0,
  695. 'program': 0,
  696. 'name': None
  697. }
  698. # @see CustomData
  699. PyCustomData = {
  700. 'type': None,
  701. 'key': None,
  702. 'value': None
  703. }
  704. # @see EngineDriverDeviceInfo
  705. PyEngineDriverDeviceInfo = {
  706. 'hints': 0x0,
  707. 'bufferSizes': [],
  708. 'sampleRates': []
  709. }
  710. # ------------------------------------------------------------------------------------------------------------
  711. # File Callback Opcode
  712. # File callback opcodes.
  713. # Front-ends must always block-wait for user input.
  714. # @see FileCallbackFunc and carla_set_file_callback()
  715. # Debug.
  716. # This opcode is undefined and used only for testing purposes.
  717. FILE_CALLBACK_DEBUG = 0
  718. # Open file or folder.
  719. FILE_CALLBACK_OPEN = 1
  720. # Save file or folder.
  721. FILE_CALLBACK_SAVE = 2
  722. # ------------------------------------------------------------------------------------------------------------
  723. # Carla Host API (C stuff)
  724. # File callback function.
  725. # @see FileCallbackOpcode
  726. FileCallbackFunc = CFUNCTYPE(c_char_p, c_void_p, c_enum, c_bool, c_char_p, c_char_p)
  727. # Information about a loaded plugin.
  728. # @see carla_get_plugin_info()
  729. class CarlaPluginInfo(Structure):
  730. _fields_ = [
  731. # Plugin type.
  732. ("type", c_enum),
  733. # Plugin category.
  734. ("category", c_enum),
  735. # Plugin hints.
  736. # @see PluginHints
  737. ("hints", c_uint),
  738. # Plugin options available for the user to change.
  739. # @see PluginOptions
  740. ("optionsAvailable", c_uint),
  741. # Plugin options currently enabled.
  742. # Some options are enabled but not available, which means they will always be on.
  743. # @see PluginOptions
  744. ("optionsEnabled", c_uint),
  745. # Plugin filename.
  746. # This can be the plugin binary or resource file.
  747. ("filename", c_char_p),
  748. # Plugin name.
  749. # This name is unique within a Carla instance.
  750. # @see carla_get_real_plugin_name()
  751. ("name", c_char_p),
  752. # Plugin label or URI.
  753. ("label", c_char_p),
  754. # Plugin author/maker.
  755. ("maker", c_char_p),
  756. # Plugin copyright/license.
  757. ("copyright", c_char_p),
  758. # Icon name for this plugin, in lowercase.
  759. # Default is "plugin".
  760. ("iconName", c_char_p),
  761. # Patchbay client Id for this plugin.
  762. # When 0, Id is considered invalid or unused.
  763. ("patchbayClientId", c_int),
  764. # Plugin unique Id.
  765. # This Id is dependant on the plugin type and may sometimes be 0.
  766. ("uniqueId", c_long)
  767. ]
  768. # Information about an internal Carla plugin.
  769. # @see carla_get_internal_plugin_info()
  770. class CarlaNativePluginInfo(Structure):
  771. _fields_ = [
  772. # Plugin category.
  773. ("category", c_enum),
  774. # Plugin hints.
  775. # @see PluginHints
  776. ("hints", c_uint),
  777. # Number of audio inputs.
  778. ("audioIns", c_uint32),
  779. # Number of audio outputs.
  780. ("audioOuts", c_uint32),
  781. # Number of MIDI inputs.
  782. ("midiIns", c_uint32),
  783. # Number of MIDI outputs.
  784. ("midiOuts", c_uint32),
  785. # Number of input parameters.
  786. ("parameterIns", c_uint32),
  787. # Number of output parameters.
  788. ("parameterOuts", c_uint32),
  789. # Plugin name.
  790. ("name", c_char_p),
  791. # Plugin label.
  792. ("label", c_char_p),
  793. # Plugin author/maker.
  794. ("maker", c_char_p),
  795. # Plugin copyright/license.
  796. ("copyright", c_char_p)
  797. ]
  798. # Port count information, used for Audio and MIDI ports and parameters.
  799. # @see carla_get_audio_port_count_info()
  800. # @see carla_get_midi_port_count_info()
  801. # @see carla_get_parameter_count_info()
  802. class CarlaPortCountInfo(Structure):
  803. _fields_ = [
  804. # Number of inputs.
  805. ("ins", c_uint32),
  806. # Number of outputs.
  807. ("outs", c_uint32)
  808. ]
  809. # Parameter information.
  810. # @see carla_get_parameter_info()
  811. class CarlaParameterInfo(Structure):
  812. _fields_ = [
  813. # Parameter name.
  814. ("name", c_char_p),
  815. # Parameter symbol.
  816. ("symbol", c_char_p),
  817. # Parameter unit.
  818. ("unit", c_char_p),
  819. # Number of scale points.
  820. # @see CarlaScalePointInfo
  821. ("scalePointCount", c_uint32)
  822. ]
  823. # Parameter scale point information.
  824. # @see carla_get_parameter_scalepoint_info()
  825. class CarlaScalePointInfo(Structure):
  826. _fields_ = [
  827. # Scale point value.
  828. ("value", c_float),
  829. # Scale point label.
  830. ("label", c_char_p)
  831. ]
  832. # Transport information.
  833. # @see carla_get_transport_info()
  834. class CarlaTransportInfo(Structure):
  835. _fields_ = [
  836. # Wherever transport is playing.
  837. ("playing", c_bool),
  838. # Current transport frame.
  839. ("frame", c_uint64),
  840. # Bar
  841. ("bar", c_int32),
  842. # Beat
  843. ("beat", c_int32),
  844. # Tick
  845. ("tick", c_int32),
  846. # Beats per minute.
  847. ("bpm", c_double)
  848. ]
  849. # ------------------------------------------------------------------------------------------------------------
  850. # Carla Host API (Python compatible stuff)
  851. # @see CarlaPluginInfo
  852. PyCarlaPluginInfo = {
  853. 'type': PLUGIN_NONE,
  854. 'category': PLUGIN_CATEGORY_NONE,
  855. 'hints': 0x0,
  856. 'optionsAvailable': 0x0,
  857. 'optionsEnabled': 0x0,
  858. 'filename': None,
  859. 'name': None,
  860. 'label': None,
  861. 'maker': None,
  862. 'copyright': None,
  863. 'iconName': None,
  864. 'patchbayClientId': 0,
  865. 'uniqueId': 0
  866. }
  867. # @see CarlaPortCountInfo
  868. PyCarlaPortCountInfo = {
  869. 'ins': 0,
  870. 'outs': 0
  871. }
  872. # @see CarlaParameterInfo
  873. PyCarlaParameterInfo = {
  874. 'name': None,
  875. 'symbol': None,
  876. 'unit': None,
  877. 'scalePointCount': 0,
  878. }
  879. # @see CarlaScalePointInfo
  880. PyCarlaScalePointInfo = {
  881. 'value': 0.0,
  882. 'label': None
  883. }
  884. # @see CarlaTransportInfo
  885. PyCarlaTransportInfo = {
  886. "playing": False,
  887. "frame": 0,
  888. "bar": 0,
  889. "beat": 0,
  890. "tick": 0,
  891. "bpm": 0.0
  892. }
  893. # ------------------------------------------------------------------------------------------------------------
  894. # Set BINARY_NATIVE
  895. if HAIKU or LINUX or MACOS:
  896. BINARY_NATIVE = BINARY_POSIX64 if kIs64bit else BINARY_POSIX32
  897. elif WINDOWS:
  898. BINARY_NATIVE = BINARY_WIN64 if kIs64bit else BINARY_WIN32
  899. else:
  900. BINARY_NATIVE = BINARY_OTHER
  901. # ------------------------------------------------------------------------------------------------------------
  902. # Python Host object (Control/Standalone)
  903. class Host(object):
  904. def __init__(self, libName):
  905. object.__init__(self)
  906. self._init(libName)
  907. # Get the complete license text of used third-party code and features.
  908. # Returned string is in basic html format.
  909. def get_complete_license_text(self):
  910. return charPtrToString(self.lib.carla_get_complete_license_text())
  911. # Get all the supported file extensions in carla_load_file().
  912. # Returned string uses this syntax:
  913. # @code
  914. # "*.ext1;*.ext2;*.ext3"
  915. # @endcode
  916. def get_supported_file_extensions(self):
  917. return charPtrToString(self.lib.carla_get_supported_file_extensions())
  918. # Get how many engine drivers are available.
  919. def get_engine_driver_count(self):
  920. return int(self.lib.carla_get_engine_driver_count())
  921. # Get an engine driver name.
  922. # @param index Driver index
  923. def get_engine_driver_name(self, index):
  924. return charPtrToString(self.lib.carla_get_engine_driver_name(index))
  925. # Get the device names of an engine driver.
  926. # @param index Driver index
  927. def get_engine_driver_device_names(self, index):
  928. return charPtrPtrToStringList(self.lib.carla_get_engine_driver_device_names(index))
  929. # Get information about a device driver.
  930. # @param index Driver index
  931. # @param name Device name
  932. def get_engine_driver_device_info(self, index, name):
  933. return structToDict(self.lib.carla_get_engine_driver_device_info(index, name).contents)
  934. # Get how many internal plugins are available.
  935. def get_internal_plugin_count(self):
  936. return int(self.lib.carla_get_internal_plugin_count())
  937. # Get information about an internal plugin.
  938. # @param index Internal plugin Id
  939. def get_internal_plugin_info(self, index):
  940. return structToDict(self.lib.carla_get_internal_plugin_info(index).contents)
  941. # Initialize the engine.
  942. # Make sure to call carla_engine_idle() at regular intervals afterwards.
  943. # @param driverName Driver to use
  944. # @param clientName Engine master client name
  945. def engine_init(self, driverName, clientName):
  946. return bool(self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8")))
  947. # Close the engine.
  948. # This function always closes the engine even if it returns false.
  949. # In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
  950. def engine_close(self):
  951. return bool(self.lib.carla_engine_close())
  952. # Idle the engine.
  953. # Do not call this if the engine is not running.
  954. def engine_idle(self):
  955. self.lib.carla_engine_idle()
  956. # Check if the engine is running.
  957. def is_engine_running(self):
  958. return bool(self.lib.carla_is_engine_running())
  959. # Tell the engine it's about to close.
  960. # This is used to prevent the engine thread(s) from reactivating.
  961. def set_engine_about_to_close(self):
  962. self.lib.carla_set_engine_about_to_close()
  963. # Set the engine callback function.
  964. # @param func Callback function
  965. def set_engine_callback(self, func):
  966. self._engineCallback = EngineCallbackFunc(func)
  967. self.lib.carla_set_engine_callback(self._engineCallback, None)
  968. # Set an engine option.
  969. # @param option Option
  970. # @param value Value as number
  971. # @param valueStr Value as string
  972. def set_engine_option(self, option, value, valueStr):
  973. self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
  974. # Set the file callback function.
  975. # @param func Callback function
  976. # @param ptr Callback pointer
  977. def set_file_callback(self, func):
  978. self._fileCallback = FileCallbackFunc(func)
  979. self.lib.carla_set_file_callback(self._fileCallback, None)
  980. # Load a file of any type.\n
  981. # This will try to load a generic file as a plugin,
  982. # either by direct handling (Csound, GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
  983. # @param Filename Filename
  984. # @see carla_get_supported_file_extensions()
  985. def load_file(self, filename):
  986. return bool(self.lib.carla_load_file(filename.encode("utf-8")))
  987. # Load a Carla project file.
  988. # @param Filename Filename
  989. # @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
  990. def load_project(self, filename):
  991. return bool(self.lib.carla_load_project(filename.encode("utf-8")))
  992. # Save current project to a file.
  993. # @param Filename Filename
  994. def save_project(self, filename):
  995. return bool(self.lib.carla_save_project(filename.encode("utf-8")))
  996. # Connect two patchbay ports.
  997. # @param portIdA Output port
  998. # @param portIdB Input port
  999. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
  1000. def patchbay_connect(self, portIdA, portIdB):
  1001. return bool(self.lib.carla_patchbay_connect(portIdA, portIdB))
  1002. # Disconnect two patchbay ports.
  1003. # @param connectionId Connection Id
  1004. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
  1005. def patchbay_disconnect(self, connectionId):
  1006. return bool(self.lib.carla_patchbay_disconnect(connectionId))
  1007. # Force the engine to resend all patchbay clients, ports and connections again.
  1008. def patchbay_refresh(self):
  1009. return bool(self.lib.carla_patchbay_refresh())
  1010. # Start playback of the engine transport.
  1011. def transport_play(self):
  1012. self.lib.carla_transport_play()
  1013. # Pause the engine transport.
  1014. def transport_pause(self):
  1015. self.lib.carla_transport_pause()
  1016. # Relocate the engine transport to a specific frame.
  1017. # @param frames Frame to relocate to.
  1018. def transport_relocate(self, frame):
  1019. self.lib.carla_transport_relocate(frame)
  1020. # Get the current transport frame.
  1021. def get_current_transport_frame(self):
  1022. return bool(self.lib.carla_get_current_transport_frame())
  1023. # Get the engine transport information.
  1024. def get_transport_info(self):
  1025. return structToDict(self.lib.carla_get_transport_info().contents)
  1026. # Add a new plugin.
  1027. # If you don't know the binary type use the BINARY_NATIVE macro.
  1028. # @param btype Binary type
  1029. # @param ptype Plugin type
  1030. # @param filename Filename, if applicable
  1031. # @param name Name of the plugin, can be NULL
  1032. # @param label Plugin label, if applicable
  1033. # @param extraPtr Extra pointer, defined per plugin type
  1034. def add_plugin(self, btype, ptype, filename, name, label, extraPtr):
  1035. cfilename = filename.encode("utf-8") if filename else None
  1036. cname = name.encode("utf-8") if name else None
  1037. clabel = label.encode("utf-8") if label else None
  1038. return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, cast(extraPtr, c_void_p)))
  1039. # Remove a plugin.
  1040. # @param pluginId Plugin to remove.
  1041. def remove_plugin(self, pluginId):
  1042. return bool(self.lib.carla_remove_plugin(pluginId))
  1043. # Remove all plugins.
  1044. def remove_all_plugins(self):
  1045. return bool(self.lib.carla_remove_all_plugins())
  1046. # Rename a plugin.\n
  1047. # Returns the new name, or NULL if the operation failed.
  1048. # @param pluginId Plugin to rename
  1049. # @param newName New plugin name
  1050. def rename_plugin(self, pluginId, newName):
  1051. return charPtrToString(self.lib.carla_rename_plugin(pluginId, newName.encode("utf-8")))
  1052. # Clone a plugin.
  1053. # @param pluginId Plugin to clone
  1054. def clone_plugin(self, pluginId):
  1055. return bool(self.lib.carla_clone_plugin(pluginId))
  1056. # Prepare replace of a plugin.\n
  1057. # The next call to carla_add_plugin() will use this id, replacing the current plugin.
  1058. # @param pluginId Plugin to replace
  1059. # @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  1060. def replace_plugin(self, pluginId):
  1061. return bool(self.lib.carla_replace_plugin(pluginId))
  1062. # Switch two plugins positions.
  1063. # @param pluginIdA Plugin A
  1064. # @param pluginIdB Plugin B
  1065. def switch_plugins(self, pluginIdA, pluginIdB):
  1066. return bool(self.lib.carla_switch_plugins(pluginIdA, pluginIdB))
  1067. # Load a plugin state.
  1068. # @param pluginId Plugin
  1069. # @param filename Path to plugin state
  1070. # @see carla_save_plugin_state()
  1071. def load_plugin_state(self, pluginId, filename):
  1072. return bool(self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8")))
  1073. # Save a plugin state.
  1074. # @param pluginId Plugin
  1075. # @param filename Path to plugin state
  1076. # @see carla_load_plugin_state()
  1077. def save_plugin_state(self, pluginId, filename):
  1078. return bool(self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8")))
  1079. # Get information from a plugin.
  1080. # @param pluginId Plugin
  1081. def get_plugin_info(self, pluginId):
  1082. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  1083. # Get audio port count information from a plugin.
  1084. # @param pluginId Plugin
  1085. def get_audio_port_count_info(self, pluginId):
  1086. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  1087. # Get MIDI port count information from a plugin.
  1088. # @param pluginId Plugin
  1089. def get_midi_port_count_info(self, pluginId):
  1090. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  1091. # Get parameter count information from a plugin.
  1092. # @param pluginId Plugin
  1093. def get_parameter_count_info(self, pluginId):
  1094. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  1095. # Get parameter information from a plugin.
  1096. # @param pluginId Plugin
  1097. # @param parameterId Parameter index
  1098. # @see carla_get_parameter_count()
  1099. def get_parameter_info(self, pluginId, parameterId):
  1100. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  1101. # Get parameter scale point information from a plugin.
  1102. # @param pluginId Plugin
  1103. # @param parameterId Parameter index
  1104. # @param scalePointId Parameter scale-point index
  1105. # @see CarlaParameterInfo::scalePointCount
  1106. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1107. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  1108. # Get a plugin's parameter data.
  1109. # @param pluginId Plugin
  1110. # @param parameterId Parameter index
  1111. # @see carla_get_parameter_count()
  1112. def get_parameter_data(self, pluginId, parameterId):
  1113. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  1114. # Get a plugin's parameter ranges.
  1115. # @param pluginId Plugin
  1116. # @param parameterId Parameter index
  1117. # @see carla_get_parameter_count()
  1118. def get_parameter_ranges(self, pluginId, parameterId):
  1119. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  1120. # Get a plugin's MIDI program data.
  1121. # @param pluginId Plugin
  1122. # @param midiProgramId MIDI Program index
  1123. # @see carla_get_midi_program_count()
  1124. def get_midi_program_data(self, pluginId, midiProgramId):
  1125. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  1126. # Get a plugin's custom data.
  1127. # @param pluginId Plugin
  1128. # @param customDataId Custom data index
  1129. # @see carla_get_custom_data_count()
  1130. def get_custom_data(self, pluginId, customDataId):
  1131. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  1132. # Get a plugin's chunk data.
  1133. # @param pluginId Plugin
  1134. # @see PLUGIN_OPTION_USE_CHUNKS
  1135. def get_chunk_data(self, pluginId):
  1136. return charPtrToString(self.lib.carla_get_chunk_data(pluginId))
  1137. # Get how many parameters a plugin has.
  1138. # @param pluginId Plugin
  1139. def get_parameter_count(self, pluginId):
  1140. return int(self.lib.carla_get_parameter_count(pluginId))
  1141. # Get how many programs a plugin has.
  1142. # @param pluginId Plugin
  1143. # @see carla_get_program_name()
  1144. def get_program_count(self, pluginId):
  1145. return int(self.lib.carla_get_program_count(pluginId))
  1146. # Get how many MIDI programs a plugin has.
  1147. # @param pluginId Plugin
  1148. # @see carla_get_midi_program_name() and carla_get_midi_program_data()
  1149. def get_midi_program_count(self, pluginId):
  1150. return int(self.lib.carla_get_midi_program_count(pluginId))
  1151. # Get how many custom data sets a plugin has.
  1152. # @param pluginId Plugin
  1153. # @see carla_get_custom_data()
  1154. def get_custom_data_count(self, pluginId):
  1155. return int(self.lib.carla_get_custom_data_count(pluginId))
  1156. # Get a plugin's parameter text (custom display of internal values).
  1157. # @param pluginId Plugin
  1158. # @param parameterId Parameter index
  1159. # @param value Parameter value
  1160. # @see PARAMETER_USES_CUSTOM_TEXT
  1161. def get_parameter_text(self, pluginId, parameterId, value):
  1162. return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId, value))
  1163. # Get a plugin's program name.
  1164. # @param pluginId Plugin
  1165. # @param programId Program index
  1166. # @see carla_get_program_count()
  1167. def get_program_name(self, pluginId, programId):
  1168. return charPtrToString(self.lib.carla_get_program_name(pluginId, programId))
  1169. # Get a plugin's MIDI program name.
  1170. # @param pluginId Plugin
  1171. # @param midiProgramId MIDI Program index
  1172. # @see carla_get_midi_program_count()
  1173. def get_midi_program_name(self, pluginId, midiProgramId):
  1174. return charPtrToString(self.lib.carla_get_midi_program_name(pluginId, midiProgramId))
  1175. # Get a plugin's real name.\n
  1176. # This is the name the plugin uses to identify itself; may not be unique.
  1177. # @param pluginId Plugin
  1178. def get_real_plugin_name(self, pluginId):
  1179. return charPtrToString(self.lib.carla_get_real_plugin_name(pluginId))
  1180. # Get a plugin's program index.
  1181. # @param pluginId Plugin
  1182. def get_current_program_index(self, pluginId):
  1183. return int(self.lib.carla_get_current_program_index(pluginId))
  1184. # Get a plugin's midi program index.
  1185. # @param pluginId Plugin
  1186. def get_current_midi_program_index(self, pluginId):
  1187. return int(self.lib.carla_get_current_midi_program_index(pluginId))
  1188. # Get a plugin's default parameter value.
  1189. # @param pluginId Plugin
  1190. # @param parameterId Parameter index
  1191. def get_default_parameter_value(self, pluginId, parameterId):
  1192. return float(self.lib.carla_get_default_parameter_value(pluginId, parameterId))
  1193. # Get a plugin's current parameter value.
  1194. # @param pluginId Plugin
  1195. # @param parameterId Parameter index
  1196. def get_current_parameter_value(self, pluginId, parameterId):
  1197. return float(self.lib.carla_get_current_parameter_value(pluginId, parameterId))
  1198. # Get a plugin's input peak value.
  1199. # @param pluginId Plugin
  1200. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1201. def get_input_peak_value(self, pluginId, isLeft):
  1202. return float(self.lib.carla_get_input_peak_value(pluginId, isLeft))
  1203. # Get a plugin's output peak value.
  1204. # @param pluginId Plugin
  1205. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1206. def get_output_peak_value(self, pluginId, isLeft):
  1207. return float(self.lib.carla_get_output_peak_value(pluginId, isLeft))
  1208. # Enable a plugin's option.
  1209. # @param pluginId Plugin
  1210. # @param option An option from PluginOptions
  1211. # @param yesNo New enabled state
  1212. def set_option(self, pluginId, option, yesNo):
  1213. self.lib.carla_set_option(pluginId, option, yesNo)
  1214. # Enable or disable a plugin.
  1215. # @param pluginId Plugin
  1216. # @param onOff New active state
  1217. def set_active(self, pluginId, onOff):
  1218. self.lib.carla_set_active(pluginId, onOff)
  1219. # Change a plugin's internal dry/wet.
  1220. # @param pluginId Plugin
  1221. # @param value New dry/wet value
  1222. def set_drywet(self, pluginId, value):
  1223. self.lib.carla_set_drywet(pluginId, value)
  1224. # Change a plugin's internal volume.
  1225. # @param pluginId Plugin
  1226. # @param value New volume
  1227. def set_volume(self, pluginId, value):
  1228. self.lib.carla_set_volume(pluginId, value)
  1229. # Change a plugin's internal stereo balance, left channel.
  1230. # @param pluginId Plugin
  1231. # @param value New value
  1232. def set_balance_left(self, pluginId, value):
  1233. self.lib.carla_set_balance_left(pluginId, value)
  1234. # Change a plugin's internal stereo balance, right channel.
  1235. # @param pluginId Plugin
  1236. # @param value New value
  1237. def set_balance_right(self, pluginId, value):
  1238. self.lib.carla_set_balance_right(pluginId, value)
  1239. # Change a plugin's internal mono panning value.
  1240. # @param pluginId Plugin
  1241. # @param value New value
  1242. def set_panning(self, pluginId, value):
  1243. self.lib.carla_set_panning(pluginId, value)
  1244. # Change a plugin's internal control channel.
  1245. # @param pluginId Plugin
  1246. # @param channel New channel
  1247. def set_ctrl_channel(self, pluginId, channel):
  1248. self.lib.carla_set_ctrl_channel(pluginId, channel)
  1249. # Change a plugin's parameter value.
  1250. # @param pluginId Plugin
  1251. # @param parameterId Parameter index
  1252. # @param value New value
  1253. def set_parameter_value(self, pluginId, parameterId, value):
  1254. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  1255. # Change a plugin's parameter MIDI cc.
  1256. # @param pluginId Plugin
  1257. # @param parameterId Parameter index
  1258. # @param cc New MIDI cc
  1259. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1260. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  1261. # Change a plugin's parameter MIDI channel.
  1262. # @param pluginId Plugin
  1263. # @param parameterId Parameter index
  1264. # @param channel New MIDI channel
  1265. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  1266. self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)
  1267. # Change a plugin's current program.
  1268. # @param pluginId Plugin
  1269. # @param programId New program
  1270. def set_program(self, pluginId, programId):
  1271. self.lib.carla_set_program(pluginId, programId)
  1272. # Change a plugin's current MIDI program.
  1273. # @param pluginId Plugin
  1274. # @param midiProgramId New value
  1275. def set_midi_program(self, pluginId, midiProgramId):
  1276. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  1277. # Set a plugin's custom data set.
  1278. # @param pluginId Plugin
  1279. # @param type Type
  1280. # @param key Key
  1281. # @param value New value
  1282. # @see CustomDataTypes and CustomDataKeys
  1283. def set_custom_data(self, pluginId, type_, key, value):
  1284. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  1285. # Set a plugin's chunk data.
  1286. # @param pluginId Plugin
  1287. # @param value New value
  1288. # @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  1289. def set_chunk_data(self, pluginId, chunkData):
  1290. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  1291. # Tell a plugin to prepare for save.\n
  1292. # This should be called before saving custom data sets.
  1293. # @param pluginId Plugin
  1294. def prepare_for_save(self, pluginId):
  1295. self.lib.carla_prepare_for_save(pluginId)
  1296. # Send a single note of a plugin.\n
  1297. # If velocity is 0, note-off is sent; note-on otherwise.
  1298. # @param pluginId Plugin
  1299. # @param channel Note channel
  1300. # @param note Note pitch
  1301. # @param velocity Note velocity
  1302. def send_midi_note(self, pluginId, channel, note, velocity):
  1303. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  1304. # Tell a plugin to show its own custom UI.
  1305. # @param pluginId Plugin
  1306. # @param yesNo New UI state, visible or not
  1307. # @see PLUGIN_HAS_CUSTOM_UI
  1308. def show_custom_ui(self, pluginId, yesNo):
  1309. self.lib.carla_show_custom_ui(pluginId, yesNo)
  1310. # Get the current engine buffer size.
  1311. def get_buffer_size(self):
  1312. return int(self.lib.carla_get_buffer_size())
  1313. # Get the current engine sample rate.
  1314. def get_sample_rate(self):
  1315. return float(self.lib.carla_get_sample_rate())
  1316. # Get the last error.
  1317. def get_last_error(self):
  1318. return charPtrToString(self.lib.carla_get_last_error())
  1319. # Get the current engine OSC URL (TCP).
  1320. def get_host_osc_url_tcp(self):
  1321. return charPtrToString(self.lib.carla_get_host_osc_url_tcp())
  1322. # Get the current engine OSC URL (UDP).
  1323. def get_host_osc_url_udp(self):
  1324. return charPtrToString(self.lib.carla_get_host_osc_url_udp())
  1325. def _init(self, libName):
  1326. self.lib = cdll.LoadLibrary(libName)
  1327. self.lib.carla_get_complete_license_text.argtypes = None
  1328. self.lib.carla_get_complete_license_text.restype = c_char_p
  1329. self.lib.carla_get_supported_file_extensions.argtypes = None
  1330. self.lib.carla_get_supported_file_extensions.restype = c_char_p
  1331. self.lib.carla_get_engine_driver_count.argtypes = None
  1332. self.lib.carla_get_engine_driver_count.restype = c_uint
  1333. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  1334. self.lib.carla_get_engine_driver_name.restype = c_char_p
  1335. self.lib.carla_get_engine_driver_device_names.argtypes = [c_uint]
  1336. self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)
  1337. self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p]
  1338. self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)
  1339. self.lib.carla_get_internal_plugin_count.argtypes = None
  1340. self.lib.carla_get_internal_plugin_count.restype = c_uint
  1341. self.lib.carla_get_internal_plugin_info.argtypes = [c_uint]
  1342. self.lib.carla_get_internal_plugin_info.restype = POINTER(CarlaNativePluginInfo)
  1343. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  1344. self.lib.carla_engine_init.restype = c_bool
  1345. self.lib.carla_engine_close.argtypes = None
  1346. self.lib.carla_engine_close.restype = c_bool
  1347. self.lib.carla_engine_idle.argtypes = None
  1348. self.lib.carla_engine_idle.restype = None
  1349. self.lib.carla_is_engine_running.argtypes = None
  1350. self.lib.carla_is_engine_running.restype = c_bool
  1351. self.lib.carla_set_engine_about_to_close.argtypes = None
  1352. self.lib.carla_set_engine_about_to_close.restype = None
  1353. self.lib.carla_set_engine_callback.argtypes = [EngineCallbackFunc, c_void_p]
  1354. self.lib.carla_set_engine_callback.restype = None
  1355. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  1356. self.lib.carla_set_engine_option.restype = None
  1357. self.lib.carla_set_file_callback.argtypes = [FileCallbackFunc, c_void_p]
  1358. self.lib.carla_set_file_callback.restype = None
  1359. self.lib.carla_load_file.argtypes = [c_char_p]
  1360. self.lib.carla_load_file.restype = c_bool
  1361. self.lib.carla_load_project.argtypes = [c_char_p]
  1362. self.lib.carla_load_project.restype = c_bool
  1363. self.lib.carla_save_project.argtypes = [c_char_p]
  1364. self.lib.carla_save_project.restype = c_bool
  1365. self.lib.carla_patchbay_connect.argtypes = [c_int, c_int]
  1366. self.lib.carla_patchbay_connect.restype = c_bool
  1367. self.lib.carla_patchbay_disconnect.argtypes = [c_int]
  1368. self.lib.carla_patchbay_disconnect.restype = c_bool
  1369. self.lib.carla_patchbay_refresh.argtypes = None
  1370. self.lib.carla_patchbay_refresh.restype = c_bool
  1371. self.lib.carla_transport_play.argtypes = None
  1372. self.lib.carla_transport_play.restype = None
  1373. self.lib.carla_transport_pause.argtypes = None
  1374. self.lib.carla_transport_pause.restype = None
  1375. self.lib.carla_transport_relocate.argtypes = [c_uint64]
  1376. self.lib.carla_transport_relocate.restype = None
  1377. self.lib.carla_get_current_transport_frame.argtypes = None
  1378. self.lib.carla_get_current_transport_frame.restype = c_uint64
  1379. self.lib.carla_get_transport_info.argtypes = None
  1380. self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
  1381. self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_void_p]
  1382. self.lib.carla_add_plugin.restype = c_bool
  1383. self.lib.carla_remove_plugin.argtypes = [c_uint]
  1384. self.lib.carla_remove_plugin.restype = c_bool
  1385. self.lib.carla_remove_all_plugins.argtypes = None
  1386. self.lib.carla_remove_all_plugins.restype = c_bool
  1387. self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
  1388. self.lib.carla_rename_plugin.restype = c_char_p
  1389. self.lib.carla_clone_plugin.argtypes = [c_uint]
  1390. self.lib.carla_clone_plugin.restype = c_bool
  1391. self.lib.carla_replace_plugin.argtypes = [c_uint]
  1392. self.lib.carla_replace_plugin.restype = c_bool
  1393. self.lib.carla_switch_plugins.argtypes = [c_uint, c_uint]
  1394. self.lib.carla_switch_plugins.restype = c_bool
  1395. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  1396. self.lib.carla_load_plugin_state.restype = c_bool
  1397. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  1398. self.lib.carla_save_plugin_state.restype = c_bool
  1399. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  1400. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  1401. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  1402. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1403. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  1404. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1405. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  1406. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  1407. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  1408. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  1409. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  1410. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  1411. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  1412. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  1413. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  1414. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  1415. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  1416. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  1417. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  1418. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  1419. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  1420. self.lib.carla_get_chunk_data.restype = c_char_p
  1421. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  1422. self.lib.carla_get_parameter_count.restype = c_uint32
  1423. self.lib.carla_get_program_count.argtypes = [c_uint]
  1424. self.lib.carla_get_program_count.restype = c_uint32
  1425. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  1426. self.lib.carla_get_midi_program_count.restype = c_uint32
  1427. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  1428. self.lib.carla_get_custom_data_count.restype = c_uint32
  1429. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32, c_float]
  1430. self.lib.carla_get_parameter_text.restype = c_char_p
  1431. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  1432. self.lib.carla_get_program_name.restype = c_char_p
  1433. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  1434. self.lib.carla_get_midi_program_name.restype = c_char_p
  1435. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  1436. self.lib.carla_get_real_plugin_name.restype = c_char_p
  1437. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  1438. self.lib.carla_get_current_program_index.restype = c_int32
  1439. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  1440. self.lib.carla_get_current_midi_program_index.restype = c_int32
  1441. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  1442. self.lib.carla_get_default_parameter_value.restype = c_float
  1443. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  1444. self.lib.carla_get_current_parameter_value.restype = c_float
  1445. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_bool]
  1446. self.lib.carla_get_input_peak_value.restype = c_float
  1447. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_bool]
  1448. self.lib.carla_get_output_peak_value.restype = c_float
  1449. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  1450. self.lib.carla_set_option.restype = None
  1451. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  1452. self.lib.carla_set_active.restype = None
  1453. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  1454. self.lib.carla_set_drywet.restype = None
  1455. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  1456. self.lib.carla_set_volume.restype = None
  1457. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  1458. self.lib.carla_set_balance_left.restype = None
  1459. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  1460. self.lib.carla_set_balance_right.restype = None
  1461. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  1462. self.lib.carla_set_panning.restype = None
  1463. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  1464. self.lib.carla_set_ctrl_channel.restype = None
  1465. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  1466. self.lib.carla_set_parameter_value.restype = None
  1467. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  1468. self.lib.carla_set_parameter_midi_channel.restype = None
  1469. self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
  1470. self.lib.carla_set_parameter_midi_cc.restype = None
  1471. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  1472. self.lib.carla_set_program.restype = None
  1473. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  1474. self.lib.carla_set_midi_program.restype = None
  1475. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  1476. self.lib.carla_set_custom_data.restype = None
  1477. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  1478. self.lib.carla_set_chunk_data.restype = None
  1479. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  1480. self.lib.carla_prepare_for_save.restype = None
  1481. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  1482. self.lib.carla_send_midi_note.restype = None
  1483. self.lib.carla_show_custom_ui.argtypes = [c_uint, c_bool]
  1484. self.lib.carla_show_custom_ui.restype = None
  1485. self.lib.carla_get_buffer_size.argtypes = None
  1486. self.lib.carla_get_buffer_size.restype = c_uint32
  1487. self.lib.carla_get_sample_rate.argtypes = None
  1488. self.lib.carla_get_sample_rate.restype = c_double
  1489. self.lib.carla_get_last_error.argtypes = None
  1490. self.lib.carla_get_last_error.restype = c_char_p
  1491. self.lib.carla_get_host_osc_url_tcp.argtypes = None
  1492. self.lib.carla_get_host_osc_url_tcp.restype = c_char_p
  1493. self.lib.carla_get_host_osc_url_udp.argtypes = None
  1494. self.lib.carla_get_host_osc_url_udp.restype = c_char_p