Browse Source

Initial work to for Carla+lilv

tags/v0.9.0
falkTX 13 years ago
parent
commit
cfdfe8e945
3 changed files with 66 additions and 108 deletions
  1. +5
    -0
      src/carla-discovery/carla-discovery.cpp
  2. +56
    -40
      src/carla.py
  3. +5
    -68
      src/carla_backend.py

+ 5
- 0
src/carla-discovery/carla-discovery.cpp View File

@@ -771,6 +771,11 @@ void do_lv2_check(const char* bundle)
std::string sbundle;
sbundle += "file://";
sbundle += bundle;
#ifdef __WINDOWS__
sbundle += "\\";
#else
sbundle += "/";
#endif

Lilv::World World;
Lilv::Node Bundle(lilv_new_uri(World.me, sbundle.c_str()));


+ 56
- 40
src/carla.py View File

@@ -297,6 +297,12 @@ class SearchPluginsThread(QThread):
# TODO - split across several fuctions
global LADSPA_PATH, DSSI_PATH, LV2_PATH, VST_PATH, SF2_PATH

os.environ['LADSPA_PATH'] = splitter.join(LADSPA_PATH)
os.environ['DSSI_PATH'] = splitter.join(DSSI_PATH)
os.environ['LV2_PATH'] = splitter.join(LV2_PATH)
os.environ['VST_PATH'] = splitter.join(VST_PATH)
os.environ['SF2_PATH'] = splitter.join(SF2_PATH)

blacklist = toList(self.settings_db.value("Plugins/Blacklisted", []))
bins = []
bins_w = []
@@ -304,6 +310,7 @@ class SearchPluginsThread(QThread):
m_count = type_count = 0
if (self.check_ladspa): m_count += 1
if (self.check_dssi): m_count += 1
if (self.check_lv2): m_count += 1
if (self.check_vst): m_count += 1

check_native = check_wine = False
@@ -343,7 +350,6 @@ class SearchPluginsThread(QThread):
if (carla_discovery_win64 in self.check_bins):
bins.append(carla_discovery_win64)

if (self.check_lv2): type_count += 1
if (self.check_sf2): type_count += 1

if (type_count == 0):
@@ -356,7 +362,6 @@ class SearchPluginsThread(QThread):
soundfonts = []

ladspa_rdf_info = []
lv2_rdf_info = []

last_value = 0
percent_value = 100/type_count
@@ -488,17 +493,53 @@ class SearchPluginsThread(QThread):

last_value += percent_value

## ----- LV2
if (self.check_lv2 and haveRDF):
# ----- LV2
if (self.check_lv2):
self.pluginLook(last_value, "LV2 bundles...")
lv2_rdf.set_rdf_path(LV2_PATH)
lv2_rdf_info = lv2_rdf.recheck_all_plugins(self, last_value, percent_value)
for info in lv2_rdf_info:
plugins = checkPluginLV2(info)
if (plugins != None):
lv2_plugins.append(plugins)
lv2_bundles = []

for iPATH in LV2_PATH:
bundles = findLV2Bundles(iPATH)
for bundle in bundles:
if (bundle not in lv2_bundles):
lv2_bundles.append(bundle)

lv2_bundles.sort()

if (check_native):
for i in range(len(lv2_bundles)):
lv2 = lv2_bundles[i]
if (getShortFileName(lv2) in blacklist):
print("bundle %s is blacklisted, skip it" % (lv2))
continue
else:
percent = ( float(i) / len(lv2_bundles) ) * percent_value
self.pluginLook(last_value + percent, lv2)
self.setLastLoadedBinary(lv2)
for bin_ in bins:
plugins = checkPluginLV2(lv2, bin_)
if (plugins != None):
lv2_plugins.append(plugins)

last_value += percent_value

if (check_wine):
# Check binaries, wine
for i in range(len(lv2_bundles)):
lv2_w = lv2_bundles[i]
if (getShortFileName(lv2_w) in blacklist):
print("bundle %s is blacklisted, skip it" % (lv2_w))
continue
else:
percent = ( float(i) / len(lv2_bundles) ) * percent_value
self.pluginLook(last_value + percent, lv2_w)
self.setLastLoadedBinary(lv2_w)
for bin_w in bins_w:
plugins = checkPluginLV2(lv2_w, bin_w)
if (plugins != None):
lv2_plugins.append(plugins)

last_value += percent_value
last_value += percent_value

# ----- VST
if (self.check_vst):
@@ -612,12 +653,6 @@ class SearchPluginsThread(QThread):
json.dump(ladspa_rdf_info, f_ladspa)
f_ladspa.close()

if (self.check_lv2):
f_lv2 = open(os.path.join(SettingsDir, "lv2_rdf.db"), 'w')
if (f_lv2):
json.dump(lv2_rdf_info, f_lv2)
f_lv2.close()

# Plugin Refresh Dialog
class PluginRefreshW(QDialog, ui_carla_refresh.Ui_PluginRefreshW):
def __init__(self, parent):
@@ -2984,14 +3019,6 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW):
return gui.encode("utf-8")
return c_nullptr

elif (ptype == PLUGIN_LV2):
p_uri = plugin['label'].encode("utf-8")
for rdf_item in self.lv2_rdf_list:
if (rdf_item.URI == p_uri):
return pointer(rdf_item)
else:
return c_nullptr

else:
return c_nullptr

