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 64KB

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