Browse Source
API breakage was proving too much of a hassle, and would be even further of a mess after release and packaging. Best to make a clean break now, and fix installation to support parallel installs and prevent this kind of problem in the future. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3217 a436a847-0d15-0410-975c-d299462d15a1add_opts_to_lv2apply

32 changed files with 3500 additions and 3741 deletions
@ -1,11 +1,11 @@
@@ -1,11 +1,11 @@
|
||||
SLV2 |
||||
Lilv |
||||
---- |
||||
|
||||
SLV2 is a library for LV2 hosts intended to make using LV2 Plugins as simple |
||||
Lilv is a library for LV2 hosts intended to make using LV2 Plugins as simple |
||||
as possible (without sacrificing capabilities). |
||||
|
||||
More information about LV2 plugins can be found at <http://lv2plug.in>. |
||||
|
||||
More information about SLV2 can be found at <http://drobilla.net/software/slv2>. |
||||
More information about Lilv can be found at <http://drobilla.net/software/lilv>. |
||||
|
||||
-- David Robillard <d@drobilla.net> |
||||
|
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
prefix=@prefix@ |
||||
exec_prefix=@exec_prefix@ |
||||
libdir=@libdir@ |
||||
includedir=@includedir@ |
||||
|
||||
Name: Lilv |
||||
Version: @LILV_VERSION@ |
||||
Description: Simple C library for hosting LV2 plugins |
||||
Libs: @GLIB_LIBS@ @SORD_LIBS@ -L${libdir} -llilv-@LILV_MAJOR_VERSION@ -ldl |
||||
Cflags: @GLIB_CFLAGS@ @SORD_CFLAGS@ -I${includedir}/lilv-@LILV_MAJOR_VERSION@ |
@ -0,0 +1,264 @@
@@ -0,0 +1,264 @@
|
||||
/*
|
||||
Copyright 2007-2011 David Robillard <http://drobilla.net>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any |
||||
purpose with or without fee is hereby granted, provided that the above |
||||
copyright notice and this permission notice appear in all copies. |
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
||||
*/ |
||||
|
||||
#ifndef LILV_LILVMM_HPP |
||||
#define LILV_LILVMM_HPP |
||||
|
||||
#include "lilv/lilv.h" |
||||
|
||||
namespace Lilv { |
||||
|
||||
const char* uri_to_path(const char* uri) { return lilv_uri_to_path(uri); } |
||||
|
||||
#define LILV_WRAP0(RT, prefix, name) \ |
||||
inline RT name () { return lilv_ ## prefix ## _ ## name (me); } |
||||
|
||||
#define LILV_WRAP0_VOID(prefix, name) \ |
||||
inline void name () { lilv_ ## prefix ## _ ## name (me); } |
||||
|
||||
#define LILV_WRAP1(RT, prefix, name, T1, a1) \ |
||||
inline RT name (T1 a1) { return lilv_ ## prefix ## _ ## name (me, a1); } |
||||
|
||||
#define LILV_WRAP1_VOID(prefix, name, T1, a1) \ |
||||
inline void name (T1 a1) { lilv_ ## prefix ## _ ## name (me, a1); } |
||||
|
||||
#define LILV_WRAP2(RT, prefix, name, T1, a1, T2, a2) \ |
||||
inline RT name (T1 a1, T2 a2) { return lilv_ ## prefix ## _ ## name (me, a1, a2); } |
||||
|
||||
#define LILV_WRAP2_VOID(prefix, name, T1, a1, T2, a2) \ |
||||
inline void name (T1 a1, T2 a2) { lilv_ ## prefix ## _ ## name (me, a1, a2); } |
||||
|
||||
#ifndef SWIG |
||||
#define LILV_WRAP_CONVERSION(CT) \ |
||||
inline operator CT() const { return me; } |
||||
#else |
||||
#define LILV_WRAP_CONVERSION(CT) |
||||
#endif |
||||
|
||||
struct Value { |
||||
inline Value(LilvValue value) : me(value) {} |
||||
inline Value(const Value& copy) : me(lilv_value_duplicate(copy.me)) {} |
||||
|
||||
inline ~Value() { /*lilv_value_free(me);*/ } |
||||
|
||||
inline bool equals(const Value& other) const { |
||||
return lilv_value_equals(me, other.me); |
||||
} |
||||
|
||||
inline bool operator==(const Value& other) const { return equals(other); } |
||||
|
||||
LILV_WRAP_CONVERSION(LilvValue); |
||||
|
||||
LILV_WRAP0(char*, value, get_turtle_token); |
||||
LILV_WRAP0(bool, value, is_uri); |
||||
LILV_WRAP0(const char*, value, as_uri); |
||||
LILV_WRAP0(bool, value, is_blank); |
||||
LILV_WRAP0(const char*, value, as_blank); |
||||
LILV_WRAP0(bool, value, is_literal); |
||||
LILV_WRAP0(bool, value, is_string); |
||||
LILV_WRAP0(const char*, value, as_string); |
||||
LILV_WRAP0(bool, value, is_float); |
||||
LILV_WRAP0(float, value, as_float); |
||||
LILV_WRAP0(bool, value, is_int); |
||||
LILV_WRAP0(int, value, as_int); |
||||
LILV_WRAP0(bool, value, is_bool); |
||||
LILV_WRAP0(bool, value, as_bool); |
||||
|
||||
LilvValue me; |
||||
}; |
||||
|
||||
struct ScalePoint { |
||||
inline ScalePoint(LilvScalePoint c_obj) : me(c_obj) {} |
||||
LILV_WRAP_CONVERSION(LilvScalePoint); |
||||
|
||||
LILV_WRAP0(LilvValue, scale_point, get_label); |
||||
LILV_WRAP0(LilvValue, scale_point, get_value); |
||||
|
||||
LilvScalePoint me; |
||||
}; |
||||
|
||||
struct PluginClass { |
||||
inline PluginClass(LilvPluginClass c_obj) : me(c_obj) {} |
||||
LILV_WRAP_CONVERSION(LilvPluginClass); |
||||
|
||||
LILV_WRAP0(Value, plugin_class, get_parent_uri); |
||||
LILV_WRAP0(Value, plugin_class, get_uri); |
||||
LILV_WRAP0(Value, plugin_class, get_label); |
||||
|
||||
inline LilvPluginClasses get_children() { |
||||
return lilv_plugin_class_get_children(me); |
||||
} |
||||
|
||||
LilvPluginClass me; |
||||
}; |
||||
|
||||
#define LILV_WRAP_COLL(CT, ET, prefix) \ |
||||
struct CT { \ |
||||
inline CT(Lilv ## CT c_obj) : me(c_obj) {} \ |
||||
LILV_WRAP_CONVERSION(Lilv ## CT); \ |
||||
LILV_WRAP0(unsigned, prefix, size); \ |
||||
LILV_WRAP1(ET, prefix, get, LilvIter, i); \ |
||||
Lilv ## CT me; \ |
||||
}; \ |
||||
|
||||
LILV_WRAP_COLL(PluginClasses, PluginClass, plugin_classes); |
||||
LILV_WRAP_COLL(ScalePoints, ScalePoint, scale_points); |
||||
LILV_WRAP_COLL(Values, Value, values); |
||||
|
||||
struct Plugins { |
||||
inline Plugins(LilvPlugins c_obj) : me(c_obj) {} |
||||
LILV_WRAP_CONVERSION(LilvPlugins); |
||||
|
||||
LilvPlugins me; |
||||
}; |
||||
|
||||
struct World { |
||||
inline World() : me(lilv_world_new()) {} |
||||
inline ~World() { /*lilv_world_free(me);*/ } |
||||
|
||||
inline LilvValue new_uri(const char* uri) { |
||||
return lilv_value_new_uri(me, uri); |
||||
} |
||||
inline LilvValue new_string(const char* str) { |
||||
return lilv_value_new_string(me, str); |
||||
} |
||||
inline LilvValue new_int(int val) { |
||||
return lilv_value_new_int(me, val); |
||||
} |
||||
inline LilvValue new_float(float val) { |
||||
return lilv_value_new_float(me, val); |
||||
} |
||||
inline LilvValue new_bool(bool val) { |
||||
return lilv_value_new_bool(me, val); |
||||
} |
||||
|
||||
LILV_WRAP2_VOID(world, set_option, const char*, uri, LilvValue, value); |
||||
LILV_WRAP0_VOID(world, free); |
||||
LILV_WRAP0_VOID(world, load_all); |
||||
LILV_WRAP1_VOID(world, load_bundle, LilvValue, bundle_uri); |
||||
LILV_WRAP0(LilvPluginClass, world, get_plugin_class); |
||||
LILV_WRAP0(LilvPluginClasses, world, get_plugin_classes); |
||||
LILV_WRAP0(Plugins, world, get_all_plugins); |
||||
//LILV_WRAP1(Plugin, world, get_plugin_by_uri_string, const char*, uri);
|
||||
|
||||
LilvWorld me; |
||||
}; |
||||
|
||||
struct Port { |
||||
inline Port(LilvPlugin p, LilvPort c_obj) : parent(p), me(c_obj) {} |
||||
LILV_WRAP_CONVERSION(LilvPort); |
||||
|
||||
#define LILV_PORT_WRAP0(RT, name) \ |
||||
inline RT name () { return lilv_port_ ## name (parent, me); } |
||||
|
||||
#define LILV_PORT_WRAP1(RT, name, T1, a1) \ |
||||
inline RT name (T1 a1) { return lilv_port_ ## name (parent, me, a1); } |
||||
|
||||
LILV_PORT_WRAP1(LilvValues, get_value, LilvValue, predicate); |
||||
LILV_PORT_WRAP1(LilvValues, get_value_by_qname, const char*, predicate); |
||||
LILV_PORT_WRAP0(LilvValues, get_properties) |
||||
LILV_PORT_WRAP1(bool, has_property, LilvValue, property_uri); |
||||
LILV_PORT_WRAP1(bool, supports_event, LilvValue, event_uri); |
||||
LILV_PORT_WRAP0(LilvValue, get_symbol); |
||||
LILV_PORT_WRAP0(LilvValue, get_name); |
||||
LILV_PORT_WRAP0(LilvValues, get_classes); |
||||
LILV_PORT_WRAP1(bool, is_a, LilvValue, port_class); |
||||
LILV_PORT_WRAP0(LilvScalePoints, get_scale_points); |
||||
|
||||
// TODO: get_range (output parameters)
|
||||
|
||||
LilvPlugin parent; |
||||
LilvPort me; |
||||
}; |
||||
|
||||
struct Plugin { |
||||
inline Plugin(LilvPlugin c_obj) : me(c_obj) {} |
||||
LILV_WRAP_CONVERSION(LilvPlugin); |
||||
|
||||
LILV_WRAP0(bool, plugin, verify); |
||||
LILV_WRAP0(Value, plugin, get_uri); |
||||
LILV_WRAP0(Value, plugin, get_bundle_uri); |
||||
LILV_WRAP0(Values, plugin, get_data_uris); |
||||
LILV_WRAP0(Value, plugin, get_library_uri); |
||||
LILV_WRAP0(Value, plugin, get_name); |
||||
LILV_WRAP0(PluginClass, plugin, get_class); |
||||
LILV_WRAP1(Values, plugin, get_value, Value, pred); |
||||
LILV_WRAP1(Values, plugin, get_value_by_qname, const char*, predicate); |
||||
LILV_WRAP2(Values, plugin, get_value_for_subject, Value, subject, |
||||
Value, predicate); |
||||
LILV_WRAP1(bool, plugin, has_feature, Value, feature_uri); |
||||
LILV_WRAP0(Values, plugin, get_supported_features); |
||||
LILV_WRAP0(Values, plugin, get_required_features); |
||||
LILV_WRAP0(Values, plugin, get_optional_features); |
||||
LILV_WRAP0(unsigned, plugin, get_num_ports); |
||||
LILV_WRAP0(bool, plugin, has_latency); |
||||
LILV_WRAP0(unsigned, plugin, get_latency_port_index); |
||||
LILV_WRAP0(Value, plugin, get_author_name); |
||||
LILV_WRAP0(Value, plugin, get_author_email); |
||||
LILV_WRAP0(Value, plugin, get_author_homepage); |
||||
|
||||
inline Port get_port_by_index(unsigned index) { |
||||
return Port(me, lilv_plugin_get_port_by_index(me, index)); |
||||
} |
||||
|
||||
inline Port get_port_by_symbol(LilvValue symbol) { |
||||
return Port(me, lilv_plugin_get_port_by_symbol(me, symbol)); |
||||
} |
||||
|
||||
inline void get_port_ranges_float(float* min_values, |
||||
float* max_values, |
||||
float* def_values) { |
||||
return lilv_plugin_get_port_ranges_float( |
||||
me, min_values, max_values, def_values); |
||||
} |
||||
|
||||
inline unsigned get_num_ports_of_class(LilvValue class_1, |
||||
LilvValue class_2) { |
||||
// TODO: varargs
|
||||
return lilv_plugin_get_num_ports_of_class(me, class_1, class_2, NULL); |
||||
} |
||||
|
||||
LilvPlugin me; |
||||
}; |
||||
|
||||
struct Instance { |
||||
inline Instance(Plugin plugin, double sample_rate) { |
||||
// TODO: features
|
||||
me = lilv_plugin_instantiate(plugin, sample_rate, NULL); |
||||
} |
||||
|
||||
LILV_WRAP_CONVERSION(LilvInstance); |
||||
|
||||
LILV_WRAP2_VOID(instance, connect_port, |
||||
unsigned, port_index, |
||||
void*, data_location); |
||||
|
||||
LILV_WRAP0_VOID(instance, activate); |
||||
LILV_WRAP1_VOID(instance, run, unsigned, sample_count); |
||||
LILV_WRAP0_VOID(instance, deactivate); |
||||
|
||||
// TODO: get_extension_data
|
||||
|
||||
inline const LV2_Descriptor* get_descriptor() { |
||||
return lilv_instance_get_descriptor(me); |
||||
} |
||||
|
||||
LilvInstance me; |
||||
}; |
||||
|
||||
} /* namespace Lilv */ |
||||
|
||||
#endif /* LILV_LILVMM_HPP */ |
@ -1,10 +0,0 @@
@@ -1,10 +0,0 @@
|
||||
prefix=@prefix@ |
||||
exec_prefix=@exec_prefix@ |
||||
libdir=@libdir@ |
||||
includedir=@includedir@ |
||||
|
||||
Name: libslv2 |
||||
Version: @SLV2_VERSION@ |
||||
Description: Simple C library for hosting LV2 plugins |
||||
Libs: @GLIB_LIBS@ @SORD_LIBS@ -lsuil -L${libdir} -lslv2 -ldl |
||||
Cflags: @GLIB_CFLAGS@ @SORD_CFLAGS@ -I${includedir} |
@ -1,264 +0,0 @@
@@ -1,264 +0,0 @@
|
||||
/*
|
||||
Copyright 2007-2011 David Robillard <http://drobilla.net>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any |
||||
purpose with or without fee is hereby granted, provided that the above |
||||
copyright notice and this permission notice appear in all copies. |
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
||||
*/ |
||||
|
||||
#ifndef SLV2_SLV2MM_HPP |
||||
#define SLV2_SLV2MM_HPP |
||||
|
||||
#include "slv2/slv2.h" |
||||
|
||||
namespace SLV2 { |
||||
|
||||
const char* uri_to_path(const char* uri) { return slv2_uri_to_path(uri); } |
||||
|
||||
#define SLV2_WRAP0(RT, prefix, name) \ |
||||
inline RT name () { return slv2_ ## prefix ## _ ## name (me); } |
||||
|
||||
#define SLV2_WRAP0_VOID(prefix, name) \ |
||||
inline void name () { slv2_ ## prefix ## _ ## name (me); } |
||||
|
||||
#define SLV2_WRAP1(RT, prefix, name, T1, a1) \ |
||||
inline RT name (T1 a1) { return slv2_ ## prefix ## _ ## name (me, a1); } |
||||
|
||||
#define SLV2_WRAP1_VOID(prefix, name, T1, a1) \ |
||||
inline void name (T1 a1) { slv2_ ## prefix ## _ ## name (me, a1); } |
||||
|
||||
#define SLV2_WRAP2(RT, prefix, name, T1, a1, T2, a2) \ |
||||
inline RT name (T1 a1, T2 a2) { return slv2_ ## prefix ## _ ## name (me, a1, a2); } |
||||
|
||||
#define SLV2_WRAP2_VOID(prefix, name, T1, a1, T2, a2) \ |
||||
inline void name (T1 a1, T2 a2) { slv2_ ## prefix ## _ ## name (me, a1, a2); } |
||||
|
||||
#ifndef SWIG |
||||
#define SLV2_WRAP_CONVERSION(CT) \ |
||||
inline operator CT() const { return me; } |
||||
#else |
||||
#define SLV2_WRAP_CONVERSION(CT) |
||||
#endif |
||||
|
||||
struct Value { |
||||
inline Value(SLV2Value value) : me(value) {} |
||||
inline Value(const Value& copy) : me(slv2_value_duplicate(copy.me)) {} |
||||
|
||||
inline ~Value() { /*slv2_value_free(me);*/ } |
||||
|
||||
inline bool equals(const Value& other) const { |
||||
return slv2_value_equals(me, other.me); |
||||
} |
||||
|
||||
inline bool operator==(const Value& other) const { return equals(other); } |
||||
|
||||
SLV2_WRAP_CONVERSION(SLV2Value); |
||||
|
||||
SLV2_WRAP0(char*, value, get_turtle_token); |
||||
SLV2_WRAP0(bool, value, is_uri); |
||||
SLV2_WRAP0(const char*, value, as_uri); |
||||
SLV2_WRAP0(bool, value, is_blank); |
||||
SLV2_WRAP0(const char*, value, as_blank); |
||||
SLV2_WRAP0(bool, value, is_literal); |
||||
SLV2_WRAP0(bool, value, is_string); |
||||
SLV2_WRAP0(const char*, value, as_string); |
||||
SLV2_WRAP0(bool, value, is_float); |
||||
SLV2_WRAP0(float, value, as_float); |
||||
SLV2_WRAP0(bool, value, is_int); |
||||
SLV2_WRAP0(int, value, as_int); |
||||
SLV2_WRAP0(bool, value, is_bool); |
||||
SLV2_WRAP0(bool, value, as_bool); |
||||
|
||||
SLV2Value me; |
||||
}; |
||||
|
||||
struct ScalePoint { |
||||
inline ScalePoint(SLV2ScalePoint c_obj) : me(c_obj) {} |
||||
SLV2_WRAP_CONVERSION(SLV2ScalePoint); |
||||
|
||||
SLV2_WRAP0(SLV2Value, scale_point, get_label); |
||||
SLV2_WRAP0(SLV2Value, scale_point, get_value); |
||||
|
||||
SLV2ScalePoint me; |
||||
}; |
||||
|
||||
struct PluginClass { |
||||
inline PluginClass(SLV2PluginClass c_obj) : me(c_obj) {} |
||||
SLV2_WRAP_CONVERSION(SLV2PluginClass); |
||||
|
||||
SLV2_WRAP0(Value, plugin_class, get_parent_uri); |
||||
SLV2_WRAP0(Value, plugin_class, get_uri); |
||||
SLV2_WRAP0(Value, plugin_class, get_label); |
||||
|
||||
inline SLV2PluginClasses get_children() { |
||||
return slv2_plugin_class_get_children(me); |
||||
} |
||||
|
||||
SLV2PluginClass me; |
||||
}; |
||||
|
||||
#define SLV2_WRAP_COLL(CT, ET, prefix) \ |
||||
struct CT { \ |
||||
inline CT(SLV2 ## CT c_obj) : me(c_obj) {} \ |
||||
SLV2_WRAP_CONVERSION(SLV2 ## CT); \ |
||||
SLV2_WRAP0(unsigned, prefix, size); \ |
||||
SLV2_WRAP1(ET, prefix, get, SLV2Iter, i); \ |
||||
SLV2 ## CT me; \ |
||||
}; \ |
||||
|
||||
SLV2_WRAP_COLL(PluginClasses, PluginClass, plugin_classes); |
||||
SLV2_WRAP_COLL(ScalePoints, ScalePoint, scale_points); |
||||
SLV2_WRAP_COLL(Values, Value, values); |
||||
|
||||
struct Plugins { |
||||
inline Plugins(SLV2Plugins c_obj) : me(c_obj) {} |
||||
SLV2_WRAP_CONVERSION(SLV2Plugins); |
||||
|
||||
SLV2Plugins me; |
||||
}; |
||||
|
||||
struct World { |
||||
inline World() : me(slv2_world_new()) {} |
||||
inline ~World() { /*slv2_world_free(me);*/ } |
||||
|
||||
inline SLV2Value new_uri(const char* uri) { |
||||
return slv2_value_new_uri(me, uri); |
||||
} |
||||
inline SLV2Value new_string(const char* str) { |
||||
return slv2_value_new_string(me, str); |
||||
} |
||||
inline SLV2Value new_int(int val) { |
||||
return slv2_value_new_int(me, val); |
||||
} |
||||
inline SLV2Value new_float(float val) { |
||||
return slv2_value_new_float(me, val); |
||||
} |
||||
inline SLV2Value new_bool(bool val) { |
||||
return slv2_value_new_bool(me, val); |
||||
} |
||||
|
||||
SLV2_WRAP2_VOID(world, set_option, const char*, uri, SLV2Value, value); |
||||
SLV2_WRAP0_VOID(world, free); |
||||
SLV2_WRAP0_VOID(world, load_all); |
||||
SLV2_WRAP1_VOID(world, load_bundle, SLV2Value, bundle_uri); |
||||
SLV2_WRAP0(SLV2PluginClass, world, get_plugin_class); |
||||
SLV2_WRAP0(SLV2PluginClasses, world, get_plugin_classes); |
||||
SLV2_WRAP0(Plugins, world, get_all_plugins); |
||||
//SLV2_WRAP1(Plugin, world, get_plugin_by_uri_string, const char*, uri);
|
||||
|
||||
SLV2World me; |
||||
}; |
||||
|
||||
struct Port { |
||||
inline Port(SLV2Plugin p, SLV2Port c_obj) : parent(p), me(c_obj) {} |
||||
SLV2_WRAP_CONVERSION(SLV2Port); |
||||
|
||||
#define SLV2_PORT_WRAP0(RT, name) \ |
||||
inline RT name () { return slv2_port_ ## name (parent, me); } |
||||
|
||||
#define SLV2_PORT_WRAP1(RT, name, T1, a1) \ |
||||
inline RT name (T1 a1) { return slv2_port_ ## name (parent, me, a1); } |
||||
|
||||
SLV2_PORT_WRAP1(SLV2Values, get_value, SLV2Value, predicate); |
||||
SLV2_PORT_WRAP1(SLV2Values, get_value_by_qname, const char*, predicate); |
||||
SLV2_PORT_WRAP0(SLV2Values, get_properties) |
||||
SLV2_PORT_WRAP1(bool, has_property, SLV2Value, property_uri); |
||||
SLV2_PORT_WRAP1(bool, supports_event, SLV2Value, event_uri); |
||||
SLV2_PORT_WRAP0(SLV2Value, get_symbol); |
||||
SLV2_PORT_WRAP0(SLV2Value, get_name); |
||||
SLV2_PORT_WRAP0(SLV2Values, get_classes); |
||||
SLV2_PORT_WRAP1(bool, is_a, SLV2Value, port_class); |
||||
SLV2_PORT_WRAP0(SLV2ScalePoints, get_scale_points); |
||||
|
||||
// TODO: get_range (output parameters)
|
||||
|
||||
SLV2Plugin parent; |
||||
SLV2Port me; |
||||
}; |
||||
|
||||
struct Plugin { |
||||
inline Plugin(SLV2Plugin c_obj) : me(c_obj) {} |
||||
SLV2_WRAP_CONVERSION(SLV2Plugin); |
||||
|
||||
SLV2_WRAP0(bool, plugin, verify); |
||||
SLV2_WRAP0(Value, plugin, get_uri); |
||||
SLV2_WRAP0(Value, plugin, get_bundle_uri); |
||||
SLV2_WRAP0(Values, plugin, get_data_uris); |
||||
SLV2_WRAP0(Value, plugin, get_library_uri); |
||||
SLV2_WRAP0(Value, plugin, get_name); |
||||
SLV2_WRAP0(PluginClass, plugin, get_class); |
||||
SLV2_WRAP1(Values, plugin, get_value, Value, pred); |
||||
SLV2_WRAP1(Values, plugin, get_value_by_qname, const char*, predicate); |
||||
SLV2_WRAP2(Values, plugin, get_value_for_subject, Value, subject, |
||||
Value, predicate); |
||||
SLV2_WRAP1(bool, plugin, has_feature, Value, feature_uri); |
||||
SLV2_WRAP0(Values, plugin, get_supported_features); |
||||
SLV2_WRAP0(Values, plugin, get_required_features); |
||||
SLV2_WRAP0(Values, plugin, get_optional_features); |
||||
SLV2_WRAP0(unsigned, plugin, get_num_ports); |
||||
SLV2_WRAP0(bool, plugin, has_latency); |
||||
SLV2_WRAP0(unsigned, plugin, get_latency_port_index); |
||||
SLV2_WRAP0(Value, plugin, get_author_name); |
||||
SLV2_WRAP0(Value, plugin, get_author_email); |
||||
SLV2_WRAP0(Value, plugin, get_author_homepage); |
||||
|
||||
inline Port get_port_by_index(unsigned index) { |
||||
return Port(me, slv2_plugin_get_port_by_index(me, index)); |
||||
} |
||||
|
||||
inline Port get_port_by_symbol(SLV2Value symbol) { |
||||
return Port(me, slv2_plugin_get_port_by_symbol(me, symbol)); |
||||
} |
||||
|
||||
inline void get_port_ranges_float(float* min_values, |
||||
float* max_values, |
||||
float* def_values) { |
||||
return slv2_plugin_get_port_ranges_float( |
||||
me, min_values, max_values, def_values); |
||||
} |
||||
|
||||
inline unsigned get_num_ports_of_class(SLV2Value class_1, |
||||
SLV2Value class_2) { |
||||
// TODO: varargs
|
||||
return slv2_plugin_get_num_ports_of_class(me, class_1, class_2, NULL); |
||||
} |
||||
|
||||
SLV2Plugin me; |
||||
}; |
||||
|
||||
struct Instance { |
||||
inline Instance(Plugin plugin, double sample_rate) { |
||||
// TODO: features
|
||||
me = slv2_plugin_instantiate(plugin, sample_rate, NULL); |
||||
} |
||||
|
||||
SLV2_WRAP_CONVERSION(SLV2Instance); |
||||
|
||||
SLV2_WRAP2_VOID(instance, connect_port, |
||||
unsigned, port_index, |
||||
void*, data_location); |
||||
|
||||
SLV2_WRAP0_VOID(instance, activate); |
||||
SLV2_WRAP1_VOID(instance, run, unsigned, sample_count); |
||||
SLV2_WRAP0_VOID(instance, deactivate); |
||||
|
||||
// TODO: get_extension_data
|
||||
|
||||
inline const LV2_Descriptor* get_descriptor() { |
||||
return slv2_instance_get_descriptor(me); |
||||
} |
||||
|
||||
SLV2Instance me; |
||||
}; |
||||
|
||||
} /* namespace SLV2 */ |
||||
|
||||
#endif /* SLV2_SLV2MM_HPP */ |
@ -0,0 +1,407 @@
@@ -0,0 +1,407 @@
|
||||
/*
|
||||
Copyright 2007-2011 David Robillard <http://drobilla.net>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any |
||||
purpose with or without fee is hereby granted, provided that the above |
||||
copyright notice and this permission notice appear in all copies. |
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
||||
*/ |
||||
|
||||
#ifndef LILV_INTERNAL_H |
||||
#define LILV_INTERNAL_H |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#include <stdbool.h> |
||||
#include <stddef.h> |
||||
#include <stdint.h> |
||||
#include <stdlib.h> |
||||
|
||||
#ifdef __WIN32__ |
||||
#include <windows.h> |
||||
#define dlopen(path, flags) LoadLibrary(path) |
||||
#define dlclose(lib) FreeLibrary(lib) |
||||
#define dlsym GetProcAddress |
||||
static inline char* dlerror(void) { return "Unknown error"; } |
||||
#else |
||||
#include <dlfcn.h> |
||||
#endif |
||||
|
||||
#include <glib.h> |
||||
|
||||
#include "serd/serd.h" |
||||
#include "sord/sord.h" |
||||
|
||||
#include "lilv-config.h" |
||||
|
||||
#ifdef LILV_DYN_MANIFEST |
||||
#include "lv2/lv2plug.in/ns/ext/dyn-manifest/dyn-manifest.h" |
||||
#endif |
||||
|
||||
#include "lilv/lilv.h" |
||||
|
||||
#define LILV_NS_DOAP (const uint8_t*)"http://usefulinc.com/ns/doap#"
|
||||
#define LILV_NS_RDFS (const uint8_t*)"http://www.w3.org/2000/01/rdf-schema#"
|
||||
#define LILV_NS_LILV (const uint8_t*)"http://drobilla.net/ns/lilv#"
|
||||
#define LILV_NS_LV2 (const uint8_t*)"http://lv2plug.in/ns/lv2core#"
|
||||
#define LILV_NS_XSD (const uint8_t*)"http://www.w3.org/2001/XMLSchema#"
|
||||
#define LILV_NS_RDF (const uint8_t*)"http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
|
||||
typedef SordIter* LilvMatches; |
||||
typedef const SordNode* LilvNode; |
||||
|
||||
#define FOREACH_MATCH(iter) \ |
||||
for (; !sord_iter_end(iter); sord_iter_next(iter)) |
||||
|
||||
static inline const SordNode* |
||||
lilv_match_subject(LilvMatches iter) { |
||||
SordQuad tup; |
||||
sord_iter_get(iter, tup); |
||||
return tup[SORD_SUBJECT]; |
||||
} |
||||
|
||||
static inline const SordNode* |
||||
lilv_match_object(LilvMatches iter) { |
||||
SordQuad tup; |
||||
sord_iter_get(iter, tup); |
||||
return tup[SORD_OBJECT]; |
||||
} |
||||
|
||||
static inline void |
||||
lilv_match_end(LilvMatches iter) |
||||
{ |
||||
sord_iter_free(iter); |
||||
} |
||||
|
||||
/* ********* PORT ********* */ |
||||
|
||||
/** Reference to a port on some plugin. */ |
||||
struct _LilvPort { |
||||
uint32_t index; ///< lv2:index
|
||||
LilvValue symbol; ///< lv2:symbol
|
||||
LilvValues classes; ///< rdf:type
|
||||
}; |
||||
|
||||
LilvPort lilv_port_new(LilvWorld world, uint32_t index, const char* symbol); |
||||
void lilv_port_free(LilvPort port); |
||||
|
||||
/* ********* Spec ********* */ |
||||
|
||||
struct _LilvSpec { |
||||
SordNode* spec; |
||||
SordNode* bundle; |
||||
LilvValues data_uris; |
||||
}; |
||||
|
||||
typedef struct _LilvSpec* LilvSpec; |
||||
|
||||
/* ********* Plugin ********* */ |
||||
|
||||
/** Header of an LilvPlugin, LilvPluginClass, or LilvUI.
|
||||
* Any of these structs may be safely casted to _LilvHeader, which is used to |
||||
* implement sequences without code duplication (see lilv_sequence_get_by_uri). |
||||
*/ |
||||
struct _LilvHeader { |
||||
struct _LilvWorld* world; |
||||
LilvValue uri; |
||||
}; |
||||
|
||||
/** Record of an installed/available plugin.
|
||||
* |
||||
* A simple reference to a plugin somewhere on the system. This just holds |
||||
* paths of relevant files, the actual data therein isn't loaded into memory. |
||||
*/ |
||||
struct _LilvPlugin { |
||||
struct _LilvWorld* world; |
||||
LilvValue plugin_uri; |
||||
LilvValue bundle_uri; ///< Bundle directory plugin was loaded from
|
||||
LilvValue binary_uri; ///< lv2:binary
|
||||
LilvValue dynman_uri; ///< dynamic manifest binary
|
||||
LilvPluginClass plugin_class; |
||||
LilvValues data_uris; ///< rdfs::seeAlso
|
||||
LilvPort* ports; |
||||
uint32_t num_ports; |
||||
bool loaded; |
||||
bool replaced; |
||||
}; |
||||
|
||||
LilvPlugin lilv_plugin_new(LilvWorld world, LilvValue uri, LilvValue bundle_uri); |
||||
void lilv_plugin_load_if_necessary(LilvPlugin p); |
||||
void lilv_plugin_free(LilvPlugin plugin); |
||||
|
||||
LilvValue |
||||
lilv_plugin_get_unique(LilvPlugin p, |
||||
LilvNode subject, |
||||
LilvNode predicate); |
||||
|
||||
/* ********* Plugins ********* */ |
||||
|
||||
typedef void* LilvCollection; |
||||
|
||||
LilvPlugins |
||||
lilv_plugins_new(); |
||||
|
||||
|
||||
/**
|
||||
Increment @a i to point at the next element in the collection. |
||||
*/ |
||||
LilvIter |
||||
lilv_iter_next(LilvIter i); |
||||
|
||||
/**
|
||||
Return true iff @a i is at the end of the collection. |
||||
*/ |
||||
bool |
||||
lilv_iter_end(LilvIter i); |
||||
|
||||
LilvIter |
||||
lilv_collection_begin(LilvCollection collection); |
||||
|
||||
void* |
||||
lilv_collection_get(LilvCollection collection, |
||||
LilvIter i); |
||||
|
||||
/**
|
||||
Free @a collection. |
||||
*/ |
||||
void |
||||
lilv_collection_free(LilvCollection collection); |
||||
|
||||
/**
|
||||
Get the number of elements in @a collection. |
||||
*/ |
||||
unsigned |
||||
lilv_collection_size(LilvCollection collection); |
||||
|
||||
LilvValues |
||||
lilv_values_new(void); |
||||
|
||||
LilvScalePoints |
||||
lilv_scale_points_new(void); |
||||
|
||||
|
||||
/* ********* Instance ********* */ |
||||
|
||||
/** Pimpl portion of LilvInstance */ |
||||
struct _LilvInstanceImpl { |
||||
void* lib_handle; |
||||
}; |
||||
|
||||
/* ********* Plugin Class ********* */ |
||||
|
||||
struct _LilvPluginClass { |
||||
struct _LilvWorld* world; |
||||
LilvValue uri; |
||||
LilvValue parent_uri; |
||||
LilvValue label; |
||||
}; |
||||
|
||||
LilvPluginClass lilv_plugin_class_new(LilvWorld world, |
||||
LilvNode parent_uri, |
||||
LilvNode uri, |
||||
const char* label); |
||||
|
||||
void lilv_plugin_class_free(LilvPluginClass plugin_class); |
||||
|
||||
/* ********* Plugin Classes ********* */ |
||||
|
||||
LilvPluginClasses lilv_plugin_classes_new(); |
||||
void lilv_plugin_classes_free(); |
||||
|
||||
/* ********* World ********* */ |
||||
|
||||
typedef struct { |
||||
bool dyn_manifest; |
||||
bool filter_language; |
||||
} LilvOptions; |
||||
|
||||
/** Model of LV2 (RDF) data loaded from bundles.
|
||||
*/ |
||||
struct _LilvWorld { |
||||
SordWorld* world; |
||||
SordModel* model; |
||||
SerdReader* reader; |
||||
SerdEnv* namespaces; |
||||
unsigned n_read_files; |
||||
LilvPluginClass lv2_plugin_class; |
||||
LilvPluginClasses plugin_classes; |
||||
GSList* specs; |
||||
LilvPlugins plugins; |
||||
SordNode* dc_replaces_node; |
||||
SordNode* dyn_manifest_node; |
||||
SordNode* lv2_specification_node; |
||||
SordNode* lv2_plugin_node; |
||||
SordNode* lv2_binary_node; |
||||
SordNode* lv2_default_node; |
||||
SordNode* lv2_minimum_node; |
||||
SordNode* lv2_maximum_node; |
||||
SordNode* lv2_port_node; |
||||
SordNode* lv2_portproperty_node; |
||||
SordNode* lv2_reportslatency_node; |
||||
SordNode* lv2_index_node; |
||||
SordNode* lv2_symbol_node; |
||||
SordNode* rdf_a_node; |
||||
SordNode* rdf_value_node; |
||||
SordNode* rdfs_class_node; |
||||
SordNode* rdfs_label_node; |
||||
SordNode* rdfs_seealso_node; |
||||
SordNode* rdfs_subclassof_node; |
||||
SordNode* lilv_dmanifest_node; |
||||
SordNode* xsd_boolean_node; |
||||
SordNode* xsd_decimal_node; |
||||
SordNode* xsd_double_node; |
||||
SordNode* xsd_integer_node; |
||||
LilvValue doap_name_val; |
||||
LilvValue lv2_name_val; |
||||
LilvOptions opt; |
||||
}; |
||||
|
||||
const uint8_t* |
||||
lilv_world_blank_node_prefix(LilvWorld world); |
||||
void |
||||
lilv_world_load_file(LilvWorld world, const char* file_uri); |
||||
|
||||
/* ********* Plugin UI ********* */ |
||||
|
||||
struct _LilvUI { |
||||
struct _LilvWorld* world; |
||||
LilvValue uri; |
||||
LilvValue bundle_uri; |
||||
LilvValue binary_uri; |
||||
LilvValues classes; |
||||
}; |
||||
|
||||
LilvUIs lilv_uis_new(); |
||||
|
||||
LilvUI |
||||
lilv_ui_new(LilvWorld world, |
||||
LilvValue uri, |
||||
LilvValue type_uri, |
||||
LilvValue binary_uri); |
||||
|
||||
void lilv_ui_free(LilvUI ui); |
||||
|
||||
/* ********* Value ********* */ |
||||
|
||||
typedef enum _LilvValueType { |
||||
LILV_VALUE_URI, |
||||
LILV_VALUE_QNAME_UNUSED, ///< FIXME: APIBREAK: remove
|
||||
LILV_VALUE_STRING, |
||||
LILV_VALUE_INT, |
||||
LILV_VALUE_FLOAT, |
||||
LILV_VALUE_BOOL, |
||||
LILV_VALUE_BLANK |
||||
} LilvValueType; |
||||
|
||||
struct _LilvValue { |
||||
LilvWorld world; |
||||
char* str_val; ///< always present
|
||||
union { |
||||
int int_val; |
||||
float float_val; |
||||
bool bool_val; |
||||
SordNode* uri_val; |
||||
} val; |
||||
LilvValueType type; |
||||
}; |
||||
|
||||
LilvValue lilv_value_new(LilvWorld world, LilvValueType type, const char* val); |
||||
LilvValue lilv_value_new_from_node(LilvWorld world, LilvNode node); |
||||
LilvNode lilv_value_as_node(LilvValue value); |
||||
|
||||
int |
||||
lilv_header_compare_by_uri(const void* a, const void* b, void* user_data); |
||||
|
||||
static inline void |
||||
lilv_sequence_insert(GSequence* seq, void* value) |
||||
{ |
||||
g_sequence_insert_sorted(seq, value, lilv_header_compare_by_uri, NULL); |
||||
} |
||||
|
||||
static inline void |
||||
lilv_array_append(GSequence* seq, void* value) { |
||||
g_sequence_append(seq, value); |
||||
} |
||||
|
||||
struct _LilvHeader* |
||||
lilv_sequence_get_by_uri(GSequence* seq, LilvValue uri); |
||||
|
||||
static inline SordNode* lilv_node_copy(LilvNode node) { |
||||
return sord_node_copy(node); |
||||
} |
||||
|
||||
static inline void lilv_node_free(LilvWorld world, SordNode* node) { |
||||
sord_node_free(world->world, node); |
||||
} |
||||
|
||||
/* ********* Scale Points ********* */ |
||||
|
||||
struct _LilvScalePoint { |
||||
LilvValue value; |
||||
LilvValue label; |
||||
}; |
||||
|
||||
LilvScalePoint lilv_scale_point_new(LilvValue value, LilvValue label); |
||||
void lilv_scale_point_free(LilvScalePoint point); |
||||
|
||||
/* ********* Query Results ********* */ |
||||
|
||||
LilvMatches lilv_plugin_find_statements(LilvPlugin plugin, |
||||
LilvNode subject, |
||||
LilvNode predicate, |
||||
LilvNode object); |
||||
|
||||
static inline bool lilv_matches_next(LilvMatches matches) { |
||||
return sord_iter_next(matches); |
||||
} |
||||
|
||||
static inline bool lilv_matches_end(LilvMatches matches) { |
||||
return sord_iter_end(matches); |
||||
} |
||||
|
||||
LilvValues lilv_values_from_stream_objects(LilvPlugin p, |
||||
LilvMatches stream); |
||||
|
||||
/* ********* Utilities ********* */ |
||||
|
||||
char* lilv_strjoin(const char* first, ...); |
||||
char* lilv_strdup(const char* str); |
||||
char* lilv_get_lang(); |
||||
uint8_t* lilv_qname_expand(LilvPlugin p, const char* qname); |
||||
|
||||
typedef void (*VoidFunc)(); |
||||
|
||||
/** dlsym wrapper to return a function pointer (without annoying warning) */ |
||||
static inline VoidFunc |
||||
lilv_dlfunc(void* handle, const char* symbol) |
||||
{ |
||||
typedef VoidFunc (*VoidFuncGetter)(void*, const char*); |
||||
VoidFuncGetter dlfunc = (VoidFuncGetter)dlsym; |
||||
return dlfunc(handle, symbol); |
||||
} |
||||
|
||||
/* ********* Dynamic Manifest ********* */ |
||||
#ifdef LILV_DYN_MANIFEST |
||||
static const LV2_Feature* const dman_features = { NULL }; |
||||
#endif |
||||
|
||||
#define LILV_ERROR(str) fprintf(stderr, "ERROR: %s: " str, __func__) |
||||
#define LILV_ERRORF(fmt, ...) fprintf(stderr, "ERROR: %s: " fmt, __func__, __VA_ARGS__) |
||||
|
||||
#define LILV_WARN(str) fprintf(stderr, "WARNING: %s: " str, __func__) |
||||
#define LILV_WARNF(fmt, ...) fprintf(stderr, "WARNING: %s: " fmt, __func__, __VA_ARGS__) |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* LILV_INTERNAL_H */ |