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

11 years ago
11 years ago
11 years ago
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
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
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
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
6 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
10 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
10 years ago
6 years ago
7 years ago
7 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
10 years ago
11 years ago
11 years ago
11 years ago
10 years ago
11 years ago
11 years ago
11 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
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
6 years ago
10 years ago
10 years ago
10 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla Backend code
  4. # Copyright (C) 2011-2018 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 abc import ABCMeta, abstractmethod
  20. from ctypes import *
  21. from platform import architecture
  22. from sys import platform, maxsize
  23. # ------------------------------------------------------------------------------------------------------------
  24. # 64bit check
  25. kIs64bit = bool(architecture()[0] == "64bit" and maxsize > 2**32)
  26. # ------------------------------------------------------------------------------------------------------------
  27. # Define custom types
  28. c_enum = c_int
  29. c_uintptr = c_uint64 if kIs64bit else c_uint32
  30. # ------------------------------------------------------------------------------------------------------------
  31. # Set Platform
  32. if platform == "darwin":
  33. HAIKU = False
  34. LINUX = False
  35. MACOS = True
  36. WINDOWS = False
  37. elif "haiku" in platform:
  38. HAIKU = True
  39. LINUX = False
  40. MACOS = False
  41. WINDOWS = False
  42. elif "linux" in platform:
  43. HAIKU = False
  44. LINUX = True
  45. MACOS = False
  46. WINDOWS = False
  47. elif platform in ("win32", "win64", "cygwin"):
  48. HAIKU = False
  49. LINUX = False
  50. MACOS = False
  51. WINDOWS = True
  52. else:
  53. HAIKU = False
  54. LINUX = False
  55. MACOS = False
  56. WINDOWS = False
  57. # ------------------------------------------------------------------------------------------------------------
  58. # Convert a ctypes c_char_p into a python string
  59. def charPtrToString(charPtr):
  60. if not charPtr:
  61. return ""
  62. if isinstance(charPtr, str):
  63. return charPtr
  64. return charPtr.decode("utf-8", errors="ignore")
  65. # ------------------------------------------------------------------------------------------------------------
  66. # Convert a ctypes POINTER(c_char_p) into a python string list
  67. def charPtrPtrToStringList(charPtrPtr):
  68. if not charPtrPtr:
  69. return []
  70. i = 0
  71. charPtr = charPtrPtr[0]
  72. strList = []
  73. while charPtr:
  74. strList.append(charPtr.decode("utf-8", errors="ignore"))
  75. i += 1
  76. charPtr = charPtrPtr[i]
  77. return strList
  78. # ------------------------------------------------------------------------------------------------------------
  79. # Convert a ctypes POINTER(c_<num>) into a python number list
  80. def numPtrToList(numPtr):
  81. if not numPtr:
  82. return []
  83. i = 0
  84. num = numPtr[0] #.value
  85. numList = []
  86. while num not in (0, 0.0):
  87. numList.append(num)
  88. i += 1
  89. num = numPtr[i] #.value
  90. return numList
  91. # ------------------------------------------------------------------------------------------------------------
  92. # Convert a ctypes value into a python one
  93. 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)
  94. c_float_types = (c_float, c_double, c_longdouble)
  95. c_intp_types = tuple(POINTER(i) for i in c_int_types)
  96. c_floatp_types = tuple(POINTER(i) for i in c_float_types)
  97. def toPythonType(value, attr):
  98. if isinstance(value, (bool, int, float)):
  99. return value
  100. if isinstance(value, bytes):
  101. return charPtrToString(value)
  102. if isinstance(value, c_intp_types) or isinstance(value, c_floatp_types):
  103. return numPtrToList(value)
  104. if isinstance(value, POINTER(c_char_p)):
  105. return charPtrPtrToStringList(value)
  106. print("..............", attr, ".....................", value, ":", type(value))
  107. return value
  108. # ------------------------------------------------------------------------------------------------------------
  109. # Convert a ctypes struct into a python dict
  110. def structToDict(struct):
  111. return dict((attr, toPythonType(getattr(struct, attr), attr)) for attr, value in struct._fields_)
  112. # ------------------------------------------------------------------------------------------------------------
  113. # Carla Backend API (base definitions)
  114. # Maximum default number of loadable plugins.
  115. MAX_DEFAULT_PLUGINS = 99
  116. # Maximum number of loadable plugins in rack mode.
  117. MAX_RACK_PLUGINS = 16
  118. # Maximum number of loadable plugins in patchbay mode.
  119. MAX_PATCHBAY_PLUGINS = 255
  120. # Maximum default number of parameters allowed.
  121. # @see ENGINE_OPTION_MAX_PARAMETERS
  122. MAX_DEFAULT_PARAMETERS = 200
  123. # The "plugin Id" for the global Carla instance.
  124. # Curently only used for audio peaks.
  125. MAIN_CARLA_PLUGIN_ID = 0xFFFF
  126. # ------------------------------------------------------------------------------------------------------------
  127. # Engine Driver Device Hints
  128. # Various engine driver device hints.
  129. # @see carla_get_engine_driver_device_info()
  130. # Engine driver device has custom control-panel.
  131. ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1
  132. # Engine driver device can use a triple-buffer (3 number of periods instead of the usual 2).
  133. # @see ENGINE_OPTION_AUDIO_NUM_PERIODS
  134. ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2
  135. # Engine driver device can change buffer-size on the fly.
  136. # @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
  137. ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4
  138. # Engine driver device can change sample-rate on the fly.
  139. # @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
  140. ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8
  141. # ------------------------------------------------------------------------------------------------------------
  142. # Plugin Hints
  143. # Various plugin hints.
  144. # @see carla_get_plugin_info()
  145. # Plugin is a bridge.
  146. # This hint is required because "bridge" itself is not a plugin type.
  147. PLUGIN_IS_BRIDGE = 0x001
  148. # Plugin is hard real-time safe.
  149. PLUGIN_IS_RTSAFE = 0x002
  150. # Plugin is a synth (produces sound).
  151. PLUGIN_IS_SYNTH = 0x004
  152. # Plugin has its own custom UI.
  153. # @see carla_show_custom_ui()
  154. PLUGIN_HAS_CUSTOM_UI = 0x008
  155. # Plugin can use internal Dry/Wet control.
  156. PLUGIN_CAN_DRYWET = 0x010
  157. # Plugin can use internal Volume control.
  158. PLUGIN_CAN_VOLUME = 0x020
  159. # Plugin can use internal (Stereo) Balance controls.
  160. PLUGIN_CAN_BALANCE = 0x040
  161. # Plugin can use internal (Mono) Panning control.
  162. PLUGIN_CAN_PANNING = 0x080
  163. # Plugin needs a constant, fixed-size audio buffer.
  164. PLUGIN_NEEDS_FIXED_BUFFERS = 0x100
  165. # Plugin needs to receive all UI events in the main thread.
  166. PLUGIN_NEEDS_UI_MAIN_THREAD = 0x200
  167. # Plugin uses 1 program per MIDI channel.
  168. # @note: Only used in some internal plugins and sf2 files.
  169. PLUGIN_USES_MULTI_PROGS = 0x400
  170. # Plugin can make use of inline display API.
  171. PLUGIN_HAS_INLINE_DISPLAY = 0x800
  172. # ------------------------------------------------------------------------------------------------------------
  173. # Plugin Options
  174. # Various plugin options.
  175. # @see carla_get_plugin_info() and carla_set_option()
  176. # Use constant/fixed-size audio buffers.
  177. PLUGIN_OPTION_FIXED_BUFFERS = 0x001
  178. # Force mono plugin as stereo.
  179. PLUGIN_OPTION_FORCE_STEREO = 0x002
  180. # Map MIDI programs to plugin programs.
  181. PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004
  182. # Use chunks to save and restore data instead of parameter values.
  183. PLUGIN_OPTION_USE_CHUNKS = 0x008
  184. # Send MIDI control change events.
  185. PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010
  186. # Send MIDI channel pressure events.
  187. PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020
  188. # Send MIDI note after-touch events.
  189. PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040
  190. # Send MIDI pitch-bend events.
  191. PLUGIN_OPTION_SEND_PITCHBEND = 0x080
  192. # Send MIDI all-sounds/notes-off events, single note-offs otherwise.
  193. PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100
  194. # Send MIDI bank/program changes.
  195. # @note: This option conflicts with PLUGIN_OPTION_MAP_PROGRAM_CHANGES and cannot be used at the same time.
  196. PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200
  197. # ------------------------------------------------------------------------------------------------------------
  198. # Parameter Hints
  199. # Various parameter hints.
  200. # @see CarlaPlugin::getParameterData() and carla_get_parameter_data()
  201. # Parameter value is boolean.
  202. PARAMETER_IS_BOOLEAN = 0x001
  203. # Parameter value is integer.
  204. PARAMETER_IS_INTEGER = 0x002
  205. # Parameter value is logarithmic.
  206. PARAMETER_IS_LOGARITHMIC = 0x004
  207. # Parameter is enabled.
  208. # It can be viewed, changed and stored.
  209. PARAMETER_IS_ENABLED = 0x010
  210. # Parameter is automable (real-time safe).
  211. PARAMETER_IS_AUTOMABLE = 0x020
  212. # Parameter is read-only.
  213. # It cannot be changed.
  214. PARAMETER_IS_READ_ONLY = 0x040
  215. # Parameter needs sample rate to work.
  216. # Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
  217. PARAMETER_USES_SAMPLERATE = 0x100
  218. # Parameter uses scale points to define internal values in a meaningful way.
  219. PARAMETER_USES_SCALEPOINTS = 0x200
  220. # Parameter uses custom text for displaying its value.
  221. # @see carla_get_parameter_text()
  222. PARAMETER_USES_CUSTOM_TEXT = 0x400
  223. # ------------------------------------------------------------------------------------------------------------
  224. # Patchbay Port Hints
  225. # Various patchbay port hints.
  226. # Patchbay port is input.
  227. # When this hint is not set, port is assumed to be output.
  228. PATCHBAY_PORT_IS_INPUT = 0x01
  229. # Patchbay port is of Audio type.
  230. PATCHBAY_PORT_TYPE_AUDIO = 0x02
  231. # Patchbay port is of CV type (Control Voltage).
  232. PATCHBAY_PORT_TYPE_CV = 0x04
  233. # Patchbay port is of MIDI type.
  234. PATCHBAY_PORT_TYPE_MIDI = 0x08
  235. # Patchbay port is of OSC type.
  236. PATCHBAY_PORT_TYPE_OSC = 0x10
  237. # ------------------------------------------------------------------------------------------------------------
  238. # Custom Data Types
  239. # These types define how the value in the CustomData struct is stored.
  240. # @see CustomData.type
  241. # Boolean string type URI.
  242. # Only "true" and "false" are valid values.
  243. CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean"
  244. # Chunk type URI.
  245. CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"
  246. # Property type URI.
  247. CUSTOM_DATA_TYPE_PROPERTY = "http://kxstudio.sf.net/ns/carla/property"
  248. # String type URI.
  249. CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string"
  250. # ------------------------------------------------------------------------------------------------------------
  251. # Custom Data Keys
  252. # Pre-defined keys used internally in Carla.
  253. # @see CustomData.key
  254. # Plugin options key.
  255. CUSTOM_DATA_KEY_PLUGIN_OPTIONS = "CarlaPluginOptions"
  256. # UI position key.
  257. CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition"
  258. # UI size key.
  259. CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize"
  260. # UI visible key.
  261. CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible"
  262. # ------------------------------------------------------------------------------------------------------------
  263. # Binary Type
  264. # The binary type of a plugin.
  265. # Null binary type.
  266. BINARY_NONE = 0
  267. # POSIX 32bit binary.
  268. BINARY_POSIX32 = 1
  269. # POSIX 64bit binary.
  270. BINARY_POSIX64 = 2
  271. # Windows 32bit binary.
  272. BINARY_WIN32 = 3
  273. # Windows 64bit binary.
  274. BINARY_WIN64 = 4
  275. # Other binary type.
  276. BINARY_OTHER = 5
  277. # ------------------------------------------------------------------------------------------------------------
  278. # Plugin Type
  279. # Plugin type.
  280. # Some files are handled as if they were plugins.
  281. # Null plugin type.
  282. PLUGIN_NONE = 0
  283. # Internal plugin.
  284. PLUGIN_INTERNAL = 1
  285. # LADSPA plugin.
  286. PLUGIN_LADSPA = 2
  287. # DSSI plugin.
  288. PLUGIN_DSSI = 3
  289. # LV2 plugin.
  290. PLUGIN_LV2 = 4
  291. # VST2 plugin.
  292. PLUGIN_VST2 = 5
  293. # VST3 plugin.
  294. # @note Windows and MacOS only
  295. PLUGIN_VST3 = 6
  296. # AU plugin.
  297. # @note MacOS only
  298. PLUGIN_AU = 7
  299. # SF2 file (SoundFont).
  300. PLUGIN_SF2 = 8
  301. # SFZ file.
  302. PLUGIN_SFZ = 9
  303. # JACK application.
  304. PLUGIN_JACK = 10
  305. # ------------------------------------------------------------------------------------------------------------
  306. # Plugin Category
  307. # Plugin category, which describes the functionality of a plugin.
  308. # Null plugin category.
  309. PLUGIN_CATEGORY_NONE = 0
  310. # A synthesizer or generator.
  311. PLUGIN_CATEGORY_SYNTH = 1
  312. # A delay or reverb.
  313. PLUGIN_CATEGORY_DELAY = 2
  314. # An equalizer.
  315. PLUGIN_CATEGORY_EQ = 3
  316. # A filter.
  317. PLUGIN_CATEGORY_FILTER = 4
  318. # A distortion plugin.
  319. PLUGIN_CATEGORY_DISTORTION = 5
  320. # A 'dynamic' plugin (amplifier, compressor, gate, etc).
  321. PLUGIN_CATEGORY_DYNAMICS = 6
  322. # A 'modulator' plugin (chorus, flanger, phaser, etc).
  323. PLUGIN_CATEGORY_MODULATOR = 7
  324. # An 'utility' plugin (analyzer, converter, mixer, etc).
  325. PLUGIN_CATEGORY_UTILITY = 8
  326. # Miscellaneous plugin (used to check if the plugin has a category).
  327. PLUGIN_CATEGORY_OTHER = 9
  328. # ------------------------------------------------------------------------------------------------------------
  329. # Parameter Type
  330. # Plugin parameter type.
  331. # Null parameter type.
  332. PARAMETER_UNKNOWN = 0
  333. # Input parameter.
  334. PARAMETER_INPUT = 1
  335. # Ouput parameter.
  336. PARAMETER_OUTPUT = 2
  337. # ------------------------------------------------------------------------------------------------------------
  338. # Internal Parameter Index
  339. # Special parameters used internally in Carla.
  340. # Plugins do not know about their existence.
  341. # Null parameter.
  342. PARAMETER_NULL = -1
  343. # Active parameter, boolean type.
  344. # Default is 'false'.
  345. PARAMETER_ACTIVE = -2
  346. # Dry/Wet parameter.
  347. # Range 0.0...1.0; default is 1.0.
  348. PARAMETER_DRYWET = -3
  349. # Volume parameter.
  350. # Range 0.0...1.27; default is 1.0.
  351. PARAMETER_VOLUME = -4
  352. # Stereo Balance-Left parameter.
  353. # Range -1.0...1.0; default is -1.0.
  354. PARAMETER_BALANCE_LEFT = -5
  355. # Stereo Balance-Right parameter.
  356. # Range -1.0...1.0; default is 1.0.
  357. PARAMETER_BALANCE_RIGHT = -6
  358. # Mono Panning parameter.
  359. # Range -1.0...1.0; default is 0.0.
  360. PARAMETER_PANNING = -7
  361. # MIDI Control channel, integer type.
  362. # Range -1...15 (-1 = off).
  363. PARAMETER_CTRL_CHANNEL = -8
  364. # Max value, defined only for convenience.
  365. PARAMETER_MAX = -9
  366. # ------------------------------------------------------------------------------------------------------------
  367. # Engine Callback Opcode
  368. # Engine callback opcodes.
  369. # Front-ends must never block indefinitely during a callback.
  370. # @see EngineCallbackFunc and carla_set_engine_callback()
  371. # Debug.
  372. # This opcode is undefined and used only for testing purposes.
  373. ENGINE_CALLBACK_DEBUG = 0
  374. # A plugin has been added.
  375. # @a pluginId Plugin Id
  376. # @a valueStr Plugin name
  377. ENGINE_CALLBACK_PLUGIN_ADDED = 1
  378. # A plugin has been removed.
  379. # @a pluginId Plugin Id
  380. ENGINE_CALLBACK_PLUGIN_REMOVED = 2
  381. # A plugin has been renamed.
  382. # @a pluginId Plugin Id
  383. # @a valueStr New plugin name
  384. ENGINE_CALLBACK_PLUGIN_RENAMED = 3
  385. # A plugin has become unavailable.
  386. # @a pluginId Plugin Id
  387. # @a valueStr Related error string
  388. ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4
  389. # A parameter value has changed.
  390. # @a pluginId Plugin Id
  391. # @a value1 Parameter index
  392. # @a value3 New parameter value
  393. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5
  394. # A parameter default has changed.
  395. # @a pluginId Plugin Id
  396. # @a value1 Parameter index
  397. # @a value3 New default value
  398. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6
  399. # A parameter's MIDI CC has changed.
  400. # @a pluginId Plugin Id
  401. # @a value1 Parameter index
  402. # @a value2 New MIDI CC
  403. ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED = 7
  404. # A parameter's MIDI channel has changed.
  405. # @a pluginId Plugin Id
  406. # @a value1 Parameter index
  407. # @a value2 New MIDI channel
  408. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8
  409. # A plugin option has changed.
  410. # @a pluginId Plugin Id
  411. # @a value1 Option
  412. # @a value2 New on/off state (1 for on, 0 for off)
  413. # @see PluginOptions
  414. ENGINE_CALLBACK_OPTION_CHANGED = 9
  415. # The current program of a plugin has changed.
  416. # @a pluginId Plugin Id
  417. # @a value1 New program index
  418. ENGINE_CALLBACK_PROGRAM_CHANGED = 10
  419. # The current MIDI program of a plugin has changed.
  420. # @a pluginId Plugin Id
  421. # @a value1 New MIDI program index
  422. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11
  423. # A plugin's custom UI state has changed.
  424. # @a pluginId Plugin Id
  425. # @a value1 New state, as follows:
  426. # 0: UI is now hidden
  427. # 1: UI is now visible
  428. # -1: UI has crashed and should not be shown again
  429. ENGINE_CALLBACK_UI_STATE_CHANGED = 12
  430. # A note has been pressed.
  431. # @a pluginId Plugin Id
  432. # @a value1 Channel
  433. # @a value2 Note
  434. # @a value3 Velocity
  435. ENGINE_CALLBACK_NOTE_ON = 13
  436. # A note has been released.
  437. # @a pluginId Plugin Id
  438. # @a value1 Channel
  439. # @a value2 Note
  440. ENGINE_CALLBACK_NOTE_OFF = 14
  441. # A plugin needs update.
  442. # @a pluginId Plugin Id
  443. ENGINE_CALLBACK_UPDATE = 15
  444. # A plugin's data/information has changed.
  445. # @a pluginId Plugin Id
  446. ENGINE_CALLBACK_RELOAD_INFO = 16
  447. # A plugin's parameters have changed.
  448. # @a pluginId Plugin Id
  449. ENGINE_CALLBACK_RELOAD_PARAMETERS = 17
  450. # A plugin's programs have changed.
  451. # @a pluginId Plugin Id
  452. ENGINE_CALLBACK_RELOAD_PROGRAMS = 18
  453. # A plugin state has changed.
  454. # @a pluginId Plugin Id
  455. ENGINE_CALLBACK_RELOAD_ALL = 19
  456. # A patchbay client has been added.
  457. # @a pluginId Client Id
  458. # @a value1 Client icon
  459. # @a value2 Plugin Id (-1 if not a plugin)
  460. # @a valueStr Client name
  461. # @see PatchbayIcon
  462. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 20
  463. # A patchbay client has been removed.
  464. # @a pluginId Client Id
  465. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 21
  466. # A patchbay client has been renamed.
  467. # @a pluginId Client Id
  468. # @a valueStr New client name
  469. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 22
  470. # A patchbay client data has changed.
  471. # @a pluginId Client Id
  472. # @a value1 New icon
  473. # @a value2 New plugin Id (-1 if not a plugin)
  474. # @see PatchbayIcon
  475. ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23
  476. # A patchbay port has been added.
  477. # @a pluginId Client Id
  478. # @a value1 Port Id
  479. # @a value2 Port hints
  480. # @a valueStr Port name
  481. # @see PatchbayPortHints
  482. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24
  483. # A patchbay port has been removed.
  484. # @a pluginId Client Id
  485. # @a value1 Port Id
  486. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25
  487. # A patchbay port has been renamed.
  488. # @a pluginId Client Id
  489. # @a value1 Port Id
  490. # @a valueStr New port name
  491. ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED = 26
  492. # A patchbay connection has been added.
  493. # @a pluginId Connection Id
  494. # @a valueStr Out group, port plus in group and port, in "og:op:ig:ip" syntax.
  495. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 27
  496. # A patchbay connection has been removed.
  497. # @a pluginId Connection Id
  498. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28
  499. # Engine started.
  500. # @a value1 Process mode
  501. # @a value2 Transport mode
  502. # @a value3 Sample rate
  503. # @a valuestr Engine driver
  504. # @see EngineProcessMode
  505. # @see EngineTransportMode
  506. ENGINE_CALLBACK_ENGINE_STARTED = 29
  507. # Engine stopped.
  508. ENGINE_CALLBACK_ENGINE_STOPPED = 30
  509. # Engine process mode has changed.
  510. # @a value1 New process mode
  511. # @see EngineProcessMode
  512. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 31
  513. # Engine transport mode has changed.
  514. # @a value1 New transport mode
  515. # @a valueStr New transport features enabled
  516. # @see EngineTransportMode
  517. ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32
  518. # Engine buffer-size changed.
  519. # @a value1 New buffer size
  520. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33
  521. # Engine sample-rate changed.
  522. # @a value3 New sample rate
  523. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34
  524. # Project has finished loading.
  525. ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 35
  526. # NSM callback.
  527. # (Work in progress, values are not defined yet)
  528. ENGINE_CALLBACK_NSM = 36
  529. # Idle frontend.
  530. # This is used by the engine during long operations that might block the frontend,
  531. # giving it the possibility to idle while the operation is still in place.
  532. ENGINE_CALLBACK_IDLE = 37
  533. # Show a message as information.
  534. # @a valueStr The message
  535. ENGINE_CALLBACK_INFO = 38
  536. # Show a message as an error.
  537. # @a valueStr The message
  538. ENGINE_CALLBACK_ERROR = 39
  539. # The engine has crashed or malfunctioned and will no longer work.
  540. ENGINE_CALLBACK_QUIT = 40
  541. # ------------------------------------------------------------------------------------------------------------
  542. # Engine Option
  543. # Engine options.
  544. # @see carla_set_engine_option()
  545. # Debug.
  546. # This option is undefined and used only for testing purposes.
  547. ENGINE_OPTION_DEBUG = 0
  548. # Set the engine processing mode.
  549. # Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_CONTINUOUS_RACK for all other OSes.
  550. # @see EngineProcessMode
  551. ENGINE_OPTION_PROCESS_MODE = 1
  552. # Set the engine transport mode.
  553. # Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
  554. # @see EngineTransportMode
  555. ENGINE_OPTION_TRANSPORT_MODE = 2
  556. # Force mono plugins as stereo, by running 2 instances at the same time.
  557. # Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
  558. # @note Not supported by all plugins
  559. # @see PLUGIN_OPTION_FORCE_STEREO
  560. ENGINE_OPTION_FORCE_STEREO = 3
  561. # Use plugin bridges whenever possible.
  562. # Default is no, EXPERIMENTAL.
  563. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4
  564. # Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
  565. # Default is yes.
  566. ENGINE_OPTION_PREFER_UI_BRIDGES = 5
  567. # Make custom plugin UIs always-on-top.
  568. # Default is yes.
  569. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6
  570. # Maximum number of parameters allowed.
  571. # Default is MAX_DEFAULT_PARAMETERS.
  572. ENGINE_OPTION_MAX_PARAMETERS = 7
  573. # Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  574. # Default is 4000 (4 seconds).
  575. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8
  576. # Audio buffer size.
  577. # Default is 512.
  578. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 9
  579. # Audio sample rate.
  580. # Default is 44100.
  581. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 10
  582. # Wherever to use 3 audio periods instead of the default 2.
  583. # Default is false.
  584. ENGINE_OPTION_AUDIO_TRIPLE_BUFFER = 11
  585. # Audio device (within a driver).
  586. # Default unset.
  587. ENGINE_OPTION_AUDIO_DEVICE = 12
  588. # Set path used for a specific plugin type.
  589. # Uses value as the plugin format, valueStr as actual path.
  590. # @see PluginType
  591. ENGINE_OPTION_PLUGIN_PATH = 13
  592. # Set path to the binary files.
  593. # Default unset.
  594. # @note Must be set for plugin and UI bridges to work
  595. ENGINE_OPTION_PATH_BINARIES = 14
  596. # Set path to the resource files.
  597. # Default unset.
  598. # @note Must be set for some internal plugins to work
  599. ENGINE_OPTION_PATH_RESOURCES = 15
  600. # Prevent bad plugin and UI behaviour.
  601. # @note: Linux only
  602. ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 16
  603. # Set frontend winId, used to define as parent window for plugin UIs.
  604. ENGINE_OPTION_FRONTEND_WIN_ID = 17
  605. # Set path to wine executable.
  606. ENGINE_OPTION_WINE_EXECUTABLE = 18
  607. # Enable automatic wineprefix detection.
  608. ENGINE_OPTION_WINE_AUTO_PREFIX = 19
  609. # Fallback wineprefix to use if automatic detection fails or is disabled, and WINEPREFIX is not set.
  610. ENGINE_OPTION_WINE_FALLBACK_PREFIX = 20
  611. # Enable realtime priority for Wine application and server threads.
  612. ENGINE_OPTION_WINE_RT_PRIO_ENABLED = 21
  613. # Base realtime priority for Wine threads.
  614. ENGINE_OPTION_WINE_BASE_RT_PRIO = 22
  615. # Wine server realtime priority.
  616. ENGINE_OPTION_WINE_SERVER_RT_PRIO = 23
  617. # Capture console output into debug callbacks
  618. ENGINE_OPTION_DEBUG_CONSOLE_OUTPUT = 24
  619. # ------------------------------------------------------------------------------------------------------------
  620. # Engine Process Mode
  621. # Engine process mode.
  622. # @see ENGINE_OPTION_PROCESS_MODE
  623. # Single client mode.
  624. # Inputs and outputs are added dynamically as needed by plugins.
  625. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0
  626. # Multiple client mode.
  627. # It has 1 master client + 1 client per plugin.
  628. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1
  629. # Single client, 'rack' mode.
  630. # Processes plugins in order of Id, with forced stereo always on.
  631. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2
  632. # Single client, 'patchbay' mode.
  633. ENGINE_PROCESS_MODE_PATCHBAY = 3
  634. # Special mode, used in plugin-bridges only.
  635. ENGINE_PROCESS_MODE_BRIDGE = 4
  636. # ------------------------------------------------------------------------------------------------------------
  637. # Engine Transport Mode
  638. # Engine transport mode.
  639. # @see ENGINE_OPTION_TRANSPORT_MODE
  640. # No transport.
  641. ENGINE_TRANSPORT_MODE_DISABLED = 0
  642. # Internal transport mode.
  643. ENGINE_TRANSPORT_MODE_INTERNAL = 1
  644. # Transport from JACK.
  645. # Only available if driver name is "JACK".
  646. ENGINE_TRANSPORT_MODE_JACK = 2
  647. # Transport from host, used when Carla is a plugin.
  648. ENGINE_TRANSPORT_MODE_PLUGIN = 3
  649. # Special mode, used in plugin-bridges only.
  650. ENGINE_TRANSPORT_MODE_BRIDGE = 4
  651. # ------------------------------------------------------------------------------------------------------------
  652. # File Callback Opcode
  653. # File callback opcodes.
  654. # Front-ends must always block-wait for user input.
  655. # @see FileCallbackFunc and carla_set_file_callback()
  656. # Debug.
  657. # This opcode is undefined and used only for testing purposes.
  658. FILE_CALLBACK_DEBUG = 0
  659. # Open file or folder.
  660. FILE_CALLBACK_OPEN = 1
  661. # Save file or folder.
  662. FILE_CALLBACK_SAVE = 2
  663. # ------------------------------------------------------------------------------------------------------------
  664. # Patchbay Icon
  665. # The icon of a patchbay client/group.
  666. # Generic application icon.
  667. # Used for all non-plugin clients that don't have a specific icon.
  668. PATCHBAY_ICON_APPLICATION = 0
  669. # Plugin icon.
  670. # Used for all plugin clients that don't have a specific icon.
  671. PATCHBAY_ICON_PLUGIN = 1
  672. # Hardware icon.
  673. # Used for hardware (audio or MIDI) clients.
  674. PATCHBAY_ICON_HARDWARE = 2
  675. # Carla icon.
  676. # Used for the main app.
  677. PATCHBAY_ICON_CARLA = 3
  678. # DISTRHO icon.
  679. # Used for DISTRHO based plugins.
  680. PATCHBAY_ICON_DISTRHO = 4
  681. # File icon.
  682. # Used for file type plugins (like SF2 and SFZ).
  683. PATCHBAY_ICON_FILE = 5
  684. # ------------------------------------------------------------------------------------------------------------
  685. # Carla Backend API (C stuff)
  686. # Engine callback function.
  687. # Front-ends must never block indefinitely during a callback.
  688. # @see EngineCallbackOpcode and carla_set_engine_callback()
  689. EngineCallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_float, c_char_p)
  690. # File callback function.
  691. # @see FileCallbackOpcode
  692. FileCallbackFunc = CFUNCTYPE(c_char_p, c_void_p, c_enum, c_bool, c_char_p, c_char_p)
  693. # Parameter data.
  694. class ParameterData(Structure):
  695. _fields_ = [
  696. # This parameter type.
  697. ("type", c_enum),
  698. # This parameter hints.
  699. # @see ParameterHints
  700. ("hints", c_uint),
  701. # Index as seen by Carla.
  702. ("index", c_int32),
  703. # Real index as seen by plugins.
  704. ("rindex", c_int32),
  705. # Currently mapped MIDI CC.
  706. # A value lower than 0 means invalid or unused.
  707. # Maximum allowed value is 119 (0x77).
  708. ("midiCC", c_int16),
  709. # Currently mapped MIDI channel.
  710. # Counts from 0 to 15.
  711. ("midiChannel", c_uint8)
  712. ]
  713. # Parameter ranges.
  714. class ParameterRanges(Structure):
  715. _fields_ = [
  716. # Default value.
  717. ("def", c_float),
  718. # Minimum value.
  719. ("min", c_float),
  720. # Maximum value.
  721. ("max", c_float),
  722. # Regular, single step value.
  723. ("step", c_float),
  724. # Small step value.
  725. ("stepSmall", c_float),
  726. # Large step value.
  727. ("stepLarge", c_float)
  728. ]
  729. # MIDI Program data.
  730. class MidiProgramData(Structure):
  731. _fields_ = [
  732. # MIDI bank.
  733. ("bank", c_uint32),
  734. # MIDI program.
  735. ("program", c_uint32),
  736. # MIDI program name.
  737. ("name", c_char_p)
  738. ]
  739. # Custom data, used for saving key:value 'dictionaries'.
  740. class CustomData(Structure):
  741. _fields_ = [
  742. # Value type, in URI form.
  743. # @see CustomDataTypes
  744. ("type", c_char_p),
  745. # Key.
  746. # @see CustomDataKeys
  747. ("key", c_char_p),
  748. # Value.
  749. ("value", c_char_p)
  750. ]
  751. # Engine driver device information.
  752. class EngineDriverDeviceInfo(Structure):
  753. _fields_ = [
  754. # This driver device hints.
  755. # @see EngineDriverHints
  756. ("hints", c_uint),
  757. # Available buffer sizes.
  758. # Terminated with 0.
  759. ("bufferSizes", POINTER(c_uint32)),
  760. # Available sample rates.
  761. # Terminated with 0.0.
  762. ("sampleRates", POINTER(c_double))
  763. ]
  764. # ------------------------------------------------------------------------------------------------------------
  765. # Carla Backend API (Python compatible stuff)
  766. # @see ParameterData
  767. PyParameterData = {
  768. 'type': PARAMETER_UNKNOWN,
  769. 'hints': 0x0,
  770. 'index': PARAMETER_NULL,
  771. 'rindex': -1,
  772. 'midiCC': -1,
  773. 'midiChannel': 0
  774. }
  775. # @see ParameterRanges
  776. PyParameterRanges = {
  777. 'def': 0.0,
  778. 'min': 0.0,
  779. 'max': 1.0,
  780. 'step': 0.01,
  781. 'stepSmall': 0.0001,
  782. 'stepLarge': 0.1
  783. }
  784. # @see MidiProgramData
  785. PyMidiProgramData = {
  786. 'bank': 0,
  787. 'program': 0,
  788. 'name': None
  789. }
  790. # @see CustomData
  791. PyCustomData = {
  792. 'type': None,
  793. 'key': None,
  794. 'value': None
  795. }
  796. # @see EngineDriverDeviceInfo
  797. PyEngineDriverDeviceInfo = {
  798. 'hints': 0x0,
  799. 'bufferSizes': [],
  800. 'sampleRates': []
  801. }
  802. # ------------------------------------------------------------------------------------------------------------
  803. # Carla Host API (C stuff)
  804. # Information about a loaded plugin.
  805. # @see carla_get_plugin_info()
  806. class CarlaPluginInfo(Structure):
  807. _fields_ = [
  808. # Plugin type.
  809. ("type", c_enum),
  810. # Plugin category.
  811. ("category", c_enum),
  812. # Plugin hints.
  813. # @see PluginHints
  814. ("hints", c_uint),
  815. # Plugin options available for the user to change.
  816. # @see PluginOptions
  817. ("optionsAvailable", c_uint),
  818. # Plugin options currently enabled.
  819. # Some options are enabled but not available, which means they will always be on.
  820. # @see PluginOptions
  821. ("optionsEnabled", c_uint),
  822. # Plugin filename.
  823. # This can be the plugin binary or resource file.
  824. ("filename", c_char_p),
  825. # Plugin name.
  826. # This name is unique within a Carla instance.
  827. # @see carla_get_real_plugin_name()
  828. ("name", c_char_p),
  829. # Plugin label or URI.
  830. ("label", c_char_p),
  831. # Plugin author/maker.
  832. ("maker", c_char_p),
  833. # Plugin copyright/license.
  834. ("copyright", c_char_p),
  835. # Icon name for this plugin, in lowercase.
  836. # Default is "plugin".
  837. ("iconName", c_char_p),
  838. # Plugin unique Id.
  839. # This Id is dependant on the plugin type and may sometimes be 0.
  840. ("uniqueId", c_int64)
  841. ]
  842. # Port count information, used for Audio and MIDI ports and parameters.
  843. # @see carla_get_audio_port_count_info()
  844. # @see carla_get_midi_port_count_info()
  845. # @see carla_get_parameter_count_info()
  846. class CarlaPortCountInfo(Structure):
  847. _fields_ = [
  848. # Number of inputs.
  849. ("ins", c_uint32),
  850. # Number of outputs.
  851. ("outs", c_uint32)
  852. ]
  853. # Parameter information.
  854. # @see carla_get_parameter_info()
  855. class CarlaParameterInfo(Structure):
  856. _fields_ = [
  857. # Parameter name.
  858. ("name", c_char_p),
  859. # Parameter symbol.
  860. ("symbol", c_char_p),
  861. # Parameter unit.
  862. ("unit", c_char_p),
  863. # Number of scale points.
  864. # @see CarlaScalePointInfo
  865. ("scalePointCount", c_uint32)
  866. ]
  867. # Parameter scale point information.
  868. # @see carla_get_parameter_scalepoint_info()
  869. class CarlaScalePointInfo(Structure):
  870. _fields_ = [
  871. # Scale point value.
  872. ("value", c_float),
  873. # Scale point label.
  874. ("label", c_char_p)
  875. ]
  876. # Transport information.
  877. # @see carla_get_transport_info()
  878. class CarlaTransportInfo(Structure):
  879. _fields_ = [
  880. # Wherever transport is playing.
  881. ("playing", c_bool),
  882. # Current transport frame.
  883. ("frame", c_uint64),
  884. # Bar
  885. ("bar", c_int32),
  886. # Beat
  887. ("beat", c_int32),
  888. # Tick
  889. ("tick", c_int32),
  890. # Beats per minute.
  891. ("bpm", c_double)
  892. ]
  893. # Image data for LV2 inline display API.
  894. # raw image pixmap format is ARGB32,
  895. class CarlaInlineDisplayImageSurface(Structure):
  896. _fields_ = [
  897. ("data", POINTER(c_ubyte)),
  898. ("width", c_int),
  899. ("height", c_int),
  900. ("stride", c_int)
  901. ]
  902. # ------------------------------------------------------------------------------------------------------------
  903. # Carla Host API (Python compatible stuff)
  904. # @see CarlaPluginInfo
  905. PyCarlaPluginInfo = {
  906. 'type': PLUGIN_NONE,
  907. 'category': PLUGIN_CATEGORY_NONE,
  908. 'hints': 0x0,
  909. 'optionsAvailable': 0x0,
  910. 'optionsEnabled': 0x0,
  911. 'filename': "",
  912. 'name': "",
  913. 'label': "",
  914. 'maker': "",
  915. 'copyright': "",
  916. 'iconName': "",
  917. 'uniqueId': 0
  918. }
  919. # @see CarlaPortCountInfo
  920. PyCarlaPortCountInfo = {
  921. 'ins': 0,
  922. 'outs': 0
  923. }
  924. # @see CarlaParameterInfo
  925. PyCarlaParameterInfo = {
  926. 'name': "",
  927. 'symbol': "",
  928. 'unit': "",
  929. 'scalePointCount': 0,
  930. }
  931. # @see CarlaScalePointInfo
  932. PyCarlaScalePointInfo = {
  933. 'value': 0.0,
  934. 'label': ""
  935. }
  936. # @see CarlaTransportInfo
  937. PyCarlaTransportInfo = {
  938. "playing": False,
  939. "frame": 0,
  940. "bar": 0,
  941. "beat": 0,
  942. "tick": 0,
  943. "bpm": 0.0
  944. }
  945. # ------------------------------------------------------------------------------------------------------------
  946. # Set BINARY_NATIVE
  947. if WINDOWS:
  948. BINARY_NATIVE = BINARY_WIN64 if kIs64bit else BINARY_WIN32
  949. else:
  950. BINARY_NATIVE = BINARY_POSIX64 if kIs64bit else BINARY_POSIX32
  951. # ------------------------------------------------------------------------------------------------------------
  952. # Carla Host object (Meta)
  953. class CarlaHostMeta(object):
  954. #class CarlaHostMeta(object, metaclass=ABCMeta):
  955. def __init__(self):
  956. object.__init__(self)
  957. # info about this host object
  958. self.isControl = False
  959. self.isPlugin = False
  960. self.isRemote = False
  961. self.nsmOK = False
  962. # settings
  963. self.processMode = ENGINE_PROCESS_MODE_PATCHBAY
  964. self.transportMode = ENGINE_TRANSPORT_MODE_INTERNAL
  965. self.transportExtra = ""
  966. self.nextProcessMode = self.processMode
  967. self.processModeForced = False
  968. self.audioDriverForced = None
  969. # settings
  970. self.experimental = False
  971. self.exportLV2 = False
  972. self.forceStereo = False
  973. self.manageUIs = False
  974. self.maxParameters = 0
  975. self.preferPluginBridges = False
  976. self.preferUIBridges = False
  977. self.preventBadBehaviour = False
  978. self.showLogs = False
  979. self.showPluginBridges = False
  980. self.showWineBridges = False
  981. self.uiBridgesTimeout = 0
  982. self.uisAlwaysOnTop = False
  983. # settings
  984. self.pathBinaries = ""
  985. self.pathResources = ""
  986. # Get how many engine drivers are available.
  987. @abstractmethod
  988. def get_engine_driver_count(self):
  989. raise NotImplementedError
  990. # Get an engine driver name.
  991. # @param index Driver index
  992. @abstractmethod
  993. def get_engine_driver_name(self, index):
  994. raise NotImplementedError
  995. # Get the device names of an engine driver.
  996. # @param index Driver index
  997. @abstractmethod
  998. def get_engine_driver_device_names(self, index):
  999. raise NotImplementedError
  1000. # Get information about a device driver.
  1001. # @param index Driver index
  1002. # @param name Device name
  1003. @abstractmethod
  1004. def get_engine_driver_device_info(self, index, name):
  1005. raise NotImplementedError
  1006. # Initialize the engine.
  1007. # Make sure to call carla_engine_idle() at regular intervals afterwards.
  1008. # @param driverName Driver to use
  1009. # @param clientName Engine master client name
  1010. @abstractmethod
  1011. def engine_init(self, driverName, clientName):
  1012. raise NotImplementedError
  1013. # Close the engine.
  1014. # This function always closes the engine even if it returns false.
  1015. # In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
  1016. @abstractmethod
  1017. def engine_close(self):
  1018. raise NotImplementedError
  1019. # Idle the engine.
  1020. # Do not call this if the engine is not running.
  1021. @abstractmethod
  1022. def engine_idle(self):
  1023. raise NotImplementedError
  1024. # Check if the engine is running.
  1025. @abstractmethod
  1026. def is_engine_running(self):
  1027. raise NotImplementedError
  1028. # Tell the engine it's about to close.
  1029. # This is used to prevent the engine thread(s) from reactivating.
  1030. @abstractmethod
  1031. def set_engine_about_to_close(self):
  1032. raise NotImplementedError
  1033. # Set the engine callback function.
  1034. # @param func Callback function
  1035. @abstractmethod
  1036. def set_engine_callback(self, func):
  1037. raise NotImplementedError
  1038. # Set an engine option.
  1039. # @param option Option
  1040. # @param value Value as number
  1041. # @param valueStr Value as string
  1042. @abstractmethod
  1043. def set_engine_option(self, option, value, valueStr):
  1044. raise NotImplementedError
  1045. # Set the file callback function.
  1046. # @param func Callback function
  1047. # @param ptr Callback pointer
  1048. @abstractmethod
  1049. def set_file_callback(self, func):
  1050. raise NotImplementedError
  1051. # Load a file of any type.
  1052. # This will try to load a generic file as a plugin,
  1053. # either by direct handling (SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
  1054. # @see carla_get_supported_file_extensions()
  1055. @abstractmethod
  1056. def load_file(self, filename):
  1057. raise NotImplementedError
  1058. # Load a Carla project file.
  1059. # @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
  1060. @abstractmethod
  1061. def load_project(self, filename):
  1062. raise NotImplementedError
  1063. # Save current project to a file.
  1064. @abstractmethod
  1065. def save_project(self, filename):
  1066. raise NotImplementedError
  1067. # Connect two patchbay ports.
  1068. # @param groupIdA Output group
  1069. # @param portIdA Output port
  1070. # @param groupIdB Input group
  1071. # @param portIdB Input port
  1072. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
  1073. @abstractmethod
  1074. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  1075. raise NotImplementedError
  1076. # Disconnect two patchbay ports.
  1077. # @param connectionId Connection Id
  1078. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
  1079. @abstractmethod
  1080. def patchbay_disconnect(self, connectionId):
  1081. raise NotImplementedError
  1082. # Force the engine to resend all patchbay clients, ports and connections again.
  1083. # @param external Wherever to show external/hardware ports instead of internal ones.
  1084. # Only valid in patchbay engine mode, other modes will ignore this.
  1085. @abstractmethod
  1086. def patchbay_refresh(self, external):
  1087. raise NotImplementedError
  1088. # Start playback of the engine transport.
  1089. @abstractmethod
  1090. def transport_play(self):
  1091. raise NotImplementedError
  1092. # Pause the engine transport.
  1093. @abstractmethod
  1094. def transport_pause(self):
  1095. raise NotImplementedError
  1096. # Pause the engine transport.
  1097. @abstractmethod
  1098. def transport_bpm(self, bpm):
  1099. raise NotImplementedError
  1100. # Relocate the engine transport to a specific frame.
  1101. @abstractmethod
  1102. def transport_relocate(self, frame):
  1103. raise NotImplementedError
  1104. # Get the current transport frame.
  1105. @abstractmethod
  1106. def get_current_transport_frame(self):
  1107. raise NotImplementedError
  1108. # Get the engine transport information.
  1109. @abstractmethod
  1110. def get_transport_info(self):
  1111. raise NotImplementedError
  1112. # Current number of plugins loaded.
  1113. @abstractmethod
  1114. def get_current_plugin_count(self):
  1115. raise NotImplementedError
  1116. # Maximum number of loadable plugins allowed.
  1117. # Returns 0 if engine is not started.
  1118. @abstractmethod
  1119. def get_max_plugin_number(self):
  1120. raise NotImplementedError
  1121. # Add a new plugin.
  1122. # If you don't know the binary type use the BINARY_NATIVE macro.
  1123. # @param btype Binary type
  1124. # @param ptype Plugin type
  1125. # @param filename Filename, if applicable
  1126. # @param name Name of the plugin, can be NULL
  1127. # @param label Plugin label, if applicable
  1128. # @param uniqueId Plugin unique Id, if applicable
  1129. # @param extraPtr Extra pointer, defined per plugin type
  1130. # @param options Initial plugin options
  1131. @abstractmethod
  1132. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  1133. raise NotImplementedError
  1134. # Remove a plugin.
  1135. # @param pluginId Plugin to remove.
  1136. @abstractmethod
  1137. def remove_plugin(self, pluginId):
  1138. raise NotImplementedError
  1139. # Remove all plugins.
  1140. @abstractmethod
  1141. def remove_all_plugins(self):
  1142. raise NotImplementedError
  1143. # Rename a plugin.
  1144. # Returns the new name, or NULL if the operation failed.
  1145. # @param pluginId Plugin to rename
  1146. # @param newName New plugin name
  1147. @abstractmethod
  1148. def rename_plugin(self, pluginId, newName):
  1149. raise NotImplementedError
  1150. # Clone a plugin.
  1151. # @param pluginId Plugin to clone
  1152. @abstractmethod
  1153. def clone_plugin(self, pluginId):
  1154. raise NotImplementedError
  1155. # Prepare replace of a plugin.
  1156. # The next call to carla_add_plugin() will use this id, replacing the current plugin.
  1157. # @param pluginId Plugin to replace
  1158. # @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  1159. @abstractmethod
  1160. def replace_plugin(self, pluginId):
  1161. raise NotImplementedError
  1162. # Switch two plugins positions.
  1163. # @param pluginIdA Plugin A
  1164. # @param pluginIdB Plugin B
  1165. @abstractmethod
  1166. def switch_plugins(self, pluginIdA, pluginIdB):
  1167. raise NotImplementedError
  1168. # Load a plugin state.
  1169. # @param pluginId Plugin
  1170. # @param filename Path to plugin state
  1171. # @see carla_save_plugin_state()
  1172. @abstractmethod
  1173. def load_plugin_state(self, pluginId, filename):
  1174. raise NotImplementedError
  1175. # Save a plugin state.
  1176. # @param pluginId Plugin
  1177. # @param filename Path to plugin state
  1178. # @see carla_load_plugin_state()
  1179. @abstractmethod
  1180. def save_plugin_state(self, pluginId, filename):
  1181. raise NotImplementedError
  1182. # Export plugin as LV2.
  1183. # @param pluginId Plugin
  1184. # @param lv2path Path to lv2 plugin folder
  1185. def export_plugin_lv2(self, pluginId, lv2path):
  1186. raise NotImplementedError
  1187. # Get information from a plugin.
  1188. # @param pluginId Plugin
  1189. @abstractmethod
  1190. def get_plugin_info(self, pluginId):
  1191. raise NotImplementedError
  1192. # Get audio port count information from a plugin.
  1193. # @param pluginId Plugin
  1194. @abstractmethod
  1195. def get_audio_port_count_info(self, pluginId):
  1196. raise NotImplementedError
  1197. # Get MIDI port count information from a plugin.
  1198. # @param pluginId Plugin
  1199. @abstractmethod
  1200. def get_midi_port_count_info(self, pluginId):
  1201. raise NotImplementedError
  1202. # Get parameter count information from a plugin.
  1203. # @param pluginId Plugin
  1204. @abstractmethod
  1205. def get_parameter_count_info(self, pluginId):
  1206. raise NotImplementedError
  1207. # Get parameter information from a plugin.
  1208. # @param pluginId Plugin
  1209. # @param parameterId Parameter index
  1210. # @see carla_get_parameter_count()
  1211. @abstractmethod
  1212. def get_parameter_info(self, pluginId, parameterId):
  1213. raise NotImplementedError
  1214. # Get parameter scale point information from a plugin.
  1215. # @param pluginId Plugin
  1216. # @param parameterId Parameter index
  1217. # @param scalePointId Parameter scale-point index
  1218. # @see CarlaParameterInfo::scalePointCount
  1219. @abstractmethod
  1220. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1221. raise NotImplementedError
  1222. # Get a plugin's parameter data.
  1223. # @param pluginId Plugin
  1224. # @param parameterId Parameter index
  1225. # @see carla_get_parameter_count()
  1226. @abstractmethod
  1227. def get_parameter_data(self, pluginId, parameterId):
  1228. raise NotImplementedError
  1229. # Get a plugin's parameter ranges.
  1230. # @param pluginId Plugin
  1231. # @param parameterId Parameter index
  1232. # @see carla_get_parameter_count()
  1233. @abstractmethod
  1234. def get_parameter_ranges(self, pluginId, parameterId):
  1235. raise NotImplementedError
  1236. # Get a plugin's MIDI program data.
  1237. # @param pluginId Plugin
  1238. # @param midiProgramId MIDI Program index
  1239. # @see carla_get_midi_program_count()
  1240. @abstractmethod
  1241. def get_midi_program_data(self, pluginId, midiProgramId):
  1242. raise NotImplementedError
  1243. # Get a plugin's custom data, using index.
  1244. # @param pluginId Plugin
  1245. # @param customDataId Custom data index
  1246. # @see carla_get_custom_data_count()
  1247. @abstractmethod
  1248. def get_custom_data(self, pluginId, customDataId):
  1249. raise NotImplementedError
  1250. # Get a plugin's custom data value, using type and key.
  1251. # @param pluginId Plugin
  1252. # @param type Custom data type
  1253. # @param key Custom data key
  1254. # @see carla_get_custom_data_count()
  1255. @abstractmethod
  1256. def get_custom_data_value(self, pluginId, type_, key):
  1257. raise NotImplementedError
  1258. # Get a plugin's chunk data.
  1259. # @param pluginId Plugin
  1260. # @see PLUGIN_OPTION_USE_CHUNKS
  1261. @abstractmethod
  1262. def get_chunk_data(self, pluginId):
  1263. raise NotImplementedError
  1264. # Get how many parameters a plugin has.
  1265. # @param pluginId Plugin
  1266. @abstractmethod
  1267. def get_parameter_count(self, pluginId):
  1268. raise NotImplementedError
  1269. # Get how many programs a plugin has.
  1270. # @param pluginId Plugin
  1271. # @see carla_get_program_name()
  1272. @abstractmethod
  1273. def get_program_count(self, pluginId):
  1274. raise NotImplementedError
  1275. # Get how many MIDI programs a plugin has.
  1276. # @param pluginId Plugin
  1277. # @see carla_get_midi_program_name() and carla_get_midi_program_data()
  1278. @abstractmethod
  1279. def get_midi_program_count(self, pluginId):
  1280. raise NotImplementedError
  1281. # Get how many custom data sets a plugin has.
  1282. # @param pluginId Plugin
  1283. # @see carla_get_custom_data()
  1284. @abstractmethod
  1285. def get_custom_data_count(self, pluginId):
  1286. raise NotImplementedError
  1287. # Get a plugin's parameter text (custom display of internal values).
  1288. # @param pluginId Plugin
  1289. # @param parameterId Parameter index
  1290. # @see PARAMETER_USES_CUSTOM_TEXT
  1291. @abstractmethod
  1292. def get_parameter_text(self, pluginId, parameterId):
  1293. raise NotImplementedError
  1294. # Get a plugin's program name.
  1295. # @param pluginId Plugin
  1296. # @param programId Program index
  1297. # @see carla_get_program_count()
  1298. @abstractmethod
  1299. def get_program_name(self, pluginId, programId):
  1300. raise NotImplementedError
  1301. # Get a plugin's MIDI program name.
  1302. # @param pluginId Plugin
  1303. # @param midiProgramId MIDI Program index
  1304. # @see carla_get_midi_program_count()
  1305. @abstractmethod
  1306. def get_midi_program_name(self, pluginId, midiProgramId):
  1307. raise NotImplementedError
  1308. # Get a plugin's real name.
  1309. # This is the name the plugin uses to identify itself; may not be unique.
  1310. # @param pluginId Plugin
  1311. @abstractmethod
  1312. def get_real_plugin_name(self, pluginId):
  1313. raise NotImplementedError
  1314. # Get a plugin's program index.
  1315. # @param pluginId Plugin
  1316. @abstractmethod
  1317. def get_current_program_index(self, pluginId):
  1318. raise NotImplementedError
  1319. # Get a plugin's midi program index.
  1320. # @param pluginId Plugin
  1321. @abstractmethod
  1322. def get_current_midi_program_index(self, pluginId):
  1323. raise NotImplementedError
  1324. # Get a plugin's default parameter value.
  1325. # @param pluginId Plugin
  1326. # @param parameterId Parameter index
  1327. @abstractmethod
  1328. def get_default_parameter_value(self, pluginId, parameterId):
  1329. raise NotImplementedError
  1330. # Get a plugin's current parameter value.
  1331. # @param pluginId Plugin
  1332. # @param parameterId Parameter index
  1333. @abstractmethod
  1334. def get_current_parameter_value(self, pluginId, parameterId):
  1335. raise NotImplementedError
  1336. # Get a plugin's internal parameter value.
  1337. # @param pluginId Plugin
  1338. # @param parameterId Parameter index, maybe be negative
  1339. # @see InternalParameterIndex
  1340. @abstractmethod
  1341. def get_internal_parameter_value(self, pluginId, parameterId):
  1342. raise NotImplementedError
  1343. # Get a plugin's input peak value.
  1344. # @param pluginId Plugin
  1345. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1346. @abstractmethod
  1347. def get_input_peak_value(self, pluginId, isLeft):
  1348. raise NotImplementedError
  1349. # Get a plugin's output peak value.
  1350. # @param pluginId Plugin
  1351. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1352. @abstractmethod
  1353. def get_output_peak_value(self, pluginId, isLeft):
  1354. raise NotImplementedError
  1355. # Render a plugin's inline display.
  1356. # @param pluginId Plugin
  1357. @abstractmethod
  1358. def render_inline_display(self, pluginId, width, height):
  1359. raise NotImplementedError
  1360. # Enable a plugin's option.
  1361. # @param pluginId Plugin
  1362. # @param option An option from PluginOptions
  1363. # @param yesNo New enabled state
  1364. @abstractmethod
  1365. def set_option(self, pluginId, option, yesNo):
  1366. raise NotImplementedError
  1367. # Enable or disable a plugin.
  1368. # @param pluginId Plugin
  1369. # @param onOff New active state
  1370. @abstractmethod
  1371. def set_active(self, pluginId, onOff):
  1372. raise NotImplementedError
  1373. # Change a plugin's internal dry/wet.
  1374. # @param pluginId Plugin
  1375. # @param value New dry/wet value
  1376. @abstractmethod
  1377. def set_drywet(self, pluginId, value):
  1378. raise NotImplementedError
  1379. # Change a plugin's internal volume.
  1380. # @param pluginId Plugin
  1381. # @param value New volume
  1382. @abstractmethod
  1383. def set_volume(self, pluginId, value):
  1384. raise NotImplementedError
  1385. # Change a plugin's internal stereo balance, left channel.
  1386. # @param pluginId Plugin
  1387. # @param value New value
  1388. @abstractmethod
  1389. def set_balance_left(self, pluginId, value):
  1390. raise NotImplementedError
  1391. # Change a plugin's internal stereo balance, right channel.
  1392. # @param pluginId Plugin
  1393. # @param value New value
  1394. @abstractmethod
  1395. def set_balance_right(self, pluginId, value):
  1396. raise NotImplementedError
  1397. # Change a plugin's internal mono panning value.
  1398. # @param pluginId Plugin
  1399. # @param value New value
  1400. @abstractmethod
  1401. def set_panning(self, pluginId, value):
  1402. raise NotImplementedError
  1403. # Change a plugin's internal control channel.
  1404. # @param pluginId Plugin
  1405. # @param channel New channel
  1406. @abstractmethod
  1407. def set_ctrl_channel(self, pluginId, channel):
  1408. raise NotImplementedError
  1409. # Change a plugin's parameter value.
  1410. # @param pluginId Plugin
  1411. # @param parameterId Parameter index
  1412. # @param value New value
  1413. @abstractmethod
  1414. def set_parameter_value(self, pluginId, parameterId, value):
  1415. raise NotImplementedError
  1416. # Change a plugin's parameter MIDI cc.
  1417. # @param pluginId Plugin
  1418. # @param parameterId Parameter index
  1419. # @param cc New MIDI cc
  1420. @abstractmethod
  1421. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1422. raise NotImplementedError
  1423. # Change a plugin's parameter MIDI channel.
  1424. # @param pluginId Plugin
  1425. # @param parameterId Parameter index
  1426. # @param channel New MIDI channel
  1427. @abstractmethod
  1428. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  1429. raise NotImplementedError
  1430. # Change a plugin's current program.
  1431. # @param pluginId Plugin
  1432. # @param programId New program
  1433. @abstractmethod
  1434. def set_program(self, pluginId, programId):
  1435. raise NotImplementedError
  1436. # Change a plugin's current MIDI program.
  1437. # @param pluginId Plugin
  1438. # @param midiProgramId New value
  1439. @abstractmethod
  1440. def set_midi_program(self, pluginId, midiProgramId):
  1441. raise NotImplementedError
  1442. # Set a plugin's custom data set.
  1443. # @param pluginId Plugin
  1444. # @param type Type
  1445. # @param key Key
  1446. # @param value New value
  1447. # @see CustomDataTypes and CustomDataKeys
  1448. @abstractmethod
  1449. def set_custom_data(self, pluginId, type_, key, value):
  1450. raise NotImplementedError
  1451. # Set a plugin's chunk data.
  1452. # @param pluginId Plugin
  1453. # @param chunkData New chunk data
  1454. # @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  1455. @abstractmethod
  1456. def set_chunk_data(self, pluginId, chunkData):
  1457. raise NotImplementedError
  1458. # Tell a plugin to prepare for save.
  1459. # This should be called before saving custom data sets.
  1460. # @param pluginId Plugin
  1461. @abstractmethod
  1462. def prepare_for_save(self, pluginId):
  1463. raise NotImplementedError
  1464. # Reset all plugin's parameters.
  1465. # @param pluginId Plugin
  1466. @abstractmethod
  1467. def reset_parameters(self, pluginId):
  1468. raise NotImplementedError
  1469. # Randomize all plugin's parameters.
  1470. # @param pluginId Plugin
  1471. @abstractmethod
  1472. def randomize_parameters(self, pluginId):
  1473. raise NotImplementedError
  1474. # Send a single note of a plugin.
  1475. # If velocity is 0, note-off is sent; note-on otherwise.
  1476. # @param pluginId Plugin
  1477. # @param channel Note channel
  1478. # @param note Note pitch
  1479. # @param velocity Note velocity
  1480. @abstractmethod
  1481. def send_midi_note(self, pluginId, channel, note, velocity):
  1482. raise NotImplementedError
  1483. # Tell a plugin to show its own custom UI.
  1484. # @param pluginId Plugin
  1485. # @param yesNo New UI state, visible or not
  1486. # @see PLUGIN_HAS_CUSTOM_UI
  1487. @abstractmethod
  1488. def show_custom_ui(self, pluginId, yesNo):
  1489. raise NotImplementedError
  1490. # Get the current engine buffer size.
  1491. @abstractmethod
  1492. def get_buffer_size(self):
  1493. raise NotImplementedError
  1494. # Get the current engine sample rate.
  1495. @abstractmethod
  1496. def get_sample_rate(self):
  1497. raise NotImplementedError
  1498. # Get the last error.
  1499. @abstractmethod
  1500. def get_last_error(self):
  1501. raise NotImplementedError
  1502. # Get the current engine OSC URL (TCP).
  1503. @abstractmethod
  1504. def get_host_osc_url_tcp(self):
  1505. raise NotImplementedError
  1506. # Get the current engine OSC URL (UDP).
  1507. @abstractmethod
  1508. def get_host_osc_url_udp(self):
  1509. raise NotImplementedError
  1510. # ------------------------------------------------------------------------------------------------------------
  1511. # Carla Host object (dummy/null, does nothing)
  1512. class CarlaHostNull(CarlaHostMeta):
  1513. def __init__(self):
  1514. CarlaHostMeta.__init__(self)
  1515. self.fEngineCallback = None
  1516. self.fFileCallback = None
  1517. self.fEngineRunning = False
  1518. def get_engine_driver_count(self):
  1519. return 0
  1520. def get_engine_driver_name(self, index):
  1521. return ""
  1522. def get_engine_driver_device_names(self, index):
  1523. return []
  1524. def get_engine_driver_device_info(self, index, name):
  1525. return PyEngineDriverDeviceInfo
  1526. def engine_init(self, driverName, clientName):
  1527. self.fEngineRunning = True
  1528. if self.fEngineCallback is not None:
  1529. self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STARTED, 0, self.processMode, self.transportMode, 0.0, driverName)
  1530. return True
  1531. def engine_close(self):
  1532. self.fEngineRunning = False
  1533. if self.fEngineCallback is not None:
  1534. self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0.0, "")
  1535. return True
  1536. def engine_idle(self):
  1537. return
  1538. def is_engine_running(self):
  1539. return self.fEngineRunning
  1540. def set_engine_about_to_close(self):
  1541. return True
  1542. def set_engine_callback(self, func):
  1543. self.fEngineCallback = func
  1544. def set_engine_option(self, option, value, valueStr):
  1545. return
  1546. def set_file_callback(self, func):
  1547. self.fFileCallback = func
  1548. def load_file(self, filename):
  1549. return False
  1550. def load_project(self, filename):
  1551. return False
  1552. def save_project(self, filename):
  1553. return False
  1554. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  1555. return False
  1556. def patchbay_disconnect(self, connectionId):
  1557. return False
  1558. def patchbay_refresh(self, external):
  1559. return False
  1560. def transport_play(self):
  1561. return
  1562. def transport_pause(self):
  1563. return
  1564. def transport_bpm(self, bpm):
  1565. return
  1566. def transport_relocate(self, frame):
  1567. return
  1568. def get_current_transport_frame(self):
  1569. return 0
  1570. def get_transport_info(self):
  1571. return PyCarlaTransportInfo
  1572. def get_current_plugin_count(self):
  1573. return 0
  1574. def get_max_plugin_number(self):
  1575. return 0
  1576. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  1577. return False
  1578. def remove_plugin(self, pluginId):
  1579. return False
  1580. def remove_all_plugins(self):
  1581. return False
  1582. def rename_plugin(self, pluginId, newName):
  1583. return ""
  1584. def clone_plugin(self, pluginId):
  1585. return False
  1586. def replace_plugin(self, pluginId):
  1587. return False
  1588. def switch_plugins(self, pluginIdA, pluginIdB):
  1589. return False
  1590. def load_plugin_state(self, pluginId, filename):
  1591. return False
  1592. def save_plugin_state(self, pluginId, filename):
  1593. return False
  1594. def export_plugin_lv2(self, pluginId, lv2path):
  1595. return False
  1596. def get_plugin_info(self, pluginId):
  1597. return PyCarlaPluginInfo
  1598. def get_audio_port_count_info(self, pluginId):
  1599. return PyCarlaPortCountInfo
  1600. def get_midi_port_count_info(self, pluginId):
  1601. return PyCarlaPortCountInfo
  1602. def get_parameter_count_info(self, pluginId):
  1603. return PyCarlaPortCountInfo
  1604. def get_parameter_info(self, pluginId, parameterId):
  1605. return PyCarlaParameterInfo
  1606. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1607. return PyCarlaScalePointInfo
  1608. def get_parameter_data(self, pluginId, parameterId):
  1609. return PyParameterData
  1610. def get_parameter_ranges(self, pluginId, parameterId):
  1611. return PyParameterRanges
  1612. def get_midi_program_data(self, pluginId, midiProgramId):
  1613. return PyMidiProgramData
  1614. def get_custom_data(self, pluginId, customDataId):
  1615. return PyCustomData
  1616. def get_custom_data_value(self, pluginId, type_, key):
  1617. return ""
  1618. def get_chunk_data(self, pluginId):
  1619. return ""
  1620. def get_parameter_count(self, pluginId):
  1621. return 0
  1622. def get_program_count(self, pluginId):
  1623. return 0
  1624. def get_midi_program_count(self, pluginId):
  1625. return 0
  1626. def get_custom_data_count(self, pluginId):
  1627. return 0
  1628. def get_parameter_text(self, pluginId, parameterId):
  1629. return ""
  1630. def get_program_name(self, pluginId, programId):
  1631. return ""
  1632. def get_midi_program_name(self, pluginId, midiProgramId):
  1633. return ""
  1634. def get_real_plugin_name(self, pluginId):
  1635. return ""
  1636. def get_current_program_index(self, pluginId):
  1637. return 0
  1638. def get_current_midi_program_index(self, pluginId):
  1639. return 0
  1640. def get_default_parameter_value(self, pluginId, parameterId):
  1641. return 0.0
  1642. def get_current_parameter_value(self, pluginId, parameterId):
  1643. return 0.0
  1644. def get_internal_parameter_value(self, pluginId, parameterId):
  1645. return 0.0
  1646. def get_input_peak_value(self, pluginId, isLeft):
  1647. return 0.0
  1648. def get_output_peak_value(self, pluginId, isLeft):
  1649. return 0.0
  1650. def render_inline_display(self, pluginId, width, height):
  1651. return None
  1652. def set_option(self, pluginId, option, yesNo):
  1653. return
  1654. def set_active(self, pluginId, onOff):
  1655. return
  1656. def set_drywet(self, pluginId, value):
  1657. return
  1658. def set_volume(self, pluginId, value):
  1659. return
  1660. def set_balance_left(self, pluginId, value):
  1661. return
  1662. def set_balance_right(self, pluginId, value):
  1663. return
  1664. def set_panning(self, pluginId, value):
  1665. return
  1666. def set_ctrl_channel(self, pluginId, channel):
  1667. return
  1668. def set_parameter_value(self, pluginId, parameterId, value):
  1669. return
  1670. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1671. return
  1672. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  1673. return
  1674. def set_program(self, pluginId, programId):
  1675. return
  1676. def set_midi_program(self, pluginId, midiProgramId):
  1677. return
  1678. def set_custom_data(self, pluginId, type_, key, value):
  1679. return
  1680. def set_chunk_data(self, pluginId, chunkData):
  1681. return
  1682. def prepare_for_save(self, pluginId):
  1683. return
  1684. def reset_parameters(self, pluginId):
  1685. return
  1686. def randomize_parameters(self, pluginId):
  1687. return
  1688. def send_midi_note(self, pluginId, channel, note, velocity):
  1689. return
  1690. def show_custom_ui(self, pluginId, yesNo):
  1691. return
  1692. def get_buffer_size(self):
  1693. return 0
  1694. def get_sample_rate(self):
  1695. return 0.0
  1696. def get_last_error(self):
  1697. return ""
  1698. def get_host_osc_url_tcp(self):
  1699. return ""
  1700. def get_host_osc_url_udp(self):
  1701. return ""
  1702. def nsm_init(self, pid, executableName):
  1703. return False
  1704. def nsm_ready(self, action):
  1705. return
  1706. # ------------------------------------------------------------------------------------------------------------
  1707. # Carla Host object using a DLL
  1708. class CarlaHostDLL(CarlaHostMeta):
  1709. def __init__(self, libName, loadGlobal):
  1710. CarlaHostMeta.__init__(self)
  1711. # info about this host object
  1712. self.isPlugin = False
  1713. self.lib = CDLL(libName, RTLD_GLOBAL if loadGlobal else RTLD_LOCAL)
  1714. self.lib.carla_get_engine_driver_count.argtypes = None
  1715. self.lib.carla_get_engine_driver_count.restype = c_uint
  1716. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  1717. self.lib.carla_get_engine_driver_name.restype = c_char_p
  1718. self.lib.carla_get_engine_driver_device_names.argtypes = [c_uint]
  1719. self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)
  1720. self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p]
  1721. self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)
  1722. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  1723. self.lib.carla_engine_init.restype = c_bool
  1724. self.lib.carla_engine_close.argtypes = None
  1725. self.lib.carla_engine_close.restype = c_bool
  1726. self.lib.carla_engine_idle.argtypes = None
  1727. self.lib.carla_engine_idle.restype = None
  1728. self.lib.carla_is_engine_running.argtypes = None
  1729. self.lib.carla_is_engine_running.restype = c_bool
  1730. self.lib.carla_set_engine_about_to_close.argtypes = None
  1731. self.lib.carla_set_engine_about_to_close.restype = c_bool
  1732. self.lib.carla_set_engine_callback.argtypes = [EngineCallbackFunc, c_void_p]
  1733. self.lib.carla_set_engine_callback.restype = None
  1734. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  1735. self.lib.carla_set_engine_option.restype = None
  1736. self.lib.carla_set_file_callback.argtypes = [FileCallbackFunc, c_void_p]
  1737. self.lib.carla_set_file_callback.restype = None
  1738. self.lib.carla_load_file.argtypes = [c_char_p]
  1739. self.lib.carla_load_file.restype = c_bool
  1740. self.lib.carla_load_project.argtypes = [c_char_p]
  1741. self.lib.carla_load_project.restype = c_bool
  1742. self.lib.carla_save_project.argtypes = [c_char_p]
  1743. self.lib.carla_save_project.restype = c_bool
  1744. self.lib.carla_patchbay_connect.argtypes = [c_uint, c_uint, c_uint, c_uint]
  1745. self.lib.carla_patchbay_connect.restype = c_bool
  1746. self.lib.carla_patchbay_disconnect.argtypes = [c_uint]
  1747. self.lib.carla_patchbay_disconnect.restype = c_bool
  1748. self.lib.carla_patchbay_refresh.argtypes = [c_bool]
  1749. self.lib.carla_patchbay_refresh.restype = c_bool
  1750. self.lib.carla_transport_play.argtypes = None
  1751. self.lib.carla_transport_play.restype = None
  1752. self.lib.carla_transport_pause.argtypes = None
  1753. self.lib.carla_transport_pause.restype = None
  1754. self.lib.carla_transport_bpm.argtypes = [c_double]
  1755. self.lib.carla_transport_bpm.restype = None
  1756. self.lib.carla_transport_relocate.argtypes = [c_uint64]
  1757. self.lib.carla_transport_relocate.restype = None
  1758. self.lib.carla_get_current_transport_frame.argtypes = None
  1759. self.lib.carla_get_current_transport_frame.restype = c_uint64
  1760. self.lib.carla_get_transport_info.argtypes = None
  1761. self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
  1762. self.lib.carla_get_current_plugin_count.argtypes = None
  1763. self.lib.carla_get_current_plugin_count.restype = c_uint32
  1764. self.lib.carla_get_max_plugin_number.argtypes = None
  1765. self.lib.carla_get_max_plugin_number.restype = c_uint32
  1766. self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_int64, c_void_p, c_uint]
  1767. self.lib.carla_add_plugin.restype = c_bool
  1768. self.lib.carla_remove_plugin.argtypes = [c_uint]
  1769. self.lib.carla_remove_plugin.restype = c_bool
  1770. self.lib.carla_remove_all_plugins.argtypes = None
  1771. self.lib.carla_remove_all_plugins.restype = c_bool
  1772. self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
  1773. self.lib.carla_rename_plugin.restype = c_char_p
  1774. self.lib.carla_clone_plugin.argtypes = [c_uint]
  1775. self.lib.carla_clone_plugin.restype = c_bool
  1776. self.lib.carla_replace_plugin.argtypes = [c_uint]
  1777. self.lib.carla_replace_plugin.restype = c_bool
  1778. self.lib.carla_switch_plugins.argtypes = [c_uint, c_uint]
  1779. self.lib.carla_switch_plugins.restype = c_bool
  1780. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  1781. self.lib.carla_load_plugin_state.restype = c_bool
  1782. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  1783. self.lib.carla_save_plugin_state.restype = c_bool
  1784. self.lib.carla_export_plugin_lv2.argtypes = [c_uint, c_char_p]
  1785. self.lib.carla_export_plugin_lv2.restype = c_bool
  1786. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  1787. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  1788. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  1789. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1790. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  1791. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1792. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  1793. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  1794. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  1795. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  1796. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  1797. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  1798. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  1799. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  1800. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  1801. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  1802. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  1803. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  1804. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  1805. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  1806. self.lib.carla_get_custom_data_value.argtypes = [c_uint, c_char_p, c_char_p]
  1807. self.lib.carla_get_custom_data_value.restype = c_char_p
  1808. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  1809. self.lib.carla_get_chunk_data.restype = c_char_p
  1810. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  1811. self.lib.carla_get_parameter_count.restype = c_uint32
  1812. self.lib.carla_get_program_count.argtypes = [c_uint]
  1813. self.lib.carla_get_program_count.restype = c_uint32
  1814. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  1815. self.lib.carla_get_midi_program_count.restype = c_uint32
  1816. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  1817. self.lib.carla_get_custom_data_count.restype = c_uint32
  1818. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
  1819. self.lib.carla_get_parameter_text.restype = c_char_p
  1820. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  1821. self.lib.carla_get_program_name.restype = c_char_p
  1822. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  1823. self.lib.carla_get_midi_program_name.restype = c_char_p
  1824. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  1825. self.lib.carla_get_real_plugin_name.restype = c_char_p
  1826. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  1827. self.lib.carla_get_current_program_index.restype = c_int32
  1828. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  1829. self.lib.carla_get_current_midi_program_index.restype = c_int32
  1830. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  1831. self.lib.carla_get_default_parameter_value.restype = c_float
  1832. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  1833. self.lib.carla_get_current_parameter_value.restype = c_float
  1834. self.lib.carla_get_internal_parameter_value.argtypes = [c_uint, c_int32]
  1835. self.lib.carla_get_internal_parameter_value.restype = c_float
  1836. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_bool]
  1837. self.lib.carla_get_input_peak_value.restype = c_float
  1838. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_bool]
  1839. self.lib.carla_get_output_peak_value.restype = c_float
  1840. self.lib.carla_render_inline_display.argtypes = [c_uint, c_uint, c_uint]
  1841. self.lib.carla_render_inline_display.restype = POINTER(CarlaInlineDisplayImageSurface)
  1842. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  1843. self.lib.carla_set_option.restype = None
  1844. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  1845. self.lib.carla_set_active.restype = None
  1846. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  1847. self.lib.carla_set_drywet.restype = None
  1848. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  1849. self.lib.carla_set_volume.restype = None
  1850. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  1851. self.lib.carla_set_balance_left.restype = None
  1852. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  1853. self.lib.carla_set_balance_right.restype = None
  1854. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  1855. self.lib.carla_set_panning.restype = None
  1856. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  1857. self.lib.carla_set_ctrl_channel.restype = None
  1858. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  1859. self.lib.carla_set_parameter_value.restype = None
  1860. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  1861. self.lib.carla_set_parameter_midi_channel.restype = None
  1862. self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
  1863. self.lib.carla_set_parameter_midi_cc.restype = None
  1864. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  1865. self.lib.carla_set_program.restype = None
  1866. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  1867. self.lib.carla_set_midi_program.restype = None
  1868. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  1869. self.lib.carla_set_custom_data.restype = None
  1870. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  1871. self.lib.carla_set_chunk_data.restype = None
  1872. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  1873. self.lib.carla_prepare_for_save.restype = None
  1874. self.lib.carla_reset_parameters.argtypes = [c_uint]
  1875. self.lib.carla_reset_parameters.restype = None
  1876. self.lib.carla_randomize_parameters.argtypes = [c_uint]
  1877. self.lib.carla_randomize_parameters.restype = None
  1878. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  1879. self.lib.carla_send_midi_note.restype = None
  1880. self.lib.carla_show_custom_ui.argtypes = [c_uint, c_bool]
  1881. self.lib.carla_show_custom_ui.restype = None
  1882. self.lib.carla_get_buffer_size.argtypes = None
  1883. self.lib.carla_get_buffer_size.restype = c_uint32
  1884. self.lib.carla_get_sample_rate.argtypes = None
  1885. self.lib.carla_get_sample_rate.restype = c_double
  1886. self.lib.carla_get_last_error.argtypes = None
  1887. self.lib.carla_get_last_error.restype = c_char_p
  1888. self.lib.carla_get_host_osc_url_tcp.argtypes = None
  1889. self.lib.carla_get_host_osc_url_tcp.restype = c_char_p
  1890. self.lib.carla_get_host_osc_url_udp.argtypes = None
  1891. self.lib.carla_get_host_osc_url_udp.restype = c_char_p
  1892. self.lib.carla_nsm_init.argtypes = [c_int, c_char_p]
  1893. self.lib.carla_nsm_init.restype = c_bool
  1894. self.lib.carla_nsm_ready.argtypes = [c_int]
  1895. self.lib.carla_nsm_ready.restype = None
  1896. # --------------------------------------------------------------------------------------------------------
  1897. def get_engine_driver_count(self):
  1898. return int(self.lib.carla_get_engine_driver_count())
  1899. def get_engine_driver_name(self, index):
  1900. return charPtrToString(self.lib.carla_get_engine_driver_name(index))
  1901. def get_engine_driver_device_names(self, index):
  1902. return charPtrPtrToStringList(self.lib.carla_get_engine_driver_device_names(index))
  1903. def get_engine_driver_device_info(self, index, name):
  1904. return structToDict(self.lib.carla_get_engine_driver_device_info(index, name.encode("utf-8")).contents)
  1905. def engine_init(self, driverName, clientName):
  1906. return bool(self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8")))
  1907. def engine_close(self):
  1908. return bool(self.lib.carla_engine_close())
  1909. def engine_idle(self):
  1910. self.lib.carla_engine_idle()
  1911. def is_engine_running(self):
  1912. return bool(self.lib.carla_is_engine_running())
  1913. def set_engine_about_to_close(self):
  1914. return bool(self.lib.carla_set_engine_about_to_close())
  1915. def set_engine_callback(self, func):
  1916. self._engineCallback = EngineCallbackFunc(func)
  1917. self.lib.carla_set_engine_callback(self._engineCallback, None)
  1918. def set_engine_option(self, option, value, valueStr):
  1919. self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
  1920. def set_file_callback(self, func):
  1921. self._fileCallback = FileCallbackFunc(func)
  1922. self.lib.carla_set_file_callback(self._fileCallback, None)
  1923. def load_file(self, filename):
  1924. return bool(self.lib.carla_load_file(filename.encode("utf-8")))
  1925. def load_project(self, filename):
  1926. return bool(self.lib.carla_load_project(filename.encode("utf-8")))
  1927. def save_project(self, filename):
  1928. return bool(self.lib.carla_save_project(filename.encode("utf-8")))
  1929. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  1930. return bool(self.lib.carla_patchbay_connect(groupIdA, portIdA, groupIdB, portIdB))
  1931. def patchbay_disconnect(self, connectionId):
  1932. return bool(self.lib.carla_patchbay_disconnect(connectionId))
  1933. def patchbay_refresh(self, external):
  1934. return bool(self.lib.carla_patchbay_refresh(external))
  1935. def transport_play(self):
  1936. self.lib.carla_transport_play()
  1937. def transport_pause(self):
  1938. self.lib.carla_transport_pause()
  1939. def transport_bpm(self, bpm):
  1940. self.lib.carla_transport_bpm(bpm)
  1941. def transport_relocate(self, frame):
  1942. self.lib.carla_transport_relocate(frame)
  1943. def get_current_transport_frame(self):
  1944. return int(self.lib.carla_get_current_transport_frame())
  1945. def get_transport_info(self):
  1946. return structToDict(self.lib.carla_get_transport_info().contents)
  1947. def get_current_plugin_count(self):
  1948. return int(self.lib.carla_get_current_plugin_count())
  1949. def get_max_plugin_number(self):
  1950. return int(self.lib.carla_get_max_plugin_number())
  1951. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  1952. cfilename = filename.encode("utf-8") if filename else None
  1953. cname = name.encode("utf-8") if name else None
  1954. clabel = label.encode("utf-8") if label else None
  1955. return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p), options))
  1956. def remove_plugin(self, pluginId):
  1957. return bool(self.lib.carla_remove_plugin(pluginId))
  1958. def remove_all_plugins(self):
  1959. return bool(self.lib.carla_remove_all_plugins())
  1960. def rename_plugin(self, pluginId, newName):
  1961. return charPtrToString(self.lib.carla_rename_plugin(pluginId, newName.encode("utf-8")))
  1962. def clone_plugin(self, pluginId):
  1963. return bool(self.lib.carla_clone_plugin(pluginId))
  1964. def replace_plugin(self, pluginId):
  1965. return bool(self.lib.carla_replace_plugin(pluginId))
  1966. def switch_plugins(self, pluginIdA, pluginIdB):
  1967. return bool(self.lib.carla_switch_plugins(pluginIdA, pluginIdB))
  1968. def load_plugin_state(self, pluginId, filename):
  1969. return bool(self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8")))
  1970. def save_plugin_state(self, pluginId, filename):
  1971. return bool(self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8")))
  1972. def export_plugin_lv2(self, pluginId, lv2path):
  1973. return bool(self.lib.carla_export_plugin_lv2(pluginId, lv2path.encode("utf-8")))
  1974. def get_plugin_info(self, pluginId):
  1975. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  1976. def get_audio_port_count_info(self, pluginId):
  1977. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  1978. def get_midi_port_count_info(self, pluginId):
  1979. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  1980. def get_parameter_count_info(self, pluginId):
  1981. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  1982. def get_parameter_info(self, pluginId, parameterId):
  1983. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  1984. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1985. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  1986. def get_parameter_data(self, pluginId, parameterId):
  1987. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  1988. def get_parameter_ranges(self, pluginId, parameterId):
  1989. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  1990. def get_midi_program_data(self, pluginId, midiProgramId):
  1991. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  1992. def get_custom_data(self, pluginId, customDataId):
  1993. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  1994. def get_custom_data_value(self, pluginId, type_, key):
  1995. return charPtrToString(self.lib.carla_get_custom_data_value(pluginId, type_.encode("utf-8"), key.encode("utf-8")))
  1996. def get_chunk_data(self, pluginId):
  1997. return charPtrToString(self.lib.carla_get_chunk_data(pluginId))
  1998. def get_parameter_count(self, pluginId):
  1999. return int(self.lib.carla_get_parameter_count(pluginId))
  2000. def get_program_count(self, pluginId):
  2001. return int(self.lib.carla_get_program_count(pluginId))
  2002. def get_midi_program_count(self, pluginId):
  2003. return int(self.lib.carla_get_midi_program_count(pluginId))
  2004. def get_custom_data_count(self, pluginId):
  2005. return int(self.lib.carla_get_custom_data_count(pluginId))
  2006. def get_parameter_text(self, pluginId, parameterId):
  2007. return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId))
  2008. def get_program_name(self, pluginId, programId):
  2009. return charPtrToString(self.lib.carla_get_program_name(pluginId, programId))
  2010. def get_midi_program_name(self, pluginId, midiProgramId):
  2011. return charPtrToString(self.lib.carla_get_midi_program_name(pluginId, midiProgramId))
  2012. def get_real_plugin_name(self, pluginId):
  2013. return charPtrToString(self.lib.carla_get_real_plugin_name(pluginId))
  2014. def get_current_program_index(self, pluginId):
  2015. return int(self.lib.carla_get_current_program_index(pluginId))
  2016. def get_current_midi_program_index(self, pluginId):
  2017. return int(self.lib.carla_get_current_midi_program_index(pluginId))
  2018. def get_default_parameter_value(self, pluginId, parameterId):
  2019. return float(self.lib.carla_get_default_parameter_value(pluginId, parameterId))
  2020. def get_current_parameter_value(self, pluginId, parameterId):
  2021. return float(self.lib.carla_get_current_parameter_value(pluginId, parameterId))
  2022. def get_internal_parameter_value(self, pluginId, parameterId):
  2023. return float(self.lib.carla_get_internal_parameter_value(pluginId, parameterId))
  2024. def get_input_peak_value(self, pluginId, isLeft):
  2025. return float(self.lib.carla_get_input_peak_value(pluginId, isLeft))
  2026. def get_output_peak_value(self, pluginId, isLeft):
  2027. return float(self.lib.carla_get_output_peak_value(pluginId, isLeft))
  2028. def render_inline_display(self, pluginId, width, height):
  2029. return structToDict(self.lib.carla_render_inline_display(pluginId, width, height))
  2030. def set_option(self, pluginId, option, yesNo):
  2031. self.lib.carla_set_option(pluginId, option, yesNo)
  2032. def set_active(self, pluginId, onOff):
  2033. self.lib.carla_set_active(pluginId, onOff)
  2034. def set_drywet(self, pluginId, value):
  2035. self.lib.carla_set_drywet(pluginId, value)
  2036. def set_volume(self, pluginId, value):
  2037. self.lib.carla_set_volume(pluginId, value)
  2038. def set_balance_left(self, pluginId, value):
  2039. self.lib.carla_set_balance_left(pluginId, value)
  2040. def set_balance_right(self, pluginId, value):
  2041. self.lib.carla_set_balance_right(pluginId, value)
  2042. def set_panning(self, pluginId, value):
  2043. self.lib.carla_set_panning(pluginId, value)
  2044. def set_ctrl_channel(self, pluginId, channel):
  2045. self.lib.carla_set_ctrl_channel(pluginId, channel)
  2046. def set_parameter_value(self, pluginId, parameterId, value):
  2047. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  2048. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  2049. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  2050. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  2051. self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)
  2052. def set_program(self, pluginId, programId):
  2053. self.lib.carla_set_program(pluginId, programId)
  2054. def set_midi_program(self, pluginId, midiProgramId):
  2055. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  2056. def set_custom_data(self, pluginId, type_, key, value):
  2057. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  2058. def set_chunk_data(self, pluginId, chunkData):
  2059. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  2060. def prepare_for_save(self, pluginId):
  2061. self.lib.carla_prepare_for_save(pluginId)
  2062. def reset_parameters(self, pluginId):
  2063. self.lib.carla_reset_parameters(pluginId)
  2064. def randomize_parameters(self, pluginId):
  2065. self.lib.carla_randomize_parameters(pluginId)
  2066. def send_midi_note(self, pluginId, channel, note, velocity):
  2067. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  2068. def show_custom_ui(self, pluginId, yesNo):
  2069. self.lib.carla_show_custom_ui(pluginId, yesNo)
  2070. def get_buffer_size(self):
  2071. return int(self.lib.carla_get_buffer_size())
  2072. def get_sample_rate(self):
  2073. return float(self.lib.carla_get_sample_rate())
  2074. def get_last_error(self):
  2075. return charPtrToString(self.lib.carla_get_last_error())
  2076. def get_host_osc_url_tcp(self):
  2077. return charPtrToString(self.lib.carla_get_host_osc_url_tcp())
  2078. def get_host_osc_url_udp(self):
  2079. return charPtrToString(self.lib.carla_get_host_osc_url_udp())
  2080. def nsm_init(self, pid, executableName):
  2081. return bool(self.lib.carla_nsm_init(pid, executableName.encode("utf-8")))
  2082. def nsm_ready(self, action):
  2083. self.lib.carla_nsm_ready(action)
  2084. # ------------------------------------------------------------------------------------------------------------
  2085. # Helper object for CarlaHostPlugin
  2086. class PluginStoreInfo(object):
  2087. __slots__ = [
  2088. 'pluginInfo',
  2089. 'pluginRealName',
  2090. 'internalValues',
  2091. 'audioCountInfo',
  2092. 'midiCountInfo',
  2093. 'parameterCount',
  2094. 'parameterCountInfo',
  2095. 'parameterInfo',
  2096. 'parameterData',
  2097. 'parameterRanges',
  2098. 'parameterValues',
  2099. 'programCount',
  2100. 'programCurrent',
  2101. 'programNames',
  2102. 'midiProgramCount',
  2103. 'midiProgramCurrent',
  2104. 'midiProgramData',
  2105. 'customDataCount',
  2106. 'customData',
  2107. 'peaks'
  2108. ]
  2109. # ------------------------------------------------------------------------------------------------------------
  2110. # Carla Host object for plugins (using pipes)
  2111. class CarlaHostPlugin(CarlaHostMeta):
  2112. #class CarlaHostPlugin(CarlaHostMeta, metaclass=ABCMeta):
  2113. def __init__(self):
  2114. CarlaHostMeta.__init__(self)
  2115. # info about this host object
  2116. self.isPlugin = True
  2117. self.processModeForced = True
  2118. # text data to return when requested
  2119. self.fMaxPluginNumber = 0
  2120. self.fLastError = ""
  2121. # plugin info
  2122. self.fPluginsInfo = []
  2123. # transport info
  2124. self.fTransportInfo = {
  2125. "playing": False,
  2126. "frame": 0,
  2127. "bar": 0,
  2128. "beat": 0,
  2129. "tick": 0,
  2130. "bpm": 0.0
  2131. }
  2132. # some other vars
  2133. self.fBufferSize = 0
  2134. self.fSampleRate = 0.0
  2135. self.fOscTCP = ""
  2136. self.fOscUDP = ""
  2137. # --------------------------------------------------------------------------------------------------------
  2138. # Needs to be reimplemented
  2139. @abstractmethod
  2140. def sendMsg(self, lines):
  2141. raise NotImplementedError
  2142. # internal, sets error if sendMsg failed
  2143. def sendMsgAndSetError(self, lines):
  2144. if self.sendMsg(lines):
  2145. return True
  2146. self.fLastError = "Communication error with backend"
  2147. return False
  2148. # --------------------------------------------------------------------------------------------------------
  2149. def get_engine_driver_count(self):
  2150. return 1
  2151. def get_engine_driver_name(self, index):
  2152. return "Plugin"
  2153. def get_engine_driver_device_names(self, index):
  2154. return []
  2155. def get_engine_driver_device_info(self, index, name):
  2156. return PyEngineDriverDeviceInfo
  2157. def set_engine_callback(self, func):
  2158. return # TODO
  2159. def set_engine_option(self, option, value, valueStr):
  2160. self.sendMsg(["set_engine_option", option, int(value), valueStr])
  2161. def set_file_callback(self, func):
  2162. return # TODO
  2163. def load_file(self, filename):
  2164. return self.sendMsgAndSetError(["load_file", filename])
  2165. def load_project(self, filename):
  2166. return self.sendMsgAndSetError(["load_project", filename])
  2167. def save_project(self, filename):
  2168. return self.sendMsgAndSetError(["save_project", filename])
  2169. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  2170. return self.sendMsgAndSetError(["patchbay_connect", groupIdA, portIdA, groupIdB, portIdB])
  2171. def patchbay_disconnect(self, connectionId):
  2172. return self.sendMsgAndSetError(["patchbay_disconnect", connectionId])
  2173. def patchbay_refresh(self, external):
  2174. # don't send external param, never used in plugins
  2175. return self.sendMsgAndSetError(["patchbay_refresh"])
  2176. def transport_play(self):
  2177. self.sendMsg(["transport_play"])
  2178. def transport_pause(self):
  2179. self.sendMsg(["transport_pause"])
  2180. def transport_bpm(self, bpm):
  2181. self.sendMsg(["transport_bpm", bpm])
  2182. def transport_relocate(self, frame):
  2183. self.sendMsg(["transport_relocate"])
  2184. def get_current_transport_frame(self):
  2185. return self.fTransportInfo['frame']
  2186. def get_transport_info(self):
  2187. return self.fTransportInfo
  2188. def get_current_plugin_count(self):
  2189. return len(self.fPluginsInfo)
  2190. def get_max_plugin_number(self):
  2191. return self.fMaxPluginNumber
  2192. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options):
  2193. return self.sendMsgAndSetError(["add_plugin", btype, ptype, filename, name, label, uniqueId, options])
  2194. def remove_plugin(self, pluginId):
  2195. return self.sendMsgAndSetError(["remove_plugin", pluginId])
  2196. def remove_all_plugins(self):
  2197. return self.sendMsgAndSetError(["remove_all_plugins"])
  2198. def rename_plugin(self, pluginId, newName):
  2199. if self.sendMsg(["rename_plugin", pluginId, newName]):
  2200. return newName
  2201. self.fLastError = "Communication error with backend"
  2202. return ""
  2203. def clone_plugin(self, pluginId):
  2204. return self.sendMsgAndSetError(["clone_plugin", pluginId])
  2205. def replace_plugin(self, pluginId):
  2206. return self.sendMsgAndSetError(["replace_plugin", pluginId])
  2207. def switch_plugins(self, pluginIdA, pluginIdB):
  2208. ret = self.sendMsgAndSetError(["switch_plugins", pluginIdA, pluginIdB])
  2209. if ret:
  2210. self._switchPlugins(pluginIdA, pluginIdB)
  2211. return ret
  2212. def load_plugin_state(self, pluginId, filename):
  2213. return self.sendMsgAndSetError(["load_plugin_state", pluginId, filename])
  2214. def save_plugin_state(self, pluginId, filename):
  2215. return self.sendMsgAndSetError(["save_plugin_state", pluginId, filename])
  2216. def export_plugin_lv2(self, pluginId, lv2path):
  2217. self.fLastError = "Operation unavailable in plugin version"
  2218. return False
  2219. def get_plugin_info(self, pluginId):
  2220. return self.fPluginsInfo[pluginId].pluginInfo
  2221. def get_audio_port_count_info(self, pluginId):
  2222. return self.fPluginsInfo[pluginId].audioCountInfo
  2223. def get_midi_port_count_info(self, pluginId):
  2224. return self.fPluginsInfo[pluginId].midiCountInfo
  2225. def get_parameter_count_info(self, pluginId):
  2226. return self.fPluginsInfo[pluginId].parameterCountInfo
  2227. def get_parameter_info(self, pluginId, parameterId):
  2228. return self.fPluginsInfo[pluginId].parameterInfo[parameterId]
  2229. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  2230. return PyCarlaScalePointInfo
  2231. def get_parameter_data(self, pluginId, parameterId):
  2232. return self.fPluginsInfo[pluginId].parameterData[parameterId]
  2233. def get_parameter_ranges(self, pluginId, parameterId):
  2234. return self.fPluginsInfo[pluginId].parameterRanges[parameterId]
  2235. def get_midi_program_data(self, pluginId, midiProgramId):
  2236. return self.fPluginsInfo[pluginId].midiProgramData[midiProgramId]
  2237. def get_custom_data(self, pluginId, customDataId):
  2238. return self.fPluginsInfo[pluginId].customData[customDataId]
  2239. def get_custom_data_value(self, pluginId, type_, key):
  2240. for customData in self.fPluginsInfo[pluginId].customData:
  2241. if customData['type'] == type_ and customData['key'] == key:
  2242. return customData['value']
  2243. return ""
  2244. def get_chunk_data(self, pluginId):
  2245. return ""
  2246. def get_parameter_count(self, pluginId):
  2247. return self.fPluginsInfo[pluginId].parameterCount
  2248. def get_program_count(self, pluginId):
  2249. return self.fPluginsInfo[pluginId].programCount
  2250. def get_midi_program_count(self, pluginId):
  2251. return self.fPluginsInfo[pluginId].midiProgramCount
  2252. def get_custom_data_count(self, pluginId):
  2253. return self.fPluginsInfo[pluginId].customDataCount
  2254. def get_parameter_text(self, pluginId, parameterId):
  2255. return ""
  2256. def get_program_name(self, pluginId, programId):
  2257. return self.fPluginsInfo[pluginId].programNames[programId]
  2258. def get_midi_program_name(self, pluginId, midiProgramId):
  2259. return self.fPluginsInfo[pluginId].midiProgramData[midiProgramId]['label']
  2260. def get_real_plugin_name(self, pluginId):
  2261. return self.fPluginsInfo[pluginId].pluginRealName
  2262. def get_current_program_index(self, pluginId):
  2263. return self.fPluginsInfo[pluginId].programCurrent
  2264. def get_current_midi_program_index(self, pluginId):
  2265. return self.fPluginsInfo[pluginId].midiProgramCurrent
  2266. def get_default_parameter_value(self, pluginId, parameterId):
  2267. return self.fPluginsInfo[pluginId].parameterRanges[parameterId]['def']
  2268. def get_current_parameter_value(self, pluginId, parameterId):
  2269. return self.fPluginsInfo[pluginId].parameterValues[parameterId]
  2270. def get_internal_parameter_value(self, pluginId, parameterId):
  2271. if parameterId == PARAMETER_NULL or parameterId <= PARAMETER_MAX:
  2272. return 0.0
  2273. if parameterId < 0:
  2274. return self.fPluginsInfo[pluginId].internalValues[abs(parameterId)-2]
  2275. return self.fPluginsInfo[pluginId].parameterValues[parameterId]
  2276. def get_input_peak_value(self, pluginId, isLeft):
  2277. return self.fPluginsInfo[pluginId].peaks[0 if isLeft else 1]
  2278. def get_output_peak_value(self, pluginId, isLeft):
  2279. return self.fPluginsInfo[pluginId].peaks[2 if isLeft else 3]
  2280. def render_inline_display(self, pluginId, width, height):
  2281. return None
  2282. def set_option(self, pluginId, option, yesNo):
  2283. self.sendMsg(["set_option", pluginId, option, yesNo])
  2284. def set_active(self, pluginId, onOff):
  2285. self.sendMsg(["set_active", pluginId, onOff])
  2286. self.fPluginsInfo[pluginId].internalValues[0] = 1.0 if onOff else 0.0
  2287. def set_drywet(self, pluginId, value):
  2288. self.sendMsg(["set_drywet", pluginId, value])
  2289. self.fPluginsInfo[pluginId].internalValues[1] = value
  2290. def set_volume(self, pluginId, value):
  2291. self.sendMsg(["set_volume", pluginId, value])
  2292. self.fPluginsInfo[pluginId].internalValues[2] = value
  2293. def set_balance_left(self, pluginId, value):
  2294. self.sendMsg(["set_balance_left", pluginId, value])
  2295. self.fPluginsInfo[pluginId].internalValues[3] = value
  2296. def set_balance_right(self, pluginId, value):
  2297. self.sendMsg(["set_balance_right", pluginId, value])
  2298. self.fPluginsInfo[pluginId].internalValues[4] = value
  2299. def set_panning(self, pluginId, value):
  2300. self.sendMsg(["set_panning", pluginId, value])
  2301. self.fPluginsInfo[pluginId].internalValues[5] = value
  2302. def set_ctrl_channel(self, pluginId, channel):
  2303. self.sendMsg(["set_ctrl_channel", pluginId, channel])
  2304. self.fPluginsInfo[pluginId].internalValues[6] = float(channel)
  2305. def set_parameter_value(self, pluginId, parameterId, value):
  2306. self.sendMsg(["set_parameter_value", pluginId, parameterId, value])
  2307. self.fPluginsInfo[pluginId].parameterValues[parameterId] = value
  2308. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  2309. self.sendMsg(["set_parameter_midi_channel", pluginId, parameterId, channel])
  2310. self.fPluginsInfo[pluginId].parameterData[parameterId]['midiCC'] = channel
  2311. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  2312. self.sendMsg(["set_parameter_midi_cc", pluginId, parameterId, cc])
  2313. self.fPluginsInfo[pluginId].parameterData[parameterId]['midiCC'] = cc
  2314. def set_program(self, pluginId, programId):
  2315. self.sendMsg(["set_program", pluginId, programId])
  2316. self.fPluginsInfo[pluginId].programCurrent = programId
  2317. def set_midi_program(self, pluginId, midiProgramId):
  2318. self.sendMsg(["set_midi_program", pluginId, midiProgramId])
  2319. self.fPluginsInfo[pluginId].midiProgramCurrent = midiProgramId
  2320. def set_custom_data(self, pluginId, type_, key, value):
  2321. self.sendMsg(["set_custom_data", pluginId, type_, key, value])
  2322. for cdata in self.fPluginsInfo[pluginId].customData:
  2323. if cdata['type'] != type_:
  2324. continue
  2325. if cdata['key'] != key:
  2326. continue
  2327. cdata['value'] = value
  2328. break
  2329. def set_chunk_data(self, pluginId, chunkData):
  2330. self.sendMsg(["set_chunk_data", pluginId, chunkData])
  2331. def prepare_for_save(self, pluginId):
  2332. self.sendMsg(["prepare_for_save", pluginId])
  2333. def reset_parameters(self, pluginId):
  2334. self.sendMsg(["reset_parameters", pluginId])
  2335. def randomize_parameters(self, pluginId):
  2336. self.sendMsg(["randomize_parameters", pluginId])
  2337. def send_midi_note(self, pluginId, channel, note, velocity):
  2338. self.sendMsg(["send_midi_note", pluginId, channel, note, velocity])
  2339. def show_custom_ui(self, pluginId, yesNo):
  2340. self.sendMsg(["show_custom_ui", pluginId, yesNo])
  2341. def get_buffer_size(self):
  2342. return self.fBufferSize
  2343. def get_sample_rate(self):
  2344. return self.fSampleRate
  2345. def get_last_error(self):
  2346. return self.fLastError
  2347. def get_host_osc_url_tcp(self):
  2348. return self.fOscTCP
  2349. def get_host_osc_url_udp(self):
  2350. return self.fOscUDP
  2351. # --------------------------------------------------------------------------------------------------------
  2352. def _set_transport(self, playing, frame, bar, beat, tick, bpm):
  2353. self.fTransportInfo = {
  2354. "playing": playing,
  2355. "frame": frame,
  2356. "bar": bar,
  2357. "beat": beat,
  2358. "tick": tick,
  2359. "bpm": bpm
  2360. }
  2361. def _add(self, pluginId):
  2362. if len(self.fPluginsInfo) != pluginId:
  2363. self._reset_info(self.fPluginsInfo[pluginId])
  2364. return
  2365. info = PluginStoreInfo()
  2366. self._reset_info(info)
  2367. self.fPluginsInfo.append(info)
  2368. def _reset_info(self, info):
  2369. info.pluginInfo = PyCarlaPluginInfo.copy()
  2370. info.pluginRealName = ""
  2371. info.internalValues = [0.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0]
  2372. info.audioCountInfo = PyCarlaPortCountInfo.copy()
  2373. info.midiCountInfo = PyCarlaPortCountInfo.copy()
  2374. info.parameterCount = 0
  2375. info.parameterCountInfo = PyCarlaPortCountInfo.copy()
  2376. info.parameterInfo = []
  2377. info.parameterData = []
  2378. info.parameterRanges = []
  2379. info.parameterValues = []
  2380. info.programCount = 0
  2381. info.programCurrent = -1
  2382. info.programNames = []
  2383. info.midiProgramCount = 0
  2384. info.midiProgramCurrent = -1
  2385. info.midiProgramData = []
  2386. info.customDataCount = 0
  2387. info.customData = []
  2388. info.peaks = [0.0, 0.0, 0.0, 0.0]
  2389. def _set_pluginInfo(self, pluginId, info):
  2390. self.fPluginsInfo[pluginId].pluginInfo = info
  2391. def _set_pluginInfoUpdate(self, pluginId, info):
  2392. self.fPluginsInfo[pluginId].pluginInfo.update(info)
  2393. def _set_pluginName(self, pluginId, name):
  2394. self.fPluginsInfo[pluginId].pluginInfo['name'] = name
  2395. def _set_pluginRealName(self, pluginId, realName):
  2396. self.fPluginsInfo[pluginId].pluginRealName = realName
  2397. def _set_internalValue(self, pluginId, paramIndex, value):
  2398. if pluginId < len(self.fPluginsInfo) and PARAMETER_NULL > paramIndex > PARAMETER_MAX:
  2399. self.fPluginsInfo[pluginId].internalValues[abs(paramIndex)-2] = float(value)
  2400. def _set_audioCountInfo(self, pluginId, info):
  2401. self.fPluginsInfo[pluginId].audioCountInfo = info
  2402. def _set_midiCountInfo(self, pluginId, info):
  2403. self.fPluginsInfo[pluginId].midiCountInfo = info
  2404. def _set_parameterCountInfo(self, pluginId, count, info):
  2405. self.fPluginsInfo[pluginId].parameterCount = count
  2406. self.fPluginsInfo[pluginId].parameterCountInfo = info
  2407. # clear
  2408. self.fPluginsInfo[pluginId].parameterInfo = []
  2409. self.fPluginsInfo[pluginId].parameterData = []
  2410. self.fPluginsInfo[pluginId].parameterRanges = []
  2411. self.fPluginsInfo[pluginId].parameterValues = []
  2412. # add placeholders
  2413. for x in range(count):
  2414. self.fPluginsInfo[pluginId].parameterInfo.append(PyCarlaParameterInfo.copy())
  2415. self.fPluginsInfo[pluginId].parameterData.append(PyParameterData.copy())
  2416. self.fPluginsInfo[pluginId].parameterRanges.append(PyParameterRanges.copy())
  2417. self.fPluginsInfo[pluginId].parameterValues.append(0.0)
  2418. def _set_programCount(self, pluginId, count):
  2419. self.fPluginsInfo[pluginId].programCount = count
  2420. # clear
  2421. self.fPluginsInfo[pluginId].programNames = []
  2422. # add placeholders
  2423. for x in range(count):
  2424. self.fPluginsInfo[pluginId].programNames.append("")
  2425. def _set_midiProgramCount(self, pluginId, count):
  2426. self.fPluginsInfo[pluginId].midiProgramCount = count
  2427. # clear
  2428. self.fPluginsInfo[pluginId].midiProgramData = []
  2429. # add placeholders
  2430. for x in range(count):
  2431. self.fPluginsInfo[pluginId].midiProgramData.append(PyMidiProgramData.copy())
  2432. def _set_customDataCount(self, pluginId, count):
  2433. self.fPluginsInfo[pluginId].customDataCount = count
  2434. # clear
  2435. self.fPluginsInfo[pluginId].customData = []
  2436. # add placeholders
  2437. for x in range(count):
  2438. self.fPluginsInfo[pluginId].customData.append(PyCustomData)
  2439. def _set_parameterInfo(self, pluginId, paramIndex, info):
  2440. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2441. self.fPluginsInfo[pluginId].parameterInfo[paramIndex] = info
  2442. def _set_parameterData(self, pluginId, paramIndex, data):
  2443. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2444. self.fPluginsInfo[pluginId].parameterData[paramIndex] = data
  2445. def _set_parameterRanges(self, pluginId, paramIndex, ranges):
  2446. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2447. self.fPluginsInfo[pluginId].parameterRanges[paramIndex] = ranges
  2448. def _set_parameterRangesUpdate(self, pluginId, paramIndex, ranges):
  2449. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2450. self.fPluginsInfo[pluginId].parameterRanges[paramIndex].update(ranges)
  2451. def _set_parameterValue(self, pluginId, paramIndex, value):
  2452. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2453. self.fPluginsInfo[pluginId].parameterValues[paramIndex] = value
  2454. def _set_parameterDefault(self, pluginId, paramIndex, value):
  2455. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2456. self.fPluginsInfo[pluginId].parameterRanges[paramIndex]['def'] = value
  2457. def _set_parameterMidiChannel(self, pluginId, paramIndex, channel):
  2458. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2459. self.fPluginsInfo[pluginId].parameterData[paramIndex]['midiChannel'] = channel
  2460. def _set_parameterMidiCC(self, pluginId, paramIndex, cc):
  2461. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2462. self.fPluginsInfo[pluginId].parameterData[paramIndex]['midiCC'] = cc
  2463. def _set_currentProgram(self, pluginId, pIndex):
  2464. self.fPluginsInfo[pluginId].programCurrent = pIndex
  2465. def _set_currentMidiProgram(self, pluginId, mpIndex):
  2466. self.fPluginsInfo[pluginId].midiProgramCurrent = mpIndex
  2467. def _set_programName(self, pluginId, pIndex, name):
  2468. if pIndex < self.fPluginsInfo[pluginId].programCount:
  2469. self.fPluginsInfo[pluginId].programNames[pIndex] = name
  2470. def _set_midiProgramData(self, pluginId, mpIndex, data):
  2471. if mpIndex < self.fPluginsInfo[pluginId].midiProgramCount:
  2472. self.fPluginsInfo[pluginId].midiProgramData[mpIndex] = data
  2473. def _set_customData(self, pluginId, cdIndex, data):
  2474. if cdIndex < self.fPluginsInfo[pluginId].customDataCount:
  2475. self.fPluginsInfo[pluginId].customData[cdIndex] = data
  2476. def _set_peaks(self, pluginId, in1, in2, out1, out2):
  2477. self.fPluginsInfo[pluginId].peaks = [in1, in2, out1, out2]
  2478. def _switchPlugins(self, pluginIdA, pluginIdB):
  2479. tmp = self.fPluginsInfo[pluginIdA]
  2480. self.fPluginsInfo[pluginIdA] = self.fPluginsInfo[pluginIdB]
  2481. self.fPluginsInfo[pluginIdB] = tmp
  2482. # ------------------------------------------------------------------------------------------------------------