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.

1648 lines
50KB

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla Backend code
  4. # Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
  5. #
  6. # This program is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU General Public License as
  8. # published by the Free Software Foundation; either version 2 of
  9. # the License, or any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # For a full copy of the GNU General Public License see the doc/GPL.txt file.
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Global)
  19. from ctypes import *
  20. from platform import architecture
  21. from sys import platform, maxsize
  22. # ------------------------------------------------------------------------------------------------------------
  23. # 64bit check
  24. kIs64bit = bool(architecture()[0] == "64bit" and maxsize > 2**32)
  25. # ------------------------------------------------------------------------------------------------------------
  26. # Define enum type (integer)
  27. c_enum = c_int
  28. # ------------------------------------------------------------------------------------------------------------
  29. # Set Platform
  30. if platform == "darwin":
  31. HAIKU = False
  32. LINUX = False
  33. MACOS = True
  34. WINDOWS = False
  35. elif "haiku" in platform:
  36. HAIKU = True
  37. LINUX = False
  38. MACOS = False
  39. WINDOWS = False
  40. elif "linux" in platform:
  41. HAIKU = False
  42. LINUX = True
  43. MACOS = False
  44. WINDOWS = False
  45. elif platform in ("win32", "win64", "cygwin"):
  46. HAIKU = False
  47. LINUX = False
  48. MACOS = False
  49. WINDOWS = True
  50. else:
  51. HAIKU = False
  52. LINUX = False
  53. MACOS = False
  54. WINDOWS = False
  55. # ------------------------------------------------------------------------------------------------------------
  56. # Convert a ctypes c_char_p into a python string
  57. def charPtrToString(value):
  58. if not value:
  59. return ""
  60. if isinstance(value, str):
  61. return value
  62. return value.decode("utf-8", errors="ignore")
  63. # ------------------------------------------------------------------------------------------------------------
  64. # Convert a ctypes POINTER(c_char_p) into a python string list
  65. def charPtrPtrToStringList(charPtrPtr):
  66. if not charPtrPtr:
  67. return []
  68. i = 0
  69. charPtr = charPtrPtr[0]
  70. strList = []
  71. while charPtr:
  72. strList.append(charPtr.decode("utf-8", errors="ignore"))
  73. i += 1
  74. charPtr = charPtrPtr[i]
  75. return strList
  76. # ------------------------------------------------------------------------------------------------------------
  77. # Convert a ctypes POINTER(c_<num>) into a python number list
  78. def numPtrToList(numPtr):
  79. if not numPtr:
  80. return []
  81. i = 0
  82. num = numPtr[0].value
  83. numList = []
  84. while num not in (0, 0.0):
  85. numList.append(num)
  86. i += 1
  87. num = numPtr[i].value
  88. return numList
  89. # ------------------------------------------------------------------------------------------------------------
  90. # Convert a ctypes struct into a python dict
  91. def structToDict(struct):
  92. return dict((attr, getattr(struct, attr)) for attr, value in struct._fields_)
  93. # ------------------------------------------------------------------------------------------------------------
  94. # Carla Backend API (base definitions)
  95. # Maximum default number of loadable plugins.
  96. MAX_DEFAULT_PLUGINS = 99
  97. # Maximum number of loadable plugins in rack mode.
  98. MAX_RACK_PLUGINS = 16
  99. # Maximum number of loadable plugins in patchbay mode.
  100. MAX_PATCHBAY_PLUGINS = 255
  101. # Maximum default number of parameters allowed.
  102. # @see ENGINE_OPTION_MAX_PARAMETERS
  103. MAX_DEFAULT_PARAMETERS = 200
  104. # ------------------------------------------------------------------------------------------------------------
  105. # Engine Driver Device Hints
  106. # Engine driver device has custom control-panel.
  107. ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1
  108. # Engine driver device can change buffer-size on the fly.
  109. # @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
  110. ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x2
  111. # Engine driver device can change sample-rate on the fly.
  112. # @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
  113. ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x4
  114. # ------------------------------------------------------------------------------------------------------------
  115. # Plugin Hints
  116. # Plugin is a bridge.
  117. # This hint is required because "bridge" itself is not a plugin type.
  118. PLUGIN_IS_BRIDGE = 0x01
  119. # Plugin is hard real-time safe.
  120. PLUGIN_IS_RTSAFE = 0x02
  121. # Plugin is a synth (produces sound).
  122. PLUGIN_IS_SYNTH = 0x04
  123. # Plugin has its own custom UI.
  124. # @see carla_show_custom_ui()
  125. PLUGIN_HAS_CUSTOM_UI = 0x08
  126. # Plugin can use internal Dry/Wet control.
  127. PLUGIN_CAN_DRYWET = 0x10
  128. # Plugin can use internal Volume control.
  129. PLUGIN_CAN_VOLUME = 0x20
  130. # Plugin can use internal (Stereo) Balance controls.
  131. PLUGIN_CAN_BALANCE = 0x40
  132. # Plugin can use internal (Mono) Panning control.
  133. PLUGIN_CAN_PANNING = 0x80
  134. # ------------------------------------------------------------------------------------------------------------
  135. # Plugin Options
  136. # Use constant/fixed-size audio buffers.
  137. PLUGIN_OPTION_FIXED_BUFFERS = 0x001
  138. # Force mono plugin as stereo.
  139. PLUGIN_OPTION_FORCE_STEREO = 0x002
  140. # Map MIDI programs to plugin programs.
  141. PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004
  142. # Use chunks to save and restore data.
  143. PLUGIN_OPTION_USE_CHUNKS = 0x008
  144. # Send MIDI control change events.
  145. PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010
  146. # Send MIDI channel pressure events.
  147. PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020
  148. # Send MIDI note after-touch events.
  149. PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040
  150. # Send MIDI pitch-bend events.
  151. PLUGIN_OPTION_SEND_PITCHBEND = 0x080
  152. # Send MIDI all-sounds/notes-off events, single note-offs otherwise.
  153. PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100
  154. # ------------------------------------------------------------------------------------------------------------
  155. # Parameter Hints
  156. # Parameter is input.
  157. # When this hint is not set, parameter is assumed to be output.
  158. PARAMETER_IS_INPUT = 0x001
  159. # Parameter value is boolean.
  160. PARAMETER_IS_BOOLEAN = 0x002
  161. # Parameter value is integer.
  162. PARAMETER_IS_INTEGER = 0x004
  163. # Parameter value is logarithmic.
  164. PARAMETER_IS_LOGARITHMIC = 0x008
  165. # Parameter is enabled.
  166. # It can be viewed, changed and stored.
  167. PARAMETER_IS_ENABLED = 0x010
  168. # Parameter is automable (real-time safe).
  169. PARAMETER_IS_AUTOMABLE = 0x020
  170. # Parameter is read-only.
  171. # It cannot be changed.
  172. PARAMETER_IS_READ_ONLY = 0x040
  173. # Parameter needs sample rate to work.
  174. # Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
  175. PARAMETER_USES_SAMPLERATE = 0x100
  176. # Parameter uses scale points to define internal values in a meaningful way.
  177. PARAMETER_USES_SCALEPOINTS = 0x200
  178. # Parameter uses custom text for displaying its value.
  179. # @see carla_get_parameter_text()
  180. PARAMETER_USES_CUSTOM_TEXT = 0x400
  181. # ------------------------------------------------------------------------------------------------------------
  182. # Patchbay Port Hints
  183. # Patchbay port is input.
  184. # When this hint is not set, port is assumed to be output.
  185. PATCHBAY_PORT_IS_INPUT = 0x1
  186. # Patchbay port is of Audio type.
  187. PATCHBAY_PORT_TYPE_AUDIO = 0x2
  188. # Patchbay port is of CV type (Control Voltage).
  189. PATCHBAY_PORT_TYPE_CV = 0x4
  190. # Patchbay port is of MIDI type.
  191. PATCHBAY_PORT_TYPE_MIDI = 0x8
  192. # ------------------------------------------------------------------------------------------------------------
  193. # Custom Data Types
  194. # Boolean string type URI.
  195. # Only "true" and "false" are valid values.
  196. CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean"
  197. # Chunk type URI.
  198. CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"
  199. # String type URI.
  200. CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string"
  201. # ------------------------------------------------------------------------------------------------------------
  202. # Custom Data Keys
  203. # Plugin options key.
  204. CUSTOM_DATA_KEY_PLUGIN_OPTIONS = "CarlaPluginOptions"
  205. # UI position key.
  206. CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition"
  207. # UI size key.
  208. CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize"
  209. # UI visible key.
  210. CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible"
  211. # ------------------------------------------------------------------------------------------------------------
  212. # Binary Type
  213. # Null binary type.
  214. BINARY_NONE = 0
  215. # POSIX 32bit binary.
  216. BINARY_POSIX32 = 1
  217. # POSIX 64bit binary.
  218. BINARY_POSIX64 = 2
  219. # Windows 32bit binary.
  220. BINARY_WIN32 = 3
  221. # Windows 64bit binary.
  222. BINARY_WIN64 = 4
  223. # Other binary type.
  224. BINARY_OTHER = 5
  225. # ------------------------------------------------------------------------------------------------------------
  226. # Plugin Type
  227. # Null plugin type.
  228. PLUGIN_NONE = 0
  229. # Internal plugin.
  230. PLUGIN_INTERNAL = 1
  231. # LADSPA plugin.
  232. PLUGIN_LADSPA = 2
  233. # DSSI plugin.
  234. PLUGIN_DSSI = 3
  235. # LV2 plugin.
  236. PLUGIN_LV2 = 4
  237. # VST plugin.
  238. PLUGIN_VST = 5
  239. # AU plugin.
  240. # @note MacOS only
  241. PLUGIN_AU = 6
  242. # Csound file.
  243. PLUGIN_CSOUND = 7
  244. # GIG file.
  245. PLUGIN_GIG = 8
  246. # SF2 file (also known as SoundFont).
  247. PLUGIN_SF2 = 9
  248. # SFZ file.
  249. PLUGIN_SFZ = 10
  250. # ------------------------------------------------------------------------------------------------------------
  251. # Plugin Category
  252. # Null plugin category.
  253. PLUGIN_CATEGORY_NONE = 0
  254. # A synthesizer or generator.
  255. PLUGIN_CATEGORY_SYNTH = 1
  256. # A delay or reverb.
  257. PLUGIN_CATEGORY_DELAY = 2
  258. # An equalizer.
  259. PLUGIN_CATEGORY_EQ = 3
  260. # A filter.
  261. PLUGIN_CATEGORY_FILTER = 4
  262. # A distortion plugin.
  263. PLUGIN_CATEGORY_DISTORTION = 5
  264. # A 'dynamic' plugin (amplifier, compressor, gate, etc).
  265. PLUGIN_CATEGORY_DYNAMICS = 6
  266. # A 'modulator' plugin (chorus, flanger, phaser, etc).
  267. PLUGIN_CATEGORY_MODULATOR = 7
  268. # An 'utility' plugin (analyzer, converter, mixer, etc).
  269. PLUGIN_CATEGORY_UTILITY = 8
  270. # Miscellaneous plugin (used to check if the plugin has a category).
  271. PLUGIN_CATEGORY_OTHER = 9
  272. # ------------------------------------------------------------------------------------------------------------
  273. # Internal Parameters Index
  274. # Null parameter.
  275. PARAMETER_NULL = -1
  276. # Active parameter, boolean type.
  277. # Default is 'false'.
  278. PARAMETER_ACTIVE = -2
  279. # Dry/Wet parameter.
  280. # Range 0.0...1.0; default is 1.0.
  281. PARAMETER_DRYWET = -3
  282. # Volume parameter.
  283. # Range 0.0...1.27; default is 1.0.
  284. PARAMETER_VOLUME = -4
  285. # Stereo Balance-Left parameter.
  286. # Range -1.0...1.0; default is -1.0.
  287. PARAMETER_BALANCE_LEFT = -5
  288. # Stereo Balance-Right parameter.
  289. # Range -1.0...1.0; default is 1.0.
  290. PARAMETER_BALANCE_RIGHT = -6
  291. # Mono Panning parameter.
  292. # Range -1.0...1.0; default is 0.0.
  293. PARAMETER_PANNING = -7
  294. # MIDI Control channel, integer type.
  295. # Range -1...15 (-1 = off).
  296. PARAMETER_CTRL_CHANNEL = -8
  297. # Max value, defined only for convenience.
  298. PARAMETER_MAX = -9
  299. # ------------------------------------------------------------------------------------------------------------
  300. # Engine Callback Opcode
  301. # Debug.
  302. # This opcode is undefined and used only for testing purposes.
  303. ENGINE_CALLBACK_DEBUG = 0
  304. # A plugin has been added.
  305. # @param pluginId Plugin Id
  306. # @param valueStr Plugin name
  307. ENGINE_CALLBACK_PLUGIN_ADDED = 1
  308. # A plugin has been removed.
  309. # @param pluginId Plugin Id
  310. ENGINE_CALLBACK_PLUGIN_REMOVED = 2
  311. # A plugin has been renamed.
  312. # @param pluginId Plugin Id
  313. # @param valueStr New plugin name
  314. ENGINE_CALLBACK_PLUGIN_RENAMED = 3
  315. # A plugin has become unavailable.
  316. # @param pluginId Plugin Id
  317. # @param valueStr Related error string
  318. ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4
  319. # A parameter value has changed.
  320. # @param pluginId Plugin Id
  321. # @param value1 Parameter index
  322. # @param value3 New parameter value
  323. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5
  324. # A parameter default has changed.
  325. # @param pluginId Plugin Id
  326. # @param value1 Parameter index
  327. # @param value3 New default value
  328. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6
  329. # A parameter's MIDI CC has changed.
  330. # @param pluginId Plugin Id
  331. # @param value1 Parameter index
  332. # @param value2 New MIDI CC
  333. ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED = 7
  334. # A parameter's MIDI channel has changed.
  335. # @param pluginId Plugin Id
  336. # @param value1 Parameter index
  337. # @param value2 New MIDI channel
  338. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8
  339. # The current program of a plugin has changed.
  340. # @param pluginId Plugin Id
  341. # @param value1 New program index
  342. ENGINE_CALLBACK_PROGRAM_CHANGED = 9
  343. # The current MIDI program of a plugin has changed.
  344. # @param pluginId Plugin Id
  345. # @param value1 New MIDI bank
  346. # @param value2 New MIDI program
  347. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 10
  348. # A plugin's custom UI state has changed.
  349. # @param pluginId Plugin Id
  350. # @param value1 New state, as follows:
  351. # 0: UI is now hidden
  352. # 1: UI is now visible
  353. # -1: UI has crashed and should not be shown again
  354. ENGINE_CALLBACK_UI_STATE_CHANGED = 11
  355. # A note has been pressed.
  356. # @param pluginId Plugin Id
  357. # @param value1 Channel
  358. # @param value2 Note
  359. # @param value3 Velocity
  360. ENGINE_CALLBACK_NOTE_ON = 12
  361. # A note has been released.
  362. # @param pluginId Plugin Id
  363. # @param value1 Channel
  364. # @param value2 Note
  365. ENGINE_CALLBACK_NOTE_OFF = 13
  366. # A plugin needs update.
  367. # @param pluginId Plugin Id
  368. ENGINE_CALLBACK_UPDATE = 14
  369. # A plugin's data/information has changed.
  370. # @param pluginId Plugin Id
  371. ENGINE_CALLBACK_RELOAD_INFO = 15
  372. # A plugin's parameters have changed.
  373. # @param pluginId Plugin Id
  374. ENGINE_CALLBACK_RELOAD_PARAMETERS = 16
  375. # A plugin's programs have changed.
  376. # @param pluginId Plugin Id
  377. ENGINE_CALLBACK_RELOAD_PROGRAMS = 17
  378. # A plugin state has changed.
  379. # @param pluginId Plugin Id
  380. ENGINE_CALLBACK_RELOAD_ALL = 18
  381. # A patchbay client has been added.
  382. # @param pluginId Client Id
  383. # @param valueStr Client name and icon, as "name:icon"
  384. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 19
  385. # A patchbay client has been removed.
  386. # @param pluginId Client Id
  387. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 20
  388. # A patchbay client has been renamed.
  389. # @param pluginId Client Id
  390. # @param valueStr New client name
  391. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 21
  392. # A patchbay client icon has changed.
  393. # @param pluginId Client Id
  394. # @param valueStr New icon name
  395. ENGINE_CALLBACK_PATCHBAY_CLIENT_ICON_CHANGED = 22
  396. # A patchbay port has been added.
  397. # @param pluginId Client Id
  398. # @param value1 Port Id
  399. # @param value2 Port hints
  400. # @param valueStr Port name
  401. # @see PatchbayPortHints
  402. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 23
  403. # A patchbay port has been removed.
  404. # @param pluginId Client Id
  405. # @param value1 Port Id
  406. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 24
  407. # A patchbay port has been renamed.
  408. # @param pluginId Client Id
  409. # @param value1 Port Id
  410. # @param valueStr New port name
  411. ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED = 25
  412. # A patchbay connection has been added.
  413. # @param value1 Output port Id
  414. # @param value2 Input port Id
  415. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 26
  416. # A patchbay connection has been removed.
  417. # @param value1 Output port Id
  418. # @param value2 Input port Id
  419. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 27
  420. # Engine started.
  421. # @param value1 Process mode
  422. # @param value2 Transport mode
  423. # @param valuestr Engine driver
  424. # @see EngineProcessMode
  425. # @see EngineTransportMode
  426. ENGINE_CALLBACK_ENGINE_STARTED = 28
  427. # Engine stopped.
  428. ENGINE_CALLBACK_ENGINE_STOPPED = 29
  429. # Engine process mode has changed.
  430. # @param value1 New process mode
  431. # @see EngineProcessMode
  432. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 30
  433. # Engine transport mode has changed.
  434. # @param value1 New transport mode
  435. # @see EngineTransportMode
  436. ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 31
  437. # Engine buffer-size changed.
  438. # @param value1 New buffer size
  439. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 32
  440. # Engine sample-rate changed.
  441. # @param value3 New sample rate
  442. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 33
  443. # Show a message as information.
  444. # @param valueStr The message
  445. ENGINE_CALLBACK_INFO = 34
  446. # Show a message as an error.
  447. # @param valueStr The message
  448. ENGINE_CALLBACK_ERROR = 35
  449. # The engine has crashed or malfunctioned and will no longer work.
  450. ENGINE_CALLBACK_QUIT = 36
  451. # ------------------------------------------------------------------------------------------------------------
  452. # Engine Option
  453. # Debug.
  454. # This option is undefined and used only for testing purposes.
  455. ENGINE_OPTION_DEBUG = 0
  456. # Set the engine processing mode.
  457. # Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_CONTINUOUS_RACK for all other OSes.
  458. # @see EngineProcessMode
  459. ENGINE_OPTION_PROCESS_MODE = 1
  460. # Set the engine transport mode.
  461. # Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
  462. # @see EngineTransportMode
  463. ENGINE_OPTION_TRANSPORT_MODE = 2
  464. # Force mono plugins as stereo, by running 2 instances at the same time.
  465. # Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
  466. # @note Not supported by all plugins
  467. # @see PLUGIN_OPTION_FORCE_STEREO
  468. ENGINE_OPTION_FORCE_STEREO = 3
  469. # Use plugin bridges whenever possible.
  470. # Default is no, EXPERIMENTAL.
  471. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4
  472. # Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
  473. # Default is yes.
  474. ENGINE_OPTION_PREFER_UI_BRIDGES = 5
  475. # Make custom plugin UIs always-on-top.
  476. # Default is yes.
  477. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6
  478. # Maximum number of parameters allowed.
  479. # Default is MAX_DEFAULT_PARAMETERS.
  480. ENGINE_OPTION_MAX_PARAMETERS = 7
  481. # Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  482. # Default is 4000 (4 seconds).
  483. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8
  484. # Audio number of periods.
  485. # Default is 2.
  486. ENGINE_OPTION_AUDIO_NUM_PERIODS = 9
  487. # Audio buffer size.
  488. # Default is 512.
  489. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10
  490. # Audio sample rate.
  491. # Default is 44100.
  492. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11
  493. # Audio device (within a driver).
  494. # Default unset.
  495. ENGINE_OPTION_AUDIO_DEVICE = 12
  496. # Set path to the binary files.
  497. # Default unset.
  498. # @note Must be set for plugin and UI bridges to work
  499. ENGINE_OPTION_PATH_BINARIES = 13
  500. # Set path to the resource files.
  501. # Default unset.
  502. # @note Must be set for some internal plugins to work
  503. ENGINE_OPTION_PATH_RESOURCES = 14
  504. # ------------------------------------------------------------------------------------------------------------
  505. # Engine Process Mode
  506. # Single client mode.
  507. # Inputs and outputs are added dynamically as needed by plugins.
  508. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0
  509. # Multiple client mode.
  510. # It has 1 master client + 1 client per plugin.
  511. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1
  512. # Single client, 'rack' mode.
  513. # Processes plugins in order of Id, with forced stereo always on.
  514. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2
  515. # Single client, 'patchbay' mode.
  516. ENGINE_PROCESS_MODE_PATCHBAY = 3
  517. # Special mode, used in plugin-bridges only.
  518. ENGINE_PROCESS_MODE_BRIDGE = 4
  519. # ------------------------------------------------------------------------------------------------------------
  520. # Engine Transport Mode
  521. # Internal transport mode.
  522. ENGINE_TRANSPORT_MODE_INTERNAL = 0
  523. # Transport from JACK.
  524. # Only available if driver name is "JACK".
  525. ENGINE_TRANSPORT_MODE_JACK = 1
  526. # Transport from host, used when Carla is a plugin.
  527. ENGINE_TRANSPORT_MODE_PLUGIN = 2
  528. # Special mode, used in plugin-bridges only.
  529. ENGINE_TRANSPORT_MODE_BRIDGE = 3
  530. # ------------------------------------------------------------------------------------------------------------
  531. # Carla Backend API (C stuff)
  532. # Engine callback function.
  533. # Front-ends must never block indefinitely during a callback.
  534. # @see EngineCallbackOpcode and carla_set_engine_callback()
  535. EngineCallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_float, c_char_p)
  536. # Parameter data.
  537. class ParameterData(Structure):
  538. _fields_ = [
  539. # Index as seen by Carla.
  540. ("index", c_int32),
  541. # Real index as seen by plugins.
  542. ("rindex", c_int32),
  543. # This parameter hints.
  544. # @see ParameterHints
  545. ("hints", c_uint),
  546. # Currently mapped MIDI CC.
  547. # A value lower than 0 means invalid or unused.
  548. # Maximum allowed value is 95 (0x5F).
  549. ("midiCC", c_int16),
  550. # Currently mapped MIDI channel.
  551. # Counts from 0 to 15.
  552. ("midiChannel", c_uint8)
  553. ]
  554. # Parameter ranges.
  555. class ParameterRanges(Structure):
  556. _fields_ = [
  557. # Default value.
  558. ("def", c_float),
  559. # Minimum value.
  560. ("min", c_float),
  561. # Maximum value.
  562. ("max", c_float),
  563. # Regular, single step value.
  564. ("step", c_float),
  565. # Small step value.
  566. ("stepSmall", c_float),
  567. # Large step value.
  568. ("stepLarge", c_float)
  569. ]
  570. # MIDI Program data.
  571. class MidiProgramData(Structure):
  572. _fields_ = [
  573. # MIDI bank.
  574. ("bank", c_uint32),
  575. # MIDI program.
  576. ("program", c_uint32),
  577. # MIDI program name.
  578. ("name", c_char_p)
  579. ]
  580. # Custom data, used for saving key:value 'dictionaries'.
  581. class CustomData(Structure):
  582. _fields_ = [
  583. # Value type, in URI form.
  584. # @see CustomDataTypes
  585. ("type", c_char_p),
  586. # Key.
  587. # @see CustomDataKeys
  588. ("key", c_char_p),
  589. # Value.
  590. ("value", c_char_p)
  591. ]
  592. # Engine driver device information.
  593. class EngineDriverDeviceInfo(Structure):
  594. _fields_ = [
  595. # This driver device hints.
  596. # @see EngineDriverHints
  597. ("hints", c_uint),
  598. # Available buffer sizes.
  599. # Terminated with 0.
  600. ("bufferSizes", POINTER(c_uint32)),
  601. # Available sample rates.
  602. # Terminated with 0.0.
  603. ("sampleRates", POINTER(c_double))
  604. ]
  605. # ------------------------------------------------------------------------------------------------------------
  606. # Carla Backend API (Python compatible stuff)
  607. # @see ParameterData
  608. PyParameterData = {
  609. 'index': PARAMETER_NULL,
  610. 'rindex': -1,
  611. 'hints': 0x0,
  612. 'midiCC': -1,
  613. 'midiChannel': 0
  614. }
  615. # @see ParameterRanges
  616. PyParameterRanges = {
  617. 'def': 0.0,
  618. 'min': 0.0,
  619. 'max': 1.0,
  620. 'step': 0.01,
  621. 'stepSmall': 0.0001,
  622. 'stepLarge': 0.1
  623. }
  624. # @see MidiProgramData
  625. PyMidiProgramData = {
  626. 'bank': 0,
  627. 'program': 0,
  628. 'name': None
  629. }
  630. # @see CustomData
  631. PyCustomData = {
  632. 'type': None,
  633. 'key': None,
  634. 'value': None
  635. }
  636. # @see EngineDriverDeviceInfo
  637. PyEngineDriverDeviceInfo = {
  638. 'hints': 0x0,
  639. 'bufferSizes': [],
  640. 'sampleRates': []
  641. }
  642. # ------------------------------------------------------------------------------------------------------------
  643. # File Callback Opcode
  644. # Debug.
  645. # This opcode is undefined and used only for testing purposes.
  646. FILE_CALLBACK_DEBUG = 0
  647. # Open file or folder.
  648. FILE_CALLBACK_OPEN = 1
  649. # Save file or folder.
  650. FILE_CALLBACK_SAVE = 2
  651. # ------------------------------------------------------------------------------------------------------------
  652. # Carla Host API (C stuff)
  653. # File callback function.
  654. # @see FileCallbackOpcode
  655. FileCallbackFunc = CFUNCTYPE(c_char_p, c_void_p, c_enum, c_bool, c_char_p, c_char_p)
  656. # Information about a loaded plugin.
  657. # @see carla_get_plugin_info()
  658. class CarlaPluginInfo(Structure):
  659. _fields_ = [
  660. # Plugin type.
  661. ("type", c_enum),
  662. # Plugin category.
  663. ("category", c_enum),
  664. # Plugin hints.
  665. # @see PluginHints
  666. ("hints", c_uint),
  667. # Plugin options available for the user to change.
  668. # @see PluginOptions
  669. ("optionsAvailable", c_uint),
  670. # Plugin options currently enabled.
  671. # Some options are enabled but not available, which means they will always be on.
  672. # @see PluginOptions
  673. ("optionsEnabled", c_uint),
  674. # Plugin filename.
  675. # This can be the plugin binary or resource file.
  676. ("filename", c_char_p),
  677. # Plugin name.
  678. # This name is unique within a Carla instance.
  679. # @see carla_get_real_plugin_name()
  680. ("name", c_char_p),
  681. # Plugin label or URI.
  682. ("label", c_char_p),
  683. # Plugin author/maker.
  684. ("maker", c_char_p),
  685. # Plugin copyright/license.
  686. ("copyright", c_char_p),
  687. # Icon name for this plugin, in lowercase.
  688. # Default is "plugin".
  689. ("iconName", c_char_p),
  690. # Patchbay client Id for this plugin.
  691. # When 0, Id is considered invalid or unused.
  692. ("patchbayClientId", c_int),
  693. # Plugin unique Id.
  694. # This Id is dependant on the plugin type and may sometimes be 0.
  695. ("uniqueId", c_long)
  696. ]
  697. # Information about an internal Carla plugin.
  698. # @see carla_get_internal_plugin_info()
  699. class CarlaNativePluginInfo(Structure):
  700. _fields_ = [
  701. # Plugin category.
  702. ("category", c_enum),
  703. # Plugin hints.
  704. # @see PluginHints
  705. ("hints", c_uint),
  706. # Number of audio inputs.
  707. ("audioIns", c_uint32),
  708. # Number of audio outputs.
  709. ("audioOuts", c_uint32),
  710. # Number of MIDI inputs.
  711. ("midiIns", c_uint32),
  712. # Number of MIDI outputs.
  713. ("midiOuts", c_uint32),
  714. # Number of input parameters.
  715. ("parameterIns", c_uint32),
  716. # Number of output parameters.
  717. ("parameterOuts", c_uint32),
  718. # Plugin name.
  719. ("name", c_char_p),
  720. # Plugin label.
  721. ("label", c_char_p),
  722. # Plugin author/maker.
  723. ("maker", c_char_p),
  724. # Plugin copyright/license.
  725. ("copyright", c_char_p)
  726. ]
  727. # Port count information, used for Audio and MIDI ports and parameters.
  728. # @see carla_get_audio_port_count_info()
  729. # @see carla_get_midi_port_count_info()
  730. # @see carla_get_parameter_count_info()
  731. class CarlaPortCountInfo(Structure):
  732. _fields_ = [
  733. # Number of inputs.
  734. ("ins", c_uint32),
  735. # Number of outputs.
  736. ("outs", c_uint32)
  737. ]
  738. # Parameter information.
  739. # @see carla_get_parameter_info()
  740. class CarlaParameterInfo(Structure):
  741. _fields_ = [
  742. # Parameter name.
  743. ("name", c_char_p),
  744. # Parameter symbol.
  745. ("symbol", c_char_p),
  746. # Parameter unit.
  747. ("unit", c_char_p),
  748. # Number of scale points.
  749. # @see CarlaScalePointInfo
  750. ("scalePointCount", c_uint32)
  751. ]
  752. # Parameter scale point information.
  753. # @see carla_get_parameter_scalepoint_info()
  754. class CarlaScalePointInfo(Structure):
  755. _fields_ = [
  756. # Scale point value.
  757. ("value", c_float),
  758. # Scale point label.
  759. ("label", c_char_p)
  760. ]
  761. # Transport information.
  762. # @see carla_get_transport_info()
  763. class CarlaTransportInfo(Structure):
  764. _fields_ = [
  765. # Wherever transport is playing.
  766. ("playing", c_bool),
  767. # Current transport frame.
  768. ("frame", c_uint64),
  769. # Bar
  770. ("bar", c_int32),
  771. # Beat
  772. ("beat", c_int32),
  773. # Tick
  774. ("tick", c_int32),
  775. # Beats per minute.
  776. ("bpm", c_double)
  777. ]
  778. # ------------------------------------------------------------------------------------------------------------
  779. # Carla Host API (Python compatible stuff)
  780. # @see CarlaPluginInfo
  781. PyCarlaPluginInfo = {
  782. 'type': PLUGIN_NONE,
  783. 'category': PLUGIN_CATEGORY_NONE,
  784. 'hints': 0x0,
  785. 'optionsAvailable': 0x0,
  786. 'optionsEnabled': 0x0,
  787. 'filename': None,
  788. 'name': None,
  789. 'label': None,
  790. 'maker': None,
  791. 'copyright': None,
  792. 'iconName': None,
  793. 'patchbayClientId': 0,
  794. 'uniqueId': 0
  795. }
  796. # @see CarlaPortCountInfo
  797. PyCarlaPortCountInfo = {
  798. 'ins': 0,
  799. 'outs': 0
  800. }
  801. # @see CarlaParameterInfo
  802. PyCarlaParameterInfo = {
  803. 'name': None,
  804. 'symbol': None,
  805. 'unit': None,
  806. 'scalePointCount': 0,
  807. }
  808. # @see CarlaScalePointInfo
  809. PyCarlaScalePointInfo = {
  810. 'value': 0.0,
  811. 'label': None
  812. }
  813. # @see CarlaTransportInfo
  814. PyCarlaTransportInfo = {
  815. "playing": False,
  816. "frame": 0,
  817. "bar": 0,
  818. "beat": 0,
  819. "tick": 0,
  820. "bpm": 0.0
  821. }
  822. # ------------------------------------------------------------------------------------------------------------
  823. # Set BINARY_NATIVE
  824. if HAIKU or LINUX or MACOS:
  825. BINARY_NATIVE = BINARY_POSIX64 if kIs64bit else BINARY_POSIX32
  826. elif WINDOWS:
  827. BINARY_NATIVE = BINARY_WIN64 if kIs64bit else BINARY_WIN32
  828. else:
  829. BINARY_NATIVE = BINARY_OTHER
  830. # ------------------------------------------------------------------------------------------------------------
  831. # Python Host object (Control/Standalone)
  832. class Host(object):
  833. def __init__(self, libName):
  834. object.__init__(self)
  835. self._init(libName)
  836. # Get the complete license text of used third-party code and features.
  837. # Returned string is in basic html format.
  838. def get_complete_license_text(self):
  839. return self.lib.carla_get_complete_license_text()
  840. # Get all the supported file types in carla_load_filename().
  841. # Returned string uses this syntax:
  842. # @code
  843. # "*.ext1;*.ext2;*.ext3"
  844. # @endcode
  845. def get_supported_file_extensions(self):
  846. return self.lib.carla_get_supported_file_extensions()
  847. # Get how many engine drivers are available.
  848. def get_engine_driver_count(self):
  849. return self.lib.carla_get_engine_driver_count()
  850. # Get an engine driver name.
  851. # @param index Driver index
  852. def get_engine_driver_name(self, index):
  853. return self.lib.carla_get_engine_driver_name(index)
  854. # Get the device names of an engine driver.
  855. # @param index Driver index
  856. def get_engine_driver_device_names(self, index):
  857. return charPtrPtrToStringList(self.lib.carla_get_engine_driver_device_names(index))
  858. # Get information about a device driver.
  859. # @param index Driver index
  860. # @param name Device name
  861. def get_engine_driver_device_info(self, index, name):
  862. return structToDict(self.lib.carla_get_engine_driver_device_info(index, name))
  863. def get_internal_plugin_count(self):
  864. return self.lib.carla_get_internal_plugin_count()
  865. def get_internal_plugin_info(self, internalPluginId):
  866. return structToDict(self.lib.carla_get_internal_plugin_info(internalPluginId).contents)
  867. def engine_init(self, driverName, clientName):
  868. return self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8"))
  869. def engine_close(self):
  870. return self.lib.carla_engine_close()
  871. def engine_idle(self):
  872. self.lib.carla_engine_idle()
  873. def is_engine_running(self):
  874. return self.lib.carla_is_engine_running()
  875. def set_engine_about_to_close(self):
  876. self.lib.carla_set_engine_about_to_close()
  877. def set_engine_callback(self, func):
  878. self._callback = EngineCallbackFunc(func)
  879. self.lib.carla_set_engine_callback(self._callback, c_nullptr)
  880. def set_engine_option(self, option, value, valueStr):
  881. self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
  882. def load_filename(self, filename):
  883. return self.lib.carla_load_filename(filename.encode("utf-8"))
  884. def load_project(self, filename):
  885. return self.lib.carla_load_project(filename.encode("utf-8"))
  886. def save_project(self, filename):
  887. return self.lib.carla_save_project(filename.encode("utf-8"))
  888. def patchbay_connect(self, portIdA, portIdB):
  889. return self.lib.carla_patchbay_connect(portIdA, portIdB)
  890. def patchbay_disconnect(self, connectionId):
  891. return self.lib.carla_patchbay_disconnect(connectionId)
  892. def patchbay_refresh(self):
  893. return self.lib.carla_patchbay_refresh()
  894. def transport_play(self):
  895. self.lib.carla_transport_play()
  896. def transport_pause(self):
  897. self.lib.carla_transport_pause()
  898. def transport_relocate(self, frames):
  899. self.lib.carla_transport_relocate(frames)
  900. def get_current_transport_frame(self):
  901. return self.lib.carla_get_current_transport_frame()
  902. def get_transport_info(self):
  903. return structToDict(self.lib.carla_get_transport_info().contents)
  904. def add_plugin(self, btype, ptype, filename, name, label, extraStuff):
  905. cfilename = filename.encode("utf-8") if filename else c_nullptr
  906. cname = name.encode("utf-8") if name else c_nullptr
  907. clabel = label.encode("utf-8") if label else c_nullptr
  908. return self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, cast(extraStuff, c_void_p))
  909. def remove_plugin(self, pluginId):
  910. return self.lib.carla_remove_plugin(pluginId)
  911. def remove_all_plugins(self):
  912. return self.lib.carla_remove_all_plugins()
  913. def rename_plugin(self, pluginId, newName):
  914. return self.lib.carla_rename_plugin(pluginId, newName.encode("utf-8"))
  915. def clone_plugin(self, pluginId):
  916. return self.lib.carla_clone_plugin(pluginId)
  917. def replace_plugin(self, pluginId):
  918. return self.lib.carla_replace_plugin(pluginId)
  919. def switch_plugins(self, pluginIdA, pluginIdB):
  920. return self.lib.carla_switch_plugins(pluginIdA, pluginIdB)
  921. def load_plugin_state(self, pluginId, filename):
  922. return self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8"))
  923. def save_plugin_state(self, pluginId, filename):
  924. return self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8"))
  925. def get_plugin_info(self, pluginId):
  926. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  927. def get_audio_port_count_info(self, pluginId):
  928. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  929. def get_midi_port_count_info(self, pluginId):
  930. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  931. def get_parameter_count_info(self, pluginId):
  932. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  933. def get_parameter_info(self, pluginId, parameterId):
  934. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  935. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  936. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  937. def get_parameter_data(self, pluginId, parameterId):
  938. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  939. def get_parameter_ranges(self, pluginId, parameterId):
  940. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  941. def get_midi_program_data(self, pluginId, midiProgramId):
  942. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  943. def get_custom_data(self, pluginId, customDataId):
  944. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  945. def get_chunk_data(self, pluginId):
  946. return self.lib.carla_get_chunk_data(pluginId)
  947. def get_parameter_count(self, pluginId):
  948. return self.lib.carla_get_parameter_count(pluginId)
  949. def get_program_count(self, pluginId):
  950. return self.lib.carla_get_program_count(pluginId)
  951. def get_midi_program_count(self, pluginId):
  952. return self.lib.carla_get_midi_program_count(pluginId)
  953. def get_custom_data_count(self, pluginId):
  954. return self.lib.carla_get_custom_data_count(pluginId)
  955. def get_parameter_text(self, pluginId, parameterId):
  956. return self.lib.carla_get_parameter_text(pluginId, parameterId)
  957. def get_program_name(self, pluginId, programId):
  958. return self.lib.carla_get_program_name(pluginId, programId)
  959. def get_midi_program_name(self, pluginId, midiProgramId):
  960. return self.lib.carla_get_midi_program_name(pluginId, midiProgramId)
  961. def get_real_plugin_name(self, pluginId):
  962. return self.lib.carla_get_real_plugin_name(pluginId)
  963. def get_current_program_index(self, pluginId):
  964. return self.lib.carla_get_current_program_index(pluginId)
  965. def get_current_midi_program_index(self, pluginId):
  966. return self.lib.carla_get_current_midi_program_index(pluginId)
  967. def get_default_parameter_value(self, pluginId, parameterId):
  968. return self.lib.carla_get_default_parameter_value(pluginId, parameterId)
  969. def get_current_parameter_value(self, pluginId, parameterId):
  970. return self.lib.carla_get_current_parameter_value(pluginId, parameterId)
  971. def get_input_peak_value(self, pluginId, portId):
  972. return self.lib.carla_get_input_peak_value(pluginId, portId)
  973. def get_output_peak_value(self, pluginId, portId):
  974. return self.lib.carla_get_output_peak_value(pluginId, portId)
  975. def set_option(self, pluginId, option, yesNo):
  976. self.lib.carla_set_option(pluginId, option, yesNo)
  977. def set_active(self, pluginId, onOff):
  978. self.lib.carla_set_active(pluginId, onOff)
  979. def set_drywet(self, pluginId, value):
  980. self.lib.carla_set_drywet(pluginId, value)
  981. def set_volume(self, pluginId, value):
  982. self.lib.carla_set_volume(pluginId, value)
  983. def set_balance_left(self, pluginId, value):
  984. self.lib.carla_set_balance_left(pluginId, value)
  985. def set_balance_right(self, pluginId, value):
  986. self.lib.carla_set_balance_right(pluginId, value)
  987. def set_panning(self, pluginId, value):
  988. self.lib.carla_set_panning(pluginId, value)
  989. def set_ctrl_channel(self, pluginId, channel):
  990. self.lib.carla_set_ctrl_channel(pluginId, channel)
  991. def set_parameter_value(self, pluginId, parameterId, value):
  992. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  993. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  994. self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)
  995. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  996. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  997. def set_program(self, pluginId, programId):
  998. self.lib.carla_set_program(pluginId, programId)
  999. def set_midi_program(self, pluginId, midiProgramId):
  1000. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  1001. def set_custom_data(self, pluginId, type_, key, value):
  1002. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  1003. def set_chunk_data(self, pluginId, chunkData):
  1004. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  1005. def prepare_for_save(self, pluginId):
  1006. self.lib.carla_prepare_for_save(pluginId)
  1007. def send_midi_note(self, pluginId, channel, note, velocity):
  1008. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  1009. def show_gui(self, pluginId, yesNo):
  1010. self.lib.carla_show_gui(pluginId, yesNo)
  1011. def get_last_error(self):
  1012. return self.lib.carla_get_last_error()
  1013. def get_host_osc_url_tcp(self):
  1014. return self.lib.carla_get_host_osc_url_tcp()
  1015. def get_host_osc_url_udp(self):
  1016. return self.lib.carla_get_host_osc_url_udp()
  1017. def get_buffer_size(self):
  1018. return self.lib.carla_get_buffer_size()
  1019. def get_sample_rate(self):
  1020. return self.lib.carla_get_sample_rate()
  1021. def nsm_announce(self, url, appName_, pid):
  1022. self.lib.carla_nsm_announce(url.encode("utf-8"), appName_.encode("utf-8"), pid)
  1023. def nsm_ready(self):
  1024. self.lib.carla_nsm_ready()
  1025. def nsm_reply_open(self):
  1026. self.lib.carla_nsm_reply_open()
  1027. def nsm_reply_save(self):
  1028. self.lib.carla_nsm_reply_save()
  1029. def _init(self, libName):
  1030. self.lib = cdll.LoadLibrary(libName)
  1031. self.lib.carla_get_complete_license_text.argtypes = None
  1032. self.lib.carla_get_complete_license_text.restype = c_char_p
  1033. self.lib.carla_get_supported_file_extensions.argtypes = None
  1034. self.lib.carla_get_supported_file_extensions.restype = c_char_p
  1035. self.lib.carla_get_engine_driver_count.argtypes = None
  1036. self.lib.carla_get_engine_driver_count.restype = c_uint
  1037. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  1038. self.lib.carla_get_engine_driver_name.restype = c_char_p
  1039. self.lib.carla_get_engine_driver_device_names.argtypes = [c_uint]
  1040. self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)
  1041. self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p]
  1042. self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)
  1043. return
  1044. self.lib.carla_get_internal_plugin_count.argtypes = None
  1045. self.lib.carla_get_internal_plugin_count.restype = c_uint
  1046. self.lib.carla_get_internal_plugin_info.argtypes = [c_uint]
  1047. self.lib.carla_get_internal_plugin_info.restype = POINTER(CarlaNativePluginInfo)
  1048. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  1049. self.lib.carla_engine_init.restype = c_bool
  1050. self.lib.carla_engine_close.argtypes = None
  1051. self.lib.carla_engine_close.restype = c_bool
  1052. self.lib.carla_engine_idle.argtypes = None
  1053. self.lib.carla_engine_idle.restype = None
  1054. self.lib.carla_is_engine_running.argtypes = None
  1055. self.lib.carla_is_engine_running.restype = c_bool
  1056. self.lib.carla_set_engine_about_to_close.argtypes = None
  1057. self.lib.carla_set_engine_about_to_close.restype = None
  1058. self.lib.carla_set_engine_callback.argtypes = [EngineCallbackFunc, c_void_p]
  1059. self.lib.carla_set_engine_callback.restype = None
  1060. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  1061. self.lib.carla_set_engine_option.restype = None
  1062. self.lib.carla_load_filename.argtypes = [c_char_p]
  1063. self.lib.carla_load_filename.restype = c_bool
  1064. self.lib.carla_load_project.argtypes = [c_char_p]
  1065. self.lib.carla_load_project.restype = c_bool
  1066. self.lib.carla_save_project.argtypes = [c_char_p]
  1067. self.lib.carla_save_project.restype = c_bool
  1068. self.lib.carla_patchbay_connect.argtypes = [c_int, c_int]
  1069. self.lib.carla_patchbay_connect.restype = c_bool
  1070. self.lib.carla_patchbay_disconnect.argtypes = [c_int]
  1071. self.lib.carla_patchbay_disconnect.restype = c_bool
  1072. self.lib.carla_patchbay_refresh.argtypes = None
  1073. self.lib.carla_patchbay_refresh.restype = c_bool
  1074. self.lib.carla_transport_play.argtypes = None
  1075. self.lib.carla_transport_play.restype = None
  1076. self.lib.carla_transport_pause.argtypes = None
  1077. self.lib.carla_transport_pause.restype = None
  1078. self.lib.carla_transport_relocate.argtypes = [c_uint32]
  1079. self.lib.carla_transport_relocate.restype = None
  1080. self.lib.carla_get_current_transport_frame.argtypes = None
  1081. self.lib.carla_get_current_transport_frame.restype = c_uint64
  1082. self.lib.carla_get_transport_info.argtypes = None
  1083. self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
  1084. self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_void_p]
  1085. self.lib.carla_add_plugin.restype = c_bool
  1086. self.lib.carla_remove_plugin.argtypes = [c_uint]
  1087. self.lib.carla_remove_plugin.restype = c_bool
  1088. self.lib.carla_remove_all_plugins.argtypes = None
  1089. self.lib.carla_remove_all_plugins.restype = c_bool
  1090. self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
  1091. self.lib.carla_rename_plugin.restype = c_char_p
  1092. self.lib.carla_clone_plugin.argtypes = [c_uint]
  1093. self.lib.carla_clone_plugin.restype = c_bool
  1094. self.lib.carla_replace_plugin.argtypes = [c_uint]
  1095. self.lib.carla_replace_plugin.restype = c_bool
  1096. self.lib.carla_switch_plugins.argtypes = [c_uint, c_uint]
  1097. self.lib.carla_switch_plugins.restype = c_bool
  1098. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  1099. self.lib.carla_load_plugin_state.restype = c_bool
  1100. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  1101. self.lib.carla_save_plugin_state.restype = c_bool
  1102. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  1103. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  1104. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  1105. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1106. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  1107. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1108. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  1109. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  1110. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  1111. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  1112. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  1113. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  1114. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  1115. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  1116. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  1117. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  1118. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  1119. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  1120. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  1121. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  1122. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  1123. self.lib.carla_get_chunk_data.restype = c_char_p
  1124. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  1125. self.lib.carla_get_parameter_count.restype = c_uint32
  1126. self.lib.carla_get_program_count.argtypes = [c_uint]
  1127. self.lib.carla_get_program_count.restype = c_uint32
  1128. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  1129. self.lib.carla_get_midi_program_count.restype = c_uint32
  1130. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  1131. self.lib.carla_get_custom_data_count.restype = c_uint32
  1132. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
  1133. self.lib.carla_get_parameter_text.restype = c_char_p
  1134. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  1135. self.lib.carla_get_program_name.restype = c_char_p
  1136. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  1137. self.lib.carla_get_midi_program_name.restype = c_char_p
  1138. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  1139. self.lib.carla_get_real_plugin_name.restype = c_char_p
  1140. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  1141. self.lib.carla_get_current_program_index.restype = c_int32
  1142. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  1143. self.lib.carla_get_current_midi_program_index.restype = c_int32
  1144. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  1145. self.lib.carla_get_default_parameter_value.restype = c_float
  1146. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  1147. self.lib.carla_get_current_parameter_value.restype = c_float
  1148. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_ushort]
  1149. self.lib.carla_get_input_peak_value.restype = c_float
  1150. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_ushort]
  1151. self.lib.carla_get_output_peak_value.restype = c_float
  1152. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  1153. self.lib.carla_set_option.restype = None
  1154. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  1155. self.lib.carla_set_active.restype = None
  1156. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  1157. self.lib.carla_set_drywet.restype = None
  1158. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  1159. self.lib.carla_set_volume.restype = None
  1160. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  1161. self.lib.carla_set_balance_left.restype = None
  1162. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  1163. self.lib.carla_set_balance_right.restype = None
  1164. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  1165. self.lib.carla_set_panning.restype = None
  1166. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  1167. self.lib.carla_set_ctrl_channel.restype = None
  1168. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  1169. self.lib.carla_set_parameter_value.restype = None
  1170. self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
  1171. self.lib.carla_set_parameter_midi_cc.restype = None
  1172. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  1173. self.lib.carla_set_parameter_midi_channel.restype = None
  1174. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  1175. self.lib.carla_set_program.restype = None
  1176. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  1177. self.lib.carla_set_midi_program.restype = None
  1178. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  1179. self.lib.carla_set_custom_data.restype = None
  1180. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  1181. self.lib.carla_set_chunk_data.restype = None
  1182. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  1183. self.lib.carla_prepare_for_save.restype = None
  1184. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  1185. self.lib.carla_send_midi_note.restype = None
  1186. self.lib.carla_show_gui.argtypes = [c_uint, c_bool]
  1187. self.lib.carla_show_gui.restype = None
  1188. self.lib.carla_get_buffer_size.argtypes = None
  1189. self.lib.carla_get_buffer_size.restype = c_uint32
  1190. self.lib.carla_get_sample_rate.argtypes = None
  1191. self.lib.carla_get_sample_rate.restype = c_double
  1192. self.lib.carla_get_last_error.argtypes = None
  1193. self.lib.carla_get_last_error.restype = c_char_p
  1194. self.lib.carla_get_host_osc_url_tcp.argtypes = None
  1195. self.lib.carla_get_host_osc_url_tcp.restype = c_char_p
  1196. self.lib.carla_get_host_osc_url_udp.argtypes = None
  1197. self.lib.carla_get_host_osc_url_udp.restype = c_char_p
  1198. self.lib.carla_nsm_announce.argtypes = [c_char_p, c_char_p, c_int]
  1199. self.lib.carla_nsm_announce.restype = None
  1200. self.lib.carla_nsm_ready.argtypes = None
  1201. self.lib.carla_nsm_ready.restype = None
  1202. self.lib.carla_nsm_reply_open.argtypes = None
  1203. self.lib.carla_nsm_reply_open.restype = None
  1204. self.lib.carla_nsm_reply_save.argtypes = None
  1205. self.lib.carla_nsm_reply_save.restype = None