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.

2005 lines
64KB

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