summaryrefslogtreecommitdiffstats
path: root/src/shared/LV2Features.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-11-14 20:44:40 +0000
committerDavid Robillard <d@drobilla.net>2009-11-14 20:44:40 +0000
commit6ae2018e81e7e81e4906e62dc6224ad34298d9c2 (patch)
tree11286438977c4f975b5148dc93b5f4dfafabdbdc /src/shared/LV2Features.hpp
parentcfec427867f42d7aa7bea6dfbb0736b5ce99e9e2 (diff)
downloadingen-6ae2018e81e7e81e4906e62dc6224ad34298d9c2.tar.gz
ingen-6ae2018e81e7e81e4906e62dc6224ad34298d9c2.tar.bz2
ingen-6ae2018e81e7e81e4906e62dc6224ad34298d9c2.zip
Object extension.
Port resize extension. Sensible extension(s) implementation design for Ingen. Replace string port extension support in Ingen with Object port extension. Implement port resize extension in Ingen. Some test plugins for this stuff. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2260 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared/LV2Features.hpp')
-rw-r--r--src/shared/LV2Features.hpp46
1 files changed, 35 insertions, 11 deletions
diff --git a/src/shared/LV2Features.hpp b/src/shared/LV2Features.hpp
index f2299c5c..78d467a5 100644
--- a/src/shared/LV2Features.hpp
+++ b/src/shared/LV2Features.hpp
@@ -25,11 +25,14 @@
#include <map>
#include <string>
+#include <vector>
#include "slv2/slv2.h"
+#include "raul/SharedPtr.hpp"
namespace Ingen {
namespace Shared {
+class Node;
/** Stuff that may need to be passed to an LV2 plugin (i.e. LV2 features).
*/
@@ -37,26 +40,47 @@ class LV2Features {
public:
LV2Features();
- struct Feature {
- Feature(LV2_Feature* f, void* c=NULL) : feature(f), controller(c) {}
- LV2_Feature* feature; ///< LV2 feature struct (plugin exposed)
- void* controller; ///< Ingen internals, not exposed to plugin
+ class Feature {
+ public:
+ virtual ~Feature() {}
+ virtual SharedPtr<LV2_Feature> feature(Node* node) = 0;
};
- typedef std::map<std::string, Feature> Features;
+ class FeatureArray {
+ public:
+ typedef std::vector< SharedPtr<LV2_Feature> > FeatureVector;
- const Feature* feature(const std::string& uri);
+ FeatureArray(FeatureVector& features)
+ : _features(features)
+ {
+ _array = (LV2_Feature**)malloc(sizeof(LV2_Feature) * (features.size() + 1));
+ _array[features.size()] = NULL;
+ for (size_t i = 0; i < features.size(); ++i)
+ _array[i] = features[i].get();
+ }
- void add_feature(const std::string& uri, LV2_Feature* feature, void* controller);
+ ~FeatureArray() {
+ free(_array);
+ }
- LV2_Feature** lv2_features() const { return _lv2_features; }
+ LV2_Feature** array() { return _array; }
+
+ private:
+ FeatureVector _features;
+ LV2_Feature** _array;
+ };
+
+ SharedPtr<Feature> feature(const std::string& uri);
+
+ void add_feature(const std::string& uri, SharedPtr<Feature> feature);
+
+ SharedPtr<LV2Features::FeatureArray> lv2_features(Node* node) const;
private:
- Features _features;
- LV2_Feature** _lv2_features;
+ typedef std::map< std::string, SharedPtr<Feature> > Features;
+ Features _features;
};
-
} // namespace Shared
} // namespace Ingen