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

11 years ago
10 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
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
10 years ago
10 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
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
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
10 years ago
11 years ago
10 years ago
11 years ago
10 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
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
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
11 years ago
11 years ago
10 years ago
11 years ago
10 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
10 years ago
10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla Backend code
  4. # Copyright (C) 2011-2014 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 (Config)
  19. from carla_config import *
  20. # ------------------------------------------------------------------------------------------------------------
  21. # Imports (Global)
  22. from abc import ABCMeta, abstractmethod
  23. from ctypes import *
  24. from os import environ
  25. from platform import architecture
  26. from sys import platform, maxsize
  27. if config_UseQt5:
  28. from PyQt5.QtCore import pyqtSignal, pyqtWrapperType, QObject
  29. else:
  30. from PyQt4.QtCore import pyqtSignal, pyqtWrapperType, QObject
  31. # ------------------------------------------------------------------------------------------------------------
  32. # 64bit check
  33. kIs64bit = bool(architecture()[0] == "64bit" and maxsize > 2**32)
  34. # ------------------------------------------------------------------------------------------------------------
  35. # Define custom types
  36. c_enum = c_int
  37. c_uintptr = c_uint64 if kIs64bit else c_uint32
  38. # ------------------------------------------------------------------------------------------------------------
  39. # Set Platform
  40. if platform == "darwin":
  41. HAIKU = False
  42. LINUX = False
  43. MACOS = True
  44. WINDOWS = False
  45. elif "haiku" in platform:
  46. HAIKU = True
  47. LINUX = False
  48. MACOS = False
  49. WINDOWS = False
  50. elif "linux" in platform:
  51. HAIKU = False
  52. LINUX = True
  53. MACOS = False
  54. WINDOWS = False
  55. elif platform in ("win32", "win64", "cygwin"):
  56. HAIKU = False
  57. LINUX = False
  58. MACOS = False
  59. WINDOWS = True
  60. else:
  61. HAIKU = False
  62. LINUX = False
  63. MACOS = False
  64. WINDOWS = False
  65. # ------------------------------------------------------------------------------------------------------------
  66. # Convert a ctypes c_char_p into a python string
  67. def charPtrToString(charPtr):
  68. if not charPtr:
  69. return ""
  70. if isinstance(charPtr, str):
  71. return charPtr
  72. return charPtr.decode("utf-8", errors="ignore")
  73. # ------------------------------------------------------------------------------------------------------------
  74. # Convert a ctypes POINTER(c_char_p) into a python string list
  75. def charPtrPtrToStringList(charPtrPtr):
  76. if not charPtrPtr:
  77. return []
  78. i = 0
  79. charPtr = charPtrPtr[0]
  80. strList = []
  81. while charPtr:
  82. strList.append(charPtr.decode("utf-8", errors="ignore"))
  83. i += 1
  84. charPtr = charPtrPtr[i]
  85. return strList
  86. # ------------------------------------------------------------------------------------------------------------
  87. # Convert a ctypes POINTER(c_<num>) into a python number list
  88. def numPtrToList(numPtr):
  89. if not numPtr:
  90. return []
  91. i = 0
  92. num = numPtr[0] #.value
  93. numList = []
  94. while num not in (0, 0.0):
  95. numList.append(num)
  96. i += 1
  97. num = numPtr[i] #.value
  98. return numList
  99. # ------------------------------------------------------------------------------------------------------------
  100. # Convert a ctypes value into a python one
  101. c_int_types = (c_int, c_int8, c_int16, c_int32, c_int64, c_uint, c_uint8, c_uint16, c_uint32, c_uint64, c_long, c_longlong)
  102. c_float_types = (c_float, c_double, c_longdouble)
  103. c_intp_types = tuple(POINTER(i) for i in c_int_types)
  104. c_floatp_types = tuple(POINTER(i) for i in c_float_types)
  105. def toPythonType(value, attr):
  106. if isinstance(value, (bool, int, float)):
  107. return value
  108. if isinstance(value, bytes):
  109. return charPtrToString(value)
  110. if isinstance(value, c_intp_types) or isinstance(value, c_floatp_types):
  111. return numPtrToList(value)
  112. if isinstance(value, POINTER(c_char_p)):
  113. return charPtrPtrToStringList(value)
  114. print("..............", attr, ".....................", value, ":", type(value))
  115. return value
  116. # ------------------------------------------------------------------------------------------------------------
  117. # Convert a ctypes struct into a python dict
  118. def structToDict(struct):
  119. return dict((attr, toPythonType(getattr(struct, attr), attr)) for attr, value in struct._fields_)
  120. # ------------------------------------------------------------------------------------------------------------
  121. # Carla Backend API (base definitions)
  122. # Maximum default number of loadable plugins.
  123. MAX_DEFAULT_PLUGINS = 99
  124. # Maximum number of loadable plugins in rack mode.
  125. MAX_RACK_PLUGINS = 16
  126. # Maximum number of loadable plugins in patchbay mode.
  127. MAX_PATCHBAY_PLUGINS = 255
  128. # Maximum default number of parameters allowed.
  129. # @see ENGINE_OPTION_MAX_PARAMETERS
  130. MAX_DEFAULT_PARAMETERS = 200
  131. # ------------------------------------------------------------------------------------------------------------
  132. # Engine Driver Device Hints
  133. # Various engine driver device hints.
  134. # @see carla_get_engine_driver_device_info()
  135. # Engine driver device has custom control-panel.
  136. ENGINE_DRIVER_DEVICE_HAS_CONTROL_PANEL = 0x1
  137. # Engine driver device can use a triple-buffer (3 number of periods instead of the usual 2).
  138. # @see ENGINE_OPTION_AUDIO_NUM_PERIODS
  139. ENGINE_DRIVER_DEVICE_CAN_TRIPLE_BUFFER = 0x2
  140. # Engine driver device can change buffer-size on the fly.
  141. # @see ENGINE_OPTION_AUDIO_BUFFER_SIZE
  142. ENGINE_DRIVER_DEVICE_VARIABLE_BUFFER_SIZE = 0x4
  143. # Engine driver device can change sample-rate on the fly.
  144. # @see ENGINE_OPTION_AUDIO_SAMPLE_RATE
  145. ENGINE_DRIVER_DEVICE_VARIABLE_SAMPLE_RATE = 0x8
  146. # ------------------------------------------------------------------------------------------------------------
  147. # Plugin Hints
  148. # Various plugin hints.
  149. # @see carla_get_plugin_info()
  150. # Plugin is a bridge.
  151. # This hint is required because "bridge" itself is not a plugin type.
  152. PLUGIN_IS_BRIDGE = 0x001
  153. # Plugin is hard real-time safe.
  154. PLUGIN_IS_RTSAFE = 0x002
  155. # Plugin is a synth (produces sound).
  156. PLUGIN_IS_SYNTH = 0x004
  157. # Plugin has its own custom UI.
  158. # @see carla_show_custom_ui()
  159. PLUGIN_HAS_CUSTOM_UI = 0x008
  160. # Plugin can use internal Dry/Wet control.
  161. PLUGIN_CAN_DRYWET = 0x010
  162. # Plugin can use internal Volume control.
  163. PLUGIN_CAN_VOLUME = 0x020
  164. # Plugin can use internal (Stereo) Balance controls.
  165. PLUGIN_CAN_BALANCE = 0x040
  166. # Plugin can use internal (Mono) Panning control.
  167. PLUGIN_CAN_PANNING = 0x080
  168. # Plugin needs a constant, fixed-size audio buffer.
  169. PLUGIN_NEEDS_FIXED_BUFFERS = 0x100
  170. # Plugin needs all UI events in a single/main thread.
  171. PLUGIN_NEEDS_SINGLE_THREAD = 0x200
  172. # ------------------------------------------------------------------------------------------------------------
  173. # Plugin Options
  174. # Various plugin options.
  175. # @see carla_get_plugin_info() and carla_set_option()
  176. # Use constant/fixed-size audio buffers.
  177. PLUGIN_OPTION_FIXED_BUFFERS = 0x001
  178. # Force mono plugin as stereo.
  179. PLUGIN_OPTION_FORCE_STEREO = 0x002
  180. # Map MIDI programs to plugin programs.
  181. PLUGIN_OPTION_MAP_PROGRAM_CHANGES = 0x004
  182. # Use chunks to save and restore data instead of parameter values.
  183. PLUGIN_OPTION_USE_CHUNKS = 0x008
  184. # Send MIDI control change events.
  185. PLUGIN_OPTION_SEND_CONTROL_CHANGES = 0x010
  186. # Send MIDI channel pressure events.
  187. PLUGIN_OPTION_SEND_CHANNEL_PRESSURE = 0x020
  188. # Send MIDI note after-touch events.
  189. PLUGIN_OPTION_SEND_NOTE_AFTERTOUCH = 0x040
  190. # Send MIDI pitch-bend events.
  191. PLUGIN_OPTION_SEND_PITCHBEND = 0x080
  192. # Send MIDI all-sounds/notes-off events, single note-offs otherwise.
  193. PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100
  194. # Send MIDI bank/program changes.
  195. # @note: This option conflicts with PLUGIN_OPTION_MAP_PROGRAM_CHANGES and cannot be used at the same time.
  196. PLUGIN_OPTION_SEND_PROGRAM_CHANGES = 0x200
  197. # ------------------------------------------------------------------------------------------------------------
  198. # Parameter Hints
  199. # Various parameter hints.
  200. # @see CarlaPlugin::getParameterData() and carla_get_parameter_data()
  201. # Parameter value is boolean.
  202. PARAMETER_IS_BOOLEAN = 0x001
  203. # Parameter value is integer.
  204. PARAMETER_IS_INTEGER = 0x002
  205. # Parameter value is logarithmic.
  206. PARAMETER_IS_LOGARITHMIC = 0x004
  207. # Parameter is enabled.
  208. # It can be viewed, changed and stored.
  209. PARAMETER_IS_ENABLED = 0x010
  210. # Parameter is automable (real-time safe).
  211. PARAMETER_IS_AUTOMABLE = 0x020
  212. # Parameter is read-only.
  213. # It cannot be changed.
  214. PARAMETER_IS_READ_ONLY = 0x040
  215. # Parameter needs sample rate to work.
  216. # Value and ranges are multiplied by sample rate on usage and divided by sample rate on save.
  217. PARAMETER_USES_SAMPLERATE = 0x100
  218. # Parameter uses scale points to define internal values in a meaningful way.
  219. PARAMETER_USES_SCALEPOINTS = 0x200
  220. # Parameter uses custom text for displaying its value.
  221. # @see carla_get_parameter_text()
  222. PARAMETER_USES_CUSTOM_TEXT = 0x400
  223. # ------------------------------------------------------------------------------------------------------------
  224. # Patchbay Port Hints
  225. # Various patchbay port hints.
  226. # Patchbay port is input.
  227. # When this hint is not set, port is assumed to be output.
  228. PATCHBAY_PORT_IS_INPUT = 0x1
  229. # Patchbay port is of Audio type.
  230. PATCHBAY_PORT_TYPE_AUDIO = 0x2
  231. # Patchbay port is of CV type (Control Voltage).
  232. PATCHBAY_PORT_TYPE_CV = 0x4
  233. # Patchbay port is of MIDI type.
  234. PATCHBAY_PORT_TYPE_MIDI = 0x8
  235. # ------------------------------------------------------------------------------------------------------------
  236. # Custom Data Types
  237. # These types define how the value in the CustomData struct is stored.
  238. # @see CustomData.type
  239. # Boolean string type URI.
  240. # Only "true" and "false" are valid values.
  241. CUSTOM_DATA_TYPE_BOOLEAN = "http://kxstudio.sf.net/ns/carla/boolean"
  242. # Chunk type URI.
  243. CUSTOM_DATA_TYPE_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"
  244. # String type URI.
  245. CUSTOM_DATA_TYPE_STRING = "http://kxstudio.sf.net/ns/carla/string"
  246. # ------------------------------------------------------------------------------------------------------------
  247. # Custom Data Keys
  248. # Pre-defined keys used internally in Carla.
  249. # @see CustomData.key
  250. # Plugin options key.
  251. CUSTOM_DATA_KEY_PLUGIN_OPTIONS = "CarlaPluginOptions"
  252. # UI position key.
  253. CUSTOM_DATA_KEY_UI_POSITION = "CarlaUiPosition"
  254. # UI size key.
  255. CUSTOM_DATA_KEY_UI_SIZE = "CarlaUiSize"
  256. # UI visible key.
  257. CUSTOM_DATA_KEY_UI_VISIBLE = "CarlaUiVisible"
  258. # ------------------------------------------------------------------------------------------------------------
  259. # Binary Type
  260. # The binary type of a plugin.
  261. # Null binary type.
  262. BINARY_NONE = 0
  263. # POSIX 32bit binary.
  264. BINARY_POSIX32 = 1
  265. # POSIX 64bit binary.
  266. BINARY_POSIX64 = 2
  267. # Windows 32bit binary.
  268. BINARY_WIN32 = 3
  269. # Windows 64bit binary.
  270. BINARY_WIN64 = 4
  271. # Other binary type.
  272. BINARY_OTHER = 5
  273. # ------------------------------------------------------------------------------------------------------------
  274. # Plugin Type
  275. # Plugin type.
  276. # Some files are handled as if they were plugins.
  277. # Null plugin type.
  278. PLUGIN_NONE = 0
  279. # Internal plugin.
  280. PLUGIN_INTERNAL = 1
  281. # LADSPA plugin.
  282. PLUGIN_LADSPA = 2
  283. # DSSI plugin.
  284. PLUGIN_DSSI = 3
  285. # LV2 plugin.
  286. PLUGIN_LV2 = 4
  287. # VST plugin.
  288. PLUGIN_VST = 5
  289. # VST3 plugin.
  290. PLUGIN_VST3 = 6
  291. # AU plugin.
  292. # @note MacOS only
  293. PLUGIN_AU = 7
  294. # GIG file.
  295. PLUGIN_GIG = 8
  296. # SF2 file (SoundFont).
  297. PLUGIN_SF2 = 9
  298. # SFZ file.
  299. PLUGIN_SFZ = 10
  300. # ------------------------------------------------------------------------------------------------------------
  301. # Plugin Category
  302. # Plugin category, which describes the functionality of a plugin.
  303. # Null plugin category.
  304. PLUGIN_CATEGORY_NONE = 0
  305. # A synthesizer or generator.
  306. PLUGIN_CATEGORY_SYNTH = 1
  307. # A delay or reverb.
  308. PLUGIN_CATEGORY_DELAY = 2
  309. # An equalizer.
  310. PLUGIN_CATEGORY_EQ = 3
  311. # A filter.
  312. PLUGIN_CATEGORY_FILTER = 4
  313. # A distortion plugin.
  314. PLUGIN_CATEGORY_DISTORTION = 5
  315. # A 'dynamic' plugin (amplifier, compressor, gate, etc).
  316. PLUGIN_CATEGORY_DYNAMICS = 6
  317. # A 'modulator' plugin (chorus, flanger, phaser, etc).
  318. PLUGIN_CATEGORY_MODULATOR = 7
  319. # An 'utility' plugin (analyzer, converter, mixer, etc).
  320. PLUGIN_CATEGORY_UTILITY = 8
  321. # Miscellaneous plugin (used to check if the plugin has a category).
  322. PLUGIN_CATEGORY_OTHER = 9
  323. # ------------------------------------------------------------------------------------------------------------
  324. # Parameter Type
  325. # Plugin parameter type.
  326. # Null parameter type.
  327. PARAMETER_UNKNOWN = 0
  328. # Input parameter.
  329. PARAMETER_INPUT = 1
  330. # Ouput parameter.
  331. PARAMETER_OUTPUT = 2
  332. # ------------------------------------------------------------------------------------------------------------
  333. # Internal Parameter Index
  334. # Special parameters used internally in Carla.
  335. # Plugins do not know about their existence.
  336. # Null parameter.
  337. PARAMETER_NULL = -1
  338. # Active parameter, boolean type.
  339. # Default is 'false'.
  340. PARAMETER_ACTIVE = -2
  341. # Dry/Wet parameter.
  342. # Range 0.0...1.0; default is 1.0.
  343. PARAMETER_DRYWET = -3
  344. # Volume parameter.
  345. # Range 0.0...1.27; default is 1.0.
  346. PARAMETER_VOLUME = -4
  347. # Stereo Balance-Left parameter.
  348. # Range -1.0...1.0; default is -1.0.
  349. PARAMETER_BALANCE_LEFT = -5
  350. # Stereo Balance-Right parameter.
  351. # Range -1.0...1.0; default is 1.0.
  352. PARAMETER_BALANCE_RIGHT = -6
  353. # Mono Panning parameter.
  354. # Range -1.0...1.0; default is 0.0.
  355. PARAMETER_PANNING = -7
  356. # MIDI Control channel, integer type.
  357. # Range -1...15 (-1 = off).
  358. PARAMETER_CTRL_CHANNEL = -8
  359. # Max value, defined only for convenience.
  360. PARAMETER_MAX = -9
  361. # ------------------------------------------------------------------------------------------------------------
  362. # Engine Callback Opcode
  363. # Engine callback opcodes.
  364. # Front-ends must never block indefinitely during a callback.
  365. # @see EngineCallbackFunc and carla_set_engine_callback()
  366. # Debug.
  367. # This opcode is undefined and used only for testing purposes.
  368. ENGINE_CALLBACK_DEBUG = 0
  369. # A plugin has been added.
  370. # @a pluginId Plugin Id
  371. # @a valueStr Plugin name
  372. ENGINE_CALLBACK_PLUGIN_ADDED = 1
  373. # A plugin has been removed.
  374. # @a pluginId Plugin Id
  375. ENGINE_CALLBACK_PLUGIN_REMOVED = 2
  376. # A plugin has been renamed.
  377. # @a pluginId Plugin Id
  378. # @a valueStr New plugin name
  379. ENGINE_CALLBACK_PLUGIN_RENAMED = 3
  380. # A plugin has become unavailable.
  381. # @a pluginId Plugin Id
  382. # @a valueStr Related error string
  383. ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4
  384. # A parameter value has changed.
  385. # @a pluginId Plugin Id
  386. # @a value1 Parameter index
  387. # @a value3 New parameter value
  388. ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5
  389. # A parameter default has changed.
  390. # @a pluginId Plugin Id
  391. # @a value1 Parameter index
  392. # @a value3 New default value
  393. ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6
  394. # A parameter's MIDI CC has changed.
  395. # @a pluginId Plugin Id
  396. # @a value1 Parameter index
  397. # @a value2 New MIDI CC
  398. ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED = 7
  399. # A parameter's MIDI channel has changed.
  400. # @a pluginId Plugin Id
  401. # @a value1 Parameter index
  402. # @a value2 New MIDI channel
  403. ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 8
  404. # A plugin option has changed.
  405. # @a pluginId Plugin Id
  406. # @a value1 Option
  407. # @a value2 New on/off state (1 for on, 0 for off)
  408. # @see PluginOptions
  409. ENGINE_CALLBACK_OPTION_CHANGED = 9
  410. # The current program of a plugin has changed.
  411. # @a pluginId Plugin Id
  412. # @a value1 New program index
  413. ENGINE_CALLBACK_PROGRAM_CHANGED = 10
  414. # The current MIDI program of a plugin has changed.
  415. # @a pluginId Plugin Id
  416. # @a value1 New MIDI program index
  417. ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED = 11
  418. # A plugin's custom UI state has changed.
  419. # @a pluginId Plugin Id
  420. # @a value1 New state, as follows:
  421. # 0: UI is now hidden
  422. # 1: UI is now visible
  423. # -1: UI has crashed and should not be shown again
  424. ENGINE_CALLBACK_UI_STATE_CHANGED = 12
  425. # A note has been pressed.
  426. # @a pluginId Plugin Id
  427. # @a value1 Channel
  428. # @a value2 Note
  429. # @a value3 Velocity
  430. ENGINE_CALLBACK_NOTE_ON = 13
  431. # A note has been released.
  432. # @a pluginId Plugin Id
  433. # @a value1 Channel
  434. # @a value2 Note
  435. ENGINE_CALLBACK_NOTE_OFF = 14
  436. # A plugin needs update.
  437. # @a pluginId Plugin Id
  438. ENGINE_CALLBACK_UPDATE = 15
  439. # A plugin's data/information has changed.
  440. # @a pluginId Plugin Id
  441. ENGINE_CALLBACK_RELOAD_INFO = 16
  442. # A plugin's parameters have changed.
  443. # @a pluginId Plugin Id
  444. ENGINE_CALLBACK_RELOAD_PARAMETERS = 17
  445. # A plugin's programs have changed.
  446. # @a pluginId Plugin Id
  447. ENGINE_CALLBACK_RELOAD_PROGRAMS = 18
  448. # A plugin state has changed.
  449. # @a pluginId Plugin Id
  450. ENGINE_CALLBACK_RELOAD_ALL = 19
  451. # A patchbay client has been added.
  452. # @a pluginId Client Id
  453. # @a value1 Client icon
  454. # @a value2 Plugin Id (-1 if not a plugin)
  455. # @a valueStr Client name
  456. # @see PatchbayIcon
  457. ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED = 20
  458. # A patchbay client has been removed.
  459. # @a pluginId Client Id
  460. ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED = 21
  461. # A patchbay client has been renamed.
  462. # @a pluginId Client Id
  463. # @a valueStr New client name
  464. ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED = 22
  465. # A patchbay client data has changed.
  466. # @a pluginId Client Id
  467. # @a value1 New icon
  468. # @a value2 New plugin Id (-1 if not a plugin)
  469. # @see PatchbayIcon
  470. ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED = 23
  471. # A patchbay port has been added.
  472. # @a pluginId Client Id
  473. # @a value1 Port Id
  474. # @a value2 Port hints
  475. # @a valueStr Port name
  476. # @see PatchbayPortHints
  477. ENGINE_CALLBACK_PATCHBAY_PORT_ADDED = 24
  478. # A patchbay port has been removed.
  479. # @a pluginId Client Id
  480. # @a value1 Port Id
  481. ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED = 25
  482. # A patchbay port has been renamed.
  483. # @a pluginId Client Id
  484. # @a value1 Port Id
  485. # @a valueStr New port name
  486. ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED = 26
  487. # A patchbay connection has been added.
  488. # @a pluginId Connection Id
  489. # @a valueStr Out group, port plus in group and port, in "og:op:ig:ip" syntax.
  490. ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED = 27
  491. # A patchbay connection has been removed.
  492. # @a pluginId Connection Id
  493. ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28
  494. # Engine started.
  495. # @a value1 Process mode
  496. # @a value2 Transport mode
  497. # @a valuestr Engine driver
  498. # @see EngineProcessMode
  499. # @see EngineTransportMode
  500. ENGINE_CALLBACK_ENGINE_STARTED = 29
  501. # Engine stopped.
  502. ENGINE_CALLBACK_ENGINE_STOPPED = 30
  503. # Engine process mode has changed.
  504. # @a value1 New process mode
  505. # @see EngineProcessMode
  506. ENGINE_CALLBACK_PROCESS_MODE_CHANGED = 31
  507. # Engine transport mode has changed.
  508. # @a value1 New transport mode
  509. # @see EngineTransportMode
  510. ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32
  511. # Engine buffer-size changed.
  512. # @a value1 New buffer size
  513. ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33
  514. # Engine sample-rate changed.
  515. # @a value3 New sample rate
  516. ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34
  517. # Idle frontend.
  518. # This is used by the engine during long operations that might block the frontend,
  519. # giving it the possibility to idle while the operation is still in place.
  520. ENGINE_CALLBACK_IDLE = 35
  521. # Show a message as information.
  522. # @a valueStr The message
  523. ENGINE_CALLBACK_INFO = 36
  524. # Show a message as an error.
  525. # @a valueStr The message
  526. ENGINE_CALLBACK_ERROR = 37
  527. # The engine has crashed or malfunctioned and will no longer work.
  528. ENGINE_CALLBACK_QUIT = 38
  529. # ------------------------------------------------------------------------------------------------------------
  530. # Engine Option
  531. # Engine options.
  532. # @see carla_set_engine_option()
  533. # Debug.
  534. # This option is undefined and used only for testing purposes.
  535. ENGINE_OPTION_DEBUG = 0
  536. # Set the engine processing mode.
  537. # Default is ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS on Linux and ENGINE_PROCESS_MODE_CONTINUOUS_RACK for all other OSes.
  538. # @see EngineProcessMode
  539. ENGINE_OPTION_PROCESS_MODE = 1
  540. # Set the engine transport mode.
  541. # Default is ENGINE_TRANSPORT_MODE_JACK on Linux and ENGINE_TRANSPORT_MODE_INTERNAL for all other OSes.
  542. # @see EngineTransportMode
  543. ENGINE_OPTION_TRANSPORT_MODE = 2
  544. # Force mono plugins as stereo, by running 2 instances at the same time.
  545. # Default is false, but always true when process mode is ENGINE_PROCESS_MODE_CONTINUOUS_RACK.
  546. # @note Not supported by all plugins
  547. # @see PLUGIN_OPTION_FORCE_STEREO
  548. ENGINE_OPTION_FORCE_STEREO = 3
  549. # Use plugin bridges whenever possible.
  550. # Default is no, EXPERIMENTAL.
  551. ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4
  552. # Use UI bridges whenever possible, otherwise UIs will be directly handled in the main backend thread.
  553. # Default is yes.
  554. ENGINE_OPTION_PREFER_UI_BRIDGES = 5
  555. # Make custom plugin UIs always-on-top.
  556. # Default is yes.
  557. ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6
  558. # Maximum number of parameters allowed.
  559. # Default is MAX_DEFAULT_PARAMETERS.
  560. ENGINE_OPTION_MAX_PARAMETERS = 7
  561. # Timeout value for how much to wait for UI bridges to respond, in milliseconds.
  562. # Default is 4000 (4 seconds).
  563. ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8
  564. # Number of audio periods.
  565. # Default is 2.
  566. ENGINE_OPTION_AUDIO_NUM_PERIODS = 9
  567. # Audio buffer size.
  568. # Default is 512.
  569. ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10
  570. # Audio sample rate.
  571. # Default is 44100.
  572. ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11
  573. # Audio device (within a driver).
  574. # Default unset.
  575. ENGINE_OPTION_AUDIO_DEVICE = 12
  576. # Set data needed for NSM support.
  577. ENGINE_OPTION_NSM_INIT = 13
  578. # Set path used for a specific plugin type.
  579. # Uses value as the plugin format, valueStr as actual path.
  580. # @see PluginType
  581. ENGINE_OPTION_PLUGIN_PATH = 14
  582. # Set path to the binary files.
  583. # Default unset.
  584. # @note Must be set for plugin and UI bridges to work
  585. ENGINE_OPTION_PATH_BINARIES = 15
  586. # Set path to the resource files.
  587. # Default unset.
  588. # @note Must be set for some internal plugins to work
  589. ENGINE_OPTION_PATH_RESOURCES = 16
  590. # Prevent bad plugin and UI behaviour.
  591. # @note: Linux only
  592. ENGINE_OPTION_PREVENT_BAD_BEHAVIOUR = 17
  593. # Set frontend winId, used to define as parent window for plugin UIs.
  594. ENGINE_OPTION_FRONTEND_WIN_ID = 18
  595. # ------------------------------------------------------------------------------------------------------------
  596. # Engine Process Mode
  597. # Engine process mode.
  598. # @see ENGINE_OPTION_PROCESS_MODE
  599. # Single client mode.
  600. # Inputs and outputs are added dynamically as needed by plugins.
  601. ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0
  602. # Multiple client mode.
  603. # It has 1 master client + 1 client per plugin.
  604. ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1
  605. # Single client, 'rack' mode.
  606. # Processes plugins in order of Id, with forced stereo always on.
  607. ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2
  608. # Single client, 'patchbay' mode.
  609. ENGINE_PROCESS_MODE_PATCHBAY = 3
  610. # Special mode, used in plugin-bridges only.
  611. ENGINE_PROCESS_MODE_BRIDGE = 4
  612. # ------------------------------------------------------------------------------------------------------------
  613. # Engine Transport Mode
  614. # Engine transport mode.
  615. # @see ENGINE_OPTION_TRANSPORT_MODE
  616. # Internal transport mode.
  617. ENGINE_TRANSPORT_MODE_INTERNAL = 0
  618. # Transport from JACK.
  619. # Only available if driver name is "JACK".
  620. ENGINE_TRANSPORT_MODE_JACK = 1
  621. # Transport from host, used when Carla is a plugin.
  622. ENGINE_TRANSPORT_MODE_PLUGIN = 2
  623. # Special mode, used in plugin-bridges only.
  624. ENGINE_TRANSPORT_MODE_BRIDGE = 3
  625. # ------------------------------------------------------------------------------------------------------------
  626. # File Callback Opcode
  627. # File callback opcodes.
  628. # Front-ends must always block-wait for user input.
  629. # @see FileCallbackFunc and carla_set_file_callback()
  630. # Debug.
  631. # This opcode is undefined and used only for testing purposes.
  632. FILE_CALLBACK_DEBUG = 0
  633. # Open file or folder.
  634. FILE_CALLBACK_OPEN = 1
  635. # Save file or folder.
  636. FILE_CALLBACK_SAVE = 2
  637. # ------------------------------------------------------------------------------------------------------------
  638. # Patchbay Icon
  639. # The icon of a patchbay client/group.
  640. # Generic application icon.
  641. # Used for all non-plugin clients that don't have a specific icon.
  642. PATCHBAY_ICON_APPLICATION = 0
  643. # Plugin icon.
  644. # Used for all plugin clients that don't have a specific icon.
  645. PATCHBAY_ICON_PLUGIN = 1
  646. # Hardware icon.
  647. # Used for hardware (audio or MIDI) clients.
  648. PATCHBAY_ICON_HARDWARE = 2
  649. # Carla icon.
  650. # Used for the main app.
  651. PATCHBAY_ICON_CARLA = 3
  652. # DISTRHO icon.
  653. # Used for DISTRHO based plugins.
  654. PATCHBAY_ICON_DISTRHO = 4
  655. # File icon.
  656. # Used for file type plugins (like GIG and SF2).
  657. PATCHBAY_ICON_FILE = 5
  658. # ------------------------------------------------------------------------------------------------------------
  659. # Carla Backend API (C stuff)
  660. # Engine callback function.
  661. # Front-ends must never block indefinitely during a callback.
  662. # @see EngineCallbackOpcode and carla_set_engine_callback()
  663. EngineCallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_float, c_char_p)
  664. # File callback function.
  665. # @see FileCallbackOpcode
  666. FileCallbackFunc = CFUNCTYPE(c_char_p, c_void_p, c_enum, c_bool, c_char_p, c_char_p)
  667. # Parameter data.
  668. class ParameterData(Structure):
  669. _fields_ = [
  670. # This parameter type.
  671. ("type", c_enum),
  672. # This parameter hints.
  673. # @see ParameterHints
  674. ("hints", c_uint),
  675. # Index as seen by Carla.
  676. ("index", c_int32),
  677. # Real index as seen by plugins.
  678. ("rindex", c_int32),
  679. # Currently mapped MIDI CC.
  680. # A value lower than 0 means invalid or unused.
  681. # Maximum allowed value is 119 (0x77).
  682. ("midiCC", c_int16),
  683. # Currently mapped MIDI channel.
  684. # Counts from 0 to 15.
  685. ("midiChannel", c_uint8)
  686. ]
  687. # Parameter ranges.
  688. class ParameterRanges(Structure):
  689. _fields_ = [
  690. # Default value.
  691. ("def", c_float),
  692. # Minimum value.
  693. ("min", c_float),
  694. # Maximum value.
  695. ("max", c_float),
  696. # Regular, single step value.
  697. ("step", c_float),
  698. # Small step value.
  699. ("stepSmall", c_float),
  700. # Large step value.
  701. ("stepLarge", c_float)
  702. ]
  703. # MIDI Program data.
  704. class MidiProgramData(Structure):
  705. _fields_ = [
  706. # MIDI bank.
  707. ("bank", c_uint32),
  708. # MIDI program.
  709. ("program", c_uint32),
  710. # MIDI program name.
  711. ("name", c_char_p)
  712. ]
  713. # Custom data, used for saving key:value 'dictionaries'.
  714. class CustomData(Structure):
  715. _fields_ = [
  716. # Value type, in URI form.
  717. # @see CustomDataTypes
  718. ("type", c_char_p),
  719. # Key.
  720. # @see CustomDataKeys
  721. ("key", c_char_p),
  722. # Value.
  723. ("value", c_char_p)
  724. ]
  725. # Engine driver device information.
  726. class EngineDriverDeviceInfo(Structure):
  727. _fields_ = [
  728. # This driver device hints.
  729. # @see EngineDriverHints
  730. ("hints", c_uint),
  731. # Available buffer sizes.
  732. # Terminated with 0.
  733. ("bufferSizes", POINTER(c_uint32)),
  734. # Available sample rates.
  735. # Terminated with 0.0.
  736. ("sampleRates", POINTER(c_double))
  737. ]
  738. # ------------------------------------------------------------------------------------------------------------
  739. # Carla Backend API (Python compatible stuff)
  740. # @see ParameterData
  741. PyParameterData = {
  742. 'type': PARAMETER_UNKNOWN,
  743. 'hints': 0x0,
  744. 'index': PARAMETER_NULL,
  745. 'rindex': -1,
  746. 'midiCC': -1,
  747. 'midiChannel': 0
  748. }
  749. # @see ParameterRanges
  750. PyParameterRanges = {
  751. 'def': 0.0,
  752. 'min': 0.0,
  753. 'max': 1.0,
  754. 'step': 0.01,
  755. 'stepSmall': 0.0001,
  756. 'stepLarge': 0.1
  757. }
  758. # @see MidiProgramData
  759. PyMidiProgramData = {
  760. 'bank': 0,
  761. 'program': 0,
  762. 'name': None
  763. }
  764. # @see CustomData
  765. PyCustomData = {
  766. 'type': None,
  767. 'key': None,
  768. 'value': None
  769. }
  770. # @see EngineDriverDeviceInfo
  771. PyEngineDriverDeviceInfo = {
  772. 'hints': 0x0,
  773. 'bufferSizes': [],
  774. 'sampleRates': []
  775. }
  776. # ------------------------------------------------------------------------------------------------------------
  777. # Carla Host API (C stuff)
  778. # Information about a loaded plugin.
  779. # @see carla_get_plugin_info()
  780. class CarlaPluginInfo(Structure):
  781. _fields_ = [
  782. # Plugin type.
  783. ("type", c_enum),
  784. # Plugin category.
  785. ("category", c_enum),
  786. # Plugin hints.
  787. # @see PluginHints
  788. ("hints", c_uint),
  789. # Plugin options available for the user to change.
  790. # @see PluginOptions
  791. ("optionsAvailable", c_uint),
  792. # Plugin options currently enabled.
  793. # Some options are enabled but not available, which means they will always be on.
  794. # @see PluginOptions
  795. ("optionsEnabled", c_uint),
  796. # Plugin filename.
  797. # This can be the plugin binary or resource file.
  798. ("filename", c_char_p),
  799. # Plugin name.
  800. # This name is unique within a Carla instance.
  801. # @see carla_get_real_plugin_name()
  802. ("name", c_char_p),
  803. # Plugin label or URI.
  804. ("label", c_char_p),
  805. # Plugin author/maker.
  806. ("maker", c_char_p),
  807. # Plugin copyright/license.
  808. ("copyright", c_char_p),
  809. # Icon name for this plugin, in lowercase.
  810. # Default is "plugin".
  811. ("iconName", c_char_p),
  812. # Plugin unique Id.
  813. # This Id is dependant on the plugin type and may sometimes be 0.
  814. ("uniqueId", c_int64)
  815. ]
  816. # Information about an internal Carla plugin.
  817. # @see carla_get_cached_plugin_info()
  818. class CarlaCachedPluginInfo(Structure):
  819. _fields_ = [
  820. # Plugin category.
  821. ("category", c_enum),
  822. # Plugin hints.
  823. # @see PluginHints
  824. ("hints", c_uint),
  825. # Number of audio inputs.
  826. ("audioIns", c_uint32),
  827. # Number of audio outputs.
  828. ("audioOuts", c_uint32),
  829. # Number of MIDI inputs.
  830. ("midiIns", c_uint32),
  831. # Number of MIDI outputs.
  832. ("midiOuts", c_uint32),
  833. # Number of input parameters.
  834. ("parameterIns", c_uint32),
  835. # Number of output parameters.
  836. ("parameterOuts", c_uint32),
  837. # Plugin name.
  838. ("name", c_char_p),
  839. # Plugin label.
  840. ("label", c_char_p),
  841. # Plugin author/maker.
  842. ("maker", c_char_p),
  843. # Plugin copyright/license.
  844. ("copyright", c_char_p)
  845. ]
  846. # Port count information, used for Audio and MIDI ports and parameters.
  847. # @see carla_get_audio_port_count_info()
  848. # @see carla_get_midi_port_count_info()
  849. # @see carla_get_parameter_count_info()
  850. class CarlaPortCountInfo(Structure):
  851. _fields_ = [
  852. # Number of inputs.
  853. ("ins", c_uint32),
  854. # Number of outputs.
  855. ("outs", c_uint32)
  856. ]
  857. # Parameter information.
  858. # @see carla_get_parameter_info()
  859. class CarlaParameterInfo(Structure):
  860. _fields_ = [
  861. # Parameter name.
  862. ("name", c_char_p),
  863. # Parameter symbol.
  864. ("symbol", c_char_p),
  865. # Parameter unit.
  866. ("unit", c_char_p),
  867. # Number of scale points.
  868. # @see CarlaScalePointInfo
  869. ("scalePointCount", c_uint32)
  870. ]
  871. # Parameter scale point information.
  872. # @see carla_get_parameter_scalepoint_info()
  873. class CarlaScalePointInfo(Structure):
  874. _fields_ = [
  875. # Scale point value.
  876. ("value", c_float),
  877. # Scale point label.
  878. ("label", c_char_p)
  879. ]
  880. # Transport information.
  881. # @see carla_get_transport_info()
  882. class CarlaTransportInfo(Structure):
  883. _fields_ = [
  884. # Wherever transport is playing.
  885. ("playing", c_bool),
  886. # Current transport frame.
  887. ("frame", c_uint64),
  888. # Bar
  889. ("bar", c_int32),
  890. # Beat
  891. ("beat", c_int32),
  892. # Tick
  893. ("tick", c_int32),
  894. # Beats per minute.
  895. ("bpm", c_double)
  896. ]
  897. # ------------------------------------------------------------------------------------------------------------
  898. # Carla Host API (Python compatible stuff)
  899. # @see CarlaPluginInfo
  900. PyCarlaPluginInfo = {
  901. 'type': PLUGIN_NONE,
  902. 'category': PLUGIN_CATEGORY_NONE,
  903. 'hints': 0x0,
  904. 'optionsAvailable': 0x0,
  905. 'optionsEnabled': 0x0,
  906. 'filename': "",
  907. 'name': "",
  908. 'label': "",
  909. 'maker': "",
  910. 'copyright': "",
  911. 'iconName': "",
  912. 'uniqueId': 0
  913. }
  914. # @see CarlaCachedPluginInfo
  915. PyCarlaCachedPluginInfo = {
  916. 'category': PLUGIN_CATEGORY_NONE,
  917. 'hints': 0x0,
  918. 'audioIns': 0,
  919. 'audioOuts': 0,
  920. 'midiIns': 0,
  921. 'midiOuts': 0,
  922. 'parameterIns': 0,
  923. 'parameterOuts': 0,
  924. 'name': "",
  925. 'label': "",
  926. 'maker': "",
  927. 'copyright': ""
  928. }
  929. # @see CarlaPortCountInfo
  930. PyCarlaPortCountInfo = {
  931. 'ins': 0,
  932. 'outs': 0
  933. }
  934. # @see CarlaParameterInfo
  935. PyCarlaParameterInfo = {
  936. 'name': "",
  937. 'symbol': "",
  938. 'unit': "",
  939. 'scalePointCount': 0,
  940. }
  941. # @see CarlaScalePointInfo
  942. PyCarlaScalePointInfo = {
  943. 'value': 0.0,
  944. 'label': ""
  945. }
  946. # @see CarlaTransportInfo
  947. PyCarlaTransportInfo = {
  948. "playing": False,
  949. "frame": 0,
  950. "bar": 0,
  951. "beat": 0,
  952. "tick": 0,
  953. "bpm": 0.0
  954. }
  955. # ------------------------------------------------------------------------------------------------------------
  956. # Set BINARY_NATIVE
  957. if HAIKU or LINUX or MACOS:
  958. BINARY_NATIVE = BINARY_POSIX64 if kIs64bit else BINARY_POSIX32
  959. elif WINDOWS:
  960. BINARY_NATIVE = BINARY_WIN64 if kIs64bit else BINARY_WIN32
  961. else:
  962. BINARY_NATIVE = BINARY_OTHER
  963. # ------------------------------------------------------------------------------------------------------------
  964. # An empty class used to resolve metaclass conflicts between ABC and PyQt modules
  965. class PyQtMetaClass(pyqtWrapperType, ABCMeta):
  966. pass
  967. # ------------------------------------------------------------------------------------------------------------
  968. # Carla Host object (Meta)
  969. class CarlaHostMeta(QObject):
  970. #class CarlaHostMeta(QObject, metaclass=PyQtMetaClass):
  971. # signals
  972. DebugCallback = pyqtSignal(int, int, int, float, str)
  973. PluginAddedCallback = pyqtSignal(int, str)
  974. PluginRemovedCallback = pyqtSignal(int)
  975. PluginRenamedCallback = pyqtSignal(int, str)
  976. PluginUnavailableCallback = pyqtSignal(int, str)
  977. ParameterValueChangedCallback = pyqtSignal(int, int, float)
  978. ParameterDefaultChangedCallback = pyqtSignal(int, int, float)
  979. ParameterMidiCcChangedCallback = pyqtSignal(int, int, int)
  980. ParameterMidiChannelChangedCallback = pyqtSignal(int, int, int)
  981. ProgramChangedCallback = pyqtSignal(int, int)
  982. MidiProgramChangedCallback = pyqtSignal(int, int)
  983. OptionChangedCallback = pyqtSignal(int, int, bool)
  984. UiStateChangedCallback = pyqtSignal(int, int)
  985. NoteOnCallback = pyqtSignal(int, int, int, int)
  986. NoteOffCallback = pyqtSignal(int, int, int)
  987. UpdateCallback = pyqtSignal(int)
  988. ReloadInfoCallback = pyqtSignal(int)
  989. ReloadParametersCallback = pyqtSignal(int)
  990. ReloadProgramsCallback = pyqtSignal(int)
  991. ReloadAllCallback = pyqtSignal(int)
  992. PatchbayClientAddedCallback = pyqtSignal(int, int, int, str)
  993. PatchbayClientRemovedCallback = pyqtSignal(int)
  994. PatchbayClientRenamedCallback = pyqtSignal(int, str)
  995. PatchbayClientDataChangedCallback = pyqtSignal(int, int, int)
  996. PatchbayPortAddedCallback = pyqtSignal(int, int, int, str)
  997. PatchbayPortRemovedCallback = pyqtSignal(int, int)
  998. PatchbayPortRenamedCallback = pyqtSignal(int, int, str)
  999. PatchbayConnectionAddedCallback = pyqtSignal(int, int, int, int, int)
  1000. PatchbayConnectionRemovedCallback = pyqtSignal(int, int, int)
  1001. EngineStartedCallback = pyqtSignal(int, int, str)
  1002. EngineStoppedCallback = pyqtSignal()
  1003. ProcessModeChangedCallback = pyqtSignal(int)
  1004. TransportModeChangedCallback = pyqtSignal(int)
  1005. BufferSizeChangedCallback = pyqtSignal(int)
  1006. SampleRateChangedCallback = pyqtSignal(float)
  1007. InfoCallback = pyqtSignal(str)
  1008. ErrorCallback = pyqtSignal(str)
  1009. QuitCallback = pyqtSignal()
  1010. def __init__(self):
  1011. QObject.__init__(self)
  1012. # info about this host object
  1013. self.isControl = False
  1014. self.isPlugin = False
  1015. # settings
  1016. self.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK
  1017. self.transportMode = ENGINE_TRANSPORT_MODE_INTERNAL
  1018. self.processModeForced = False
  1019. # settings
  1020. self.forceStereo = False
  1021. self.preferPluginBridges = False
  1022. self.preferUIBridges = False
  1023. self.preventBadBehaviour = False
  1024. self.uisAlwaysOnTop = False
  1025. self.maxParameters = 0
  1026. self.uiBridgesTimeout = 0
  1027. # settings
  1028. self.pathBinaries = ""
  1029. self.pathResources = ""
  1030. # use _putenv on windows
  1031. if not WINDOWS:
  1032. self.msvcrt = None
  1033. return
  1034. self.msvcrt = cdll.msvcrt
  1035. self.msvcrt._putenv.argtypes = [c_char_p]
  1036. self.msvcrt._putenv.restype = None
  1037. # set environment variable
  1038. def setenv(self, key, value):
  1039. environ[key] = value
  1040. if WINDOWS:
  1041. keyvalue = "%s=%s" % (key, value)
  1042. self.msvcrt._putenv(keyvalue.encode("utf-8"))
  1043. # unset environment variable
  1044. def unsetenv(self, key):
  1045. environ.pop(key)
  1046. if WINDOWS:
  1047. keyrm = "%s=" % key
  1048. self.msvcrt._putenv(keyrm.encode("utf-8"))
  1049. # Get the complete license text of used third-party code and features.
  1050. # Returned string is in basic html format.
  1051. @abstractmethod
  1052. def get_complete_license_text(self):
  1053. raise NotImplementedError
  1054. # Get the juce version used in the current Carla build.
  1055. @abstractmethod
  1056. def get_juce_version(self):
  1057. raise NotImplementedError
  1058. # Get all the supported file extensions in carla_load_file().
  1059. # Returned string uses this syntax:
  1060. # @code
  1061. # "*.ext1;*.ext2;*.ext3"
  1062. # @endcode
  1063. @abstractmethod
  1064. def get_supported_file_extensions(self):
  1065. raise NotImplementedError
  1066. # Get how many engine drivers are available.
  1067. @abstractmethod
  1068. def get_engine_driver_count(self):
  1069. raise NotImplementedError
  1070. # Get an engine driver name.
  1071. # @param index Driver index
  1072. @abstractmethod
  1073. def get_engine_driver_name(self, index):
  1074. raise NotImplementedError
  1075. # Get the device names of an engine driver.
  1076. # @param index Driver index
  1077. @abstractmethod
  1078. def get_engine_driver_device_names(self, index):
  1079. raise NotImplementedError
  1080. # Get information about a device driver.
  1081. # @param index Driver index
  1082. # @param name Device name
  1083. @abstractmethod
  1084. def get_engine_driver_device_info(self, index, name):
  1085. raise NotImplementedError
  1086. # Get how many internal plugins are available.
  1087. @abstractmethod
  1088. def get_cached_plugin_count(self, ptype, pluginPath):
  1089. raise NotImplementedError
  1090. # Get information about a cached plugin.
  1091. @abstractmethod
  1092. def get_cached_plugin_info(self, ptype, index):
  1093. raise NotImplementedError
  1094. # Initialize the engine.
  1095. # Make sure to call carla_engine_idle() at regular intervals afterwards.
  1096. # @param driverName Driver to use
  1097. # @param clientName Engine master client name
  1098. @abstractmethod
  1099. def engine_init(self, driverName, clientName):
  1100. raise NotImplementedError
  1101. # Close the engine.
  1102. # This function always closes the engine even if it returns false.
  1103. # In other words, even when something goes wrong when closing the engine it still be closed nonetheless.
  1104. @abstractmethod
  1105. def engine_close(self):
  1106. raise NotImplementedError
  1107. # Idle the engine.
  1108. # Do not call this if the engine is not running.
  1109. @abstractmethod
  1110. def engine_idle(self):
  1111. raise NotImplementedError
  1112. # Check if the engine is running.
  1113. @abstractmethod
  1114. def is_engine_running(self):
  1115. raise NotImplementedError
  1116. # Tell the engine it's about to close.
  1117. # This is used to prevent the engine thread(s) from reactivating.
  1118. @abstractmethod
  1119. def set_engine_about_to_close(self):
  1120. raise NotImplementedError
  1121. # Set the engine callback function.
  1122. # @param func Callback function
  1123. @abstractmethod
  1124. def set_engine_callback(self, func):
  1125. raise NotImplementedError
  1126. # Set an engine option.
  1127. # @param option Option
  1128. # @param value Value as number
  1129. # @param valueStr Value as string
  1130. @abstractmethod
  1131. def set_engine_option(self, option, value, valueStr):
  1132. raise NotImplementedError
  1133. # Set the file callback function.
  1134. # @param func Callback function
  1135. # @param ptr Callback pointer
  1136. @abstractmethod
  1137. def set_file_callback(self, func):
  1138. raise NotImplementedError
  1139. # Load a file of any type.
  1140. # This will try to load a generic file as a plugin,
  1141. # either by direct handling (GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI).
  1142. # @see carla_get_supported_file_extensions()
  1143. @abstractmethod
  1144. def load_file(self, filename):
  1145. raise NotImplementedError
  1146. # Load a Carla project file.
  1147. # @note Currently loaded plugins are not removed; call carla_remove_all_plugins() first if needed.
  1148. @abstractmethod
  1149. def load_project(self, filename):
  1150. raise NotImplementedError
  1151. # Save current project to a file.
  1152. @abstractmethod
  1153. def save_project(self, filename):
  1154. raise NotImplementedError
  1155. # Connect two patchbay ports.
  1156. # @param groupIdA Output group
  1157. # @param portIdA Output port
  1158. # @param groupIdB Input group
  1159. # @param portIdB Input port
  1160. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED
  1161. @abstractmethod
  1162. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  1163. raise NotImplementedError
  1164. # Disconnect two patchbay ports.
  1165. # @param connectionId Connection Id
  1166. # @see ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED
  1167. @abstractmethod
  1168. def patchbay_disconnect(self, connectionId):
  1169. raise NotImplementedError
  1170. # Force the engine to resend all patchbay clients, ports and connections again.
  1171. # @param external Wherever to show external/hardware ports instead of internal ones.
  1172. # Only valid in patchbay engine mode, other modes will ignore this.
  1173. @abstractmethod
  1174. def patchbay_refresh(self, external):
  1175. raise NotImplementedError
  1176. # Start playback of the engine transport.
  1177. @abstractmethod
  1178. def transport_play(self):
  1179. raise NotImplementedError
  1180. # Pause the engine transport.
  1181. @abstractmethod
  1182. def transport_pause(self):
  1183. raise NotImplementedError
  1184. # Relocate the engine transport to a specific frame.
  1185. @abstractmethod
  1186. def transport_relocate(self, frame):
  1187. raise NotImplementedError
  1188. # Get the current transport frame.
  1189. @abstractmethod
  1190. def get_current_transport_frame(self):
  1191. raise NotImplementedError
  1192. # Get the engine transport information.
  1193. @abstractmethod
  1194. def get_transport_info(self):
  1195. raise NotImplementedError
  1196. # Current number of plugins loaded.
  1197. @abstractmethod
  1198. def get_current_plugin_count(self):
  1199. raise NotImplementedError
  1200. # Maximum number of loadable plugins allowed.
  1201. # Returns 0 if engine is not started.
  1202. @abstractmethod
  1203. def get_max_plugin_number(self):
  1204. raise NotImplementedError
  1205. # Add a new plugin.
  1206. # If you don't know the binary type use the BINARY_NATIVE macro.
  1207. # @param btype Binary type
  1208. # @param ptype Plugin type
  1209. # @param filename Filename, if applicable
  1210. # @param name Name of the plugin, can be NULL
  1211. # @param label Plugin label, if applicable
  1212. # @param uniqueId Plugin unique Id, if applicable
  1213. # @param extraPtr Extra pointer, defined per plugin type
  1214. @abstractmethod
  1215. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr):
  1216. raise NotImplementedError
  1217. # Remove a plugin.
  1218. # @param pluginId Plugin to remove.
  1219. @abstractmethod
  1220. def remove_plugin(self, pluginId):
  1221. raise NotImplementedError
  1222. # Remove all plugins.
  1223. @abstractmethod
  1224. def remove_all_plugins(self):
  1225. raise NotImplementedError
  1226. # Rename a plugin.
  1227. # Returns the new name, or NULL if the operation failed.
  1228. # @param pluginId Plugin to rename
  1229. # @param newName New plugin name
  1230. @abstractmethod
  1231. def rename_plugin(self, pluginId, newName):
  1232. raise NotImplementedError
  1233. # Clone a plugin.
  1234. # @param pluginId Plugin to clone
  1235. @abstractmethod
  1236. def clone_plugin(self, pluginId):
  1237. raise NotImplementedError
  1238. # Prepare replace of a plugin.
  1239. # The next call to carla_add_plugin() will use this id, replacing the current plugin.
  1240. # @param pluginId Plugin to replace
  1241. # @note This function requires carla_add_plugin() to be called afterwards *as soon as possible*.
  1242. @abstractmethod
  1243. def replace_plugin(self, pluginId):
  1244. raise NotImplementedError
  1245. # Switch two plugins positions.
  1246. # @param pluginIdA Plugin A
  1247. # @param pluginIdB Plugin B
  1248. @abstractmethod
  1249. def switch_plugins(self, pluginIdA, pluginIdB):
  1250. raise NotImplementedError
  1251. # Load a plugin state.
  1252. # @param pluginId Plugin
  1253. # @param filename Path to plugin state
  1254. # @see carla_save_plugin_state()
  1255. @abstractmethod
  1256. def load_plugin_state(self, pluginId, filename):
  1257. raise NotImplementedError
  1258. # Save a plugin state.
  1259. # @param pluginId Plugin
  1260. # @param filename Path to plugin state
  1261. # @see carla_load_plugin_state()
  1262. @abstractmethod
  1263. def save_plugin_state(self, pluginId, filename):
  1264. raise NotImplementedError
  1265. # Get information from a plugin.
  1266. # @param pluginId Plugin
  1267. @abstractmethod
  1268. def get_plugin_info(self, pluginId):
  1269. raise NotImplementedError
  1270. # Get audio port count information from a plugin.
  1271. # @param pluginId Plugin
  1272. @abstractmethod
  1273. def get_audio_port_count_info(self, pluginId):
  1274. raise NotImplementedError
  1275. # Get MIDI port count information from a plugin.
  1276. # @param pluginId Plugin
  1277. @abstractmethod
  1278. def get_midi_port_count_info(self, pluginId):
  1279. raise NotImplementedError
  1280. # Get parameter count information from a plugin.
  1281. # @param pluginId Plugin
  1282. @abstractmethod
  1283. def get_parameter_count_info(self, pluginId):
  1284. raise NotImplementedError
  1285. # Get parameter information from a plugin.
  1286. # @param pluginId Plugin
  1287. # @param parameterId Parameter index
  1288. # @see carla_get_parameter_count()
  1289. @abstractmethod
  1290. def get_parameter_info(self, pluginId, parameterId):
  1291. raise NotImplementedError
  1292. # Get parameter scale point information from a plugin.
  1293. # @param pluginId Plugin
  1294. # @param parameterId Parameter index
  1295. # @param scalePointId Parameter scale-point index
  1296. # @see CarlaParameterInfo::scalePointCount
  1297. @abstractmethod
  1298. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1299. raise NotImplementedError
  1300. # Get a plugin's parameter data.
  1301. # @param pluginId Plugin
  1302. # @param parameterId Parameter index
  1303. # @see carla_get_parameter_count()
  1304. @abstractmethod
  1305. def get_parameter_data(self, pluginId, parameterId):
  1306. raise NotImplementedError
  1307. # Get a plugin's parameter ranges.
  1308. # @param pluginId Plugin
  1309. # @param parameterId Parameter index
  1310. # @see carla_get_parameter_count()
  1311. @abstractmethod
  1312. def get_parameter_ranges(self, pluginId, parameterId):
  1313. raise NotImplementedError
  1314. # Get a plugin's MIDI program data.
  1315. # @param pluginId Plugin
  1316. # @param midiProgramId MIDI Program index
  1317. # @see carla_get_midi_program_count()
  1318. @abstractmethod
  1319. def get_midi_program_data(self, pluginId, midiProgramId):
  1320. raise NotImplementedError
  1321. # Get a plugin's custom data.
  1322. # @param pluginId Plugin
  1323. # @param customDataId Custom data index
  1324. # @see carla_get_custom_data_count()
  1325. @abstractmethod
  1326. def get_custom_data(self, pluginId, customDataId):
  1327. raise NotImplementedError
  1328. # Get a plugin's chunk data.
  1329. # @param pluginId Plugin
  1330. # @see PLUGIN_OPTION_USE_CHUNKS
  1331. @abstractmethod
  1332. def get_chunk_data(self, pluginId):
  1333. raise NotImplementedError
  1334. # Get how many parameters a plugin has.
  1335. # @param pluginId Plugin
  1336. @abstractmethod
  1337. def get_parameter_count(self, pluginId):
  1338. raise NotImplementedError
  1339. # Get how many programs a plugin has.
  1340. # @param pluginId Plugin
  1341. # @see carla_get_program_name()
  1342. @abstractmethod
  1343. def get_program_count(self, pluginId):
  1344. raise NotImplementedError
  1345. # Get how many MIDI programs a plugin has.
  1346. # @param pluginId Plugin
  1347. # @see carla_get_midi_program_name() and carla_get_midi_program_data()
  1348. @abstractmethod
  1349. def get_midi_program_count(self, pluginId):
  1350. raise NotImplementedError
  1351. # Get how many custom data sets a plugin has.
  1352. # @param pluginId Plugin
  1353. # @see carla_get_custom_data()
  1354. @abstractmethod
  1355. def get_custom_data_count(self, pluginId):
  1356. raise NotImplementedError
  1357. # Get a plugin's parameter text (custom display of internal values).
  1358. # @param pluginId Plugin
  1359. # @param parameterId Parameter index
  1360. # @see PARAMETER_USES_CUSTOM_TEXT
  1361. @abstractmethod
  1362. def get_parameter_text(self, pluginId, parameterId):
  1363. raise NotImplementedError
  1364. # Get a plugin's program name.
  1365. # @param pluginId Plugin
  1366. # @param programId Program index
  1367. # @see carla_get_program_count()
  1368. @abstractmethod
  1369. def get_program_name(self, pluginId, programId):
  1370. raise NotImplementedError
  1371. # Get a plugin's MIDI program name.
  1372. # @param pluginId Plugin
  1373. # @param midiProgramId MIDI Program index
  1374. # @see carla_get_midi_program_count()
  1375. @abstractmethod
  1376. def get_midi_program_name(self, pluginId, midiProgramId):
  1377. raise NotImplementedError
  1378. # Get a plugin's real name.
  1379. # This is the name the plugin uses to identify itself; may not be unique.
  1380. # @param pluginId Plugin
  1381. @abstractmethod
  1382. def get_real_plugin_name(self, pluginId):
  1383. raise NotImplementedError
  1384. # Get a plugin's program index.
  1385. # @param pluginId Plugin
  1386. @abstractmethod
  1387. def get_current_program_index(self, pluginId):
  1388. raise NotImplementedError
  1389. # Get a plugin's midi program index.
  1390. # @param pluginId Plugin
  1391. @abstractmethod
  1392. def get_current_midi_program_index(self, pluginId):
  1393. raise NotImplementedError
  1394. # Get a plugin's default parameter value.
  1395. # @param pluginId Plugin
  1396. # @param parameterId Parameter index
  1397. @abstractmethod
  1398. def get_default_parameter_value(self, pluginId, parameterId):
  1399. raise NotImplementedError
  1400. # Get a plugin's current parameter value.
  1401. # @param pluginId Plugin
  1402. # @param parameterId Parameter index
  1403. @abstractmethod
  1404. def get_current_parameter_value(self, pluginId, parameterId):
  1405. raise NotImplementedError
  1406. # Get a plugin's internal parameter value.
  1407. # @param pluginId Plugin
  1408. # @param parameterId Parameter index, maybe be negative
  1409. # @see InternalParameterIndex
  1410. @abstractmethod
  1411. def get_internal_parameter_value(self, pluginId, parameterId):
  1412. raise NotImplementedError
  1413. # Get a plugin's input peak value.
  1414. # @param pluginId Plugin
  1415. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1416. @abstractmethod
  1417. def get_input_peak_value(self, pluginId, isLeft):
  1418. raise NotImplementedError
  1419. # Get a plugin's output peak value.
  1420. # @param pluginId Plugin
  1421. # @param isLeft Wherever to get the left/mono value, otherwise right.
  1422. @abstractmethod
  1423. def get_output_peak_value(self, pluginId, isLeft):
  1424. raise NotImplementedError
  1425. # Enable a plugin's option.
  1426. # @param pluginId Plugin
  1427. # @param option An option from PluginOptions
  1428. # @param yesNo New enabled state
  1429. @abstractmethod
  1430. def set_option(self, pluginId, option, yesNo):
  1431. raise NotImplementedError
  1432. # Enable or disable a plugin.
  1433. # @param pluginId Plugin
  1434. # @param onOff New active state
  1435. @abstractmethod
  1436. def set_active(self, pluginId, onOff):
  1437. raise NotImplementedError
  1438. # Change a plugin's internal dry/wet.
  1439. # @param pluginId Plugin
  1440. # @param value New dry/wet value
  1441. @abstractmethod
  1442. def set_drywet(self, pluginId, value):
  1443. raise NotImplementedError
  1444. # Change a plugin's internal volume.
  1445. # @param pluginId Plugin
  1446. # @param value New volume
  1447. @abstractmethod
  1448. def set_volume(self, pluginId, value):
  1449. raise NotImplementedError
  1450. # Change a plugin's internal stereo balance, left channel.
  1451. # @param pluginId Plugin
  1452. # @param value New value
  1453. @abstractmethod
  1454. def set_balance_left(self, pluginId, value):
  1455. raise NotImplementedError
  1456. # Change a plugin's internal stereo balance, right channel.
  1457. # @param pluginId Plugin
  1458. # @param value New value
  1459. @abstractmethod
  1460. def set_balance_right(self, pluginId, value):
  1461. raise NotImplementedError
  1462. # Change a plugin's internal mono panning value.
  1463. # @param pluginId Plugin
  1464. # @param value New value
  1465. @abstractmethod
  1466. def set_panning(self, pluginId, value):
  1467. raise NotImplementedError
  1468. # Change a plugin's internal control channel.
  1469. # @param pluginId Plugin
  1470. # @param channel New channel
  1471. @abstractmethod
  1472. def set_ctrl_channel(self, pluginId, channel):
  1473. raise NotImplementedError
  1474. # Change a plugin's parameter value.
  1475. # @param pluginId Plugin
  1476. # @param parameterId Parameter index
  1477. # @param value New value
  1478. @abstractmethod
  1479. def set_parameter_value(self, pluginId, parameterId, value):
  1480. raise NotImplementedError
  1481. # Change a plugin's parameter MIDI cc.
  1482. # @param pluginId Plugin
  1483. # @param parameterId Parameter index
  1484. # @param cc New MIDI cc
  1485. @abstractmethod
  1486. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1487. raise NotImplementedError
  1488. # Change a plugin's parameter MIDI channel.
  1489. # @param pluginId Plugin
  1490. # @param parameterId Parameter index
  1491. # @param channel New MIDI channel
  1492. @abstractmethod
  1493. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  1494. raise NotImplementedError
  1495. # Change a plugin's current program.
  1496. # @param pluginId Plugin
  1497. # @param programId New program
  1498. @abstractmethod
  1499. def set_program(self, pluginId, programId):
  1500. raise NotImplementedError
  1501. # Change a plugin's current MIDI program.
  1502. # @param pluginId Plugin
  1503. # @param midiProgramId New value
  1504. @abstractmethod
  1505. def set_midi_program(self, pluginId, midiProgramId):
  1506. raise NotImplementedError
  1507. # Set a plugin's custom data set.
  1508. # @param pluginId Plugin
  1509. # @param type Type
  1510. # @param key Key
  1511. # @param value New value
  1512. # @see CustomDataTypes and CustomDataKeys
  1513. @abstractmethod
  1514. def set_custom_data(self, pluginId, type_, key, value):
  1515. raise NotImplementedError
  1516. # Set a plugin's chunk data.
  1517. # @param pluginId Plugin
  1518. # @param chunkData New chunk data
  1519. # @see PLUGIN_OPTION_USE_CHUNKS and carla_get_chunk_data()
  1520. @abstractmethod
  1521. def set_chunk_data(self, pluginId, chunkData):
  1522. raise NotImplementedError
  1523. # Tell a plugin to prepare for save.
  1524. # This should be called before saving custom data sets.
  1525. # @param pluginId Plugin
  1526. @abstractmethod
  1527. def prepare_for_save(self, pluginId):
  1528. raise NotImplementedError
  1529. # Reset all plugin's parameters.
  1530. # @param pluginId Plugin
  1531. @abstractmethod
  1532. def reset_parameters(self, pluginId):
  1533. raise NotImplementedError
  1534. # Randomize all plugin's parameters.
  1535. # @param pluginId Plugin
  1536. @abstractmethod
  1537. def randomize_parameters(self, pluginId):
  1538. raise NotImplementedError
  1539. # Send a single note of a plugin.
  1540. # If velocity is 0, note-off is sent; note-on otherwise.
  1541. # @param pluginId Plugin
  1542. # @param channel Note channel
  1543. # @param note Note pitch
  1544. # @param velocity Note velocity
  1545. @abstractmethod
  1546. def send_midi_note(self, pluginId, channel, note, velocity):
  1547. raise NotImplementedError
  1548. # Tell a plugin to show its own custom UI.
  1549. # @param pluginId Plugin
  1550. # @param yesNo New UI state, visible or not
  1551. # @see PLUGIN_HAS_CUSTOM_UI
  1552. @abstractmethod
  1553. def show_custom_ui(self, pluginId, yesNo):
  1554. raise NotImplementedError
  1555. # Get the current engine buffer size.
  1556. @abstractmethod
  1557. def get_buffer_size(self):
  1558. raise NotImplementedError
  1559. # Get the current engine sample rate.
  1560. @abstractmethod
  1561. def get_sample_rate(self):
  1562. raise NotImplementedError
  1563. # Get the last error.
  1564. @abstractmethod
  1565. def get_last_error(self):
  1566. raise NotImplementedError
  1567. # Get the current engine OSC URL (TCP).
  1568. @abstractmethod
  1569. def get_host_osc_url_tcp(self):
  1570. raise NotImplementedError
  1571. # Get the current engine OSC URL (UDP).
  1572. @abstractmethod
  1573. def get_host_osc_url_udp(self):
  1574. raise NotImplementedError
  1575. # ------------------------------------------------------------------------------------------------------------
  1576. # Carla Host object (dummy/null, does nothing)
  1577. class CarlaHostNull(CarlaHostMeta):
  1578. def __init__(self):
  1579. CarlaHostMeta.__init__(self)
  1580. self.fEngineCallback = None
  1581. self.fEngineRunning = False
  1582. def get_complete_license_text(self):
  1583. text = (
  1584. "<p>This current Carla build is using the following features and 3rd-party code:</p>"
  1585. "<ul>"
  1586. # Plugin formats
  1587. "<li>LADSPA plugin support</li>"
  1588. "<li>DSSI plugin support</li>"
  1589. "<li>LV2 plugin support</li>"
  1590. "<li>VST plugin support using official VST SDK 2.4 [1]</li>"
  1591. "<li>VST3 plugin support using official VST SDK 3.6 [1]</li>"
  1592. "<li>AU plugin support</li>"
  1593. # Sample kit libraries
  1594. "<li>FluidSynth library for SF2 support</li>"
  1595. "<li>LinuxSampler library for GIG and SFZ support [2]</li>"
  1596. # Internal plugins
  1597. "<li>NekoFilter plugin code based on lv2fil by Nedko Arnaudov and Fons Adriaensen</li>"
  1598. "<li>ZynAddSubFX plugin code</li>"
  1599. # misc libs
  1600. "<li>base64 utilities based on code by Ren\u00E9 Nyffenegger</li>"
  1601. "<li>sem_timedwait for Mac OS by Keith Shortridge</li>"
  1602. "<li>liblo library for OSC support</li>"
  1603. "<li>rtmempool library by Nedko Arnaudov"
  1604. "<li>serd, sord, sratom and lilv libraries for LV2 discovery</li>"
  1605. "<li>RtAudio and RtMidi libraries for extra Audio and MIDI support</li>"
  1606. # end
  1607. "</ul>"
  1608. "<p>"
  1609. # Required by VST SDK
  1610. "&nbsp;[1] Trademark of Steinberg Media Technologies GmbH.<br/>"
  1611. # LinuxSampler GPL exception
  1612. "&nbsp;[2] Using LinuxSampler code in commercial hardware or software products is not allowed without prior written authorization by the authors."
  1613. "</p>"
  1614. )
  1615. return text
  1616. def get_juce_version(self):
  1617. return "3.0"
  1618. def get_supported_file_extensions(self):
  1619. return "*.carxp;*.carxs;*.mid;*.midi;*.sf2;*.gig;*.sfz;*.xmz;*.xiz"
  1620. def get_engine_driver_count(self):
  1621. return 0
  1622. def get_engine_driver_name(self, index):
  1623. return ""
  1624. def get_engine_driver_device_names(self, index):
  1625. return []
  1626. def get_engine_driver_device_info(self, index, name):
  1627. return PyEngineDriverDeviceInfo
  1628. def get_cached_plugin_count(self, ptype, pluginPath):
  1629. return 0
  1630. def get_cached_plugin_info(self, ptype, index):
  1631. return PyCarlaCachedPluginInfo
  1632. def engine_init(self, driverName, clientName):
  1633. self.fEngineRunning = True
  1634. if self.fEngineCallback is not None:
  1635. self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STARTED, 0, self.processMode, self.transportMode, 0.0, driverName)
  1636. return True
  1637. def engine_close(self):
  1638. self.fEngineRunning = False
  1639. if self.fEngineCallback is not None:
  1640. self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0.0, "")
  1641. return True
  1642. def engine_idle(self):
  1643. return
  1644. def is_engine_running(self):
  1645. return False
  1646. def set_engine_about_to_close(self):
  1647. return
  1648. def set_engine_callback(self, func):
  1649. self.fEngineCallback = func
  1650. def set_engine_option(self, option, value, valueStr):
  1651. return
  1652. def set_file_callback(self, func):
  1653. return
  1654. def load_file(self, filename):
  1655. return False
  1656. def load_project(self, filename):
  1657. return False
  1658. def save_project(self, filename):
  1659. return False
  1660. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  1661. return False
  1662. def patchbay_disconnect(self, connectionId):
  1663. return False
  1664. def patchbay_refresh(self, external):
  1665. return False
  1666. def transport_play(self):
  1667. return
  1668. def transport_pause(self):
  1669. return
  1670. def transport_relocate(self, frame):
  1671. return
  1672. def get_current_transport_frame(self):
  1673. return 0
  1674. def get_transport_info(self):
  1675. return PyCarlaTransportInfo
  1676. def get_current_plugin_count(self):
  1677. return 0
  1678. def get_max_plugin_number(self):
  1679. return 0
  1680. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr):
  1681. return False
  1682. def remove_plugin(self, pluginId):
  1683. return False
  1684. def remove_all_plugins(self):
  1685. return False
  1686. def rename_plugin(self, pluginId, newName):
  1687. return ""
  1688. def clone_plugin(self, pluginId):
  1689. return False
  1690. def replace_plugin(self, pluginId):
  1691. return False
  1692. def switch_plugins(self, pluginIdA, pluginIdB):
  1693. return False
  1694. def load_plugin_state(self, pluginId, filename):
  1695. return False
  1696. def save_plugin_state(self, pluginId, filename):
  1697. return False
  1698. def get_plugin_info(self, pluginId):
  1699. return PyCarlaPluginInfo
  1700. def get_audio_port_count_info(self, pluginId):
  1701. return PyCarlaPortCountInfo
  1702. def get_midi_port_count_info(self, pluginId):
  1703. return PyCarlaPortCountInfo
  1704. def get_parameter_count_info(self, pluginId):
  1705. return PyCarlaPortCountInfo
  1706. def get_parameter_info(self, pluginId, parameterId):
  1707. return PyCarlaParameterInfo
  1708. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  1709. return PyCarlaScalePointInfo
  1710. def get_parameter_data(self, pluginId, parameterId):
  1711. return PyParameterData
  1712. def get_parameter_ranges(self, pluginId, parameterId):
  1713. return PyParameterRanges
  1714. def get_midi_program_data(self, pluginId, midiProgramId):
  1715. return PyMidiProgramData
  1716. def get_custom_data(self, pluginId, customDataId):
  1717. return PyCustomData
  1718. def get_chunk_data(self, pluginId):
  1719. return ""
  1720. def get_parameter_count(self, pluginId):
  1721. return 0
  1722. def get_program_count(self, pluginId):
  1723. return 0
  1724. def get_midi_program_count(self, pluginId):
  1725. return 0
  1726. def get_custom_data_count(self, pluginId):
  1727. return 0
  1728. def get_parameter_text(self, pluginId, parameterId):
  1729. return ""
  1730. def get_program_name(self, pluginId, programId):
  1731. return ""
  1732. def get_midi_program_name(self, pluginId, midiProgramId):
  1733. return ""
  1734. def get_real_plugin_name(self, pluginId):
  1735. return ""
  1736. def get_current_program_index(self, pluginId):
  1737. return 0
  1738. def get_current_midi_program_index(self, pluginId):
  1739. return 0
  1740. def get_default_parameter_value(self, pluginId, parameterId):
  1741. return 0.0
  1742. def get_current_parameter_value(self, pluginId, parameterId):
  1743. return 0.0
  1744. def get_internal_parameter_value(self, pluginId, parameterId):
  1745. return 0.0
  1746. def get_input_peak_value(self, pluginId, isLeft):
  1747. return 0.0
  1748. def get_output_peak_value(self, pluginId, isLeft):
  1749. return 0.0
  1750. def set_option(self, pluginId, option, yesNo):
  1751. return
  1752. def set_active(self, pluginId, onOff):
  1753. return
  1754. def set_drywet(self, pluginId, value):
  1755. return
  1756. def set_volume(self, pluginId, value):
  1757. return
  1758. def set_balance_left(self, pluginId, value):
  1759. return
  1760. def set_balance_right(self, pluginId, value):
  1761. return
  1762. def set_panning(self, pluginId, value):
  1763. return
  1764. def set_ctrl_channel(self, pluginId, channel):
  1765. return
  1766. def set_parameter_value(self, pluginId, parameterId, value):
  1767. return
  1768. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  1769. return
  1770. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  1771. return
  1772. def set_program(self, pluginId, programId):
  1773. return
  1774. def set_midi_program(self, pluginId, midiProgramId):
  1775. return
  1776. def set_custom_data(self, pluginId, type_, key, value):
  1777. return
  1778. def set_chunk_data(self, pluginId, chunkData):
  1779. return
  1780. def prepare_for_save(self, pluginId):
  1781. return
  1782. def reset_parameters(self, pluginId):
  1783. return
  1784. def randomize_parameters(self, pluginId):
  1785. return
  1786. def send_midi_note(self, pluginId, channel, note, velocity):
  1787. return
  1788. def show_custom_ui(self, pluginId, yesNo):
  1789. return
  1790. def get_buffer_size(self):
  1791. return 0
  1792. def get_sample_rate(self):
  1793. return 0.0
  1794. def get_last_error(self):
  1795. return ""
  1796. def get_host_osc_url_tcp(self):
  1797. return ""
  1798. def get_host_osc_url_udp(self):
  1799. return ""
  1800. # ------------------------------------------------------------------------------------------------------------
  1801. # Carla Host object using a DLL
  1802. class CarlaHostDLL(CarlaHostMeta):
  1803. def __init__(self, libName):
  1804. CarlaHostMeta.__init__(self)
  1805. # info about this host object
  1806. self.isPlugin = False
  1807. self.lib = cdll.LoadLibrary(libName)
  1808. self.lib.carla_get_complete_license_text.argtypes = None
  1809. self.lib.carla_get_complete_license_text.restype = c_char_p
  1810. self.lib.carla_get_juce_version.argtypes = None
  1811. self.lib.carla_get_juce_version.restype = c_char_p
  1812. self.lib.carla_get_supported_file_extensions.argtypes = None
  1813. self.lib.carla_get_supported_file_extensions.restype = c_char_p
  1814. self.lib.carla_get_engine_driver_count.argtypes = None
  1815. self.lib.carla_get_engine_driver_count.restype = c_uint
  1816. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  1817. self.lib.carla_get_engine_driver_name.restype = c_char_p
  1818. self.lib.carla_get_engine_driver_device_names.argtypes = [c_uint]
  1819. self.lib.carla_get_engine_driver_device_names.restype = POINTER(c_char_p)
  1820. self.lib.carla_get_engine_driver_device_info.argtypes = [c_uint, c_char_p]
  1821. self.lib.carla_get_engine_driver_device_info.restype = POINTER(EngineDriverDeviceInfo)
  1822. self.lib.carla_get_cached_plugin_count.argtypes = [c_enum, c_char_p]
  1823. self.lib.carla_get_cached_plugin_count.restype = c_uint
  1824. self.lib.carla_get_cached_plugin_info.argtypes = [c_enum, c_uint]
  1825. self.lib.carla_get_cached_plugin_info.restype = POINTER(CarlaCachedPluginInfo)
  1826. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  1827. self.lib.carla_engine_init.restype = c_bool
  1828. self.lib.carla_engine_close.argtypes = None
  1829. self.lib.carla_engine_close.restype = c_bool
  1830. self.lib.carla_engine_idle.argtypes = None
  1831. self.lib.carla_engine_idle.restype = None
  1832. self.lib.carla_is_engine_running.argtypes = None
  1833. self.lib.carla_is_engine_running.restype = c_bool
  1834. self.lib.carla_set_engine_about_to_close.argtypes = None
  1835. self.lib.carla_set_engine_about_to_close.restype = None
  1836. self.lib.carla_set_engine_callback.argtypes = [EngineCallbackFunc, c_void_p]
  1837. self.lib.carla_set_engine_callback.restype = None
  1838. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  1839. self.lib.carla_set_engine_option.restype = None
  1840. self.lib.carla_set_file_callback.argtypes = [FileCallbackFunc, c_void_p]
  1841. self.lib.carla_set_file_callback.restype = None
  1842. self.lib.carla_load_file.argtypes = [c_char_p]
  1843. self.lib.carla_load_file.restype = c_bool
  1844. self.lib.carla_load_project.argtypes = [c_char_p]
  1845. self.lib.carla_load_project.restype = c_bool
  1846. self.lib.carla_save_project.argtypes = [c_char_p]
  1847. self.lib.carla_save_project.restype = c_bool
  1848. self.lib.carla_patchbay_connect.argtypes = [c_uint, c_uint, c_uint, c_uint]
  1849. self.lib.carla_patchbay_connect.restype = c_bool
  1850. self.lib.carla_patchbay_disconnect.argtypes = [c_uint]
  1851. self.lib.carla_patchbay_disconnect.restype = c_bool
  1852. self.lib.carla_patchbay_refresh.argtypes = [c_bool]
  1853. self.lib.carla_patchbay_refresh.restype = c_bool
  1854. self.lib.carla_transport_play.argtypes = None
  1855. self.lib.carla_transport_play.restype = None
  1856. self.lib.carla_transport_pause.argtypes = None
  1857. self.lib.carla_transport_pause.restype = None
  1858. self.lib.carla_transport_relocate.argtypes = [c_uint64]
  1859. self.lib.carla_transport_relocate.restype = None
  1860. self.lib.carla_get_current_transport_frame.argtypes = None
  1861. self.lib.carla_get_current_transport_frame.restype = c_uint64
  1862. self.lib.carla_get_transport_info.argtypes = None
  1863. self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
  1864. self.lib.carla_get_current_plugin_count.argtypes = None
  1865. self.lib.carla_get_current_plugin_count.restype = c_uint32
  1866. self.lib.carla_get_max_plugin_number.argtypes = None
  1867. self.lib.carla_get_max_plugin_number.restype = c_uint32
  1868. self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_int64, c_void_p]
  1869. self.lib.carla_add_plugin.restype = c_bool
  1870. self.lib.carla_remove_plugin.argtypes = [c_uint]
  1871. self.lib.carla_remove_plugin.restype = c_bool
  1872. self.lib.carla_remove_all_plugins.argtypes = None
  1873. self.lib.carla_remove_all_plugins.restype = c_bool
  1874. self.lib.carla_rename_plugin.argtypes = [c_uint, c_char_p]
  1875. self.lib.carla_rename_plugin.restype = c_char_p
  1876. self.lib.carla_clone_plugin.argtypes = [c_uint]
  1877. self.lib.carla_clone_plugin.restype = c_bool
  1878. self.lib.carla_replace_plugin.argtypes = [c_uint]
  1879. self.lib.carla_replace_plugin.restype = c_bool
  1880. self.lib.carla_switch_plugins.argtypes = [c_uint, c_uint]
  1881. self.lib.carla_switch_plugins.restype = c_bool
  1882. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  1883. self.lib.carla_load_plugin_state.restype = c_bool
  1884. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  1885. self.lib.carla_save_plugin_state.restype = c_bool
  1886. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  1887. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  1888. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  1889. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1890. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  1891. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  1892. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  1893. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  1894. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  1895. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  1896. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  1897. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  1898. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  1899. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  1900. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  1901. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  1902. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  1903. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  1904. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  1905. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  1906. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  1907. self.lib.carla_get_chunk_data.restype = c_char_p
  1908. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  1909. self.lib.carla_get_parameter_count.restype = c_uint32
  1910. self.lib.carla_get_program_count.argtypes = [c_uint]
  1911. self.lib.carla_get_program_count.restype = c_uint32
  1912. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  1913. self.lib.carla_get_midi_program_count.restype = c_uint32
  1914. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  1915. self.lib.carla_get_custom_data_count.restype = c_uint32
  1916. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
  1917. self.lib.carla_get_parameter_text.restype = c_char_p
  1918. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  1919. self.lib.carla_get_program_name.restype = c_char_p
  1920. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  1921. self.lib.carla_get_midi_program_name.restype = c_char_p
  1922. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  1923. self.lib.carla_get_real_plugin_name.restype = c_char_p
  1924. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  1925. self.lib.carla_get_current_program_index.restype = c_int32
  1926. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  1927. self.lib.carla_get_current_midi_program_index.restype = c_int32
  1928. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  1929. self.lib.carla_get_default_parameter_value.restype = c_float
  1930. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  1931. self.lib.carla_get_current_parameter_value.restype = c_float
  1932. self.lib.carla_get_internal_parameter_value.argtypes = [c_uint, c_int32]
  1933. self.lib.carla_get_internal_parameter_value.restype = c_float
  1934. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_bool]
  1935. self.lib.carla_get_input_peak_value.restype = c_float
  1936. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_bool]
  1937. self.lib.carla_get_output_peak_value.restype = c_float
  1938. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  1939. self.lib.carla_set_option.restype = None
  1940. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  1941. self.lib.carla_set_active.restype = None
  1942. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  1943. self.lib.carla_set_drywet.restype = None
  1944. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  1945. self.lib.carla_set_volume.restype = None
  1946. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  1947. self.lib.carla_set_balance_left.restype = None
  1948. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  1949. self.lib.carla_set_balance_right.restype = None
  1950. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  1951. self.lib.carla_set_panning.restype = None
  1952. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  1953. self.lib.carla_set_ctrl_channel.restype = None
  1954. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  1955. self.lib.carla_set_parameter_value.restype = None
  1956. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  1957. self.lib.carla_set_parameter_midi_channel.restype = None
  1958. self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
  1959. self.lib.carla_set_parameter_midi_cc.restype = None
  1960. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  1961. self.lib.carla_set_program.restype = None
  1962. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  1963. self.lib.carla_set_midi_program.restype = None
  1964. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  1965. self.lib.carla_set_custom_data.restype = None
  1966. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  1967. self.lib.carla_set_chunk_data.restype = None
  1968. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  1969. self.lib.carla_prepare_for_save.restype = None
  1970. self.lib.carla_reset_parameters.argtypes = [c_uint]
  1971. self.lib.carla_reset_parameters.restype = None
  1972. self.lib.carla_randomize_parameters.argtypes = [c_uint]
  1973. self.lib.carla_randomize_parameters.restype = None
  1974. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  1975. self.lib.carla_send_midi_note.restype = None
  1976. self.lib.carla_show_custom_ui.argtypes = [c_uint, c_bool]
  1977. self.lib.carla_show_custom_ui.restype = None
  1978. self.lib.carla_get_buffer_size.argtypes = None
  1979. self.lib.carla_get_buffer_size.restype = c_uint32
  1980. self.lib.carla_get_sample_rate.argtypes = None
  1981. self.lib.carla_get_sample_rate.restype = c_double
  1982. self.lib.carla_get_last_error.argtypes = None
  1983. self.lib.carla_get_last_error.restype = c_char_p
  1984. self.lib.carla_get_host_osc_url_tcp.argtypes = None
  1985. self.lib.carla_get_host_osc_url_tcp.restype = c_char_p
  1986. self.lib.carla_get_host_osc_url_udp.argtypes = None
  1987. self.lib.carla_get_host_osc_url_udp.restype = c_char_p
  1988. # --------------------------------------------------------------------------------------------------------
  1989. def get_complete_license_text(self):
  1990. return charPtrToString(self.lib.carla_get_complete_license_text())
  1991. def get_juce_version(self):
  1992. return charPtrToString(self.lib.carla_get_juce_version())
  1993. def get_supported_file_extensions(self):
  1994. return charPtrToString(self.lib.carla_get_supported_file_extensions())
  1995. def get_engine_driver_count(self):
  1996. return int(self.lib.carla_get_engine_driver_count())
  1997. def get_engine_driver_name(self, index):
  1998. return charPtrToString(self.lib.carla_get_engine_driver_name(index))
  1999. def get_engine_driver_device_names(self, index):
  2000. return charPtrPtrToStringList(self.lib.carla_get_engine_driver_device_names(index))
  2001. def get_engine_driver_device_info(self, index, name):
  2002. return structToDict(self.lib.carla_get_engine_driver_device_info(index, name.encode("utf-8")).contents)
  2003. def get_cached_plugin_count(self, ptype, pluginPath):
  2004. return int(self.lib.carla_get_cached_plugin_count(ptype, pluginPath.encode("utf-8")))
  2005. def get_cached_plugin_info(self, ptype, index):
  2006. return structToDict(self.lib.carla_get_cached_plugin_info(ptype, index).contents)
  2007. def engine_init(self, driverName, clientName):
  2008. return bool(self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8")))
  2009. def engine_close(self):
  2010. return bool(self.lib.carla_engine_close())
  2011. def engine_idle(self):
  2012. self.lib.carla_engine_idle()
  2013. def is_engine_running(self):
  2014. return bool(self.lib.carla_is_engine_running())
  2015. def set_engine_about_to_close(self):
  2016. self.lib.carla_set_engine_about_to_close()
  2017. def set_engine_callback(self, func):
  2018. self._engineCallback = EngineCallbackFunc(func)
  2019. self.lib.carla_set_engine_callback(self._engineCallback, None)
  2020. def set_engine_option(self, option, value, valueStr):
  2021. self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
  2022. def set_file_callback(self, func):
  2023. self._fileCallback = FileCallbackFunc(func)
  2024. self.lib.carla_set_file_callback(self._fileCallback, None)
  2025. def load_file(self, filename):
  2026. return bool(self.lib.carla_load_file(filename.encode("utf-8")))
  2027. def load_project(self, filename):
  2028. return bool(self.lib.carla_load_project(filename.encode("utf-8")))
  2029. def save_project(self, filename):
  2030. return bool(self.lib.carla_save_project(filename.encode("utf-8")))
  2031. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  2032. return bool(self.lib.carla_patchbay_connect(groupIdA, portIdA, groupIdB, portIdB))
  2033. def patchbay_disconnect(self, connectionId):
  2034. return bool(self.lib.carla_patchbay_disconnect(connectionId))
  2035. def patchbay_refresh(self, external):
  2036. return bool(self.lib.carla_patchbay_refresh(external))
  2037. def transport_play(self):
  2038. self.lib.carla_transport_play()
  2039. def transport_pause(self):
  2040. self.lib.carla_transport_pause()
  2041. def transport_relocate(self, frame):
  2042. self.lib.carla_transport_relocate(frame)
  2043. def get_current_transport_frame(self):
  2044. return int(self.lib.carla_get_current_transport_frame())
  2045. def get_transport_info(self):
  2046. return structToDict(self.lib.carla_get_transport_info().contents)
  2047. def get_current_plugin_count(self):
  2048. return int(self.lib.carla_get_current_plugin_count())
  2049. def get_max_plugin_number(self):
  2050. return int(self.lib.carla_get_max_plugin_number())
  2051. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr):
  2052. cfilename = filename.encode("utf-8") if filename else None
  2053. cname = name.encode("utf-8") if name else None
  2054. clabel = label.encode("utf-8") if label else None
  2055. return bool(self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, uniqueId, cast(extraPtr, c_void_p)))
  2056. def remove_plugin(self, pluginId):
  2057. return bool(self.lib.carla_remove_plugin(pluginId))
  2058. def remove_all_plugins(self):
  2059. return bool(self.lib.carla_remove_all_plugins())
  2060. def rename_plugin(self, pluginId, newName):
  2061. return charPtrToString(self.lib.carla_rename_plugin(pluginId, newName.encode("utf-8")))
  2062. def clone_plugin(self, pluginId):
  2063. return bool(self.lib.carla_clone_plugin(pluginId))
  2064. def replace_plugin(self, pluginId):
  2065. return bool(self.lib.carla_replace_plugin(pluginId))
  2066. def switch_plugins(self, pluginIdA, pluginIdB):
  2067. return bool(self.lib.carla_switch_plugins(pluginIdA, pluginIdB))
  2068. def load_plugin_state(self, pluginId, filename):
  2069. return bool(self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8")))
  2070. def save_plugin_state(self, pluginId, filename):
  2071. return bool(self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8")))
  2072. def get_plugin_info(self, pluginId):
  2073. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  2074. def get_audio_port_count_info(self, pluginId):
  2075. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  2076. def get_midi_port_count_info(self, pluginId):
  2077. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  2078. def get_parameter_count_info(self, pluginId):
  2079. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  2080. def get_parameter_info(self, pluginId, parameterId):
  2081. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  2082. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  2083. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  2084. def get_parameter_data(self, pluginId, parameterId):
  2085. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  2086. def get_parameter_ranges(self, pluginId, parameterId):
  2087. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  2088. def get_midi_program_data(self, pluginId, midiProgramId):
  2089. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  2090. def get_custom_data(self, pluginId, customDataId):
  2091. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  2092. def get_chunk_data(self, pluginId):
  2093. return charPtrToString(self.lib.carla_get_chunk_data(pluginId))
  2094. def get_parameter_count(self, pluginId):
  2095. return int(self.lib.carla_get_parameter_count(pluginId))
  2096. def get_program_count(self, pluginId):
  2097. return int(self.lib.carla_get_program_count(pluginId))
  2098. def get_midi_program_count(self, pluginId):
  2099. return int(self.lib.carla_get_midi_program_count(pluginId))
  2100. def get_custom_data_count(self, pluginId):
  2101. return int(self.lib.carla_get_custom_data_count(pluginId))
  2102. def get_parameter_text(self, pluginId, parameterId):
  2103. return charPtrToString(self.lib.carla_get_parameter_text(pluginId, parameterId))
  2104. def get_program_name(self, pluginId, programId):
  2105. return charPtrToString(self.lib.carla_get_program_name(pluginId, programId))
  2106. def get_midi_program_name(self, pluginId, midiProgramId):
  2107. return charPtrToString(self.lib.carla_get_midi_program_name(pluginId, midiProgramId))
  2108. def get_real_plugin_name(self, pluginId):
  2109. return charPtrToString(self.lib.carla_get_real_plugin_name(pluginId))
  2110. def get_current_program_index(self, pluginId):
  2111. return int(self.lib.carla_get_current_program_index(pluginId))
  2112. def get_current_midi_program_index(self, pluginId):
  2113. return int(self.lib.carla_get_current_midi_program_index(pluginId))
  2114. def get_default_parameter_value(self, pluginId, parameterId):
  2115. return float(self.lib.carla_get_default_parameter_value(pluginId, parameterId))
  2116. def get_current_parameter_value(self, pluginId, parameterId):
  2117. return float(self.lib.carla_get_current_parameter_value(pluginId, parameterId))
  2118. def get_internal_parameter_value(self, pluginId, parameterId):
  2119. return float(self.lib.carla_get_internal_parameter_value(pluginId, parameterId))
  2120. def get_input_peak_value(self, pluginId, isLeft):
  2121. return float(self.lib.carla_get_input_peak_value(pluginId, isLeft))
  2122. def get_output_peak_value(self, pluginId, isLeft):
  2123. return float(self.lib.carla_get_output_peak_value(pluginId, isLeft))
  2124. def set_option(self, pluginId, option, yesNo):
  2125. self.lib.carla_set_option(pluginId, option, yesNo)
  2126. def set_active(self, pluginId, onOff):
  2127. self.lib.carla_set_active(pluginId, onOff)
  2128. def set_drywet(self, pluginId, value):
  2129. self.lib.carla_set_drywet(pluginId, value)
  2130. def set_volume(self, pluginId, value):
  2131. self.lib.carla_set_volume(pluginId, value)
  2132. def set_balance_left(self, pluginId, value):
  2133. self.lib.carla_set_balance_left(pluginId, value)
  2134. def set_balance_right(self, pluginId, value):
  2135. self.lib.carla_set_balance_right(pluginId, value)
  2136. def set_panning(self, pluginId, value):
  2137. self.lib.carla_set_panning(pluginId, value)
  2138. def set_ctrl_channel(self, pluginId, channel):
  2139. self.lib.carla_set_ctrl_channel(pluginId, channel)
  2140. def set_parameter_value(self, pluginId, parameterId, value):
  2141. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  2142. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  2143. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  2144. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  2145. self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)
  2146. def set_program(self, pluginId, programId):
  2147. self.lib.carla_set_program(pluginId, programId)
  2148. def set_midi_program(self, pluginId, midiProgramId):
  2149. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  2150. def set_custom_data(self, pluginId, type_, key, value):
  2151. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  2152. def set_chunk_data(self, pluginId, chunkData):
  2153. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  2154. def prepare_for_save(self, pluginId):
  2155. self.lib.carla_prepare_for_save(pluginId)
  2156. def reset_parameters(self, pluginId):
  2157. self.lib.carla_reset_parameters(pluginId)
  2158. def randomize_parameters(self, pluginId):
  2159. self.lib.carla_randomize_parameters(pluginId)
  2160. def send_midi_note(self, pluginId, channel, note, velocity):
  2161. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  2162. def show_custom_ui(self, pluginId, yesNo):
  2163. self.lib.carla_show_custom_ui(pluginId, yesNo)
  2164. def get_buffer_size(self):
  2165. return int(self.lib.carla_get_buffer_size())
  2166. def get_sample_rate(self):
  2167. return float(self.lib.carla_get_sample_rate())
  2168. def get_last_error(self):
  2169. return charPtrToString(self.lib.carla_get_last_error())
  2170. def get_host_osc_url_tcp(self):
  2171. return charPtrToString(self.lib.carla_get_host_osc_url_tcp())
  2172. def get_host_osc_url_udp(self):
  2173. return charPtrToString(self.lib.carla_get_host_osc_url_udp())
  2174. # ------------------------------------------------------------------------------------------------------------
  2175. # Helper object for CarlaHostPlugin
  2176. class PluginStoreInfo(object):
  2177. __slots__ = [
  2178. 'pluginInfo',
  2179. 'pluginRealName',
  2180. 'internalValues',
  2181. 'audioCountInfo',
  2182. 'midiCountInfo',
  2183. 'parameterCount',
  2184. 'parameterCountInfo',
  2185. 'parameterInfo',
  2186. 'parameterData',
  2187. 'parameterRanges',
  2188. 'parameterValues',
  2189. 'programCount',
  2190. 'programCurrent',
  2191. 'programNames',
  2192. 'midiProgramCount',
  2193. 'midiProgramCurrent',
  2194. 'midiProgramData',
  2195. 'peaks'
  2196. ]
  2197. # ------------------------------------------------------------------------------------------------------------
  2198. # Carla Host object for plugins (using pipes)
  2199. class CarlaHostPlugin(CarlaHostMeta):
  2200. #class CarlaHostPlugin(CarlaHostMeta, metaclass=PyQtMetaClass):
  2201. def __init__(self):
  2202. CarlaHostMeta.__init__(self)
  2203. # info about this host object
  2204. self.isPlugin = True
  2205. self.processModeForced = True
  2206. # text data to return when requested
  2207. self.fCompleteLicenseText = ""
  2208. self.fJuceVersion = ""
  2209. self.fSupportedFileExts = ""
  2210. self.fMaxPluginNumber = 0
  2211. self.fLastError = ""
  2212. # plugin info
  2213. self.fPluginsInfo = []
  2214. # transport info
  2215. self.fTransportInfo = {
  2216. "playing": False,
  2217. "frame": 0,
  2218. "bar": 0,
  2219. "beat": 0,
  2220. "tick": 0,
  2221. "bpm": 0.0
  2222. }
  2223. # some other vars
  2224. self.fBufferSize = 0
  2225. self.fSampleRate = 0.0
  2226. # --------------------------------------------------------------------------------------------------------
  2227. # Needs to be reimplemented
  2228. @abstractmethod
  2229. def sendMsg(self, lines):
  2230. raise NotImplementedError
  2231. # internal, sets error if sendMsg failed
  2232. def sendMsgAndSetError(self, lines):
  2233. if self.sendMsg(lines):
  2234. return True
  2235. self.fLastError = "Communication error with backend"
  2236. return False
  2237. # --------------------------------------------------------------------------------------------------------
  2238. def get_complete_license_text(self):
  2239. return self.fCompleteLicenseText
  2240. def get_juce_version(self):
  2241. return self.fJuceVersion
  2242. def get_supported_file_extensions(self):
  2243. return self.fSupportedFileExts
  2244. def get_engine_driver_count(self):
  2245. return 1
  2246. def get_engine_driver_name(self, index):
  2247. return "Plugin"
  2248. def get_engine_driver_device_names(self, index):
  2249. return []
  2250. def get_engine_driver_device_info(self, index, name):
  2251. return PyEngineDriverDeviceInfo
  2252. def get_cached_plugin_count(self, ptype, pluginPath):
  2253. return 0
  2254. def get_cached_plugin_info(self, ptype, index):
  2255. return PyCarlaCachedPluginInfo
  2256. def set_engine_callback(self, func):
  2257. return # TODO
  2258. def set_engine_option(self, option, value, valueStr):
  2259. self.sendMsg(["set_engine_option", option, value, valueStr])
  2260. def set_file_callback(self, func):
  2261. return # TODO
  2262. def load_file(self, filename):
  2263. return self.sendMsgAndSetError(["load_file", filename])
  2264. def load_project(self, filename):
  2265. return self.sendMsgAndSetError(["load_project", filename])
  2266. def save_project(self, filename):
  2267. return self.sendMsgAndSetError(["save_project", filename])
  2268. def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB):
  2269. return self.sendMsgAndSetError(["patchbay_connect", groupIdA, portIdA, groupIdB, portIdB])
  2270. def patchbay_disconnect(self, connectionId):
  2271. return self.sendMsgAndSetError(["patchbay_disconnect", connectionId])
  2272. def patchbay_refresh(self, external):
  2273. # don't send external param, never used in plugins
  2274. return self.sendMsgAndSetError(["patchbay_refresh"])
  2275. def transport_play(self):
  2276. self.sendMsg(["transport_play"])
  2277. def transport_pause(self):
  2278. self.sendMsg(["transport_pause"])
  2279. def transport_relocate(self, frame):
  2280. self.sendMsg(["transport_relocate"])
  2281. def get_current_transport_frame(self):
  2282. return self.fTransportInfo['frame']
  2283. def get_transport_info(self):
  2284. return self.fTransportInfo
  2285. def get_current_plugin_count(self):
  2286. return len(self.fPluginsInfo)
  2287. def get_max_plugin_number(self):
  2288. return self.fMaxPluginNumber
  2289. def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr):
  2290. return self.sendMsgAndSetError(["add_plugin", btype, ptype, filename, name, label, uniqueId])
  2291. def remove_plugin(self, pluginId):
  2292. return self.sendMsgAndSetError(["remove_plugin", pluginId])
  2293. def remove_all_plugins(self):
  2294. return self.sendMsgAndSetError(["remove_all_plugins"])
  2295. def rename_plugin(self, pluginId, newName):
  2296. if self.sendMsg(["rename_plugin", pluginId, newName]):
  2297. return newName
  2298. self.fLastError = "Communication error with backend"
  2299. return ""
  2300. def clone_plugin(self, pluginId):
  2301. return self.sendMsgAndSetError(["clone_plugin", pluginId])
  2302. def replace_plugin(self, pluginId):
  2303. return self.sendMsgAndSetError(["replace_plugin", pluginId])
  2304. def switch_plugins(self, pluginIdA, pluginIdB):
  2305. return self.sendMsgAndSetError(["switch_plugins", pluginIdA, pluginIdB])
  2306. def load_plugin_state(self, pluginId, filename):
  2307. return self.sendMsgAndSetError(["load_plugin_state", pluginId, filename])
  2308. def save_plugin_state(self, pluginId, filename):
  2309. return self.sendMsgAndSetError(["save_plugin_state", pluginId, filename])
  2310. def get_plugin_info(self, pluginId):
  2311. return self.fPluginsInfo[pluginId].pluginInfo
  2312. def get_audio_port_count_info(self, pluginId):
  2313. return self.fPluginsInfo[pluginId].audioCountInfo
  2314. def get_midi_port_count_info(self, pluginId):
  2315. return self.fPluginsInfo[pluginId].midiCountInfo
  2316. def get_parameter_count_info(self, pluginId):
  2317. return self.fPluginsInfo[pluginId].parameterCountInfo
  2318. def get_parameter_info(self, pluginId, parameterId):
  2319. return self.fPluginsInfo[pluginId].parameterInfo[parameterId]
  2320. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  2321. return PyCarlaScalePointInfo
  2322. def get_parameter_data(self, pluginId, parameterId):
  2323. return self.fPluginsInfo[pluginId].parameterData[parameterId]
  2324. def get_parameter_ranges(self, pluginId, parameterId):
  2325. return self.fPluginsInfo[pluginId].parameterRanges[parameterId]
  2326. def get_midi_program_data(self, pluginId, midiProgramId):
  2327. return self.fPluginsInfo[pluginId].midiProgramData[midiProgramId]
  2328. def get_custom_data(self, pluginId, customDataId):
  2329. return PyCustomData
  2330. def get_chunk_data(self, pluginId):
  2331. return ""
  2332. def get_parameter_count(self, pluginId):
  2333. return self.fPluginsInfo[pluginId].parameterCount
  2334. def get_program_count(self, pluginId):
  2335. return self.fPluginsInfo[pluginId].programCount
  2336. def get_midi_program_count(self, pluginId):
  2337. return self.fPluginsInfo[pluginId].midiProgramCount
  2338. def get_custom_data_count(self, pluginId):
  2339. return 0
  2340. def get_parameter_text(self, pluginId, parameterId):
  2341. return ""
  2342. def get_program_name(self, pluginId, programId):
  2343. return self.fPluginsInfo[pluginId].programNames[programId]
  2344. def get_midi_program_name(self, pluginId, midiProgramId):
  2345. return self.fPluginsInfo[pluginId].midiProgramData[midiProgramId]['label']
  2346. def get_real_plugin_name(self, pluginId):
  2347. return self.fPluginsInfo[pluginId].pluginRealName
  2348. def get_current_program_index(self, pluginId):
  2349. return self.fPluginsInfo[pluginId].programCurrent
  2350. def get_current_midi_program_index(self, pluginId):
  2351. return self.fPluginsInfo[pluginId].midiProgramCurrent
  2352. def get_default_parameter_value(self, pluginId, parameterId):
  2353. return self.fPluginsInfo[pluginId].parameterRanges[parameterId]['def']
  2354. def get_current_parameter_value(self, pluginId, parameterId):
  2355. return self.fPluginsInfo[pluginId].parameterValues[parameterId]
  2356. def get_internal_parameter_value(self, pluginId, parameterId):
  2357. if parameterId == PARAMETER_NULL or parameterId <= PARAMETER_MAX:
  2358. return 0.0
  2359. if parameterId < 0:
  2360. return self.fPluginsInfo[pluginId].internalValues[abs(parameterId)-2]
  2361. return self.fPluginsInfo[pluginId].parameterValues[parameterId]
  2362. def get_input_peak_value(self, pluginId, isLeft):
  2363. return self.fPluginsInfo[pluginId].peaks[0 if isLeft else 1]
  2364. def get_output_peak_value(self, pluginId, isLeft):
  2365. return self.fPluginsInfo[pluginId].peaks[2 if isLeft else 3]
  2366. def set_option(self, pluginId, option, yesNo):
  2367. self.sendMsg(["set_option", pluginId, option, yesNo])
  2368. def set_active(self, pluginId, onOff):
  2369. self.sendMsg(["set_active", pluginId, onOff])
  2370. def set_drywet(self, pluginId, value):
  2371. self.sendMsg(["set_drywet", pluginId, value])
  2372. def set_volume(self, pluginId, value):
  2373. self.sendMsg(["set_volume", pluginId, value])
  2374. def set_balance_left(self, pluginId, value):
  2375. self.sendMsg(["set_balance_left", pluginId, value])
  2376. def set_balance_right(self, pluginId, value):
  2377. self.sendMsg(["set_balance_right", pluginId, value])
  2378. def set_panning(self, pluginId, value):
  2379. self.sendMsg(["set_panning", pluginId, value])
  2380. def set_ctrl_channel(self, pluginId, channel):
  2381. self.sendMsg(["set_ctrl_channel", pluginId, channel])
  2382. def set_parameter_value(self, pluginId, parameterId, value):
  2383. self.sendMsg(["set_parameter_value", pluginId, parameterId, value])
  2384. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  2385. self.sendMsg(["set_parameter_midi_channel", pluginId, parameterId, channel])
  2386. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  2387. self.sendMsg(["set_parameter_midi_cc", pluginId, parameterId, cc])
  2388. def set_program(self, pluginId, programId):
  2389. self.sendMsg(["set_program", pluginId, programId])
  2390. def set_midi_program(self, pluginId, midiProgramId):
  2391. self.sendMsg(["set_midi_program", pluginId, midiProgramId])
  2392. def set_custom_data(self, pluginId, type_, key, value):
  2393. self.sendMsg(["set_custom_data", pluginId, type_, key, value])
  2394. def set_chunk_data(self, pluginId, chunkData):
  2395. self.sendMsg(["set_chunk_data", pluginId, chunkData])
  2396. def prepare_for_save(self, pluginId):
  2397. self.sendMsg(["prepare_for_save", pluginId])
  2398. def reset_parameters(self, pluginId):
  2399. self.sendMsg(["reset_parameters", pluginId])
  2400. def randomize_parameters(self, pluginId):
  2401. self.sendMsg(["randomize_parameters", pluginId])
  2402. def send_midi_note(self, pluginId, channel, note, velocity):
  2403. self.sendMsg(["send_midi_note", pluginId, channel, note, velocity])
  2404. def show_custom_ui(self, pluginId, yesNo):
  2405. self.sendMsg(["show_custom_ui", pluginId, yesNo])
  2406. def get_buffer_size(self):
  2407. return self.fBufferSize
  2408. def get_sample_rate(self):
  2409. return self.fSampleRate
  2410. def get_last_error(self):
  2411. return self.fLastError
  2412. def get_host_osc_url_tcp(self):
  2413. return ""
  2414. def get_host_osc_url_udp(self):
  2415. return ""
  2416. # --------------------------------------------------------------------------------------------------------
  2417. def _set_info(self, license, juceversion, fileexts, maxnum):
  2418. self.fCompleteLicenseText = license
  2419. self.fJuceVersion = juceversion
  2420. self.fSupportedFileExts = fileexts
  2421. self.fMaxPluginNumber = maxnum
  2422. def _set_transport(self, playing, frame, bar, beat, tick, bpm):
  2423. self.fTransportInfo = {
  2424. "playing": playing,
  2425. "frame": frame,
  2426. "bar": bar,
  2427. "beat": beat,
  2428. "tick": tick,
  2429. "bpm": bpm
  2430. }
  2431. def _add(self, pluginId):
  2432. if len(self.fPluginsInfo) != pluginId:
  2433. return
  2434. info = PluginStoreInfo()
  2435. info.pluginInfo = PyCarlaPluginInfo
  2436. info.pluginRealName = ""
  2437. info.internalValues = [0.0, 1.0, 1.0, -1.0, 1.0, 0.0, -1.0]
  2438. info.audioCountInfo = PyCarlaPortCountInfo
  2439. info.midiCountInfo = PyCarlaPortCountInfo
  2440. info.parameterCount = 0
  2441. info.parameterCountInfo = PyCarlaPortCountInfo
  2442. info.parameterInfo = []
  2443. info.parameterData = []
  2444. info.parameterRanges = []
  2445. info.parameterValues = []
  2446. info.programCount = 0
  2447. info.programCurrent = -1
  2448. info.programNames = []
  2449. info.midiProgramCount = 0
  2450. info.midiProgramCurrent = -1
  2451. info.midiProgramData = []
  2452. info.peaks = [0.0, 0.0, 0.0, 0.0]
  2453. self.fPluginsInfo.append(info)
  2454. def _set_pluginInfo(self, pluginId, info):
  2455. self.fPluginsInfo[pluginId].pluginInfo = info
  2456. def _set_pluginName(self, pluginId, name):
  2457. self.fPluginsInfo[pluginId].pluginInfo['name'] = name
  2458. def _set_pluginRealName(self, pluginId, realName):
  2459. self.fPluginsInfo[pluginId].pluginRealName = realName
  2460. def _set_internalValue(self, pluginId, paramIndex, value):
  2461. if pluginId < len(self.fPluginsInfo) and PARAMETER_NULL > paramIndex > PARAMETER_MAX:
  2462. self.fPluginsInfo[pluginId].internalValues[abs(paramIndex)-2] = float(value)
  2463. def _set_audioCountInfo(self, pluginId, info):
  2464. self.fPluginsInfo[pluginId].audioCountInfo = info
  2465. def _set_midiCountInfo(self, pluginId, info):
  2466. self.fPluginsInfo[pluginId].midiCountInfo = info
  2467. def _set_parameterCountInfo(self, pluginId, count, info):
  2468. self.fPluginsInfo[pluginId].parameterCount = count
  2469. self.fPluginsInfo[pluginId].parameterCountInfo = info
  2470. # clear
  2471. self.fPluginsInfo[pluginId].parameterInfo = []
  2472. self.fPluginsInfo[pluginId].parameterData = []
  2473. self.fPluginsInfo[pluginId].parameterRanges = []
  2474. self.fPluginsInfo[pluginId].parameterValues = []
  2475. # add placeholders
  2476. for x in range(count):
  2477. self.fPluginsInfo[pluginId].parameterInfo.append(PyCarlaParameterInfo)
  2478. self.fPluginsInfo[pluginId].parameterData.append(PyParameterData)
  2479. self.fPluginsInfo[pluginId].parameterRanges.append(PyParameterRanges)
  2480. self.fPluginsInfo[pluginId].parameterValues.append(0.0)
  2481. def _set_programCount(self, pluginId, count):
  2482. self.fPluginsInfo[pluginId].programCount = count
  2483. # clear
  2484. self.fPluginsInfo[pluginId].programNames = []
  2485. # add placeholders
  2486. for x in range(count):
  2487. self.fPluginsInfo[pluginId].programNames.append("")
  2488. def _set_midiProgramCount(self, pluginId, count):
  2489. self.fPluginsInfo[pluginId].midiProgramCount = count
  2490. # clear
  2491. self.fPluginsInfo[pluginId].midiProgramData = []
  2492. # add placeholders
  2493. for x in range(count):
  2494. self.fPluginsInfo[pluginId].midiProgramData.append(PyMidiProgramData)
  2495. def _set_parameterInfo(self, pluginId, paramIndex, info):
  2496. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2497. self.fPluginsInfo[pluginId].parameterInfo[paramIndex] = info
  2498. def _set_parameterData(self, pluginId, paramIndex, data):
  2499. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2500. self.fPluginsInfo[pluginId].parameterData[paramIndex] = data
  2501. def _set_parameterRanges(self, pluginId, paramIndex, ranges):
  2502. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2503. self.fPluginsInfo[pluginId].parameterRanges[paramIndex] = ranges
  2504. def _set_parameterValue(self, pluginId, paramIndex, value):
  2505. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2506. self.fPluginsInfo[pluginId].parameterValues[paramIndex] = value
  2507. def _set_parameterDefault(self, pluginId, paramIndex, value):
  2508. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2509. self.fPluginsInfo[pluginId].parameterRanges[paramIndex]['def'] = value
  2510. def _set_parameterMidiChannel(self, pluginId, paramIndex, channel):
  2511. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2512. self.fPluginsInfo[pluginId].parameterData[paramIndex]['midiChannel'] = channel
  2513. def _set_parameterMidiCC(self, pluginId, paramIndex, cc):
  2514. if pluginId < len(self.fPluginsInfo) and paramIndex < self.fPluginsInfo[pluginId].parameterCount:
  2515. self.fPluginsInfo[pluginId].parameterData[paramIndex]['midiCC'] = cc
  2516. def _set_currentProgram(self, pluginId, pIndex):
  2517. self.fPluginsInfo[pluginId].programCurrent = pIndex
  2518. def _set_currentMidiProgram(self, pluginId, mpIndex):
  2519. self.fPluginsInfo[pluginId].midiProgramCurrent = mpIndex
  2520. def _set_programName(self, pluginId, pIndex, name):
  2521. if pIndex < self.fPluginsInfo[pluginId].programCount:
  2522. self.fPluginsInfo[pluginId].programNames[pIndex] = name
  2523. def _set_midiProgramData(self, pluginId, mpIndex, data):
  2524. if mpIndex < self.fPluginsInfo[pluginId].midiProgramCount:
  2525. self.fPluginsInfo[pluginId].midiProgramData[mpIndex] = data
  2526. def _set_peaks(self, pluginId, in1, in2, out1, out2):
  2527. self.fPluginsInfo[pluginId].peaks = [in1, in2, out1, out2]
  2528. # ------------------------------------------------------------------------------------------------------------