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
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955
  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_int64)
  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 uniqueId Plugin unique Id, if applicable
  1042. # @param extraPtr Extra pointer, defined per plugin type
  1043. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr):
  1044. cfilename = filename.encode("utf-8") if filename else None
  1045. cname = name.encode("utf-8") if name else None
  1046. clabel = label.encode("utf-8") if label else None
  1047. return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p)))
  1048. # Remove a plugin.
  1049. # @param pluginId Plugin to remove.
  1050. def remove_plugin(self, pluginId):
  1051. return bool(self.lib.carla_remove_plugin(pluginId))
  1052. # Remove all plugins.
  1053. def remove_all_plugins(self):
  1054. return bool(self.lib.carla_remove_all_plugins())
  1055. # Rename a plugin.\n
  1056. # Returns the new name, or NULL if the operation failed.
  1057. # @param pluginId Plugin to rename
  1058. # @param newName New plugin name
  1059. def rename_plugin(self, pluginId, newName):
  1060. return charPtrToString(self.lib.carla_rename_plugin(pluginId, newName.encode("utf-8")))
  1061. # Clone a plugin.
  1062. # @param pluginId Plugin to clone
  1063. def clone_plugin(self, pluginId):
  1064. return bool(self.lib.carla_clone_plugin(pluginId))
  1065. # Prepare replace of a plugin.\n
  1066. # The next call to carla_add_plugin() will use this id, replacing the current plugin.
  1067. # @param pluginId Plugin to replace
  1068. # @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  1069. def replace_plugin(self, pluginId):
  1070. return bool(self.lib.carla_replace_plugin(pluginId))
  1071. # Switch two plugins positions.
  1072. # @param pluginIdA Plugin A
  1073. # @param pluginIdB Plugin B
  1074. def switch_plugins(self, pluginIdA, pluginIdB):
  1075. return bool(self.lib.carla_switch_plugins(pluginIdA, pluginIdB))
  1076. # Load a plugin state.
  1077. # @param pluginId Plugin
  1078. # @param filename Path to plugin state
  1079. # @see carla_save_plugin_state()
  1080. def load_plugin_state(self, pluginId, filename):
  1081. return bool(self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8")))
  1082. # Save a plugin state.
  1083. # @param pluginId Plugin
  1084. # @param filename Path to plugin state
  1085. # @see carla_load_plugin_state()
  1086. def save_plugin_state(self, pluginId, filename):
  1087. return bool(self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8")))
  1088. # Get information from a plugin.
  1089. # @param pluginId Plugin
  1090. def get_plugin_info(self, pluginId):
  1091. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  1092. # Get audio port count information from a plugin.
  1093. # @param pluginId Plugin
  1094. def get_audio_port_count_info(self, pluginId):
  1095. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  1096. # Get MIDI port count information from a plugin.
  1097. # @param pluginId Plugin
  1098. def get_midi_port_count_info(self, pluginId):
  1099. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  1100. # Get parameter count information from a plugin.
  1101. # @param pluginId Plugin
  1102. def get_parameter_count_info(self, pluginId):
  1103. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  1104. # Get parameter information from a plugin.
  1105. # @param pluginId Plugin
  1106. # @param parameterId Parameter index
  1107. # @see carla_get_parameter_count()
  1108. def get_parameter_info(self, pluginId, parameterId):
  1109. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  1110. # Get parameter scale point information from a plugin.
  1111. # @param pluginId Plugin
  1112. # @param parameterId Parameter index
  1113. # @param scalePointId Parameter scale-point index
  1114. # @see CarlaParameterInfo::scalePointCount
  1115. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1116. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  1117. # Get a plugin's parameter data.
  1118. # @param pluginId Plugin
  1119. # @param parameterId Parameter index
  1120. # @see carla_get_parameter_count()
  1121. def get_parameter_data(self, pluginId, parameterId):
  1122. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  1123. # Get a plugin's parameter ranges.
  1124. # @param pluginId Plugin
  1125. # @param parameterId Parameter index
  1126. # @see carla_get_parameter_count()
  1127. def get_parameter_ranges(self, pluginId, parameterId):
  1128. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  1129. # Get a plugin's MIDI program data.
  1130. # @param pluginId Plugin
  1131. # @param midiProgramId MIDI Program index
  1132. # @see carla_get_midi_program_count()
  1133. def get_midi_program_data(self, pluginId, midiProgramId):
  1134. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  1135. # Get a plugin's custom data.
  1136. # @param pluginId Plugin
  1137. # @param customDataId Custom data index
  1138. # @see carla_get_custom_data_count()
  1139. def get_custom_data(self, pluginId, customDataId):
  1140. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  1141. # Get a plugin's chunk data.
  1142. # @param pluginId Plugin
  1143. # @see PLUGIN_OPTION_USE_CHUNKS
  1144. def get_chunk_data(self, pluginId):
  1145. return charPtrToString(self.lib.carla_get_chunk_data(pluginId))
  1146. # Get how many parameters a plugin has.
  1147. # @param pluginId Plugin
  1148. def get_parameter_count(self, pluginId):
  1149. return int(self.lib.carla_get_parameter_count(pluginId))
  1150. # Get how many programs a plugin has.
  1151. # @param pluginId Plugin
  1152. # @see carla_get_program_name()
  1153. def get_program_count(self, pluginId):
  1154. return int(self.lib.carla_get_program_count(pluginId))
  1155. # Get how many MIDI programs a plugin has.
  1156. # @param pluginId Plugin
  1157. # @see carla_get_midi_program_name() and carla_get_midi_program_data()
  1158. def get_midi_program_count(self, pluginId):
  1159. return int(self.lib.carla_get_midi_program_count(pluginId))
  1160. # Get how many custom data sets a plugin has.
  1161. # @param pluginId Plugin
  1162. # @see carla_get_custom_data()
  1163. def get_custom_data_count(self, pluginId):
  1164. return int(self.lib.carla_get_custom_data_count(pluginId))
  1165. # Get a plugin's parameter text (custom display of internal values).
  1166. # @param pluginId Plugin
  1167. # @param parameterId Parameter index
  1168. # @param value Parameter value
  1169. # @see PARAMETER_USES_CUSTOM_TEXT
  1170. def get_parameter_text(self, pluginId, parameterId, value):
  1171. return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId, value))
  1172. # Get a plugin's program name.
  1173. # @param pluginId Plugin
  1174. # @param programId Program index
  1175. # @see carla_get_program_count()
  1176. def get_program_name(self, pluginId, programId):
  1177. return charPtrToString(self.lib.carla_get_program_name(pluginId, programId))
  1178. # Get a plugin's MIDI program name.
  1179. # @param pluginId Plugin
  1180. # @param midiProgramId MIDI Program index
  1181. # @see carla_get_midi_program_count()
  1182. def get_midi_program_name(self, pluginId, midiProgramId):
  1183. return charPtrToString(self.lib.carla_get_midi_program_name(pluginId, midiProgramId))
  1184. # Get a plugin's real name.\n
  1185. # This is the name the plugin uses to identify itself; may not be unique.
  1186. # @param pluginId Plugin
  1187. def get_real_plugin_name(self, pluginId):
  1188. return charPtrToString(self.lib.carla_get_real_plugin_name(pluginId))
  1189. # Get a plugin's program index.
  1190. # @param pluginId Plugin
  1191. def get_current_program_index(self, pluginId):
  1192. return int(self.lib.carla_get_current_program_index(pluginId))
  1193. # Get a plugin's midi program index.
  1194. # @param pluginId Plugin
  1195. def get_current_midi_program_index(self, pluginId):
  1196. return int(self.lib.carla_get_current_midi_program_index(pluginId))
  1197. # Get a plugin's default parameter value.
  1198. # @param pluginId Plugin
  1199. # @param parameterId Parameter index
  1200. def get_default_parameter_value(self, pluginId, parameterId):
  1201. return float(self.lib.carla_get_default_parameter_value(pluginId, parameterId))
  1202. # Get a plugin's current parameter value.
  1203. # @param pluginId Plugin
  1204. # @param parameterId Parameter index
  1205. def get_current_parameter_value(self, pluginId, parameterId):
  1206. return float(self.lib.carla_get_current_parameter_value(pluginId, parameterId))
  1207. # Get a plugin's input peak value.
  1208. # @param pluginId Plugin
  1209. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1210. def get_input_peak_value(self, pluginId, isLeft):
  1211. return float(self.lib.carla_get_input_peak_value(pluginId, isLeft))
  1212. # Get a plugin's output peak value.
  1213. # @param pluginId Plugin
  1214. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1215. def get_output_peak_value(self, pluginId, isLeft):
  1216. return float(self.lib.carla_get_output_peak_value(pluginId, isLeft))
  1217. # Enable a plugin's option.
  1218. # @param pluginId Plugin
  1219. # @param option An option from PluginOptions
  1220. # @param yesNo New enabled state
  1221. def set_option(self, pluginId, option, yesNo):
  1222. self.lib.carla_set_option(pluginId, option, yesNo)
  1223. # Enable or disable a plugin.
  1224. # @param pluginId Plugin
  1225. # @param onOff New active state
  1226. def set_active(self, pluginId, onOff):
  1227. self.lib.carla_set_active(pluginId, onOff)
  1228. # Change a plugin's internal dry/wet.
  1229. # @param pluginId Plugin
  1230. # @param value New dry/wet value
  1231. def set_drywet(self, pluginId, value):
  1232. self.lib.carla_set_drywet(pluginId, value)
  1233. # Change a plugin's internal volume.
  1234. # @param pluginId Plugin
  1235. # @param value New volume
  1236. def set_volume(self, pluginId, value):
  1237. self.lib.carla_set_volume(pluginId, value)
  1238. # Change a plugin's internal stereo balance, left channel.
  1239. # @param pluginId Plugin
  1240. # @param value New value
  1241. def set_balance_left(self, pluginId, value):
  1242. self.lib.carla_set_balance_left(pluginId, value)
  1243. # Change a plugin's internal stereo balance, right channel.
  1244. # @param pluginId Plugin
  1245. # @param value New value
  1246. def set_balance_right(self, pluginId, value):
  1247. self.lib.carla_set_balance_right(pluginId, value)
  1248. # Change a plugin's internal mono panning value.
  1249. # @param pluginId Plugin
  1250. # @param value New value
  1251. def set_panning(self, pluginId, value):
  1252. self.lib.carla_set_panning(pluginId, value)
  1253. # Change a plugin's internal control channel.
  1254. # @param pluginId Plugin
  1255. # @param channel New channel
  1256. def set_ctrl_channel(self, pluginId, channel):
  1257. self.lib.carla_set_ctrl_channel(pluginId, channel)
  1258. # Change a plugin's parameter value.
  1259. # @param pluginId Plugin
  1260. # @param parameterId Parameter index
  1261. # @param value New value
  1262. def set_parameter_value(self, pluginId, parameterId, value):
  1263. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  1264. # Change a plugin's parameter MIDI cc.
  1265. # @param pluginId Plugin
  1266. # @param parameterId Parameter index
  1267. # @param cc New MIDI cc
  1268. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1269. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  1270. # Change a plugin's parameter MIDI channel.
  1271. # @param pluginId Plugin
  1272. # @param parameterId Parameter index
  1273. # @param channel New MIDI channel
  1274. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  1275. self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)
  1276. # Change a plugin's current program.
  1277. # @param pluginId Plugin
  1278. # @param programId New program
  1279. def set_program(self, pluginId, programId):
  1280. self.lib.carla_set_program(pluginId, programId)
  1281. # Change a plugin's current MIDI program.
  1282. # @param pluginId Plugin
  1283. # @param midiProgramId New value
  1284. def set_midi_program(self, pluginId, midiProgramId):
  1285. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  1286. # Set a plugin's custom data set.
  1287. # @param pluginId Plugin
  1288. # @param type Type
  1289. # @param key Key
  1290. # @param value New value
  1291. # @see CustomDataTypes and CustomDataKeys
  1292. def set_custom_data(self, pluginId, type_, key, value):
  1293. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  1294. # Set a plugin's chunk data.
  1295. # @param pluginId Plugin
  1296. # @param value New value
  1297. # @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  1298. def set_chunk_data(self, pluginId, chunkData):
  1299. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  1300. # Tell a plugin to prepare for save.\n
  1301. # This should be called before saving custom data sets.
  1302. # @param pluginId Plugin
  1303. def prepare_for_save(self, pluginId):
  1304. self.lib.carla_prepare_for_save(pluginId)
  1305. # Send a single note of a plugin.\n
  1306. # If velocity is 0, note-off is sent; note-on otherwise.
  1307. # @param pluginId Plugin
  1308. # @param channel Note channel
  1309. # @param note Note pitch
  1310. # @param velocity Note velocity
  1311. def send_midi_note(self, pluginId, channel, note, velocity):
  1312. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  1313. # Tell a plugin to show its own custom UI.
  1314. # @param pluginId Plugin
  1315. # @param yesNo New UI state, visible or not
  1316. # @see PLUGIN_HAS_CUSTOM_UI
  1317. def show_custom_ui(self, pluginId, yesNo):
  1318. self.lib.carla_show_custom_ui(pluginId, yesNo)
  1319. # Get the current engine buffer size.
  1320. def get_buffer_size(self):
  1321. return int(self.lib.carla_get_buffer_size())
  1322. # Get the current engine sample rate.
  1323. def get_sample_rate(self):
  1324. return float(self.lib.carla_get_sample_rate())
  1325. # Get the last error.
  1326. def get_last_error(self):
  1327. return charPtrToString(self.lib.carla_get_last_error())
  1328. # Get the current engine OSC URL (TCP).
  1329. def get_host_osc_url_tcp(self):
  1330. return charPtrToString(self.lib.carla_get_host_osc_url_tcp())
  1331. # Get the current engine OSC URL (UDP).
  1332. def get_host_osc_url_udp(self):
  1333. return charPtrToString(self.lib.carla_get_host_osc_url_udp())
  1334. def _init(self, libName):
  1335. self.lib = cdll.LoadLibrary(libName)
  1336. self.lib.carla_get_complete_license_text.argtypes = None
  1337. self.lib.carla_get_complete_license_text.restype = c_char_p
  1338. self.lib.carla_get_supported_file_extensions.argtypes = None
  1339. self.lib.carla_get_supported_file_extensions.restype = c_char_p
  1340. self.lib.carla_get_engine_driver_count.argtypes = None
  1341. self.lib.carla_get_engine_driver_count.restype = c_uint
  1342. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  1343. self.lib.carla_get_engine_driver_name.restype = c_char_p
  1344. self.lib.carla_get_engine_driver_device_names.argtypes = [c_uint]
  1345. self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)
  1346. self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p]
  1347. self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)
  1348. self.lib.carla_get_internal_plugin_count.argtypes = None
  1349. self.lib.carla_get_internal_plugin_count.restype = c_uint
  1350. self.lib.carla_get_internal_plugin_info.argtypes = [c_uint]
  1351. self.lib.carla_get_internal_plugin_info.restype = POINTER(CarlaNativePluginInfo)
  1352. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  1353. self.lib.carla_engine_init.restype = c_bool
  1354. self.lib.carla_engine_close.argtypes = None
  1355. self.lib.carla_engine_close.restype = c_bool
  1356. self.lib.carla_engine_idle.argtypes = None
  1357. self.lib.carla_engine_idle.restype = None
  1358. self.lib.carla_is_engine_running.argtypes = None
  1359. self.lib.carla_is_engine_running.restype = c_bool
  1360. self.lib.carla_set_engine_about_to_close.argtypes = None
  1361. self.lib.carla_set_engine_about_to_close.restype = None
  1362. self.lib.carla_set_engine_callback.argtypes = [EngineCallbackFunc, c_void_p]
  1363. self.lib.carla_set_engine_callback.restype = None
  1364. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  1365. self.lib.carla_set_engine_option.restype = None
  1366. self.lib.carla_set_file_callback.argtypes = [FileCallbackFunc, c_void_p]
  1367. self.lib.carla_set_file_callback.restype = None
  1368. self.lib.carla_load_file.argtypes = [c_char_p]
  1369. self.lib.carla_load_file.restype = c_bool
  1370. self.lib.carla_load_project.argtypes = [c_char_p]
  1371. self.lib.carla_load_project.restype = c_bool
  1372. self.lib.carla_save_project.argtypes = [c_char_p]
  1373. self.lib.carla_save_project.restype = c_bool
  1374. self.lib.carla_patchbay_connect.argtypes = [c_int, c_int]
  1375. self.lib.carla_patchbay_connect.restype = c_bool
  1376. self.lib.carla_patchbay_disconnect.argtypes = [c_uint]
  1377. self.lib.carla_patchbay_disconnect.restype = c_bool
  1378. self.lib.carla_patchbay_refresh.argtypes = None
  1379. self.lib.carla_patchbay_refresh.restype = c_bool
  1380. self.lib.carla_transport_play.argtypes = None
  1381. self.lib.carla_transport_play.restype = None
  1382. self.lib.carla_transport_pause.argtypes = None
  1383. self.lib.carla_transport_pause.restype = None
  1384. self.lib.carla_transport_relocate.argtypes = [c_uint64]
  1385. self.lib.carla_transport_relocate.restype = None
  1386. self.lib.carla_get_current_transport_frame.argtypes = None
  1387. self.lib.carla_get_current_transport_frame.restype = c_uint64
  1388. self.lib.carla_get_transport_info.argtypes = None
  1389. self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
  1390. self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_int64, c_void_p]
  1391. self.lib.carla_add_plugin.restype = c_bool
  1392. self.lib.carla_remove_plugin.argtypes = [c_uint]
  1393. self.lib.carla_remove_plugin.restype = c_bool
  1394. self.lib.carla_remove_all_plugins.argtypes = None
  1395. self.lib.carla_remove_all_plugins.restype = c_bool
  1396. self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
  1397. self.lib.carla_rename_plugin.restype = c_char_p
  1398. self.lib.carla_clone_plugin.argtypes = [c_uint]
  1399. self.lib.carla_clone_plugin.restype = c_bool
  1400. self.lib.carla_replace_plugin.argtypes = [c_uint]
  1401. self.lib.carla_replace_plugin.restype = c_bool
  1402. self.lib.carla_switch_plugins.argtypes = [c_uint, c_uint]
  1403. self.lib.carla_switch_plugins.restype = c_bool
  1404. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  1405. self.lib.carla_load_plugin_state.restype = c_bool
  1406. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  1407. self.lib.carla_save_plugin_state.restype = c_bool
  1408. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  1409. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  1410. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  1411. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1412. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  1413. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1414. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  1415. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  1416. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  1417. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  1418. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  1419. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  1420. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  1421. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  1422. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  1423. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  1424. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  1425. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  1426. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  1427. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  1428. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  1429. self.lib.carla_get_chunk_data.restype = c_char_p
  1430. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  1431. self.lib.carla_get_parameter_count.restype = c_uint32
  1432. self.lib.carla_get_program_count.argtypes = [c_uint]
  1433. self.lib.carla_get_program_count.restype = c_uint32
  1434. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  1435. self.lib.carla_get_midi_program_count.restype = c_uint32
  1436. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  1437. self.lib.carla_get_custom_data_count.restype = c_uint32
  1438. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32, c_float]
  1439. self.lib.carla_get_parameter_text.restype = c_char_p
  1440. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  1441. self.lib.carla_get_program_name.restype = c_char_p
  1442. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  1443. self.lib.carla_get_midi_program_name.restype = c_char_p
  1444. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  1445. self.lib.carla_get_real_plugin_name.restype = c_char_p
  1446. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  1447. self.lib.carla_get_current_program_index.restype = c_int32
  1448. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  1449. self.lib.carla_get_current_midi_program_index.restype = c_int32
  1450. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  1451. self.lib.carla_get_default_parameter_value.restype = c_float
  1452. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  1453. self.lib.carla_get_current_parameter_value.restype = c_float
  1454. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_bool]
  1455. self.lib.carla_get_input_peak_value.restype = c_float
  1456. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_bool]
  1457. self.lib.carla_get_output_peak_value.restype = c_float
  1458. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  1459. self.lib.carla_set_option.restype = None
  1460. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  1461. self.lib.carla_set_active.restype = None
  1462. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  1463. self.lib.carla_set_drywet.restype = None
  1464. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  1465. self.lib.carla_set_volume.restype = None
  1466. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  1467. self.lib.carla_set_balance_left.restype = None
  1468. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  1469. self.lib.carla_set_balance_right.restype = None
  1470. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  1471. self.lib.carla_set_panning.restype = None
  1472. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  1473. self.lib.carla_set_ctrl_channel.restype = None
  1474. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  1475. self.lib.carla_set_parameter_value.restype = None
  1476. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  1477. self.lib.carla_set_parameter_midi_channel.restype = None
  1478. self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
  1479. self.lib.carla_set_parameter_midi_cc.restype = None
  1480. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  1481. self.lib.carla_set_program.restype = None
  1482. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  1483. self.lib.carla_set_midi_program.restype = None
  1484. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  1485. self.lib.carla_set_custom_data.restype = None
  1486. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  1487. self.lib.carla_set_chunk_data.restype = None
  1488. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  1489. self.lib.carla_prepare_for_save.restype = None
  1490. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  1491. self.lib.carla_send_midi_note.restype = None
  1492. self.lib.carla_show_custom_ui.argtypes = [c_uint, c_bool]
  1493. self.lib.carla_show_custom_ui.restype = None
  1494. self.lib.carla_get_buffer_size.argtypes = None
  1495. self.lib.carla_get_buffer_size.restype = c_uint32
  1496. self.lib.carla_get_sample_rate.argtypes = None
  1497. self.lib.carla_get_sample_rate.restype = c_double
  1498. self.lib.carla_get_last_error.argtypes = None
  1499. self.lib.carla_get_last_error.restype = c_char_p
  1500. self.lib.carla_get_host_osc_url_tcp.argtypes = None
  1501. self.lib.carla_get_host_osc_url_tcp.restype = c_char_p
  1502. self.lib.carla_get_host_osc_url_udp.argtypes = None
  1503. self.lib.carla_get_host_osc_url_udp.restype = c_char_p