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.

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