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.

652 lines
24KB

  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. class CarlaTransportInfo(Structure):
  114. _fields_ = [
  115. ("playing", c_bool),
  116. ("frame", c_uint32),
  117. ("bar", c_int32),
  118. ("beat", c_int32),
  119. ("tick", c_int32),
  120. ("bpm", c_double)
  121. ]
  122. # ------------------------------------------------------------------------------------------------------------
  123. # Standalone Python object
  124. class Host(object):
  125. def __init__(self, lib_prefix_arg):
  126. object.__init__(self)
  127. global carla_library_path
  128. if lib_prefix_arg:
  129. carla_library_path = os.path.join(lib_prefix_arg, "lib", "carla", carla_libname)
  130. if not carla_library_path:
  131. self.lib = None
  132. return
  133. self.lib = cdll.LoadLibrary(carla_library_path)
  134. self.lib.carla_get_extended_license_text.argtypes = None
  135. self.lib.carla_get_extended_license_text.restype = c_char_p
  136. self.lib.carla_get_supported_file_types.argtypes = None
  137. self.lib.carla_get_supported_file_types.restype = c_char_p
  138. self.lib.carla_get_engine_driver_count.argtypes = None
  139. self.lib.carla_get_engine_driver_count.restype = c_uint
  140. self.lib.carla_get_engine_driver_name.argtypes = [c_uint]
  141. self.lib.carla_get_engine_driver_name.restype = c_char_p
  142. self.lib.carla_get_internal_plugin_count.argtypes = None
  143. self.lib.carla_get_internal_plugin_count.restype = c_uint
  144. self.lib.carla_get_internal_plugin_info.argtypes = [c_uint]
  145. self.lib.carla_get_internal_plugin_info.restype = POINTER(CarlaNativePluginInfo)
  146. self.lib.carla_engine_init.argtypes = [c_char_p, c_char_p]
  147. self.lib.carla_engine_init.restype = c_bool
  148. self.lib.carla_engine_close.argtypes = None
  149. self.lib.carla_engine_close.restype = c_bool
  150. self.lib.carla_engine_idle.argtypes = None
  151. self.lib.carla_engine_idle.restype = None
  152. self.lib.carla_is_engine_running.argtypes = None
  153. self.lib.carla_is_engine_running.restype = c_bool
  154. self.lib.carla_set_engine_about_to_close.argtypes = None
  155. self.lib.carla_set_engine_about_to_close.restype = None
  156. self.lib.carla_set_engine_callback.argtypes = [CallbackFunc, c_void_p]
  157. self.lib.carla_set_engine_callback.restype = None
  158. self.lib.carla_set_engine_option.argtypes = [c_enum, c_int, c_char_p]
  159. self.lib.carla_set_engine_option.restype = None
  160. self.lib.carla_load_project.argtypes = [c_char_p]
  161. self.lib.carla_load_project.restype = c_bool
  162. self.lib.carla_save_project.argtypes = [c_char_p]
  163. self.lib.carla_save_project.restype = c_bool
  164. self.lib.carla_patchbay_connect.argtypes = [c_int, c_int]
  165. self.lib.carla_patchbay_connect.restype = None
  166. self.lib.carla_patchbay_disconnect.argtypes = [c_int]
  167. self.lib.carla_patchbay_disconnect.restype = None
  168. self.lib.carla_patchbay_refresh.argtypes = None
  169. self.lib.carla_patchbay_refresh.restype = None
  170. self.lib.carla_transport_play.argtypes = None
  171. self.lib.carla_transport_play.restype = None
  172. self.lib.carla_transport_pause.argtypes = None
  173. self.lib.carla_transport_pause.restype = None
  174. self.lib.carla_transport_relocate.argtypes = [c_uint32]
  175. self.lib.carla_transport_relocate.restype = None
  176. self.lib.carla_get_current_transport_frame.argtypes = None
  177. self.lib.carla_get_current_transport_frame.restype = c_uint32
  178. self.lib.carla_get_transport_info.argtypes = None
  179. self.lib.carla_get_transport_info.restype = POINTER(CarlaTransportInfo)
  180. self.lib.carla_add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_char_p, c_void_p]
  181. self.lib.carla_add_plugin.restype = c_bool
  182. self.lib.carla_remove_plugin.argtypes = [c_uint]
  183. self.lib.carla_remove_plugin.restype = c_bool
  184. self.lib.carla_remove_all_plugins.argtypes = None
  185. self.lib.carla_remove_all_plugins.restype = None
  186. self.lib.carla_load_plugin_state.argtypes = [c_uint, c_char_p]
  187. self.lib.carla_load_plugin_state.restype = c_bool
  188. self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
  189. self.lib.carla_save_plugin_state.restype = c_bool
  190. self.lib.carla_get_plugin_info.argtypes = [c_uint]
  191. self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)
  192. self.lib.carla_get_audio_port_count_info.argtypes = [c_uint]
  193. self.lib.carla_get_audio_port_count_info.restype = POINTER(CarlaPortCountInfo)
  194. self.lib.carla_get_midi_port_count_info.argtypes = [c_uint]
  195. self.lib.carla_get_midi_port_count_info.restype = POINTER(CarlaPortCountInfo)
  196. self.lib.carla_get_parameter_count_info.argtypes = [c_uint]
  197. self.lib.carla_get_parameter_count_info.restype = POINTER(CarlaPortCountInfo)
  198. self.lib.carla_get_parameter_info.argtypes = [c_uint, c_uint32]
  199. self.lib.carla_get_parameter_info.restype = POINTER(CarlaParameterInfo)
  200. self.lib.carla_get_parameter_scalepoint_info.argtypes = [c_uint, c_uint32, c_uint32]
  201. self.lib.carla_get_parameter_scalepoint_info.restype = POINTER(CarlaScalePointInfo)
  202. self.lib.carla_get_parameter_data.argtypes = [c_uint, c_uint32]
  203. self.lib.carla_get_parameter_data.restype = POINTER(ParameterData)
  204. self.lib.carla_get_parameter_ranges.argtypes = [c_uint, c_uint32]
  205. self.lib.carla_get_parameter_ranges.restype = POINTER(ParameterRanges)
  206. self.lib.carla_get_midi_program_data.argtypes = [c_uint, c_uint32]
  207. self.lib.carla_get_midi_program_data.restype = POINTER(MidiProgramData)
  208. self.lib.carla_get_custom_data.argtypes = [c_uint, c_uint32]
  209. self.lib.carla_get_custom_data.restype = POINTER(CustomData)
  210. self.lib.carla_get_chunk_data.argtypes = [c_uint]
  211. self.lib.carla_get_chunk_data.restype = c_char_p
  212. self.lib.carla_get_parameter_count.argtypes = [c_uint]
  213. self.lib.carla_get_parameter_count.restype = c_uint32
  214. self.lib.carla_get_program_count.argtypes = [c_uint]
  215. self.lib.carla_get_program_count.restype = c_uint32
  216. self.lib.carla_get_midi_program_count.argtypes = [c_uint]
  217. self.lib.carla_get_midi_program_count.restype = c_uint32
  218. self.lib.carla_get_custom_data_count.argtypes = [c_uint]
  219. self.lib.carla_get_custom_data_count.restype = c_uint32
  220. self.lib.carla_get_parameter_text.argtypes = [c_uint, c_uint32]
  221. self.lib.carla_get_parameter_text.restype = c_char_p
  222. self.lib.carla_get_program_name.argtypes = [c_uint, c_uint32]
  223. self.lib.carla_get_program_name.restype = c_char_p
  224. self.lib.carla_get_midi_program_name.argtypes = [c_uint, c_uint32]
  225. self.lib.carla_get_midi_program_name.restype = c_char_p
  226. self.lib.carla_get_real_plugin_name.argtypes = [c_uint]
  227. self.lib.carla_get_real_plugin_name.restype = c_char_p
  228. self.lib.carla_get_current_program_index.argtypes = [c_uint]
  229. self.lib.carla_get_current_program_index.restype = c_int32
  230. self.lib.carla_get_current_midi_program_index.argtypes = [c_uint]
  231. self.lib.carla_get_current_midi_program_index.restype = c_int32
  232. # TODO - consider removal
  233. self.lib.carla_get_default_parameter_value.argtypes = [c_uint, c_uint32]
  234. self.lib.carla_get_default_parameter_value.restype = c_float
  235. # TODO - consider removal
  236. self.lib.carla_get_current_parameter_value.argtypes = [c_uint, c_uint32]
  237. self.lib.carla_get_current_parameter_value.restype = c_float
  238. self.lib.carla_get_input_peak_value.argtypes = [c_uint, c_ushort]
  239. self.lib.carla_get_input_peak_value.restype = c_float
  240. self.lib.carla_get_output_peak_value.argtypes = [c_uint, c_ushort]
  241. self.lib.carla_get_output_peak_value.restype = c_float
  242. self.lib.carla_set_option.argtypes = [c_uint, c_uint, c_bool]
  243. self.lib.carla_set_option.restype = None
  244. self.lib.carla_set_active.argtypes = [c_uint, c_bool]
  245. self.lib.carla_set_active.restype = None
  246. self.lib.carla_set_drywet.argtypes = [c_uint, c_float]
  247. self.lib.carla_set_drywet.restype = None
  248. self.lib.carla_set_volume.argtypes = [c_uint, c_float]
  249. self.lib.carla_set_volume.restype = None
  250. self.lib.carla_set_balance_left.argtypes = [c_uint, c_float]
  251. self.lib.carla_set_balance_left.restype = None
  252. self.lib.carla_set_balance_right.argtypes = [c_uint, c_float]
  253. self.lib.carla_set_balance_right.restype = None
  254. self.lib.carla_set_panning.argtypes = [c_uint, c_float]
  255. self.lib.carla_set_panning.restype = None
  256. self.lib.carla_set_ctrl_channel.argtypes = [c_uint, c_int8]
  257. self.lib.carla_set_ctrl_channel.restype = None
  258. self.lib.carla_set_parameter_value.argtypes = [c_uint, c_uint32, c_float]
  259. self.lib.carla_set_parameter_value.restype = None
  260. self.lib.carla_set_parameter_midi_cc.argtypes = [c_uint, c_uint32, c_int16]
  261. self.lib.carla_set_parameter_midi_cc.restype = None
  262. self.lib.carla_set_parameter_midi_channel.argtypes = [c_uint, c_uint32, c_uint8]
  263. self.lib.carla_set_parameter_midi_channel.restype = None
  264. self.lib.carla_set_program.argtypes = [c_uint, c_uint32]
  265. self.lib.carla_set_program.restype = None
  266. self.lib.carla_set_midi_program.argtypes = [c_uint, c_uint32]
  267. self.lib.carla_set_midi_program.restype = None
  268. self.lib.carla_set_custom_data.argtypes = [c_uint, c_char_p, c_char_p, c_char_p]
  269. self.lib.carla_set_custom_data.restype = None
  270. self.lib.carla_set_chunk_data.argtypes = [c_uint, c_char_p]
  271. self.lib.carla_set_chunk_data.restype = None
  272. self.lib.carla_prepare_for_save.argtypes = [c_uint]
  273. self.lib.carla_prepare_for_save.restype = None
  274. self.lib.carla_send_midi_note.argtypes = [c_uint, c_uint8, c_uint8, c_uint8]
  275. self.lib.carla_send_midi_note.restype = None
  276. self.lib.carla_show_gui.argtypes = [c_uint, c_bool]
  277. self.lib.carla_show_gui.restype = None
  278. self.lib.carla_get_buffer_size.argtypes = None
  279. self.lib.carla_get_buffer_size.restype = c_uint32
  280. self.lib.carla_get_sample_rate.argtypes = None
  281. self.lib.carla_get_sample_rate.restype = c_double
  282. self.lib.carla_get_last_error.argtypes = None
  283. self.lib.carla_get_last_error.restype = c_char_p
  284. self.lib.carla_get_host_osc_url.argtypes = None
  285. self.lib.carla_get_host_osc_url.restype = c_char_p
  286. #self.lib.nsm_announce.argtypes = [c_char_p, c_int]
  287. #self.lib.nsm_announce.restype = None
  288. #self.lib.nsm_reply_open.argtypes = None
  289. #self.lib.nsm_reply_open.restype = None
  290. #self.lib.nsm_reply_save.argtypes = None
  291. #self.lib.nsm_reply_save.restype = None
  292. def get_extended_license_text(self):
  293. return self.lib.carla_get_extended_license_text()
  294. def get_supported_file_types(self):
  295. return self.lib.carla_get_supported_file_types()
  296. def get_engine_driver_count(self):
  297. return self.lib.carla_get_engine_driver_count()
  298. def get_engine_driver_name(self, index):
  299. return self.lib.carla_get_engine_driver_name(index)
  300. def get_internal_plugin_count(self):
  301. return self.lib.carla_get_internal_plugin_count()
  302. def get_internal_plugin_info(self, internalPluginId):
  303. return structToDict(self.lib.carla_get_internal_plugin_info(internalPluginId).contents)
  304. def engine_init(self, driverName, clientName):
  305. return self.lib.carla_engine_init(driverName.encode("utf-8"), clientName.encode("utf-8"))
  306. def engine_close(self):
  307. return self.lib.carla_engine_close()
  308. def engine_idle(self):
  309. self.lib.carla_engine_idle()
  310. def is_engine_running(self):
  311. return self.lib.carla_is_engine_running()
  312. def set_engine_about_to_close(self):
  313. self.lib.carla_set_engine_about_to_close()
  314. def set_engine_callback(self, func):
  315. self._callback = CallbackFunc(func)
  316. self.lib.carla_set_engine_callback(self._callback, c_nullptr)
  317. def set_engine_option(self, option, value, valueStr):
  318. self.lib.carla_set_engine_option(option, value, valueStr.encode("utf-8"))
  319. def load_project(self, filename):
  320. return self.lib.carla_load_project(filename.encode("utf-8"))
  321. def save_project(self, filename):
  322. return self.lib.carla_save_project(filename.encode("utf-8"))
  323. def patchbay_connect(self, portIdA, portIdB):
  324. self.lib.carla_patchbay_connect(portIdA, portIdB)
  325. def patchbay_disconnect(self, connectionId):
  326. self.lib.carla_patchbay_disconnect(connectionId)
  327. def patchbay_refresh(self):
  328. self.lib.carla_patchbay_refresh()
  329. def transport_play(self):
  330. self.lib.carla_transport_play()
  331. def transport_pause(self):
  332. self.lib.carla_transport_pause()
  333. def transport_relocate(self, frames):
  334. self.lib.carla_transport_relocate(frames)
  335. def get_current_transport_frame(self):
  336. return self.lib.carla_get_current_transport_frame()
  337. def get_transport_info(self):
  338. return structToDict(self.lib.carla_get_transport_info().contents)
  339. def add_plugin(self, btype, ptype, filename, name, label, extraStuff):
  340. cfilename = filename.encode("utf-8") if filename else c_nullptr
  341. cname = name.encode("utf-8") if name else c_nullptr
  342. clabel = label.encode("utf-8") if label else c_nullptr
  343. return self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, cast(extraStuff, c_void_p))
  344. def remove_plugin(self, pluginId):
  345. return self.lib.carla_remove_plugin(pluginId)
  346. def remove_all_plugins(self):
  347. self.lib.carla_remove_all_plugins()
  348. def load_plugin_state(self, pluginId, filename):
  349. return self.lib.carla_load_plugin_state(pluginId, filename.encode("utf-8"))
  350. def save_plugin_state(self, pluginId, filename):
  351. return self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8"))
  352. def get_plugin_info(self, pluginId):
  353. return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)
  354. def get_audio_port_count_info(self, pluginId):
  355. return structToDict(self.lib.carla_get_audio_port_count_info(pluginId).contents)
  356. def get_midi_port_count_info(self, pluginId):
  357. return structToDict(self.lib.carla_get_midi_port_count_info(pluginId).contents)
  358. def get_parameter_count_info(self, pluginId):
  359. return structToDict(self.lib.carla_get_parameter_count_info(pluginId).contents)
  360. def get_parameter_info(self, pluginId, parameterId):
  361. return structToDict(self.lib.carla_get_parameter_info(pluginId, parameterId).contents)
  362. def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId):
  363. return structToDict(self.lib.carla_get_parameter_scalepoint_info(pluginId, parameterId, scalePointId).contents)
  364. def get_parameter_data(self, pluginId, parameterId):
  365. return structToDict(self.lib.carla_get_parameter_data(pluginId, parameterId).contents)
  366. def get_parameter_ranges(self, pluginId, parameterId):
  367. return structToDict(self.lib.carla_get_parameter_ranges(pluginId, parameterId).contents)
  368. def get_midi_program_data(self, pluginId, midiProgramId):
  369. return structToDict(self.lib.carla_get_midi_program_data(pluginId, midiProgramId).contents)
  370. def get_custom_data(self, pluginId, customDataId):
  371. return structToDict(self.lib.carla_get_custom_data(pluginId, customDataId).contents)
  372. def get_chunk_data(self, pluginId):
  373. return self.lib.carla_get_chunk_data(pluginId)
  374. def get_parameter_count(self, pluginId):
  375. return self.lib.carla_get_parameter_count(pluginId)
  376. def get_program_count(self, pluginId):
  377. return self.lib.carla_get_program_count(pluginId)
  378. def get_midi_program_count(self, pluginId):
  379. return self.lib.carla_get_midi_program_count(pluginId)
  380. def get_custom_data_count(self, pluginId):
  381. return self.lib.carla_get_custom_data_count(pluginId)
  382. def get_parameter_text(self, pluginId, parameterId):
  383. return self.lib.carla_get_parameter_text(pluginId, parameterId)
  384. def get_program_name(self, pluginId, programId):
  385. return self.lib.carla_get_program_name(pluginId, programId)
  386. def get_midi_program_name(self, pluginId, midiProgramId):
  387. return self.lib.carla_get_midi_program_name(pluginId, midiProgramId)
  388. def get_real_plugin_name(self, pluginId):
  389. return self.lib.carla_get_real_plugin_name(pluginId)
  390. def get_current_program_index(self, pluginId):
  391. return self.lib.carla_get_current_program_index(pluginId)
  392. def get_current_midi_program_index(self, pluginId):
  393. return self.lib.carla_get_current_midi_program_index(pluginId)
  394. def get_default_parameter_value(self, pluginId, parameterId):
  395. return self.lib.carla_get_default_parameter_value(pluginId, parameterId)
  396. def get_current_parameter_value(self, pluginId, parameterId):
  397. return self.lib.carla_get_current_parameter_value(pluginId, parameterId)
  398. def get_input_peak_value(self, pluginId, portId):
  399. return self.lib.carla_get_input_peak_value(pluginId, portId)
  400. def get_output_peak_value(self, pluginId, portId):
  401. return self.lib.carla_get_output_peak_value(pluginId, portId)
  402. def set_option(self, pluginId, option, yesNo):
  403. self.lib.carla_set_option(pluginId, option, yesNo)
  404. def set_active(self, pluginId, onOff):
  405. self.lib.carla_set_active(pluginId, onOff)
  406. def set_drywet(self, pluginId, value):
  407. self.lib.carla_set_drywet(pluginId, value)
  408. def set_volume(self, pluginId, value):
  409. self.lib.carla_set_volume(pluginId, value)
  410. def set_balance_left(self, pluginId, value):
  411. self.lib.carla_set_balance_left(pluginId, value)
  412. def set_balance_right(self, pluginId, value):
  413. self.lib.carla_set_balance_right(pluginId, value)
  414. def set_panning(self, pluginId, value):
  415. self.lib.carla_set_panning(pluginId, value)
  416. def set_ctrl_channel(self, pluginId, channel):
  417. self.lib.carla_set_ctrl_channel(pluginId, channel)
  418. def set_parameter_value(self, pluginId, parameterId, value):
  419. self.lib.carla_set_parameter_value(pluginId, parameterId, value)
  420. def set_parameter_midi_cc(self, pluginId, parameterId, cc):
  421. self.lib.carla_set_parameter_midi_cc(pluginId, parameterId, cc)
  422. def set_parameter_midi_channel(self, pluginId, parameterId, channel):
  423. self.lib.carla_set_parameter_midi_channel(pluginId, parameterId, channel)
  424. def set_program(self, pluginId, programId):
  425. self.lib.carla_set_program(pluginId, programId)
  426. def set_midi_program(self, pluginId, midiProgramId):
  427. self.lib.carla_set_midi_program(pluginId, midiProgramId)
  428. def set_custom_data(self, pluginId, type_, key, value):
  429. self.lib.carla_set_custom_data(pluginId, type_.encode("utf-8"), key.encode("utf-8"), value.encode("utf-8"))
  430. def set_chunk_data(self, pluginId, chunkData):
  431. self.lib.carla_set_chunk_data(pluginId, chunkData.encode("utf-8"))
  432. def prepare_for_save(self, pluginId):
  433. self.lib.carla_prepare_for_save(pluginId)
  434. def send_midi_note(self, pluginId, channel, note, velocity):
  435. self.lib.carla_send_midi_note(pluginId, channel, note, velocity)
  436. def show_gui(self, pluginId, yesNo):
  437. self.lib.carla_show_gui(pluginId, yesNo)
  438. def get_last_error(self):
  439. return self.lib.carla_get_last_error()
  440. def get_host_osc_url(self):
  441. return self.lib.carla_get_host_osc_url()
  442. def get_buffer_size(self):
  443. return self.lib.carla_get_buffer_size()
  444. def get_sample_rate(self):
  445. return self.lib.carla_get_sample_rate()
  446. #def nsm_announce(self, url, pid):
  447. #self.lib.nsm_announce(url.encode("utf-8"), pid)
  448. #def nsm_reply_open(self):
  449. #self.lib.nsm_reply_open()
  450. #def nsm_reply_save(self):
  451. #self.lib.nsm_reply_save()
  452. #Carla.host = Host(None)
  453. ## Test available drivers
  454. #driverCount = Carla.host.get_engine_driver_count()
  455. #driverList = []
  456. #for i in range(driverCount):
  457. #driver = cString(Carla.host.get_engine_driver_name(i))
  458. #if driver:
  459. #driverList.append(driver)
  460. #print(i, driver)
  461. ## Test available internal plugins
  462. #pluginCount = Carla.host.get_internal_plugin_count()
  463. #for i in range(pluginCount):
  464. #plugin = Carla.host.get_internal_plugin_info(i)
  465. #print(plugin)