Collection of tools useful for audio production
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.

1204 lines
37KB

  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Carla Backend code
  4. # Copyright (C) 2011-2012 Filipe Coelho <falktx@gmail.com> FIXME
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # 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 COPYING file
  17. # Imports (Global)
  18. import os, sys
  19. from ctypes import *
  20. from copy import deepcopy
  21. from subprocess import Popen, PIPE
  22. # Imports (Custom)
  23. try:
  24. import ladspa_rdf, lv2_rdf
  25. haveRDF = True
  26. except:
  27. print("RDF Support not available (LADSPA-RDF and LV2 will be disabled)")
  28. haveRDF = False
  29. # Set Platform and Architecture
  30. is64bit = False
  31. LINUX = False
  32. MACOS = False
  33. WINDOWS = False
  34. if (sys.platform == "darwin"):
  35. MACOS = True
  36. elif (sys.platform.startswith("linux")):
  37. LINUX = True
  38. if (len(os.uname()) > 4 and os.uname()[4] in ('x86_64',)): #FIXME - need more checks
  39. is64bit = True
  40. elif (sys.platform.startswith("win")):
  41. WINDOWS = True
  42. if (sys.platform == "win64"):
  43. is64bit = True
  44. if (is64bit):
  45. c_uintptr = c_uint64
  46. else:
  47. c_uintptr = c_uint32
  48. # Get short filename from full filename (/a/b.c -> b.c)
  49. def getShortFileName(filename):
  50. short = filename
  51. if (os.sep in filename):
  52. short = filename.rsplit(os.sep, 1)[1]
  53. return short
  54. # Convert a ctypes struct into a dict
  55. def struct_to_dict(struct):
  56. return dict((attr, getattr(struct, attr)) for attr, value in struct._fields_)
  57. # ------------------------------------------------------------------------------------------------
  58. # Default Plugin Folders
  59. if (WINDOWS):
  60. splitter = ";"
  61. APPDATA = os.getenv("APPDATA")
  62. PROGRAMFILES = os.getenv("PROGRAMFILES")
  63. COMMONPROGRAMFILES = os.getenv("COMMONPROGRAMFILES")
  64. # Small integrity tests
  65. if not APPDATA:
  66. print("APPDATA variable not set, cannot continue")
  67. sys.exit(1)
  68. if not PROGRAMFILES:
  69. print("PROGRAMFILES variable not set, cannot continue")
  70. sys.exit(1)
  71. if not COMMONPROGRAMFILES:
  72. print("COMMONPROGRAMFILES variable not set, cannot continue")
  73. sys.exit(1)
  74. DEFAULT_LADSPA_PATH = [
  75. os.path.join(APPDATA, "LADSPA"),
  76. os.path.join(PROGRAMFILES, "LADSPA")
  77. ]
  78. DEFAULT_DSSI_PATH = [
  79. os.path.join(APPDATA, "DSSI"),
  80. os.path.join(PROGRAMFILES, "DSSI")
  81. ]
  82. DEFAULT_LV2_PATH = [
  83. os.path.join(APPDATA, "LV2"),
  84. os.path.join(COMMONPROGRAMFILES, "LV2")
  85. ]
  86. DEFAULT_VST_PATH = [
  87. os.path.join(PROGRAMFILES, "VstPlugins"),
  88. os.path.join(PROGRAMFILES, "Steinberg", "VstPlugins")
  89. ]
  90. DEFAULT_SF2_PATH = [
  91. os.path.join(APPDATA, "SF2")
  92. ]
  93. #if (is64bit):
  94. # TODO
  95. elif (MACOS):
  96. splitter = ":"
  97. HOME = os.getenv("HOME")
  98. # Small integrity tests
  99. if not HOME:
  100. print("HOME variable not set, cannot continue")
  101. sys.exit(1)
  102. DEFAULT_LADSPA_PATH = [
  103. os.path.join(HOME, "Library", "Audio", "Plug-Ins", "LADSPA"),
  104. os.path.join("/", "Library", "Audio", "Plug-Ins", "LADSPA")
  105. ]
  106. DEFAULT_DSSI_PATH = [
  107. os.path.join(HOME, "Library", "Audio", "Plug-Ins", "DSSI"),
  108. os.path.join("/", "Library", "Audio", "Plug-Ins", "DSSI")
  109. ]
  110. DEFAULT_LV2_PATH = [
  111. os.path.join(HOME, "Library", "Audio", "Plug-Ins", "LV2"),
  112. os.path.join("/", "Library", "Audio", "Plug-Ins", "LV2")
  113. ]
  114. DEFAULT_VST_PATH = [
  115. os.path.join(HOME, "Library", "Audio", "Plug-Ins", "VST"),
  116. os.path.join("/", "Library", "Audio", "Plug-Ins", "VST")
  117. ]
  118. DEFAULT_SF2_PATH = [
  119. # TODO
  120. ]
  121. else:
  122. splitter = ":"
  123. HOME = os.getenv("HOME")
  124. # Small integrity tests
  125. if not HOME:
  126. print("HOME variable not set, cannot continue")
  127. sys.exit(1)
  128. DEFAULT_LADSPA_PATH = [
  129. os.path.join(HOME, ".ladspa"),
  130. os.path.join("/", "usr", "lib", "ladspa"),
  131. os.path.join("/", "usr", "local", "lib", "ladspa")
  132. ]
  133. DEFAULT_DSSI_PATH = [
  134. os.path.join(HOME, ".dssi"),
  135. os.path.join("/", "usr", "lib", "dssi"),
  136. os.path.join("/", "usr", "local", "lib", "dssi")
  137. ]
  138. DEFAULT_LV2_PATH = [
  139. os.path.join(HOME, ".lv2"),
  140. os.path.join("/", "usr", "lib", "lv2"),
  141. os.path.join("/", "usr", "local", "lib", "lv2")
  142. ]
  143. DEFAULT_VST_PATH = [
  144. os.path.join(HOME, ".vst"),
  145. os.path.join("/", "usr", "lib", "vst"),
  146. os.path.join("/", "usr", "local", "lib", "vst")
  147. ]
  148. DEFAULT_SF2_PATH = [
  149. os.path.join(HOME, ".sounds"),
  150. os.path.join("/", "usr", "share", "sounds", "sf2")
  151. ]
  152. # ------------------------------------------------------------------------------------------------
  153. # Search for Carla library and tools
  154. global carla_library_path
  155. carla_library_path = ""
  156. carla_discovery_unix32 = ""
  157. carla_discovery_unix64 = ""
  158. carla_discovery_win32 = ""
  159. carla_discovery_win64 = ""
  160. carla_bridge_unix32 = ""
  161. carla_bridge_unix64 = ""
  162. carla_bridge_win32 = ""
  163. carla_bridge_win64 = ""
  164. carla_bridge_lv2_gtk2 = ""
  165. carla_bridge_lv2_qt4 = ""
  166. carla_bridge_lv2_x11 = ""
  167. if (WINDOWS):
  168. carla_libname = "carla_backend.dll"
  169. elif (MACOS):
  170. carla_libname = "carla_backend.dylib"
  171. else:
  172. carla_libname = "carla_backend.so"
  173. if (WINDOWS):
  174. PATH = (os.path.join(PROGRAMFILES, "Cadence", "carla"),)
  175. else:
  176. PATH_env = os.getenv("PATH")
  177. if (PATH_env != None):
  178. PATH = PATH_env.split(":")
  179. else:
  180. PATH = ("/usr/bin", "/usr/local/bin")
  181. CWD = sys.path[0]
  182. # carla-backend
  183. if (os.path.exists(os.path.join(CWD, "carla", carla_libname))):
  184. carla_library_path = os.path.join(CWD, "carla", carla_libname)
  185. else:
  186. if (WINDOWS):
  187. CARLA_PATH = (os.path.join(PROGRAMFILES, "Cadence", "carla"),)
  188. elif (MACOS):
  189. CARLA_PATH = ("/usr/lib", "/usr/local/lib/") # FIXME
  190. else:
  191. CARLA_PATH = ("/usr/lib", "/usr/local/lib/")
  192. for p in CARLA_PATH:
  193. if (os.path.exists(os.path.join(p, "carla", carla_libname))):
  194. carla_library_path = os.path.join(p, "carla", carla_libname)
  195. break
  196. # discovery-unix32
  197. if (os.path.exists(os.path.join(CWD, "carla-discovery", "carla-discovery-unix32"))):
  198. carla_discovery_unix32 = os.path.join(CWD, "carla-discovery", "carla-discovery-unix32")
  199. else:
  200. for p in PATH:
  201. if (os.path.exists(os.path.join(p, "carla-discovery-unix32"))):
  202. carla_discovery_unix32 = os.path.join(p, "carla-discovery-unix32")
  203. break
  204. # discovery-unix64
  205. if (os.path.exists(os.path.join(CWD, "carla-discovery", "carla-discovery-unix64"))):
  206. carla_discovery_unix64 = os.path.join(CWD, "carla-discovery", "carla-discovery-unix64")
  207. else:
  208. for p in PATH:
  209. if (os.path.exists(os.path.join(p, "carla-discovery-unix64"))):
  210. carla_discovery_unix64 = os.path.join(p, "carla-discovery-unix64")
  211. break
  212. # discovery-win32
  213. if (os.path.exists(os.path.join(CWD, "carla-discovery", "carla-discovery-win32.exe"))):
  214. carla_discovery_win32 = os.path.join(CWD, "carla-discovery", "carla-discovery-win32.exe")
  215. else:
  216. for p in PATH:
  217. if (os.path.exists(os.path.join(p, "carla-discovery-wine32.exe"))):
  218. carla_discovery_win32 = os.path.join(p, "carla-discovery-win32.exe")
  219. break
  220. # discovery-win64
  221. if (os.path.exists(os.path.join(CWD, "carla-discovery", "carla-discovery-win64.exe"))):
  222. carla_discovery_win64 = os.path.join(CWD, "carla-discovery", "carla-discovery-win64.exe")
  223. else:
  224. for p in PATH:
  225. if (os.path.exists(os.path.join(p, "carla-discovery-win64.exe"))):
  226. carla_discovery_win64 = os.path.join(p, "carla-discovery-win64.exe")
  227. break
  228. # bridge-unix32
  229. if (os.path.exists(os.path.join(CWD, "carla-bridge", "carla-bridge-unix32"))):
  230. carla_bridge_unix32 = os.path.join(CWD, "carla-bridge", "carla-bridge-unix32")
  231. else:
  232. for p in PATH:
  233. if (os.path.exists(os.path.join(p, "carla-bridge-unix32"))):
  234. carla_bridge_unix32 = os.path.join(p, "carla-bridge-unix32")
  235. break
  236. # bridge-unix64
  237. if (os.path.exists(os.path.join(CWD, "carla-bridge", "carla-bridge-unix64"))):
  238. carla_bridge_unix64 = os.path.join(CWD, "carla-bridge", "carla-bridge-unix64")
  239. else:
  240. for p in PATH:
  241. if (os.path.exists(os.path.join(p, "carla-bridge-unix64"))):
  242. carla_bridge_unix64 = os.path.join(p, "carla-bridge-unix64")
  243. break
  244. # bridge-win32
  245. if (os.path.exists(os.path.join(CWD, "carla-bridge", "carla-bridge-win32.exe"))):
  246. carla_bridge_win32 = os.path.join(CWD, "carla-bridge", "carla-bridge-win32.exe")
  247. else:
  248. for p in PATH:
  249. if (os.path.exists(os.path.join(p, "carla-bridge-wine32.exe"))):
  250. carla_bridge_win32 = os.path.join(p, "carla-bridge-win32.exe")
  251. break
  252. # bridge-win64
  253. if (os.path.exists(os.path.join(CWD, "carla-bridge", "carla-bridge-win64.exe"))):
  254. carla_bridge_win64 = os.path.join(CWD, "carla-bridge", "carla-bridge-win64.exe")
  255. else:
  256. for p in PATH:
  257. if (os.path.exists(os.path.join(p, "carla-bridge-win64.exe"))):
  258. carla_bridge_win64 = os.path.join(p, "carla-bridge-win64.exe")
  259. break
  260. # bridge-lv2-gtk2
  261. if (os.path.exists(os.path.join(CWD, "carla-bridge-ui", "carla-bridge-lv2-gtk2"))):
  262. carla_bridge_lv2_gtk2 = os.path.join(CWD, "carla-bridge-ui", "carla-bridge-lv2-gtk2")
  263. else:
  264. for p in PATH:
  265. if (os.path.exists(os.path.join(p, "carla-bridge-lv2-gtk2"))):
  266. carla_bridge_lv2_gtk2 = os.path.join(p, "carla-bridge-lv2-gtk2")
  267. break
  268. # bridge-lv2-qt4
  269. if (os.path.exists(os.path.join(CWD, "carla-bridge-ui", "carla-bridge-lv2-qt4"))):
  270. carla_bridge_lv2_qt4 = os.path.join(CWD, "carla-bridge-ui", "carla-bridge-lv2-qt4")
  271. else:
  272. for p in PATH:
  273. if (os.path.exists(os.path.join(p, "carla-bridge-lv2-qt4"))):
  274. carla_bridge_lv2_qt4 = os.path.join(p, "carla-bridge-lv2-qt4")
  275. break
  276. # bridge-lv2-x11
  277. if (os.path.exists(os.path.join(CWD, "carla-bridge-ui", "carla-bridge-lv2-x11"))):
  278. carla_bridge_lv2_x11 = os.path.join(CWD, "carla-bridge-ui", "carla-bridge-lv2-x11")
  279. else:
  280. for p in PATH:
  281. if (os.path.exists(os.path.join(p, "carla-bridge-lv2-x11"))):
  282. carla_bridge_lv2_x11 = os.path.join(p, "carla-bridge-lv2-x11")
  283. break
  284. # ------------------------------------------------------------------------------------------------
  285. # Plugin Query (helper functions)
  286. def findBinaries(bPATH, OS):
  287. binaries = []
  288. if (OS == "WINDOWS"):
  289. extensions = (".dll",)
  290. elif (OS == "MACOS"):
  291. extensions = (".dylib", ".so")
  292. else:
  293. extensions = (".so", ".sO", ".SO", ".So")
  294. for root, dirs, files in os.walk(bPATH):
  295. for name in [name for name in files if name.endswith(extensions)]:
  296. binaries.append(os.path.join(root, name))
  297. return binaries
  298. def findSoundFonts(bPATH):
  299. soundfonts = []
  300. extensions = (".sf2", ".sF2", ".SF2", ".Sf2")
  301. for root, dirs, files in os.walk(bPATH):
  302. for name in [name for name in files if name.endswith(extensions)]:
  303. soundfonts.append(os.path.join(root, name))
  304. return soundfonts
  305. def findLV2Bundles(bPATH):
  306. bundles = []
  307. extensions = (".lv2", ".lV2", ".LV2", ".Lv2")
  308. for root, dirs, files in os.walk(bPATH):
  309. for dir_ in [dir_ for dir_ in dirs if dir_.endswith(extensions)]:
  310. bundles.append(os.path.join(root, dir_))
  311. return bundles
  312. def findDSSIGUI(filename, name, label):
  313. plugin_dir = filename.rsplit(".", 1)[0]
  314. short_name = getShortFileName(plugin_dir)
  315. gui_filename = ""
  316. check_name = name.replace(" ","_")
  317. check_label = label
  318. check_sname = short_name
  319. if (check_name[-1] != "_"): check_name += "_"
  320. if (check_label[-1] != "_"): check_label += "_"
  321. if (check_sname[-1] != "_"): check_sname += "_"
  322. for root, dirs, files in os.walk(plugin_dir):
  323. gui_files = files
  324. break
  325. else:
  326. gui_files = []
  327. for gui in gui_files:
  328. if (gui.startswith(check_name) or gui.startswith(check_label) or gui.startswith(check_sname)):
  329. gui_filename = os.path.join(plugin_dir, gui)
  330. break
  331. return gui_filename
  332. # ------------------------------------------------------------------------------------------------
  333. # Plugin Query
  334. PyPluginInfo = {
  335. 'build': 0, # BINARY_NONE
  336. 'type': 0, # PLUGIN_NONE,
  337. 'category': 0, # PLUGIN_CATEGORY_NONE
  338. 'hints': 0x0,
  339. 'binary': "",
  340. 'name': "",
  341. 'label': "",
  342. 'maker': "",
  343. 'copyright': "",
  344. 'unique_id': 0,
  345. 'audio.ins': 0,
  346. 'audio.outs': 0,
  347. 'audio.totals': 0,
  348. 'midi.ins': 0,
  349. 'midi.outs': 0,
  350. 'midi.totals': 0,
  351. 'parameters.ins': 0,
  352. 'parameters.outs': 0,
  353. 'parameters.total': 0,
  354. 'programs.total': 0
  355. }
  356. def runCarlaDiscovery(itype, stype, filename, tool, isWine=False):
  357. short_name = getShortFileName(filename).rsplit(".", 1)[0]
  358. plugins = []
  359. pinfo = None
  360. command = []
  361. if (LINUX or MACOS):
  362. command.append("env")
  363. command.append("LANG=C")
  364. if (isWine):
  365. command.append("WINEDEBUG=-all")
  366. command.append(tool)
  367. command.append(stype)
  368. command.append(filename)
  369. p = Popen(command, stdout=PIPE)
  370. p.wait()
  371. output = p.stdout.read().decode("utf-8", errors="ignore").split("\n")
  372. for line in output:
  373. if (line == "carla-discovery::init::-----------"):
  374. pinfo = deepcopy(PyPluginInfo)
  375. pinfo['type'] = itype
  376. pinfo['binary'] = filename
  377. elif (line == "carla-discovery::end::------------"):
  378. if (pinfo != None):
  379. plugins.append(pinfo)
  380. pinfo = None
  381. elif (line == "Segmentation fault"):
  382. print("carla-discovery::crash::%s crashed during discovery" % (filename))
  383. elif line.startswith("err:module:import_dll Library"):
  384. print(line)
  385. elif line.startswith("carla-discovery::error::"):
  386. print("%s - %s" % (line, filename))
  387. elif line.startswith("carla-discovery::"):
  388. if (pinfo == None):
  389. continue
  390. prop, value = line.replace("carla-discovery::","").split("::", 1)
  391. if (prop == "name"):
  392. pinfo['name'] = value if (value) else short_name
  393. elif (prop == "label"):
  394. pinfo['label'] = value if (value) else short_name
  395. elif (prop == "maker"):
  396. pinfo['maker'] = value
  397. elif (prop == "copyright"):
  398. pinfo['copyright'] = value
  399. elif (prop == "unique_id"):
  400. if value.isdigit(): pinfo['unique_id'] = int(value)
  401. elif (prop == "hints"):
  402. if value.isdigit(): pinfo['hints'] = int(value)
  403. elif (prop == "category"):
  404. if value.isdigit(): pinfo['category'] = int(value)
  405. elif (prop == "audio.ins"):
  406. if value.isdigit(): pinfo['audio.ins'] = int(value)
  407. elif (prop == "audio.outs"):
  408. if value.isdigit(): pinfo['audio.outs'] = int(value)
  409. elif (prop == "audio.total"):
  410. if value.isdigit(): pinfo['audio.total'] = int(value)
  411. elif (prop == "midi.ins"):
  412. if value.isdigit(): pinfo['midi.ins'] = int(value)
  413. elif (prop == "midi.outs"):
  414. if value.isdigit(): pinfo['midi.outs'] = int(value)
  415. elif (prop == "midi.total"):
  416. if value.isdigit(): pinfo['midi.total'] = int(value)
  417. elif (prop == "parameters.ins"):
  418. if value.isdigit(): pinfo['parameters.ins'] = int(value)
  419. elif (prop == "parameters.outs"):
  420. if value.isdigit(): pinfo['parameters.outs'] = int(value)
  421. elif (prop == "parameters.total"):
  422. if value.isdigit(): pinfo['parameters.total'] = int(value)
  423. elif (prop == "programs.total"):
  424. if value.isdigit(): pinfo['programs.total'] = int(value)
  425. elif (prop == "build"):
  426. if value.isdigit(): pinfo['build'] = int(value)
  427. # Additional checks
  428. for pinfo in plugins:
  429. if (itype == PLUGIN_DSSI):
  430. if (findDSSIGUI(pinfo['binary'], pinfo['name'], pinfo['label'])):
  431. pinfo['hints'] |= PLUGIN_HAS_GUI
  432. return plugins
  433. def checkPluginLADSPA(filename, tool, isWine=False):
  434. return runCarlaDiscovery(PLUGIN_LADSPA, "LADSPA", filename, tool, isWine)
  435. def checkPluginDSSI(filename, tool, isWine=False):
  436. return runCarlaDiscovery(PLUGIN_DSSI, "DSSI", filename, tool, isWine)
  437. def checkPluginVST(filename, tool, isWine=False):
  438. return runCarlaDiscovery(PLUGIN_VST, "VST", filename, tool, isWine)
  439. def checkPluginSF2(filename, tool):
  440. return runCarlaDiscovery(PLUGIN_SF2, "SF2", filename, tool)
  441. def checkPluginLV2(rdf_info):
  442. plugins = []
  443. pinfo = deepcopy(PyPluginInfo)
  444. pinfo['type'] = PLUGIN_LV2
  445. pinfo['build'] = BINARY_NATIVE
  446. pinfo['category'] = PLUGIN_CATEGORY_NONE # TODO
  447. pinfo['hints'] = 0
  448. pinfo['binary'] = rdf_info['Binary']
  449. pinfo['name'] = rdf_info['Name']
  450. pinfo['label'] = rdf_info['URI']
  451. pinfo['maker'] = rdf_info['Author']
  452. pinfo['copyright'] = rdf_info['License']
  453. pinfo['unique_id'] = rdf_info['UniqueID']
  454. pinfo['audio.ins'] = 0
  455. pinfo['audio.outs'] = 0
  456. pinfo['audio.total'] = 0
  457. pinfo['midi.ins'] = 0
  458. pinfo['midi.outs'] = 0
  459. pinfo['midi.total'] = 0
  460. pinfo['parameters.ins'] = 0
  461. pinfo['parameters.outs'] = 0
  462. pinfo['parameters.total'] = 0
  463. pinfo['programs.total'] = 0 #rdf_info['PresetCount']
  464. if (pinfo['binary'] == "" or pinfo['name'] == "" or not rdf_info['Bundle']):
  465. return None
  466. for i in range(rdf_info['PortCount']):
  467. PortType = rdf_info['Ports'][i]['Type']
  468. PortProps = rdf_info['Ports'][i]['Properties']
  469. if (PortType & lv2_rdf.LV2_PORT_AUDIO):
  470. pinfo['audio.total'] += 1
  471. if (PortType & lv2_rdf.LV2_PORT_INPUT):
  472. pinfo['audio.ins'] += 1
  473. elif (PortType & lv2_rdf.LV2_PORT_OUTPUT):
  474. pinfo['audio.outs'] += 1
  475. elif (PortType & lv2_rdf.LV2_PORT_SUPPORTS_MIDI):
  476. pinfo['midi.total'] += 1
  477. if (PortType & lv2_rdf.LV2_PORT_INPUT):
  478. pinfo['midi.ins'] += 1
  479. elif (PortType & lv2_rdf.LV2_PORT_OUTPUT):
  480. pinfo['midi.outs'] += 1
  481. elif (PortType & lv2_rdf.LV2_PORT_CONTROL):
  482. pinfo['parameters.total'] += 1
  483. if (PortType & lv2_rdf.LV2_PORT_INPUT):
  484. pinfo['parameters.ins'] += 1
  485. elif (PortType & lv2_rdf.LV2_PORT_OUTPUT):
  486. if (not PortProps & lv2_rdf.LV2_PORT_LATENCY):
  487. pinfo['parameters.outs'] += 1
  488. if (rdf_info['Type'] & lv2_rdf.LV2_GROUP_GENERATOR):
  489. pinfo['hints'] |= PLUGIN_IS_SYNTH
  490. if (rdf_info['UICount'] > 0):
  491. pinfo['hints'] |= PLUGIN_HAS_GUI
  492. plugins.append(pinfo)
  493. return plugins
  494. # ------------------------------------------------------------------------------------------------
  495. # Backend C++ -> Python variables
  496. c_enum = c_int
  497. c_nullptr = None
  498. # static max values
  499. MAX_PLUGINS = 99
  500. MAX_PARAMETERS = 200
  501. MAX_MIDI_EVENTS = 512
  502. # plugin hints
  503. PLUGIN_IS_BRIDGE = 0x01
  504. PLUGIN_IS_SYNTH = 0x02
  505. PLUGIN_HAS_GUI = 0x04
  506. PLUGIN_USES_CHUNKS = 0x08
  507. PLUGIN_CAN_DRYWET = 0x10
  508. PLUGIN_CAN_VOLUME = 0x20
  509. PLUGIN_CAN_BALANCE = 0x40
  510. # parameter hints
  511. PARAMETER_IS_BOOLEAN = 0x01
  512. PARAMETER_IS_INTEGER = 0x02
  513. PARAMETER_IS_LOGARITHMIC = 0x04
  514. PARAMETER_IS_ENABLED = 0x08
  515. PARAMETER_IS_AUTOMABLE = 0x10
  516. PARAMETER_USES_SCALEPOINTS = 0x20
  517. PARAMETER_USES_SAMPLERATE = 0x40
  518. # enum BinaryType
  519. BINARY_NONE = 0
  520. BINARY_UNIX32 = 1
  521. BINARY_UNIX64 = 2
  522. BINARY_WIN32 = 3
  523. BINARY_WIN64 = 4
  524. # enum PluginType
  525. PLUGIN_NONE = 0
  526. PLUGIN_LADSPA = 1
  527. PLUGIN_DSSI = 2
  528. PLUGIN_LV2 = 3
  529. PLUGIN_VST = 4
  530. PLUGIN_SF2 = 5
  531. # enum PluginCategory
  532. PLUGIN_CATEGORY_NONE = 0
  533. PLUGIN_CATEGORY_SYNTH = 1
  534. PLUGIN_CATEGORY_DELAY = 2 # also Reverb
  535. PLUGIN_CATEGORY_EQ = 3
  536. PLUGIN_CATEGORY_FILTER = 4
  537. PLUGIN_CATEGORY_DYNAMICS = 5 # Amplifier, Compressor, Gate
  538. PLUGIN_CATEGORY_MODULATOR = 6 # Chorus, Flanger, Phaser
  539. PLUGIN_CATEGORY_UTILITY = 7 # Analyzer, Converter, Mixer
  540. PLUGIN_CATEGORY_OUTRO = 8 # used to check if a plugin has a category
  541. # enum ParameterType
  542. PARAMETER_UNKNOWN = 0
  543. PARAMETER_INPUT = 1
  544. PARAMETER_OUTPUT = 2
  545. PARAMETER_LATENCY = 3
  546. # enum InternalParametersIndex
  547. PARAMETER_ACTIVE = -1
  548. PARAMETER_DRYWET = -2
  549. PARAMETER_VOLUME = -3
  550. PARAMETER_BALANCE_LEFT = -4
  551. PARAMETER_BALANCE_RIGHT = -5
  552. # enum CustomDataType
  553. CUSTOM_DATA_INVALID = 0
  554. CUSTOM_DATA_BOOL = 1
  555. CUSTOM_DATA_INT = 2
  556. CUSTOM_DATA_LONG = 3
  557. CUSTOM_DATA_FLOAT = 4
  558. CUSTOM_DATA_STRING = 5
  559. CUSTOM_DATA_BINARY = 6
  560. # enum GuiType
  561. GUI_NONE = 0
  562. GUI_INTERNAL_QT4 = 1
  563. GUI_INTERNAL_X11 = 2
  564. GUI_EXTERNAL_LV2 = 3
  565. GUI_EXTERNAL_OSC = 4
  566. # enum OptionsType
  567. OPTION_GLOBAL_JACK_CLIENT = 1
  568. OPTION_USE_DSSI_CHUNKS = 2
  569. OPTION_PREFER_UI_BRIDGES = 3
  570. OPTION_PATH_BRIDGE_UNIX32 = 4
  571. OPTION_PATH_BRIDGE_UNIX64 = 5
  572. OPTION_PATH_BRIDGE_WIN32 = 6
  573. OPTION_PATH_BRIDGE_WIN64 = 7
  574. OPTION_PATH_BRIDGE_LV2_GTK2 = 8
  575. OPTION_PATH_BRIDGE_LV2_QT4 = 9
  576. OPTION_PATH_BRIDGE_LV2_X11 = 10
  577. # enum CallbackType
  578. CALLBACK_DEBUG = 0
  579. CALLBACK_PARAMETER_CHANGED = 1 # parameter_id, 0, value
  580. CALLBACK_PROGRAM_CHANGED = 2 # program_id, 0, 0
  581. CALLBACK_MIDI_PROGRAM_CHANGED = 3 # midi_program_id, 0, 0
  582. CALLBACK_NOTE_ON = 4 # key, velocity, 0
  583. CALLBACK_NOTE_OFF = 5 # key, velocity, 0
  584. CALLBACK_SHOW_GUI = 6 # show? (0|1, -1=quit), 0, 0
  585. CALLBACK_RESIZE_GUI = 7 # width, height, 0
  586. CALLBACK_UPDATE = 8
  587. CALLBACK_RELOAD_INFO = 9
  588. CALLBACK_RELOAD_PARAMETERS = 10
  589. CALLBACK_RELOAD_PROGRAMS = 11
  590. CALLBACK_RELOAD_ALL = 12
  591. CALLBACK_QUIT = 13
  592. class ParameterData(Structure):
  593. _fields_ = [
  594. ("type", c_enum),
  595. ("index", c_int32),
  596. ("rindex", c_int32),
  597. ("hints", c_int32),
  598. ("midi_channel", c_uint8),
  599. ("midi_cc", c_int16)
  600. ]
  601. class ParameterRanges(Structure):
  602. _fields_ = [
  603. ("def", c_double),
  604. ("min", c_double),
  605. ("max", c_double),
  606. ("step", c_double),
  607. ("step_small", c_double),
  608. ("step_large", c_double)
  609. ]
  610. class CustomData(Structure):
  611. _fields_ = [
  612. ("type", c_enum),
  613. ("key", c_char_p),
  614. ("value", c_char_p)
  615. ]
  616. class PluginInfo(Structure):
  617. _fields_ = [
  618. ("valid", c_bool),
  619. ("type", c_enum),
  620. ("category", c_enum),
  621. ("hints", c_uint),
  622. ("binary", c_char_p),
  623. ("name", c_char_p),
  624. ("label", c_char_p),
  625. ("maker", c_char_p),
  626. ("copyright", c_char_p),
  627. ("unique_id", c_long)
  628. ]
  629. class PortCountInfo(Structure):
  630. _fields_ = [
  631. ("valid", c_bool),
  632. ("ins", c_uint32),
  633. ("outs", c_uint32),
  634. ("total", c_uint32)
  635. ]
  636. class ParameterInfo(Structure):
  637. _fields_ = [
  638. ("valid", c_bool),
  639. ("name", c_char_p),
  640. ("symbol", c_char_p),
  641. ("label", c_char_p),
  642. ("scalepoint_count", c_uint32)
  643. ]
  644. class ScalePointInfo(Structure):
  645. _fields_ = [
  646. ("valid", c_bool),
  647. ("value", c_double),
  648. ("label", c_char_p)
  649. ]
  650. class MidiProgramInfo(Structure):
  651. _fields_ = [
  652. ("valid", c_bool),
  653. ("bank", c_uint32),
  654. ("program", c_uint32),
  655. ("label", c_char_p)
  656. ]
  657. class GuiInfo(Structure):
  658. _fields_ = [
  659. ("type", c_enum),
  660. ("resizable", c_bool),
  661. ]
  662. class PluginBridgeInfo(Structure):
  663. _fields_ = [
  664. ("category", c_enum),
  665. ("hints", c_uint),
  666. ("name", c_char_p),
  667. ("maker", c_char_p),
  668. ("unique_id", c_long),
  669. ("ains", c_uint32),
  670. ("aouts", c_uint32),
  671. ("mins", c_uint32),
  672. ("mouts", c_uint32)
  673. ]
  674. CallbackFunc = CFUNCTYPE(None, c_enum, c_ushort, c_int, c_int, c_double)
  675. if (LINUX or MACOS):
  676. BINARY_NATIVE = BINARY_UNIX64 if (is64bit) else BINARY_UNIX32
  677. elif (WINDOWS):
  678. BINARY_NATIVE = BINARY_WIN64 if (is64bit) else BINARY_WIN32
  679. else:
  680. BINARY_NATIVE = BINARY_NONE
  681. # ------------------------------------------------------------------------------------------------
  682. # Backend C++ -> Python object
  683. global Callback
  684. Callback = None
  685. class Host(object):
  686. def __init__(self, lib_prefix_arg):
  687. object.__init__(self)
  688. global carla_library_path
  689. if (lib_prefix_arg):
  690. carla_library_path = os.path.join(lib_prefix_arg, "lib", "carla", carla_libname)
  691. self.lib = cdll.LoadLibrary(carla_library_path)
  692. self.lib.carla_init.argtypes = [c_char_p]
  693. self.lib.carla_init.restype = c_bool
  694. self.lib.carla_close.argtypes = None
  695. self.lib.carla_close.restype = c_bool
  696. self.lib.carla_is_engine_running.argtypes = None
  697. self.lib.carla_is_engine_running.restype = c_bool
  698. self.lib.add_plugin.argtypes = [c_enum, c_enum, c_char_p, c_char_p, c_void_p]
  699. self.lib.add_plugin.restype = c_short
  700. self.lib.remove_plugin.argtypes = [c_ushort]
  701. self.lib.remove_plugin.restype = c_bool
  702. self.lib.get_plugin_info.argtypes = [c_ushort]
  703. self.lib.get_plugin_info.restype = POINTER(PluginInfo)
  704. self.lib.get_audio_port_count_info.argtypes = [c_ushort]
  705. self.lib.get_audio_port_count_info.restype = POINTER(PortCountInfo)
  706. self.lib.get_midi_port_count_info.argtypes = [c_ushort]
  707. self.lib.get_midi_port_count_info.restype = POINTER(PortCountInfo)
  708. self.lib.get_parameter_count_info.argtypes = [c_ushort]
  709. self.lib.get_parameter_count_info.restype = POINTER(PortCountInfo)
  710. self.lib.get_parameter_info.argtypes = [c_ushort, c_uint32]
  711. self.lib.get_parameter_info.restype = POINTER(ParameterInfo)
  712. self.lib.get_scalepoint_info.argtypes = [c_ushort, c_uint32, c_uint32]
  713. self.lib.get_scalepoint_info.restype = POINTER(ScalePointInfo)
  714. self.lib.get_midi_program_info.argtypes = [c_ushort, c_uint32]
  715. self.lib.get_midi_program_info.restype = POINTER(MidiProgramInfo)
  716. self.lib.get_gui_info.argtypes = [c_ushort]
  717. self.lib.get_gui_info.restype = POINTER(GuiInfo)
  718. self.lib.get_parameter_data.argtypes = [c_ushort, c_uint32]
  719. self.lib.get_parameter_data.restype = POINTER(ParameterData)
  720. self.lib.get_parameter_ranges.argtypes = [c_ushort, c_uint32]
  721. self.lib.get_parameter_ranges.restype = POINTER(ParameterRanges)
  722. self.lib.get_custom_data.argtypes = [c_ushort, c_uint32]
  723. self.lib.get_custom_data.restype = POINTER(CustomData)
  724. self.lib.get_chunk_data.argtypes = [c_ushort]
  725. self.lib.get_chunk_data.restype = c_char_p
  726. self.lib.get_parameter_count.argtypes = [c_ushort]
  727. self.lib.get_parameter_count.restype = c_uint32
  728. self.lib.get_program_count.argtypes = [c_ushort]
  729. self.lib.get_program_count.restype = c_uint32
  730. self.lib.get_midi_program_count.argtypes = [c_ushort]
  731. self.lib.get_midi_program_count.restype = c_uint32
  732. self.lib.get_custom_data_count.argtypes = [c_ushort]
  733. self.lib.get_custom_data_count.restype = c_uint32
  734. self.lib.get_program_name.argtypes = [c_ushort, c_uint32]
  735. self.lib.get_program_name.restype = c_char_p
  736. self.lib.get_midi_program_name.argtypes = [c_ushort, c_uint32]
  737. self.lib.get_midi_program_name.restype = c_char_p
  738. self.lib.get_real_plugin_name.argtypes = [c_ushort]
  739. self.lib.get_real_plugin_name.restype = c_char_p
  740. self.lib.get_current_program_index.argtypes = [c_ushort]
  741. self.lib.get_current_program_index.restype = c_int32
  742. self.lib.get_current_midi_program_index.argtypes = [c_ushort]
  743. self.lib.get_current_midi_program_index.restype = c_int32
  744. self.lib.get_default_parameter_value.argtypes = [c_ushort, c_uint32]
  745. self.lib.get_default_parameter_value.restype = c_double
  746. self.lib.get_current_parameter_value.argtypes = [c_ushort, c_uint32]
  747. self.lib.get_current_parameter_value.restype = c_double
  748. self.lib.get_input_peak_value.argtypes = [c_ushort, c_ushort]
  749. self.lib.get_input_peak_value.restype = c_double
  750. self.lib.get_output_peak_value.argtypes = [c_ushort, c_ushort]
  751. self.lib.get_output_peak_value.restype = c_double
  752. self.lib.set_active.argtypes = [c_ushort, c_bool]
  753. self.lib.set_active.restype = None
  754. self.lib.set_drywet.argtypes = [c_ushort, c_double]
  755. self.lib.set_drywet.restype = None
  756. self.lib.set_volume.argtypes = [c_ushort, c_double]
  757. self.lib.set_volume.restype = None
  758. self.lib.set_balance_left.argtypes = [c_ushort, c_double]
  759. self.lib.set_balance_left.restype = None
  760. self.lib.set_balance_right.argtypes = [c_ushort, c_double]
  761. self.lib.set_balance_right.restype = None
  762. self.lib.set_parameter_value.argtypes = [c_ushort, c_uint32, c_double]
  763. self.lib.set_parameter_value.restype = None
  764. self.lib.set_parameter_midi_channel.argtypes = [c_ushort, c_uint32, c_uint8]
  765. self.lib.set_parameter_midi_channel.restype = None
  766. self.lib.set_parameter_midi_cc.argtypes = [c_ushort, c_uint32, c_int16]
  767. self.lib.set_parameter_midi_cc.restype = None
  768. self.lib.set_program.argtypes = [c_ushort, c_uint32]
  769. self.lib.set_program.restype = None
  770. self.lib.set_midi_program.argtypes = [c_ushort, c_uint32]
  771. self.lib.set_midi_program.restype = None
  772. self.lib.set_custom_data.argtypes = [c_ushort, c_enum, c_char_p, c_char_p]
  773. self.lib.set_custom_data.restype = None
  774. self.lib.set_chunk_data.argtypes = [c_ushort, c_char_p]
  775. self.lib.set_chunk_data.restype = None
  776. self.lib.set_gui_data.argtypes = [c_ushort, c_int, c_uintptr]
  777. self.lib.set_gui_data.restype = None
  778. self.lib.show_gui.argtypes = [c_ushort, c_bool]
  779. self.lib.show_gui.restype = None
  780. self.lib.idle_guis.argtypes = None
  781. self.lib.idle_guis.restype = None
  782. self.lib.send_midi_note.argtypes = [c_ushort, c_bool, c_uint8, c_uint8]
  783. self.lib.send_midi_note.restype = None
  784. self.lib.prepare_for_save.argtypes = [c_ushort]
  785. self.lib.prepare_for_save.restype = None
  786. self.lib.set_callback_function.argtypes = [CallbackFunc]
  787. self.lib.set_callback_function.restype = None
  788. self.lib.set_option.argtypes = [c_enum, c_int, c_char_p]
  789. self.lib.set_option.restype = None
  790. self.lib.get_last_error.argtypes = None
  791. self.lib.get_last_error.restype = c_char_p
  792. self.lib.get_host_client_name.argtypes = None
  793. self.lib.get_host_client_name.restype = c_char_p
  794. self.lib.get_host_osc_url.argtypes = None
  795. self.lib.get_host_osc_url.restype = c_char_p
  796. self.lib.get_buffer_size.argtypes = None
  797. self.lib.get_buffer_size.restype = c_uint32
  798. self.lib.get_sample_rate.argtypes = None
  799. self.lib.get_sample_rate.restype = c_double
  800. self.lib.get_latency.argtypes = None
  801. self.lib.get_latency.restype = c_double
  802. def carla_init(self, client_name):
  803. return self.lib.carla_init(client_name.encode("utf-8"))
  804. def carla_close(self):
  805. return self.lib.carla_close()
  806. def carla_is_engine_running(self):
  807. return self.lib.carla_is_engine_running()
  808. def add_plugin(self, btype, ptype, filename, label, extra_stuff):
  809. return self.lib.add_plugin(btype, ptype, filename.encode("utf-8"), label.encode("utf-8"), cast(extra_stuff, c_void_p))
  810. def remove_plugin(self, plugin_id):
  811. return self.lib.remove_plugin(plugin_id)
  812. def get_plugin_info(self, plugin_id):
  813. return struct_to_dict(self.lib.get_plugin_info(plugin_id).contents)
  814. def get_audio_port_count_info(self, plugin_id):
  815. return struct_to_dict(self.lib.get_audio_port_count_info(plugin_id).contents)
  816. def get_midi_port_count_info(self, plugin_id):
  817. return struct_to_dict(self.lib.get_midi_port_count_info(plugin_id).contents)
  818. def get_parameter_count_info(self, plugin_id):
  819. return struct_to_dict(self.lib.get_parameter_count_info(plugin_id).contents)
  820. def get_parameter_info(self, plugin_id, parameter_id):
  821. return struct_to_dict(self.lib.get_parameter_info(plugin_id, parameter_id).contents)
  822. def get_scalepoint_info(self, plugin_id, parameter_id, scalepoint_id):
  823. return struct_to_dict(self.lib.get_scalepoint_info(plugin_id, parameter_id, scalepoint_id).contents)
  824. def get_midi_program_info(self, plugin_id, midi_program_id):
  825. return struct_to_dict(self.lib.get_midi_program_info(plugin_id, midi_program_id).contents)
  826. def get_parameter_data(self, plugin_id, parameter_id):
  827. return struct_to_dict(self.lib.get_parameter_data(plugin_id, parameter_id).contents)
  828. def get_parameter_ranges(self, plugin_id, parameter_id):
  829. return struct_to_dict(self.lib.get_parameter_ranges(plugin_id, parameter_id).contents)
  830. def get_custom_data(self, plugin_id, custom_data_id):
  831. return struct_to_dict(self.lib.get_custom_data(plugin_id, custom_data_id).contents)
  832. def get_chunk_data(self, plugin_id):
  833. return self.lib.get_chunk_data(plugin_id)
  834. def get_gui_info(self, plugin_id):
  835. return struct_to_dict(self.lib.get_gui_info(plugin_id).contents)
  836. def get_parameter_count(self, plugin_id):
  837. return self.lib.get_parameter_count(plugin_id)
  838. def get_program_count(self, plugin_id):
  839. return self.lib.get_program_count(plugin_id)
  840. def get_midi_program_count(self, plugin_id):
  841. return self.lib.get_midi_program_count(plugin_id)
  842. def get_custom_data_count(self, plugin_id):
  843. return self.lib.get_custom_data_count(plugin_id)
  844. def get_program_name(self, plugin_id, program_id):
  845. return self.lib.get_program_name(plugin_id, program_id)
  846. def get_midi_program_name(self, plugin_id, midi_program_id):
  847. return self.lib.get_midi_program_name(plugin_id, midi_program_id)
  848. def get_real_plugin_name(self, plugin_id):
  849. return self.lib.get_real_plugin_name(plugin_id)
  850. def get_current_program_index(self, plugin_id):
  851. return self.lib.get_current_program_index(plugin_id)
  852. def get_current_midi_program_index(self, plugin_id):
  853. return self.lib.get_current_midi_program_index(plugin_id)
  854. def get_default_parameter_value(self, plugin_id, parameter_id):
  855. return self.lib.get_default_parameter_value(plugin_id, parameter_id)
  856. def get_current_parameter_value(self, plugin_id, parameter_id):
  857. return self.lib.get_current_parameter_value(plugin_id, parameter_id)
  858. def get_input_peak_value(self, plugin_id, port_id):
  859. return self.lib.get_input_peak_value(plugin_id, port_id)
  860. def get_output_peak_value(self, plugin_id, port_id):
  861. return self.lib.get_output_peak_value(plugin_id, port_id)
  862. def set_active(self, plugin_id, onoff):
  863. self.lib.set_active(plugin_id, onoff)
  864. def set_drywet(self, plugin_id, value):
  865. self.lib.set_drywet(plugin_id, value)
  866. def set_volume(self, plugin_id, value):
  867. self.lib.set_volume(plugin_id, value)
  868. def set_balance_left(self, plugin_id, value):
  869. self.lib.set_balance_left(plugin_id, value)
  870. def set_balance_right(self, plugin_id, value):
  871. self.lib.set_balance_right(plugin_id, value)
  872. def set_parameter_value(self, plugin_id, parameter_id, value):
  873. self.lib.set_parameter_value(plugin_id, parameter_id, value)
  874. def set_parameter_midi_channel(self, plugin_id, parameter_id, channel):
  875. self.lib.set_parameter_midi_channel(plugin_id, parameter_id, channel)
  876. def set_parameter_midi_cc(self, plugin_id, parameter_id, midi_cc):
  877. self.lib.set_parameter_midi_cc(plugin_id, parameter_id, midi_cc)
  878. def set_program(self, plugin_id, program_id):
  879. self.lib.set_program(plugin_id, program_id)
  880. def set_midi_program(self, plugin_id, midi_program_id):
  881. self.lib.set_midi_program(plugin_id, midi_program_id)
  882. def set_custom_data(self, plugin_id, dtype, key, value):
  883. self.lib.set_custom_data(plugin_id, dtype, key.encode("utf-8"), value.encode("utf-8"))
  884. def set_chunk_data(self, plugin_id, chunk_data):
  885. self.lib.set_chunk_data(plugin_id, chunk_data.encode("utf-8"))
  886. def set_gui_data(self, plugin_id, data, gui_addr):
  887. self.lib.set_gui_data(plugin_id, data, gui_addr)
  888. def show_gui(self, plugin_id, yesno):
  889. self.lib.show_gui(plugin_id, yesno)
  890. def idle_guis(self):
  891. self.lib.idle_guis()
  892. def send_midi_note(self, plugin_id, onoff, note, velocity):
  893. self.lib.send_midi_note(plugin_id, onoff, note, velocity)
  894. def prepare_for_save(self, plugin_id):
  895. self.lib.prepare_for_save(plugin_id)
  896. def set_callback_function(self, func):
  897. global Callback
  898. Callback = CallbackFunc(func)
  899. self.lib.set_callback_function(Callback)
  900. def set_option(self, option, value, value_str):
  901. self.lib.set_option(option, value, value_str.encode("utf-8"))
  902. def get_last_error(self):
  903. return self.lib.get_last_error()
  904. def get_host_client_name(self):
  905. return self.lib.get_host_client_name()
  906. def get_host_osc_url(self):
  907. return self.lib.get_host_osc_url()
  908. def get_buffer_size(self):
  909. return self.lib.get_buffer_size()
  910. def get_sample_rate(self):
  911. return self.lib.get_sample_rate()
  912. def get_latency(self):
  913. return self.lib.get_latency()
  914. # ------------------------------------------------------------------------------------------------
  915. # Default Plugin Folders (set)
  916. global LADSPA_PATH, DSSI_PATH, LV2_PATH, VST_PATH, SF2_PATH
  917. LADSPA_PATH_env = os.getenv("LADSPA_PATH")
  918. DSSI_PATH_env = os.getenv("DSSI_PATH")
  919. LV2_PATH_env = os.getenv("LV2_PATH")
  920. VST_PATH_env = os.getenv("VST_PATH")
  921. SF2_PATH_env = os.getenv("SF2_PATH")
  922. if (LADSPA_PATH_env):
  923. LADSPA_PATH = LADSPA_PATH_env.split(splitter)
  924. else:
  925. LADSPA_PATH = DEFAULT_LADSPA_PATH
  926. if (DSSI_PATH_env):
  927. DSSI_PATH = DSSI_PATH_env.split(splitter)
  928. else:
  929. DSSI_PATH = DEFAULT_DSSI_PATH
  930. if (LV2_PATH_env):
  931. LV2_PATH = LV2_PATH_env.split(splitter)
  932. else:
  933. LV2_PATH = DEFAULT_LV2_PATH
  934. if (VST_PATH_env):
  935. VST_PATH = VST_PATH_env.split(splitter)
  936. else:
  937. VST_PATH = DEFAULT_VST_PATH
  938. if (SF2_PATH_env):
  939. SF2_PATH = SF2_PATH_env.split(splitter)
  940. else:
  941. SF2_PATH = DEFAULT_SF2_PATH
  942. if (haveRDF):
  943. LADSPA_RDF_PATH_env = os.getenv("LADSPA_RDF_PATH")
  944. if (LADSPA_RDF_PATH_env):
  945. ladspa_rdf.set_rdf_path(LADSPA_RDF_PATH_env.split(splitter))
  946. lv2_rdf.set_rdf_path(LV2_PATH)