Index: CLAM/examples/PluginExamples/Lv2PluginExample/generateFilesToCompile.py =================================================================== --- CLAM/examples/PluginExamples/Lv2PluginExample/generateFilesToCompile.py (revisión: 14493) +++ CLAM/examples/PluginExamples/Lv2PluginExample/generateFilesToCompile.py (copia de trabajo) @@ -13,7 +13,8 @@ def setNumPorts(self,theNumPorts): self.numPorts = theNumPorts def getNumPorts(self): - return int(self.numPorts) + # if not specified by default one port + return 1 if not self.numPorts else int(self.numPorts) def getSymbol(self) : return self.name.strip().replace(" ","_") @@ -118,7 +119,7 @@ def printTTL(self,clamnetwork,uri,name): #TODO change the static PATH for Dynamic PATH - f = open(name.lower()+'.ttl', 'w') + f = sys.stdout f.write("""\ @prefix lv2: . @prefix doap: . @@ -146,11 +147,10 @@ for port in sorted(self.outputAudio, key=lambda p:p.pos) : ports += port.ttl("Output", len(ports)) f.write(",\n".join(ports) + ".\n") - f.close() def printCLAM_PLUGIN(clamnetworks,uris): - f = open('clam_plugin.cxx', 'w') + f = sys.stdout source = """\ #include "LV2NetworkExporter.hxx" #include "LV2Library.hxx" @@ -177,66 +177,10 @@ for i, uri in enumerate(uris) )), ) f.write(source) - f.close() -def openConfigFile(): - networks = [] - uris = [] - names = [] - f = open('network_and_URI.config',"r") - lines = f.readlines() - bundle = lines[0].strip() - for line in lines[1:]: - network,uri,name = line.split("\t") - network = network.strip() - uri = uri.strip() - name = name.strip() - uris.append(uri) - networks.append(network) - names.append(name) - f.close() - return bundle,networks,uris,names - - -def printMakeFile(bundle, names): - f = open('Makefile', 'w') - sorules = "".join([ """\ -%(so)s.so: LV2NetworkPlayer.cxx clam_plugin.cxx LV2NetworkExporter.cxx - g++ -shared -fPIC -DPIC clam_plugin.cxx LV2NetworkExporter.cxx LV2NetworkPlayer.cxx `pkg-config --cflags --libs lv2core clam_core clam_processing clam_audioio` -o %(so)s.so -l asound -"""%dict(so=name.lower().capitalize()) for name in names ]) - - f.write("""\ -BUNDLE = %(bundle)s.lv2 -INSTALL_DIR = /usr/local/lib/lv2 - - -$(BUNDLE): manifest.ttl %(ttls)s %(sos)s - rm -rf $(BUNDLE) - mkdir $(BUNDLE) - cp manifest.ttl %(ttls)s %(sos)s $(BUNDLE) - - -%(sorules)s -install: $(BUNDLE) - mkdir -p $(INSTALL_DIR) - rm -rf $(INSTALL_DIR)/$(BUNDLE) - cp -R $(BUNDLE) $(INSTALL_DIR) - -clean: - rm -rf $(BUNDLE) %(sos)s %(ttls)s clam_plugin.cxx Makefile -"""%dict( - bundle = bundle, - ttls = " ".join(["%(name)s.ttl"%dict(name=name.lower()) for name in names]), - sos = " ".join(["%(name)s.so"%dict(name=name.lower().capitalize()) for name in names]), - sorules = sorules, - )) - - f.close() - - def printManifest(uris,names): - f = open('manifest.ttl', 'w') + f = sys.stdout f.write("""\ @prefix lv2: . @prefix rdfs: . @@ -248,22 +192,39 @@ """%(uri, name) for uri, name in zip(uris, names)])) - f.close() +import os + +def parseCommandLine() : + uribase = sys.argv[2] + networks = sys.argv[3:] + names = [os.path.splitext(os.path.basename(network))[0] + for network in networks] + uris = [os.path.join(uribase,name) for name in names ] + return uribase, networks, names, uris + def main(): - bundle,clamnetworks,uris,names = openConfigFile() - printCLAM_PLUGIN(clamnetworks,uris) + command = sys.argv[1] + if command == "--manifest" : + uribase, networks, names, uris = parseCommandLine() + printManifest(uris,names) + return + if command == "--main" : + uribase, networks, names, uris = parseCommandLine() + printCLAM_PLUGIN(networks,uris) + return + if command == "--ttl" : + uribase, networks, names, uris = parseCommandLine() + for network, uri, name in zip(networks, uris, names) : + parser = make_parser() + curHandler = ExporterHandler() + parser.setContentHandler(curHandler) + parser.parse(open(network)) + curHandler.printTTL(network,uri,name) + else : + raise Exception("Invalid command %s"%command) - for i in range(0,len(clamnetworks)): - parser = make_parser() - curHandler = ExporterHandler() - parser.setContentHandler(curHandler) - parser.parse(open(clamnetworks[i])) - curHandler.printTTL(clamnetworks[i],uris[i],names[i]) - - printManifest(uris,names) - printMakeFile(bundle, names) if __name__ == '__main__' : Index: CLAM/examples/PluginExamples/Lv2PluginExample/SConstruct =================================================================== --- CLAM/examples/PluginExamples/Lv2PluginExample/SConstruct (revisión: 14493) +++ CLAM/examples/PluginExamples/Lv2PluginExample/SConstruct (copia de trabajo) @@ -1,13 +1,19 @@ #! /usr/bin/python import os, glob, sys -libraryName='clam_lv2' -print 'Building', libraryName + +bundlename = "clam_lv2_example.lv2" + +libraryName='clam_lv2_example' + options = Variables('options.cache', ARGUMENTS) options.Add(PathVariable('clam_prefix', 'The prefix where CLAM was installed', '')) -options.Add(PathVariable('prefix', 'Installation prefix (normally /usr, by default this is clam_prefix)', '', validator=PathVariable.PathAccept)) +options.Add(BoolVariable('verbose', 'Display the full command line instead a short command description', 'no') ) +#options.Add(PathVariable('prefix', 'Installation prefix (normally /usr, by default this is clam_prefix)', '', validator=PathVariable.PathAccept)) options.Add(BoolVariable('crossmingw', 'Using MinGW crosscompiler mode', 'no') ) +bundlePath=os.path.expanduser(os.path.join("~/.lv2",bundlename)) + toolChain = 'default' if sys.platform == 'win32': toolChain = 'mingw' env = Environment(ENV=os.environ, tools=[toolChain], options=options) @@ -16,11 +22,13 @@ env.SConsignFile() # Single signature file CLAMInstallDir = env['clam_prefix'] -InstallDir = env['prefix'] or env['clam_prefix'] clam_sconstoolspath = os.path.join(CLAMInstallDir,'share','clam','sconstools') if env['crossmingw'] : env.Tool('crossmingw', toolpath=[clam_sconstoolspath]) env.Tool('clam', toolpath=[clam_sconstoolspath]) +env.moveIntermediateInto('generated') +env.activateColorCommandLine() +if not env['verbose']: env.ClamQuietCompilation() env.EnableClamModules([ 'clam_core', 'clam_audioio', @@ -29,18 +37,18 @@ ] , CLAMInstallDir) networks = glob.glob("*.clamnetwork") -mainSource = env.Command("clam_plugin.cxx", networks, - "cat ${SOURCES} > ${TARGET}", - URI="" ) - # clamlv2helper --main net1 net2 > miplugin.cxx -ttls = env.Command("clam_plugin.cxx", networks, - "cat ${SOURCES} > ${TARGET}" ) -# clamlv2helper --ttl net1 uri binary name > plugin1.ttl -# clamlv2helper --ttl net1 param1 param2 > manifest.ttl +env['LV2BASEURI'] = "http://clam-project.org/examples/lv2" +manifest = env.Command("manifest.ttl", networks, + "./generateFilesToCompile.py --manifest ${LV2BASEURI} ${SOURCES} > ${TARGET}" ) -env = Program("miprograma", ["source.cxx"], LIBS=["m", "stl"]) +mainSource = env.Command("clam_plugin.cxx", networks, + "./generateFilesToCompile.py --main ${LV2BASEURI} ${SOURCES} > ${TARGET}" ) +ttls = [ + env.Command(os.path.splitext(os.path.basename(network))[0]+".ttl", network, + "./generateFilesToCompile.py --ttl ${LV2BASEURI} ${SOURCE} > ${TARGET}" ) + for network in networks ] sources = Glob("*.cxx") @@ -49,7 +57,11 @@ libraries = [ env.SharedLibrary(target=libraryName, source = sources, SHLIBPREFIX=''), ] -install = env.Install(os.path.join(InstallDir,'lib','ladspa'), libraries) + +install = env.Install(bundlePath, [libraries,ttls,manifest]) env.Alias('install', install) -env.Default(libraries) +env.Default(libraries, ttls, manifest) + + + Index: CLAM/examples/PluginExamples/Lv2PluginExample/othercable.clamnetwork =================================================================== --- CLAM/examples/PluginExamples/Lv2PluginExample/othercable.clamnetwork (revisión: 0) +++ CLAM/examples/PluginExamples/Lv2PluginExample/othercable.clamnetwork (revisión: 0) @@ -0,0 +1,89 @@ + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'FreeSans'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'DejaVu Sans';"></p></body></html> + + + 0 + 1 + 0.5 + 0.1 + - + + + + 0 + 100 + 1 + + + + 0 + 1 + 0.5 + 0.1 + - + + + + 2 + + + + 2 + + + + 20 + 2000 + 440 + 1 + Hz + + + + 440 + 1 + 0 + 44100 + + + + 1 + + + + Input.1 + Output.1 + + + + Input.2 + Output.2 + + + + SimpleOscillator.Audio Output + Tone.1 + + + + Amplitude.output + SimpleOscillator.Amplitude + + + + ControlSource.output + ControlSink.input + + + + Pitch.output + SimpleOscillator.Pitch + + + Index: CLAM/examples/PluginExamples/Lv2PluginExample/network_and_URI.config =================================================================== --- CLAM/examples/PluginExamples/Lv2PluginExample/network_and_URI.config (revisión: 14493) +++ CLAM/examples/PluginExamples/Lv2PluginExample/network_and_URI.config (copia de trabajo) @@ -1,2 +0,0 @@ -myclamlv2plugin -stereocable.clamnetwork http://ll-plugins.nongnu.org/lv2/myclamlv2plugin/clam_stereocable clam_stereocable