summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lilv/lilvmm.hpp43
-rwxr-xr-xswig/python/lv2_apply.py19
2 files changed, 37 insertions, 25 deletions
diff --git a/lilv/lilvmm.hpp b/lilv/lilvmm.hpp
index 027d4c3..5123a42 100644
--- a/lilv/lilvmm.hpp
+++ b/lilv/lilvmm.hpp
@@ -105,21 +105,29 @@ struct PluginClass {
};
#define LILV_WRAP_COLL(CT, ET, prefix) \
- struct CT { \
- inline CT(const Lilv ## CT* c_obj) : me(c_obj) {} \
- LILV_WRAP_CONVERSION(const Lilv ## CT); \
- LILV_WRAP0(unsigned, prefix, size); \
- LILV_WRAP1(const ET, prefix, get, LilvIter*, i); \
- LILV_WRAP0(LilvIter*, prefix, begin); \
- LILV_WRAP1(LilvIter*, prefix, next, LilvIter*, i); \
- LILV_WRAP1(bool, prefix, is_end, LilvIter*, i); \
- const Lilv ## CT* me; \
- }; \
-
-LILV_WRAP_COLL(PluginClasses, PluginClass, plugin_classes);
-LILV_WRAP_COLL(ScalePoints, ScalePoint, scale_points);
-LILV_WRAP_COLL(Nodes, Node, nodes);
+ inline CT(const Lilv ## CT* c_obj) : me(c_obj) {} \
+ LILV_WRAP_CONVERSION(const Lilv ## CT); \
+ LILV_WRAP0(unsigned, prefix, size); \
+ LILV_WRAP1(const ET, prefix, get, LilvIter*, i); \
+ LILV_WRAP0(LilvIter*, prefix, begin); \
+ LILV_WRAP1(LilvIter*, prefix, next, LilvIter*, i); \
+ LILV_WRAP1(bool, prefix, is_end, LilvIter*, i); \
+ const Lilv ## CT* me; \
+
+struct PluginClasses {
+ LILV_WRAP_COLL(PluginClasses, PluginClass, plugin_classes);
+ LILV_WRAP1(const PluginClass, plugin_classes, get_by_uri, const LilvNode*, uri);
+};
+
+struct ScalePoints {
+ LILV_WRAP_COLL(ScalePoints, ScalePoint, scale_points);
+};
+struct Nodes {
+ LILV_WRAP_COLL(Nodes, Node, nodes);
+ LILV_WRAP1(bool, nodes, contains, const Node, node);
+};
+
struct Port {
inline Port(const LilvPlugin* p, const LilvPort* c_obj)
: parent(p), me(c_obj)
@@ -197,7 +205,10 @@ struct Plugin {
const LilvPlugin* me;
};
-LILV_WRAP_COLL(Plugins, Plugin, plugins);
+struct Plugins {
+ LILV_WRAP_COLL(Plugins, Plugin, plugins);
+ LILV_WRAP1(const Plugin, plugins, get_by_uri, const LilvNode*, uri);
+};
struct Instance {
inline Instance(Plugin plugin, double sample_rate) {
@@ -254,7 +265,7 @@ struct World {
LILV_WRAP1_VOID(world, load_bundle, LilvNode*, bundle_uri);
LILV_WRAP0(const LilvPluginClass*, world, get_plugin_class);
LILV_WRAP0(const LilvPluginClasses*, world, get_plugin_classes);
- LILV_WRAP0(Plugins, world, get_all_plugins);
+ LILV_WRAP0(const Plugins, world, get_all_plugins);
LilvWorld* me;
};
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 ]