summaryrefslogtreecommitdiffstats
path: root/swig
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-05-04 18:35:25 +0000
committerDavid Robillard <d@drobilla.net>2011-05-04 18:35:25 +0000
commit5233941417f053a8d2e55b7720860e3778a21762 (patch)
tree4ee951691b41cba74c44883490348936ef8dd429 /swig
parentb264f9c122f03bc2fd97ef15c24aef8148dcc757 (diff)
downloadlilv-5233941417f053a8d2e55b7720860e3778a21762.tar.gz
lilv-5233941417f053a8d2e55b7720860e3778a21762.tar.bz2
lilv-5233941417f053a8d2e55b7720860e3778a21762.zip
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
Diffstat (limited to 'swig')
-rwxr-xr-xswig/python/lv2_apply.py19
1 files changed, 10 insertions, 9 deletions
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 ]