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.

carla_backend.py 62KB

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