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.

1954 lines
62KB

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