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