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.

2018 lines
64KB

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