summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-06-29 21:51:04 +0000
committerDavid Robillard <d@drobilla.net>2012-06-29 21:51:04 +0000
commit3990a92e929c8f074827d200777d5ca869296222 (patch)
tree701f4691eec48353770e9196c3a50afc2a206a35
parentdcc66ca66ceab68a30e312572b3539044a5ea9e4 (diff)
downloadlilv-3990a92e929c8f074827d200777d5ca869296222.tar.gz
lilv-3990a92e929c8f074827d200777d5ca869296222.tar.bz2
lilv-3990a92e929c8f074827d200777d5ca869296222.zip
Fix Lilv::Instance API to handle features and failed instantiations.
Deprecate old flawed Lilv::Instance constructors. Add Lilv::Instance::get_handle() and Lilv::Instance::get_extension_data(). git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4502 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--NEWS8
-rw-r--r--lilv/lilvmm.hpp33
2 files changed, 39 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 475f472..34ab67d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+lilv (9999) unstable;
+
+ * Fix Lilv::Instance API to handle features and failed instantiations
+ * Deprecate old flawed Lilv::Instance constructors
+ * Add Lilv::Instance::get_handle() and Lilv::Instance::get_extension_data()
+
+ -- David Robillard <d@drobilla.net>
+
lilv (0.14.2) stable;
* Fix dynmanifest support
diff --git a/lilv/lilvmm.hpp b/lilv/lilvmm.hpp
index fc080e2..df57db8 100644
--- a/lilv/lilvmm.hpp
+++ b/lilv/lilvmm.hpp
@@ -19,6 +19,12 @@
#include "lilv/lilv.h"
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
+# define LILV_DEPRECATED __attribute__((__deprecated__))
+#else
+# define LILV_DEPRECATED
+#endif
+
namespace Lilv {
static inline const char*
@@ -215,10 +221,27 @@ struct Plugins {
};
struct Instance {
+ inline Instance(LilvInstance* instance) : me(instance) {}
+
+ LILV_DEPRECATED
inline Instance(Plugin plugin, double sample_rate) {
- // TODO: features
me = lilv_plugin_instantiate(plugin, sample_rate, NULL);
}
+
+ LILV_DEPRECATED inline Instance(Plugin plugin,
+ double sample_rate,
+ LV2_Feature* const* features) {
+ me = lilv_plugin_instantiate(plugin, sample_rate, features);
+ }
+
+ static inline Instance* create(Plugin plugin,
+ double sample_rate,
+ LV2_Feature* const* features) {
+ LilvInstance* me = lilv_plugin_instantiate(
+ plugin, sample_rate, features);
+
+ return me ? new Instance(me) : NULL;
+ }
LILV_WRAP_CONVERSION(LilvInstance);
@@ -230,12 +253,18 @@ struct Instance {
LILV_WRAP1_VOID(instance, run, unsigned, sample_count);
LILV_WRAP0_VOID(instance, deactivate);
- // TODO: get_extension_data
+ inline const void* get_extension_data(const char* uri) {
+ return lilv_instance_get_extension_data(me, uri);
+ }
inline const LV2_Descriptor* get_descriptor() {
return lilv_instance_get_descriptor(me);
}
+ inline LV2_Handle get_handle() {
+ return lilv_instance_get_handle(me);
+ }
+
LilvInstance* me;
};