@@ -3217,25 +3244,14 @@ class CarlaMainW(QMainWindow, ui_carla.Ui_CarlaMainW):
if (os.path.exists(fr_ladspa_file)):
fr_ladspa = open(fr_ladspa_file, 'r')
if (fr_ladspa):
#try:
self.ladspa_rdf_list = ladspa_rdf.get_c_ladspa_rdfs(json.load(fr_ladspa))
#except:
#self.ladspa_rdf_list = []
try:
self.ladspa_rdf_list = ladspa_rdf.get_c_ladspa_rdfs(json.load(fr_ladspa))
except:
self.ladspa_rdf_list = []
fr_ladspa.close()

fr_lv2_file = os.path.join(SettingsDir, "lv2_rdf.db")
if (os.path.exists(fr_lv2_file)):
fr_lv2 = open(fr_lv2_file, 'r')
if (fr_lv2):
#try:
self.lv2_rdf_list = lv2_rdf.get_c_lv2_rdfs(json.load(fr_lv2))
#except:
#self.lv2_rdf_list = []
fr_lv2.close()

else:
self.ladspa_rdf_list = []
self.lv2_rdf_list = []

@pyqtSlot()
def slot_file_new(self):


+ 5
- 68
src/carla_backend.py View File

@@ -24,10 +24,10 @@ from subprocess import Popen, PIPE

# Imports (Custom)
try:
import ladspa_rdf, lv2_rdf
import ladspa_rdf
haveRDF = True
except:
print("RDF Support not available (LADSPA-RDF and LV2 will be disabled)")
print("RDF Support not available (LADSPA-RDF will be disabled)")
haveRDF = False

# Set Platform and Architecture
@@ -527,76 +527,15 @@ def checkPluginLADSPA(filename, tool, isWine=False):
def checkPluginDSSI(filename, tool, isWine=False):
return runCarlaDiscovery(PLUGIN_DSSI, "DSSI", filename, tool, isWine)

def checkPluginLV2(filename, tool, isWine=False):
return runCarlaDiscovery(PLUGIN_DSSI, "LV2", filename, tool, isWine)

def checkPluginVST(filename, tool, isWine=False):
return runCarlaDiscovery(PLUGIN_VST, "VST", filename, tool, isWine)

def checkPluginSF2(filename, tool):
return runCarlaDiscovery(PLUGIN_SF2, "SF2", filename, tool)

def checkPluginLV2(rdf_info):
plugins = []

pinfo = deepcopy(PyPluginInfo)
pinfo['type'] = PLUGIN_LV2
pinfo['build'] = BINARY_NATIVE
pinfo['category'] = PLUGIN_CATEGORY_NONE # TODO
pinfo['hints'] = 0
pinfo['binary'] = rdf_info['Binary']
pinfo['name'] = rdf_info['Name']
pinfo['label'] = rdf_info['URI']
pinfo['maker'] = rdf_info['Author']
pinfo['copyright'] = rdf_info['License']
pinfo['unique_id'] = rdf_info['UniqueID']
pinfo['audio.ins'] = 0
pinfo['audio.outs'] = 0
pinfo['audio.total'] = 0
pinfo['midi.ins'] = 0
pinfo['midi.outs'] = 0
pinfo['midi.total'] = 0
pinfo['parameters.ins'] = 0
pinfo['parameters.outs'] = 0
pinfo['parameters.total'] = 0
pinfo['programs.total'] = 0 #rdf_info['PresetCount']

if (pinfo['binary'] == "" or pinfo['name'] == "" or not rdf_info['Bundle']):
return None

for i in range(rdf_info['PortCount']):
PortType = rdf_info['Ports'][i]['Type']
PortProps = rdf_info['Ports'][i]['Properties']

if (PortType & lv2_rdf.LV2_PORT_AUDIO):
pinfo['audio.total'] += 1
if (PortType & lv2_rdf.LV2_PORT_INPUT):
pinfo['audio.ins'] += 1
elif (PortType & lv2_rdf.LV2_PORT_OUTPUT):
pinfo['audio.outs'] += 1

elif (PortType & lv2_rdf.LV2_PORT_SUPPORTS_MIDI):
pinfo['midi.total'] += 1
if (PortType & lv2_rdf.LV2_PORT_INPUT):
pinfo['midi.ins'] += 1
elif (PortType & lv2_rdf.LV2_PORT_OUTPUT):
pinfo['midi.outs'] += 1

elif (PortType & lv2_rdf.LV2_PORT_CONTROL):
pinfo['parameters.total'] += 1
if (PortType & lv2_rdf.LV2_PORT_INPUT):
pinfo['parameters.ins'] += 1
elif (PortType & lv2_rdf.LV2_PORT_OUTPUT):
if (not PortProps & lv2_rdf.LV2_PORT_LATENCY):
pinfo['parameters.outs'] += 1

if (rdf_info['Type'] & lv2_rdf.LV2_GROUP_GENERATOR):
pinfo['hints'] |= PLUGIN_IS_SYNTH

if (rdf_info['UICount'] > 0):
pinfo['hints'] |= PLUGIN_HAS_GUI

plugins.append(pinfo)

return plugins

# ------------------------------------------------------------------------------------------------
# Backend C++ -> Python variables

@@ -1199,5 +1138,3 @@ if (haveRDF):
LADSPA_RDF_PATH_env = os.getenv("LADSPA_RDF_PATH")
if (LADSPA_RDF_PATH_env):
ladspa_rdf.set_rdf_path(LADSPA_RDF_PATH_env.split(splitter))

lv2_rdf.set_rdf_path(LV2_PATH)

Loading…
Cancel
Save