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

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