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.

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