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

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # Carla Backend code
  4. # Copyright (C) 2011-2013 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 GPL.txt file
  17. # ------------------------------------------------------------------------------------------------------------
  18. # Imports (Global)
  19. from ctypes import *
  20. # ------------------------------------------------------------------------------------------------------------
  21. # Imports (Custom)
  22. from carla_shared import *
  23. # ------------------------------------------------------------------------------------------------------------
  24. # Convert a ctypes struct into a python dict
  25. def structToDict(struct):
  26. return dict((attr, getattr(struct, attr)) for attr, value in struct._fields_)
  27. # ------------------------------------------------------------------------------------------------------------
  28. # Backend C++ -> Python variables
  29. c_enum = c_int
  30. c_nullptr = None
  31. c_uintptr = c_uint64 if kIs64bit else c_uint32
  32. CallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_float, c_char_p)
  33. class ParameterData(Structure):
  34. _fields_ = [
  35. ("type", c_enum),
  36. ("index", c_int32),
  37. ("rindex", c_int32),
  38. ("hints", c_uint32),
  39. ("midiChannel", c_uint8),
  40. ("midiCC", c_int16)
  41. ]
  42. class ParameterRanges(Structure):
  43. _fields_ = [
  44. ("def", c_float),
  45. ("min", c_float),
  46. ("max", c_float),
  47. ("step", c_float),
  48. ("stepSmall", c_float),
  49. ("stepLarge", c_float)
  50. ]
  51. class MidiProgramData(Structure):
  52. _fields_ = [
  53. ("bank", c_uint32),
  54. ("program", c_uint32),
  55. ("name", c_char_p)
  56. ]
  57. class CustomData(Structure):
  58. _fields_ = [
  59. ("type", c_char_p),
  60. ("key", c_char_p),
  61. ("value", c_char_p)
  62. ]
  63. # ------------------------------------------------------------------------------------------------------------
  64. # Standalone C++ -> Python variables
  65. class CarlaPluginInfo(Structure):
  66. _fields_ = [
  67. ("type", c_enum),
  68. ("category", c_enum),
  69. ("hints", c_uint),
  70. ("optionsAvailable", c_uint),
  71. ("optionsEnabled", c_uint),
  72. ("binary", c_char_p),
  73. ("name", c_char_p),
  74. ("label", c_char_p),
  75. ("maker", c_char_p),
  76. ("copyright", c_char_p),
  77. ("uniqueId", c_long),
  78. ("latency", c_uint32)
  79. ]
  80. class CarlaNativePluginInfo(Structure):
  81. _fields_ = [
  82. ("category", c_enum),
  83. ("hints", c_uint),
  84. ("audioIns", c_uint32),
  85. ("audioOuts", c_uint32),
  86. ("midiIns", c_uint32),
  87. ("midiOuts", c_uint32),
  88. ("parameterIns", c_uint32),
  89. ("parameterOuts", c_uint32),
  90. ("name", c_char_p),
  91. ("label", c_char_p),
  92. ("maker", c_char_p),
  93. ("copyright", c_char_p)
  94. ]
  95. class CarlaPortCountInfo(Structure):
  96. _fields_ = [
  97. ("ins", c_uint32),
  98. ("outs", c_uint32),
  99. ("total", c_uint32)
  100. ]
  101. class CarlaParameterInfo(Structure):
  102. _fields_ = [
  103. ("name", c_char_p),
  104. ("symbol", c_char_p),
  105. ("unit", c_char_p),
  106. ("scalePointCount", c_uint32)
  107. ]
  108. class CarlaScalePointInfo(Structure):
  109. _fields_ = [
  110. ("value", c_float),
  111. ("label", c_char_p)
  112. ]
  113. # ------------------------------------------------------------------------------------------------------------
  114. # Standalone Python object
  115. class Host(object):
  116. def __init__(self, lib_prefix_arg):
  117. object.__init__(self)
  118. global carla_library_path
  119. if lib_prefix_arg:
  120. carla_library_path = os.path.join(lib_prefix_arg, "lib", "carla", carla_libname)
  121. if not carla_library_path:
  122. self.lib = None
  123. return
  124. self.lib = cdll.LoadLibrary(carla_library_path)
  125. self.lib.carla_get_extended_license_text.argtypes = None
  126. self.lib.carla_get_extended_license_text.restype = c_char_p
  127. self.lib.carla_get_engine_driver_count.argtypes = None
  128. self.lib.carla_get_engine_driver_count.restype = c_uint
  129. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  130. self.lib.carla_get_engine_driver_name.restype = c_char_p
  131. self.lib.carla_get_internal_plugin_count.argtypes = None
  132. self.lib.carla_get_internal_plugin_count.restype = c_uint
  133. self.lib.carla_get_internal_plugin_info.argtypes = [c_uint]
  134. self.lib.carla_get_internal_plugin_info.restype = POINTER(CarlaNativePluginInfo)
  135. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  136. self.lib.carla_engine_init.restype = c_bool
  137. self.lib.carla_engine_close.argtypes = None
  138. self.lib.carla_engine_close.restype = c_bool
  139. self.lib.carla_engine_idle.argtypes = None
  140. self.lib.carla_engine_idle.restype = None
  141. self.lib.carla_is_engine_running.argtypes = None
  142. self.lib.carla_is_engine_running.restype = c_bool
  143. self.lib.carla_set_engine_about_to_close.argtypes = None
  144. self.lib.carla_set_engine_about_to_close.restype = None
  145. self.lib.carla_set_engine_callback.argtypes = [CallbackFunc, c_void_p]
  146. self.lib.carla_set_engine_callback.restype = None
  147. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  148. self.lib.carla_set_engine_option.restype = None
  149. self.lib.carla_load_project.argtypes = [c_char_p]
  150. self.lib.carla_load_project.restype = c_bool
  151. self.lib.carla_save_project.argtypes = [c_char_p]
  152. self.lib.carla_save_project.restype = c_bool
  153. self.lib.carla_patchbay_connect.argtypes = [c_int, c_int]
  154. self.lib.carla_patchbay_connect.restype = None
  155. self.lib.carla_patchbay_disconnect.argtypes = [c_int]
  156. self.lib.carla_patchbay_disconnect.restype = None
  157. self.lib.carla_transport_play.argtypes = None
  158. self.lib.carla_transport_play.restype = None
  159. self.lib.carla_transport_pause.argtypes = None
  160. self.lib.carla_transport_pause.restype = None
  161. self.lib.carla_transport_relocate.argtypes = [c_uint32]
  162. self.lib.carla_transport_relocate.restype = None
  163. self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_void_p]
  164. self.lib.carla_add_plugin.restype = c_bool
  165. self.lib.carla_remove_plugin.argtypes = [c_uint]
  166. self.lib.carla_remove_plugin.restype = c_bool
  167. self.lib.carla_remove_all_plugins.argtypes = None
  168. self.lib.carla_remove_all_plugins.restype = None
  169. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  170. self.lib.carla_load_plugin_state.restype = c_bool
  171. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  172. self.lib.carla_save_plugin_state.restype = c_bool
  173. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  174. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  175. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  176. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  177. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  178. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  179. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  180. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  181. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  182. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  183. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  184. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  185. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  186. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  187. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  188. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  189. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  190. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  191. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  192. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  193. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  194. self.lib.carla_get_chunk_data.restype = c_char_p
  195. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  196. self.lib.carla_get_parameter_count.restype = c_uint32
  197. self.lib.carla_get_program_count.argtypes = [c_uint]
  198. self.lib.carla_get_program_count.restype = c_uint32
  199. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  200. self.lib.carla_get_midi_program_count.restype = c_uint32
  201. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  202. self.lib.carla_get_custom_data_count.restype = c_uint32
  203. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
  204. self.lib.carla_get_parameter_text.restype = c_char_p
  205. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  206. self.lib.carla_get_program_name.restype = c_char_p
  207. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  208. self.lib.carla_get_midi_program_name.restype = c_char_p
  209. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  210. self.lib.carla_get_real_plugin_name.restype = c_char_p
  211. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  212. self.lib.carla_get_current_program_index.restype = c_int32
  213. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  214. self.lib.carla_get_current_midi_program_index.restype = c_int32
  215. # TODO - consider removal
  216. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  217. self.lib.carla_get_default_parameter_value.restype = c_float
  218. # TODO - consider removal
  219. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  220. self.lib.carla_get_current_parameter_value.restype = c_float
  221. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_ushort]
  222. self.lib.carla_get_input_peak_value.restype = c_float
  223. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_ushort]
  224. self.lib.carla_get_output_peak_value.restype = c_float
  225. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  226. self.lib.carla_set_option.restype = None
  227. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  228. self.lib.carla_set_active.restype = None
  229. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  230. self.lib.carla_set_drywet.restype = None
  231. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  232. self.lib.carla_set_volume.restype = None
  233. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  234. self.lib.carla_set_balance_left.restype = None
  235. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  236. self.lib.carla_set_balance_right.restype = None
  237. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  238. self.lib.carla_set_panning.restype = None
  239. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  240. self.lib.carla_set_ctrl_channel.restype = None
  241. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  242. self.lib.carla_set_parameter_value.restype = None
  243. self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
  244. self.lib.carla_set_parameter_midi_cc.restype = None
  245. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  246. self.lib.carla_set_parameter_midi_channel.restype = None
  247. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  248. self.lib.carla_set_program.restype = None
  249. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  250. self.lib.carla_set_midi_program.restype = None
  251. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  252. self.lib.carla_set_custom_data.restype = None
  253. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  254. self.lib.carla_set_chunk_data.restype = None
  255. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  256. self.lib.carla_prepare_for_save.restype = None
  257. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  258. self.lib.carla_send_midi_note.restype = None
  259. self.lib.carla_show_gui.argtypes = [c_uint, c_bool]
  260. self.lib.carla_show_gui.restype = None
  261. self.lib.carla_get_buffer_size.argtypes = None
  262. self.lib.carla_get_buffer_size.restype = c_uint32
  263. self.lib.carla_get_sample_rate.argtypes = None
  264. self.lib.carla_get_sample_rate.restype = c_double
  265. self.lib.carla_get_last_error.argtypes = None
  266. self.lib.carla_get_last_error.restype = c_char_p
  267. self.lib.carla_get_host_osc_url.argtypes = None
  268. self.lib.carla_get_host_osc_url.restype = c_char_p
  269. #self.lib.nsm_announce.argtypes = [c_char_p, c_int]
  270. #self.lib.nsm_announce.restype = None
  271. #self.lib.nsm_reply_open.argtypes = None
  272. #self.lib.nsm_reply_open.restype = None
  273. #self.lib.nsm_reply_save.argtypes = None
  274. #self.lib.nsm_reply_save.restype = None
  275. def get_extended_license_text(self):
  276. return self.lib.carla_get_extended_license_text()
  277. def get_engine_driver_count(self):
  278. return self.lib.carla_get_engine_driver_count()
  279. def get_engine_driver_name(self, index):
  280. return self.lib.carla_get_engine_driver_name(index)
  281. def get_internal_plugin_count(self):
  282. return self.lib.carla_get_internal_plugin_count()
  283. def get_internal_plugin_info(self, internalPluginId):
  284. return structToDict(self.lib.carla_get_internal_plugin_info(internalPluginId).contents)
  285. def engine_init(self, driverName, clientName):
  286. return self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8"))
  287. def engine_close(self):
  288. return self.lib.carla_engine_close()
  289. def engine_idle(self):
  290. self.lib.carla_engine_idle()
  291. def is_engine_running(self):
  292. return self.lib.carla_is_engine_running()
  293. def set_engine_about_to_close(self):
  294. self.lib.carla_set_engine_about_to_close()
  295. def set_engine_callback(self, func):
  296. self._callback = CallbackFunc(func)
  297. self.lib.carla_set_engine_callback(self._callback, c_nullptr)
  298. def set_engine_option(self, option, value, valueStr):
  299. self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
  300. def load_project(self, filename):
  301. return self.lib.carla_load_project(filename.encode("utf-8"))
  302. def save_project(self, filename):
  303. return self.lib.carla_save_project(filename.encode("utf-8"))
  304. def patchbay_connect(self, portIdA, portIdB):
  305. self.lib.carla_patchbay_connect(portIdA, portIdB)
  306. def patchbay_disconnect(self, connectionId):
  307. self.lib.carla_patchbay_disconnect(connectionId)
  308. def transport_play(self):
  309. self.lib.carla_transport_play()
  310. def transport_pause(self):
  311. self.lib.carla_transport_pause()
  312. def transport_relocate(self, frames):
  313. self.lib.carla_transport_relocate(frames)
  314. def add_plugin(self, btype, ptype, filename, name, label, extraStuff):
  315. cfilename = filename.encode("utf-8") if filename else c_nullptr
  316. cname = name.encode("utf-8") if name else c_nullptr
  317. clabel = label.encode("utf-8") if label else c_nullptr
  318. return self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, cast(extraStuff, c_void_p))
  319. def remove_plugin(self, pluginId):
  320. return self.lib.carla_remove_plugin(pluginId)
  321. def remove_all_plugins(self):
  322. self.lib.carla_remove_all_plugins()
  323. def load_plugin_state(self, pluginId, filename):
  324. return self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8"))
  325. def save_plugin_state(self, pluginId, filename):
  326. return self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8"))
  327. def get_plugin_info(self, pluginId):
  328. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  329. def get_audio_port_count_info(self, pluginId):
  330. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  331. def get_midi_port_count_info(self, pluginId):
  332. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  333. def get_parameter_count_info(self, pluginId):
  334. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  335. def get_parameter_info(self, pluginId, parameterId):
  336. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  337. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  338. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  339. def get_parameter_data(self, pluginId, parameterId):
  340. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  341. def get_parameter_ranges(self, pluginId, parameterId):
  342. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  343. def get_midi_program_data(self, pluginId, midiProgramId):
  344. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  345. def get_custom_data(self, pluginId, customDataId):
  346. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  347. def get_chunk_data(self, pluginId):
  348. return self.lib.carla_get_chunk_data(pluginId)
  349. def get_parameter_count(self, pluginId):
  350. return self.lib.carla_get_parameter_count(pluginId)
  351. def get_program_count(self, pluginId):
  352. return self.lib.carla_get_program_count(pluginId)
  353. def get_midi_program_count(self, pluginId):
  354. return self.lib.carla_get_midi_program_count(pluginId)
  355. def get_custom_data_count(self, pluginId):
  356. return self.lib.carla_get_custom_data_count(pluginId)
  357. def get_parameter_text(self, pluginId, parameterId):
  358. return self.lib.carla_get_parameter_text(pluginId, parameterId)
  359. def get_program_name(self, pluginId, programId):
  360. return self.lib.carla_get_program_name(pluginId, programId)
  361. def get_midi_program_name(self, pluginId, midiProgramId):
  362. return self.lib.carla_get_midi_program_name(pluginId, midiProgramId)
  363. def get_real_plugin_name(self, pluginId):
  364. return self.lib.carla_get_real_plugin_name(pluginId)
  365. def get_current_program_index(self, pluginId):
  366. return self.lib.carla_get_current_program_index(pluginId)
  367. def get_current_midi_program_index(self, pluginId):
  368. return self.lib.carla_get_current_midi_program_index(pluginId)
  369. def get_default_parameter_value(self, pluginId, parameterId):
  370. return self.lib.carla_get_default_parameter_value(pluginId, parameterId)
  371. def get_current_parameter_value(self, pluginId, parameterId):
  372. return self.lib.carla_get_current_parameter_value(pluginId, parameterId)
  373. def get_input_peak_value(self, pluginId, portId):
  374. return self.lib.carla_get_input_peak_value(pluginId, portId)
  375. def get_output_peak_value(self, pluginId, portId):
  376. return self.lib.carla_get_output_peak_value(pluginId, portId)
  377. def set_option(self, pluginId, option, yesNo):
  378. self.lib.carla_set_option(pluginId, option, yesNo)
  379. def set_active(self, pluginId, onOff):
  380. self.lib.carla_set_active(pluginId, onOff)
  381. def set_drywet(self, pluginId, value):
  382. self.lib.carla_set_drywet(pluginId, value)
  383. def set_volume(self, pluginId, value):
  384. self.lib.carla_set_volume(pluginId, value)
  385. def set_balance_left(self, pluginId, value):
  386. self.lib.carla_set_balance_left(pluginId, value)
  387. def set_balance_right(self, pluginId, value):
  388. self.lib.carla_set_balance_right(pluginId, value)
  389. def set_panning(self, pluginId, value):
  390. self.lib.carla_set_panning(pluginId, value)
  391. def set_ctrl_channel(self, pluginId, channel):
  392. self.lib.carla_set_ctrl_channel(pluginId, channel)
  393. def set_parameter_value(self, pluginId, parameterId, value):
  394. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  395. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  396. self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)
  397. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  398. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  399. def set_program(self, pluginId, programId):
  400. self.lib.carla_set_program(pluginId, programId)
  401. def set_midi_program(self, pluginId, midiProgramId):
  402. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  403. def set_custom_data(self, pluginId, type_, key, value):
  404. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  405. def set_chunk_data(self, pluginId, chunkData):
  406. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  407. def prepare_for_save(self, pluginId):
  408. self.lib.carla_prepare_for_save(pluginId)
  409. def send_midi_note(self, pluginId, channel, note, velocity):
  410. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  411. def show_gui(self, pluginId, yesNo):
  412. self.lib.carla_show_gui(pluginId, yesNo)
  413. def get_last_error(self):
  414. return self.lib.carla_get_last_error()
  415. def get_host_osc_url(self):
  416. return self.lib.carla_get_host_osc_url()
  417. def get_buffer_size(self):
  418. return self.lib.carla_get_buffer_size()
  419. def get_sample_rate(self):
  420. return self.lib.carla_get_sample_rate()
  421. #def nsm_announce(self, url, pid):
  422. #self.lib.nsm_announce(url.encode("utf-8"), pid)
  423. #def nsm_reply_open(self):
  424. #self.lib.nsm_reply_open()
  425. #def nsm_reply_save(self):
  426. #self.lib.nsm_reply_save()
  427. #Carla.host = Host(None)
  428. ## Test available drivers
  429. #driverCount = Carla.host.get_engine_driver_count()
  430. #driverList = []
  431. #for i in range(driverCount):
  432. #driver = cString(Carla.host.get_engine_driver_name(i))
  433. #if driver:
  434. #driverList.append(driver)
  435. #print(i, driver)
  436. ## Test available internal plugins
  437. #pluginCount = Carla.host.get_internal_plugin_count()
  438. #for i in range(pluginCount):
  439. #plugin = Carla.host.get_internal_plugin_info(i)
  440. #print(plugin)