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