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

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