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.

1914 lines
61KB

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