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

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