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

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