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

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