From 5233941417f053a8d2e55b7720860e3778a21762 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 4 May 2011 18:35:25 +0000 Subject: Wrap get_by_uri collection methods. Fix lv2_apply.py up until run point. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3251 a436a847-0d15-0410-975c-d299462d15a1 --- swig/python/lv2_apply.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'swig/python') diff --git a/swig/python/lv2_apply.py b/swig/python/lv2_apply.py index 98d6f75..ebb43e5 100755 --- a/swig/python/lv2_apply.py +++ b/swig/python/lv2_apply.py @@ -12,23 +12,24 @@ if len(sys.argv) != 4: print 'USAGE: lv2_apply.py PLUGIN_URI INPUT_WAV OUTPUT_WAV' sys.exit(1) -plugin_uri = sys.argv[1] +# Initialise Lilv +world = lilv.World() +world.load_all() + +plugin_uri = world.new_uri(sys.argv[1]) wav_in_path = sys.argv[2] wav_out_path = sys.argv[3] -# Initialise LILV -world = lilv.World() -world.load_all() # Find plugin -plugin = world.get_all_plugins.get_by_uri(plugin_uri) +plugin = world.get_all_plugins().get_by_uri(plugin_uri) if not plugin: print "Unknown plugin `%s'\n" % plugin_uri sys.exit(1) -lv2_InputPort = world.new_uri(lilv.LILV_PORT_CLASS_INPUT) -lv2_OutputPort = world.new_uri(lilv.LILV_PORT_CLASS_OUTPUT) -lv2_AudioPort = world.new_uri(lilv.LILV_PORT_CLASS_AUDIO) +lv2_InputPort = world.new_uri(lilv.LILV_URI_INPUT_PORT) +lv2_OutputPort = world.new_uri(lilv.LILV_URI_OUTPUT_PORT) +lv2_AudioPort = world.new_uri(lilv.LILV_URI_AUDIO_PORT) n_audio_in = plugin.get_num_ports_of_class(lv2_InputPort, lv2_AudioPort) n_audio_out = plugin.get_num_ports_of_class(lv2_OutputPort, lv2_AudioPort) @@ -63,7 +64,7 @@ nframes = wav_in.getnframes() instance = lilv.Instance(plugin, rate) def read_float(wf, nframes): - wav = wf.readframes(nframes) + wav = wf.readframes(nframes) if wf.getsampwidth() == 4: wav = wave.struct.unpack("<%ul" % (len(wav) / 4), wav) wav = [ i / float(math.pow(2, 32)) for i in wav ] -- cgit v1.2.1