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.

1915 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. 'type': PARAMETER_UNKNOWN,
  655. 'hints': 0x0,
  656. 'index': PARAMETER_NULL,
  657. 'rindex': -1,
  658. 'midiCC': -1,
  659. 'midiChannel': 0
  660. }
  661. # @see ParameterRanges
  662. PyParameterRanges = {
  663. 'def': 0.0,
  664. 'min': 0.0,
  665. 'max': 1.0,
  666. 'step': 0.01,
  667. 'stepSmall': 0.0001,
  668. 'stepLarge': 0.1
  669. }
  670. # @see MidiProgramData
  671. PyMidiProgramData = {
  672. 'bank': 0,
  673. 'program': 0,
  674. 'name': None
  675. }
  676. # @see CustomData
  677. PyCustomData = {
  678. 'type': None,
  679. 'key': None,
  680. 'value': None
  681. }
  682. # @see EngineDriverDeviceInfo
  683. PyEngineDriverDeviceInfo = {
  684. 'hints': 0x0,
  685. 'bufferSizes': [],
  686. 'sampleRates': []
  687. }
  688. # ------------------------------------------------------------------------------------------------------------
  689. # File Callback Opcode
  690. # File callback opcodes.
  691. # Front-ends must always block-wait for user input.
  692. # @see FileCallbackFunc and carla_set_file_callback()
  693. # Debug.
  694. # This opcode is undefined and used only for testing purposes.
  695. FILE_CALLBACK_DEBUG = 0
  696. # Open file or folder.
  697. FILE_CALLBACK_OPEN = 1
  698. # Save file or folder.
  699. FILE_CALLBACK_SAVE = 2
  700. # ------------------------------------------------------------------------------------------------------------
  701. # Carla Host API (C stuff)
  702. # File callback function.
  703. # @see FileCallbackOpcode
  704. FileCallbackFunc = CFUNCTYPE(c_char_p, c_void_p, c_enum, c_bool, c_char_p, c_char_p)
  705. # Information about a loaded plugin.
  706. # @see carla_get_plugin_info()
  707. class CarlaPluginInfo(Structure):
  708. _fields_ = [
  709. # Plugin type.
  710. ("type", c_enum),
  711. # Plugin category.
  712. ("category", c_enum),
  713. # Plugin hints.
  714. # @see PluginHints
  715. ("hints", c_uint),
  716. # Plugin options available for the user to change.
  717. # @see PluginOptions
  718. ("optionsAvailable", c_uint),
  719. # Plugin options currently enabled.
  720. # Some options are enabled but not available, which means they will always be on.
  721. # @see PluginOptions
  722. ("optionsEnabled", c_uint),
  723. # Plugin filename.
  724. # This can be the plugin binary or resource file.
  725. ("filename", c_char_p),
  726. # Plugin name.
  727. # This name is unique within a Carla instance.
  728. # @see carla_get_real_plugin_name()
  729. ("name", c_char_p),
  730. # Plugin label or URI.
  731. ("label", c_char_p),
  732. # Plugin author/maker.
  733. ("maker", c_char_p),
  734. # Plugin copyright/license.
  735. ("copyright", c_char_p),
  736. # Icon name for this plugin, in lowercase.
  737. # Default is "plugin".
  738. ("iconName", c_char_p),
  739. # Patchbay client Id for this plugin.
  740. # When 0, Id is considered invalid or unused.
  741. ("patchbayClientId", c_int),
  742. # Plugin unique Id.
  743. # This Id is dependant on the plugin type and may sometimes be 0.
  744. ("uniqueId", c_long)
  745. ]
  746. # Information about an internal Carla plugin.
  747. # @see carla_get_internal_plugin_info()
  748. class CarlaNativePluginInfo(Structure):
  749. _fields_ = [
  750. # Plugin category.
  751. ("category", c_enum),
  752. # Plugin hints.
  753. # @see PluginHints
  754. ("hints", c_uint),
  755. # Number of audio inputs.
  756. ("audioIns", c_uint32),
  757. # Number of audio outputs.
  758. ("audioOuts", c_uint32),
  759. # Number of MIDI inputs.
  760. ("midiIns", c_uint32),
  761. # Number of MIDI outputs.
  762. ("midiOuts", c_uint32),
  763. # Number of input parameters.
  764. ("parameterIns", c_uint32),
  765. # Number of output parameters.
  766. ("parameterOuts", c_uint32),
  767. # Plugin name.
  768. ("name", c_char_p),
  769. # Plugin label.
  770. ("label", c_char_p),
  771. # Plugin author/maker.
  772. ("maker", c_char_p),
  773. # Plugin copyright/license.
  774. ("copyright", c_char_p)
  775. ]
  776. # Port count information, used for Audio and MIDI ports and parameters.
  777. # @see carla_get_audio_port_count_info()
  778. # @see carla_get_midi_port_count_info()
  779. # @see carla_get_parameter_count_info()
  780. class CarlaPortCountInfo(Structure):
  781. _fields_ = [
  782. # Number of inputs.
  783. ("ins", c_uint32),
  784. # Number of outputs.
  785. ("outs", c_uint32)
  786. ]
  787. # Parameter information.
  788. # @see carla_get_parameter_info()
  789. class CarlaParameterInfo(Structure):
  790. _fields_ = [
  791. # Parameter name.
  792. ("name", c_char_p),
  793. # Parameter symbol.
  794. ("symbol", c_char_p),
  795. # Parameter unit.
  796. ("unit", c_char_p),
  797. # Number of scale points.
  798. # @see CarlaScalePointInfo
  799. ("scalePointCount", c_uint32)
  800. ]
  801. # Parameter scale point information.
  802. # @see carla_get_parameter_scalepoint_info()
  803. class CarlaScalePointInfo(Structure):
  804. _fields_ = [
  805. # Scale point value.
  806. ("value", c_float),
  807. # Scale point label.
  808. ("label", c_char_p)
  809. ]
  810. # Transport information.
  811. # @see carla_get_transport_info()
  812. class CarlaTransportInfo(Structure):
  813. _fields_ = [
  814. # Wherever transport is playing.
  815. ("playing", c_bool),
  816. # Current transport frame.
  817. ("frame", c_uint64),
  818. # Bar
  819. ("bar", c_int32),
  820. # Beat
  821. ("beat", c_int32),
  822. # Tick
  823. ("tick", c_int32),
  824. # Beats per minute.
  825. ("bpm", c_double)
  826. ]
  827. # ------------------------------------------------------------------------------------------------------------
  828. # Carla Host API (Python compatible stuff)
  829. # @see CarlaPluginInfo
  830. PyCarlaPluginInfo = {
  831. 'type': PLUGIN_NONE,
  832. 'category': PLUGIN_CATEGORY_NONE,
  833. 'hints': 0x0,
  834. 'optionsAvailable': 0x0,
  835. 'optionsEnabled': 0x0,
  836. 'filename': None,
  837. 'name': None,
  838. 'label': None,
  839. 'maker': None,
  840. 'copyright': None,
  841. 'iconName': None,
  842. 'patchbayClientId': 0,
  843. 'uniqueId': 0
  844. }
  845. # @see CarlaPortCountInfo
  846. PyCarlaPortCountInfo = {
  847. 'ins': 0,
  848. 'outs': 0
  849. }
  850. # @see CarlaParameterInfo
  851. PyCarlaParameterInfo = {
  852. 'name': None,
  853. 'symbol': None,
  854. 'unit': None,
  855. 'scalePointCount': 0,
  856. }
  857. # @see CarlaScalePointInfo
  858. PyCarlaScalePointInfo = {
  859. 'value': 0.0,
  860. 'label': None
  861. }
  862. # @see CarlaTransportInfo
  863. PyCarlaTransportInfo = {
  864. "playing": False,
  865. "frame": 0,
  866. "bar": 0,
  867. "beat": 0,
  868. "tick": 0,
  869. "bpm": 0.0
  870. }
  871. # ------------------------------------------------------------------------------------------------------------
  872. # Set BINARY_NATIVE
  873. if HAIKU or LINUX or MACOS:
  874. BINARY_NATIVE = BINARY_POSIX64 if kIs64bit else BINARY_POSIX32
  875. elif WINDOWS:
  876. BINARY_NATIVE = BINARY_WIN64 if kIs64bit else BINARY_WIN32
  877. else:
  878. BINARY_NATIVE = BINARY_OTHER
  879. # ------------------------------------------------------------------------------------------------------------
  880. # Python Host object (Control/Standalone)
  881. class Host(object):
  882. def __init__(self, libName):
  883. object.__init__(self)
  884. self._init(libName)
  885. # Get the complete license text of used third-party code and features.
  886. # Returned string is in basic html format.
  887. def get_complete_license_text(self):
  888. return charPtrToString(self.lib.carla_get_complete_license_text())
  889. # Get all the supported file extensions in carla_load_file().
  890. # Returned string uses this syntax:
  891. # @code
  892. # "*.ext1;*.ext2;*.ext3"
  893. # @endcode
  894. def get_supported_file_extensions(self):
  895. return charPtrToString(self.lib.carla_get_supported_file_extensions())
  896. # Get how many engine drivers are available.
  897. def get_engine_driver_count(self):
  898. return int(self.lib.carla_get_engine_driver_count())
  899. # Get an engine driver name.
  900. # @param index Driver index
  901. def get_engine_driver_name(self, index):
  902. return charPtrToString(self.lib.carla_get_engine_driver_name(index))
  903. # Get the device names of an engine driver.
  904. # @param index Driver index
  905. def get_engine_driver_device_names(self, index):
  906. return charPtrPtrToStringList(self.lib.carla_get_engine_driver_device_names(index))
  907. # Get information about a device driver.
  908. # @param index Driver index
  909. # @param name Device name
  910. def get_engine_driver_device_info(self, index, name):
  911. return structToDict(self.lib.carla_get_engine_driver_device_info(index, name).contents)
  912. # Get how many internal plugins are available.
  913. def get_internal_plugin_count(self):
  914. return int(self.lib.carla_get_internal_plugin_count())
  915. # Get information about an internal plugin.
  916. # @param index Internal plugin Id
  917. def get_internal_plugin_info(self, index):
  918. return structToDict(self.lib.carla_get_internal_plugin_info(index).contents)
  919. # Initialize the engine.
  920. # Make sure to call carla_engine_idle() at regular intervals afterwards.
  921. # @param driverName Driver to use
  922. # @param clientName Engine master client name
  923. def engine_init(self, driverName, clientName):
  924. return bool(self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8")))
  925. # Close the engine.
  926. # This function always closes the engine even if it returns false.
  927. # In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
  928. def engine_close(self):
  929. return bool(self.lib.carla_engine_close())
  930. # Idle the engine.
  931. # Do not call this if the engine is not running.
  932. def engine_idle(self):
  933. self.lib.carla_engine_idle()
  934. # Check if the engine is running.
  935. def is_engine_running(self):
  936. return bool(self.lib.carla_is_engine_running())
  937. # Tell the engine it's about to close.
  938. # This is used to prevent the engine thread(s) from reactivating.
  939. def set_engine_about_to_close(self):
  940. self.lib.carla_set_engine_about_to_close()
  941. # Set the engine callback function.
  942. # @param func Callback function
  943. def set_engine_callback(self, func):
  944. self._engineCallback = EngineCallbackFunc(func)
  945. self.lib.carla_set_engine_callback(self._engineCallback, None)
  946. # Set an engine option.
  947. # @param option Option
  948. # @param value Value as number
  949. # @param valueStr Value as string
  950. def set_engine_option(self, option, value, valueStr):
  951. self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
  952. # Set the file callback function.
  953. # @param func Callback function
  954. # @param ptr Callback pointer
  955. def set_file_callback(self, func):
  956. self._fileCallback = FileCallbackFunc(func)
  957. self.lib.carla_set_file_callback(self._fileCallback, None)
  958. # Load a file of any type.\n
  959. # This will try to load a generic file as a plugin,
  960. # either by direct handling (Csound, GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
  961. # @param Filename Filename
  962. # @see carla_get_supported_file_extensions()
  963. def load_file(self, filename):
  964. return bool(self.lib.carla_load_file(filename.encode("utf-8")))
  965. # Load a Carla project file.
  966. # @param Filename Filename
  967. # @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
  968. def load_project(self, filename):
  969. return bool(self.lib.carla_load_project(filename.encode("utf-8")))
  970. # Save current project to a file.
  971. # @param Filename Filename
  972. def save_project(self, filename):
  973. return bool(self.lib.carla_save_project(filename.encode("utf-8")))
  974. # Connect two patchbay ports.
  975. # @param portIdA Output port
  976. # @param portIdB Input port
  977. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
  978. def patchbay_connect(self, portIdA, portIdB):
  979. return bool(self.lib.carla_patchbay_connect(portIdA, portIdB))
  980. # Disconnect two patchbay ports.
  981. # @param connectionId Connection Id
  982. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
  983. def patchbay_disconnect(self, connectionId):
  984. return bool(self.lib.carla_patchbay_disconnect(connectionId))
  985. # Force the engine to resend all patchbay clients, ports and connections again.
  986. def patchbay_refresh(self):
  987. return bool(self.lib.carla_patchbay_refresh())
  988. # Start playback of the engine transport.
  989. def transport_play(self):
  990. self.lib.carla_transport_play()
  991. # Pause the engine transport.
  992. def transport_pause(self):
  993. self.lib.carla_transport_pause()
  994. # Relocate the engine transport to a specific frame.
  995. # @param frames Frame to relocate to.
  996. def transport_relocate(self, frame):
  997. self.lib.carla_transport_relocate(frame)
  998. # Get the current transport frame.
  999. def get_current_transport_frame(self):
  1000. return bool(self.lib.carla_get_current_transport_frame())
  1001. # Get the engine transport information.
  1002. def get_transport_info(self):
  1003. return structToDict(self.lib.carla_get_transport_info().contents)
  1004. # Add a new plugin.
  1005. # If you don't know the binary type use the BINARY_NATIVE macro.
  1006. # @param btype Binary type
  1007. # @param ptype Plugin type
  1008. # @param filename Filename, if applicable
  1009. # @param name Name of the plugin, can be NULL
  1010. # @param label Plugin label, if applicable
  1011. # @param extraPtr Extra pointer, defined per plugin type
  1012. def add_plugin(self, btype, ptype, filename, name, label, extraPtr):
  1013. cfilename = filename.encode("utf-8") if filename else None
  1014. cname = name.encode("utf-8") if name else None
  1015. clabel = label.encode("utf-8") if label else None
  1016. return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, cast(extraPtr, c_void_p)))
  1017. # Remove a plugin.
  1018. # @param pluginId Plugin to remove.
  1019. def remove_plugin(self, pluginId):
  1020. return bool(self.lib.carla_remove_plugin(pluginId))
  1021. # Remove all plugins.
  1022. def remove_all_plugins(self):
  1023. return bool(self.lib.carla_remove_all_plugins())
  1024. # Rename a plugin.\n
  1025. # Returns the new name, or NULL if the operation failed.
  1026. # @param pluginId Plugin to rename
  1027. # @param newName New plugin name
  1028. def rename_plugin(self, pluginId, newName):
  1029. return charPtrToString(self.lib.carla_rename_plugin(pluginId, newName.encode("utf-8")))
  1030. # Clone a plugin.
  1031. # @param pluginId Plugin to clone
  1032. def clone_plugin(self, pluginId):
  1033. return bool(self.lib.carla_clone_plugin(pluginId))
  1034. # Prepare replace of a plugin.\n
  1035. # The next call to carla_add_plugin() will use this id, replacing the current plugin.
  1036. # @param pluginId Plugin to replace
  1037. # @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  1038. def replace_plugin(self, pluginId):
  1039. return bool(self.lib.carla_replace_plugin(pluginId))
  1040. # Switch two plugins positions.
  1041. # @param pluginIdA Plugin A
  1042. # @param pluginIdB Plugin B
  1043. def switch_plugins(self, pluginIdA, pluginIdB):
  1044. return bool(self.lib.carla_switch_plugins(pluginIdA, pluginIdB))
  1045. # Load a plugin state.
  1046. # @param pluginId Plugin
  1047. # @param filename Path to plugin state
  1048. # @see carla_save_plugin_state()
  1049. def load_plugin_state(self, pluginId, filename):
  1050. return bool(self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8")))
  1051. # Save a plugin state.
  1052. # @param pluginId Plugin
  1053. # @param filename Path to plugin state
  1054. # @see carla_load_plugin_state()
  1055. def save_plugin_state(self, pluginId, filename):
  1056. return bool(self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8")))
  1057. # Get information from a plugin.
  1058. # @param pluginId Plugin
  1059. def get_plugin_info(self, pluginId):
  1060. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  1061. # Get audio port count information from a plugin.
  1062. # @param pluginId Plugin
  1063. def get_audio_port_count_info(self, pluginId):
  1064. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  1065. # Get MIDI port count information from a plugin.
  1066. # @param pluginId Plugin
  1067. def get_midi_port_count_info(self, pluginId):
  1068. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  1069. # Get parameter count information from a plugin.
  1070. # @param pluginId Plugin
  1071. def get_parameter_count_info(self, pluginId):
  1072. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  1073. # Get parameter information from a plugin.
  1074. # @param pluginId Plugin
  1075. # @param parameterId Parameter index
  1076. # @see carla_get_parameter_count()
  1077. def get_parameter_info(self, pluginId, parameterId):
  1078. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  1079. # Get parameter scale point information from a plugin.
  1080. # @param pluginId Plugin
  1081. # @param parameterId Parameter index
  1082. # @param scalePointId Parameter scale-point index
  1083. # @see CarlaParameterInfo::scalePointCount
  1084. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1085. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  1086. # Get a plugin's parameter data.
  1087. # @param pluginId Plugin
  1088. # @param parameterId Parameter index
  1089. # @see carla_get_parameter_count()
  1090. def get_parameter_data(self, pluginId, parameterId):
  1091. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  1092. # Get a plugin's parameter ranges.
  1093. # @param pluginId Plugin
  1094. # @param parameterId Parameter index
  1095. # @see carla_get_parameter_count()
  1096. def get_parameter_ranges(self, pluginId, parameterId):
  1097. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  1098. # Get a plugin's MIDI program data.
  1099. # @param pluginId Plugin
  1100. # @param midiProgramId MIDI Program index
  1101. # @see carla_get_midi_program_count()
  1102. def get_midi_program_data(self, pluginId, midiProgramId):
  1103. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  1104. # Get a plugin's custom data.
  1105. # @param pluginId Plugin
  1106. # @param customDataId Custom data index
  1107. # @see carla_get_custom_data_count()
  1108. def get_custom_data(self, pluginId, customDataId):
  1109. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  1110. # Get a plugin's chunk data.
  1111. # @param pluginId Plugin
  1112. # @see PLUGIN_OPTION_USE_CHUNKS
  1113. def get_chunk_data(self, pluginId):
  1114. return charPtrToString(self.lib.carla_get_chunk_data(pluginId))
  1115. # Get how many parameters a plugin has.
  1116. # @param pluginId Plugin
  1117. def get_parameter_count(self, pluginId):
  1118. return int(self.lib.carla_get_parameter_count(pluginId))
  1119. # Get how many programs a plugin has.
  1120. # @param pluginId Plugin
  1121. # @see carla_get_program_name()
  1122. def get_program_count(self, pluginId):
  1123. return int(self.lib.carla_get_program_count(pluginId))
  1124. # Get how many MIDI programs a plugin has.
  1125. # @param pluginId Plugin
  1126. # @see carla_get_midi_program_name() and carla_get_midi_program_data()
  1127. def get_midi_program_count(self, pluginId):
  1128. return int(self.lib.carla_get_midi_program_count(pluginId))
  1129. # Get how many custom data sets a plugin has.
  1130. # @param pluginId Plugin
  1131. # @see carla_get_custom_data()
  1132. def get_custom_data_count(self, pluginId):
  1133. return int(self.lib.carla_get_custom_data_count(pluginId))
  1134. # Get a plugin's parameter text (custom display of internal values).
  1135. # @param pluginId Plugin
  1136. # @param parameterId Parameter index
  1137. # @see PARAMETER_USES_CUSTOM_TEXT
  1138. def get_parameter_text(self, pluginId, parameterId):
  1139. return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId))
  1140. # Get a plugin's program name.
  1141. # @param pluginId Plugin
  1142. # @param programId Program index
  1143. # @see carla_get_program_count()
  1144. def get_program_name(self, pluginId, programId):
  1145. return charPtrToString(self.lib.carla_get_program_name(pluginId, programId))
  1146. # Get a plugin's MIDI program name.
  1147. # @param pluginId Plugin
  1148. # @param midiProgramId MIDI Program index
  1149. # @see carla_get_midi_program_count()
  1150. def get_midi_program_name(self, pluginId, midiProgramId):
  1151. return charPtrToString(self.lib.carla_get_midi_program_name(pluginId, midiProgramId))
  1152. # Get a plugin's real name.\n
  1153. # This is the name the plugin uses to identify itself; may not be unique.
  1154. # @param pluginId Plugin
  1155. def get_real_plugin_name(self, pluginId):
  1156. return charPtrToString(self.lib.carla_get_real_plugin_name(pluginId))
  1157. # Get a plugin's program index.
  1158. # @param pluginId Plugin
  1159. def get_current_program_index(self, pluginId):
  1160. return int(self.lib.carla_get_current_program_index(pluginId))
  1161. # Get a plugin's midi program index.
  1162. # @param pluginId Plugin
  1163. def get_current_midi_program_index(self, pluginId):
  1164. return int(self.lib.carla_get_current_midi_program_index(pluginId))
  1165. # Get a plugin's default parameter value.
  1166. # @param pluginId Plugin
  1167. # @param parameterId Parameter index
  1168. def get_default_parameter_value(self, pluginId, parameterId):
  1169. return float(self.lib.carla_get_default_parameter_value(pluginId, parameterId))
  1170. # Get a plugin's current parameter value.
  1171. # @param pluginId Plugin
  1172. # @param parameterId Parameter index
  1173. def get_current_parameter_value(self, pluginId, parameterId):
  1174. return float(self.lib.carla_get_current_parameter_value(pluginId, parameterId))
  1175. # Get a plugin's input peak value.
  1176. # @param pluginId Plugin
  1177. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1178. def get_input_peak_value(self, pluginId, isLeft):
  1179. return float(self.lib.carla_get_input_peak_value(pluginId, isLeft))
  1180. # Get a plugin's output peak value.
  1181. # @param pluginId Plugin
  1182. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1183. def get_output_peak_value(self, pluginId, isLeft):
  1184. return float(self.lib.carla_get_output_peak_value(pluginId, isLeft))
  1185. # Enable a plugin's option.
  1186. # @param pluginId Plugin
  1187. # @param option An option from PluginOptions
  1188. # @param yesNo New enabled state
  1189. def set_option(self, pluginId, option, yesNo):
  1190. self.lib.carla_set_option(pluginId, option, yesNo)
  1191. # Enable or disable a plugin.
  1192. # @param pluginId Plugin
  1193. # @param onOff New active state
  1194. def set_active(self, pluginId, onOff):
  1195. self.lib.carla_set_active(pluginId, onOff)
  1196. # Change a plugin's internal dry/wet.
  1197. # @param pluginId Plugin
  1198. # @param value New dry/wet value
  1199. def set_drywet(self, pluginId, value):
  1200. self.lib.carla_set_drywet(pluginId, value)
  1201. # Change a plugin's internal volume.
  1202. # @param pluginId Plugin
  1203. # @param value New volume
  1204. def set_volume(self, pluginId, value):
  1205. self.lib.carla_set_volume(pluginId, value)
  1206. # Change a plugin's internal stereo balance, left channel.
  1207. # @param pluginId Plugin
  1208. # @param value New value
  1209. def set_balance_left(self, pluginId, value):
  1210. self.lib.carla_set_balance_left(pluginId, value)
  1211. # Change a plugin's internal stereo balance, right channel.
  1212. # @param pluginId Plugin
  1213. # @param value New value
  1214. def set_balance_right(self, pluginId, value):
  1215. self.lib.carla_set_balance_right(pluginId, value)
  1216. # Change a plugin's internal mono panning value.
  1217. # @param pluginId Plugin
  1218. # @param value New value
  1219. def set_panning(self, pluginId, value):
  1220. self.lib.carla_set_panning(pluginId, value)
  1221. # Change a plugin's internal control channel.
  1222. # @param pluginId Plugin
  1223. # @param channel New channel
  1224. def set_ctrl_channel(self, pluginId, channel):
  1225. self.lib.carla_set_ctrl_channel(pluginId, channel)
  1226. # Change a plugin's parameter value.
  1227. # @param pluginId Plugin
  1228. # @param parameterId Parameter index
  1229. # @param value New value
  1230. def set_parameter_value(self, pluginId, parameterId, value):
  1231. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  1232. # Change a plugin's parameter MIDI cc.
  1233. # @param pluginId Plugin
  1234. # @param parameterId Parameter index
  1235. # @param cc New MIDI cc
  1236. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1237. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  1238. # Change a plugin's parameter MIDI channel.
  1239. # @param pluginId Plugin
  1240. # @param parameterId Parameter index
  1241. # @param channel New MIDI channel
  1242. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  1243. self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)
  1244. # Change a plugin's current program.
  1245. # @param pluginId Plugin
  1246. # @param programId New program
  1247. def set_program(self, pluginId, programId):
  1248. self.lib.carla_set_program(pluginId, programId)
  1249. # Change a plugin's current MIDI program.
  1250. # @param pluginId Plugin
  1251. # @param midiProgramId New value
  1252. def set_midi_program(self, pluginId, midiProgramId):
  1253. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  1254. # Set a plugin's custom data set.
  1255. # @param pluginId Plugin
  1256. # @param type Type
  1257. # @param key Key
  1258. # @param value New value
  1259. # @see CustomDataTypes and CustomDataKeys
  1260. def set_custom_data(self, pluginId, type_, key, value):
  1261. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  1262. # Set a plugin's chunk data.
  1263. # @param pluginId Plugin
  1264. # @param value New value
  1265. # @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  1266. def set_chunk_data(self, pluginId, chunkData):
  1267. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  1268. # Tell a plugin to prepare for save.\n
  1269. # This should be called before saving custom data sets.
  1270. # @param pluginId Plugin
  1271. def prepare_for_save(self, pluginId):
  1272. self.lib.carla_prepare_for_save(pluginId)
  1273. # Send a single note of a plugin.\n
  1274. # If velocity is 0, note-off is sent; note-on otherwise.
  1275. # @param pluginId Plugin
  1276. # @param channel Note channel
  1277. # @param note Note pitch
  1278. # @param velocity Note velocity
  1279. def send_midi_note(self, pluginId, channel, note, velocity):
  1280. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  1281. # Tell a plugin to show its own custom UI.
  1282. # @param pluginId Plugin
  1283. # @param yesNo New UI state, visible or not
  1284. # @see PLUGIN_HAS_CUSTOM_UI
  1285. def show_custom_ui(self, pluginId, yesNo):
  1286. self.lib.carla_show_custom_ui(pluginId, yesNo)
  1287. # Get the current engine buffer size.
  1288. def get_buffer_size(self):
  1289. return int(self.lib.carla_get_buffer_size())
  1290. # Get the current engine sample rate.
  1291. def get_sample_rate(self):
  1292. return float(self.lib.carla_get_sample_rate())
  1293. # Get the last error.
  1294. def get_last_error(self):
  1295. return charPtrToString(self.lib.carla_get_last_error())
  1296. # Get the current engine OSC URL (TCP).
  1297. def get_host_osc_url_tcp(self):
  1298. return charPtrToString(self.lib.carla_get_host_osc_url_tcp())
  1299. # Get the current engine OSC URL (UDP).
  1300. def get_host_osc_url_udp(self):
  1301. return charPtrToString(self.lib.carla_get_host_osc_url_udp())
  1302. def _init(self, libName):
  1303. self.lib = cdll.LoadLibrary(libName)
  1304. self.lib.carla_get_complete_license_text.argtypes = None
  1305. self.lib.carla_get_complete_license_text.restype = c_char_p
  1306. self.lib.carla_get_supported_file_extensions.argtypes = None
  1307. self.lib.carla_get_supported_file_extensions.restype = c_char_p
  1308. self.lib.carla_get_engine_driver_count.argtypes = None
  1309. self.lib.carla_get_engine_driver_count.restype = c_uint
  1310. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  1311. self.lib.carla_get_engine_driver_name.restype = c_char_p
  1312. self.lib.carla_get_engine_driver_device_names.argtypes = [c_uint]
  1313. self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)
  1314. self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p]
  1315. self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)
  1316. self.lib.carla_get_internal_plugin_count.argtypes = None
  1317. self.lib.carla_get_internal_plugin_count.restype = c_uint
  1318. self.lib.carla_get_internal_plugin_info.argtypes = [c_uint]
  1319. self.lib.carla_get_internal_plugin_info.restype = POINTER(CarlaNativePluginInfo)
  1320. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  1321. self.lib.carla_engine_init.restype = c_bool
  1322. self.lib.carla_engine_close.argtypes = None
  1323. self.lib.carla_engine_close.restype = c_bool
  1324. self.lib.carla_engine_idle.argtypes = None
  1325. self.lib.carla_engine_idle.restype = None
  1326. self.lib.carla_is_engine_running.argtypes = None
  1327. self.lib.carla_is_engine_running.restype = c_bool
  1328. self.lib.carla_set_engine_about_to_close.argtypes = None
  1329. self.lib.carla_set_engine_about_to_close.restype = None
  1330. self.lib.carla_set_engine_callback.argtypes = [EngineCallbackFunc, c_void_p]
  1331. self.lib.carla_set_engine_callback.restype = None
  1332. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  1333. self.lib.carla_set_engine_option.restype = None
  1334. self.lib.carla_set_file_callback.argtypes = [FileCallbackFunc, c_void_p]
  1335. self.lib.carla_set_file_callback.restype = None
  1336. self.lib.carla_load_file.argtypes = [c_char_p]
  1337. self.lib.carla_load_file.restype = c_bool
  1338. self.lib.carla_load_project.argtypes = [c_char_p]
  1339. self.lib.carla_load_project.restype = c_bool
  1340. self.lib.carla_save_project.argtypes = [c_char_p]
  1341. self.lib.carla_save_project.restype = c_bool
  1342. self.lib.carla_patchbay_connect.argtypes = [c_int, c_int]
  1343. self.lib.carla_patchbay_connect.restype = c_bool
  1344. self.lib.carla_patchbay_disconnect.argtypes = [c_int]
  1345. self.lib.carla_patchbay_disconnect.restype = c_bool
  1346. self.lib.carla_patchbay_refresh.argtypes = None
  1347. self.lib.carla_patchbay_refresh.restype = c_bool
  1348. self.lib.carla_transport_play.argtypes = None
  1349. self.lib.carla_transport_play.restype = None
  1350. self.lib.carla_transport_pause.argtypes = None
  1351. self.lib.carla_transport_pause.restype = None
  1352. self.lib.carla_transport_relocate.argtypes = [c_uint64]
  1353. self.lib.carla_transport_relocate.restype = None
  1354. self.lib.carla_get_current_transport_frame.argtypes = None
  1355. self.lib.carla_get_current_transport_frame.restype = c_uint64
  1356. self.lib.carla_get_transport_info.argtypes = None
  1357. self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
  1358. self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_void_p]
  1359. self.lib.carla_add_plugin.restype = c_bool
  1360. self.lib.carla_remove_plugin.argtypes = [c_uint]
  1361. self.lib.carla_remove_plugin.restype = c_bool
  1362. self.lib.carla_remove_all_plugins.argtypes = None
  1363. self.lib.carla_remove_all_plugins.restype = c_bool
  1364. self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
  1365. self.lib.carla_rename_plugin.restype = c_char_p
  1366. self.lib.carla_clone_plugin.argtypes = [c_uint]
  1367. self.lib.carla_clone_plugin.restype = c_bool
  1368. self.lib.carla_replace_plugin.argtypes = [c_uint]
  1369. self.lib.carla_replace_plugin.restype = c_bool
  1370. self.lib.carla_switch_plugins.argtypes = [c_uint, c_uint]
  1371. self.lib.carla_switch_plugins.restype = c_bool
  1372. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  1373. self.lib.carla_load_plugin_state.restype = c_bool
  1374. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  1375. self.lib.carla_save_plugin_state.restype = c_bool
  1376. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  1377. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  1378. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  1379. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1380. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  1381. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1382. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  1383. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  1384. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  1385. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  1386. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  1387. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  1388. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  1389. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  1390. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  1391. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  1392. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  1393. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  1394. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  1395. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  1396. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  1397. self.lib.carla_get_chunk_data.restype = c_char_p
  1398. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  1399. self.lib.carla_get_parameter_count.restype = c_uint32
  1400. self.lib.carla_get_program_count.argtypes = [c_uint]
  1401. self.lib.carla_get_program_count.restype = c_uint32
  1402. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  1403. self.lib.carla_get_midi_program_count.restype = c_uint32
  1404. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  1405. self.lib.carla_get_custom_data_count.restype = c_uint32
  1406. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
  1407. self.lib.carla_get_parameter_text.restype = c_char_p
  1408. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  1409. self.lib.carla_get_program_name.restype = c_char_p
  1410. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  1411. self.lib.carla_get_midi_program_name.restype = c_char_p
  1412. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  1413. self.lib.carla_get_real_plugin_name.restype = c_char_p
  1414. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  1415. self.lib.carla_get_current_program_index.restype = c_int32
  1416. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  1417. self.lib.carla_get_current_midi_program_index.restype = c_int32
  1418. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  1419. self.lib.carla_get_default_parameter_value.restype = c_float
  1420. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  1421. self.lib.carla_get_current_parameter_value.restype = c_float
  1422. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_bool]
  1423. self.lib.carla_get_input_peak_value.restype = c_float
  1424. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_bool]
  1425. self.lib.carla_get_output_peak_value.restype = c_float
  1426. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  1427. self.lib.carla_set_option.restype = None
  1428. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  1429. self.lib.carla_set_active.restype = None
  1430. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  1431. self.lib.carla_set_drywet.restype = None
  1432. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  1433. self.lib.carla_set_volume.restype = None
  1434. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  1435. self.lib.carla_set_balance_left.restype = None
  1436. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  1437. self.lib.carla_set_balance_right.restype = None
  1438. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  1439. self.lib.carla_set_panning.restype = None
  1440. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  1441. self.lib.carla_set_ctrl_channel.restype = None
  1442. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  1443. self.lib.carla_set_parameter_value.restype = None
  1444. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  1445. self.lib.carla_set_parameter_midi_channel.restype = None
  1446. self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
  1447. self.lib.carla_set_parameter_midi_cc.restype = None
  1448. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  1449. self.lib.carla_set_program.restype = None
  1450. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  1451. self.lib.carla_set_midi_program.restype = None
  1452. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  1453. self.lib.carla_set_custom_data.restype = None
  1454. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  1455. self.lib.carla_set_chunk_data.restype = None
  1456. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  1457. self.lib.carla_prepare_for_save.restype = None
  1458. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  1459. self.lib.carla_send_midi_note.restype = None
  1460. self.lib.carla_show_custom_ui.argtypes = [c_uint, c_bool]
  1461. self.lib.carla_show_custom_ui.restype = None
  1462. self.lib.carla_get_buffer_size.argtypes = None
  1463. self.lib.carla_get_buffer_size.restype = c_uint32
  1464. self.lib.carla_get_sample_rate.argtypes = None
  1465. self.lib.carla_get_sample_rate.restype = c_double
  1466. self.lib.carla_get_last_error.argtypes = None
  1467. self.lib.carla_get_last_error.restype = c_char_p
  1468. self.lib.carla_get_host_osc_url_tcp.argtypes = None
  1469. self.lib.carla_get_host_osc_url_tcp.restype = c_char_p
  1470. self.lib.carla_get_host_osc_url_udp.argtypes = None
  1471. self.lib.carla_get_host_osc_url_udp.restype = c_char_p