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

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