summaryrefslogtreecommitdiffstats
path: root/src/engine/events/SetPortValue.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-11-12 06:56:26 +0000
committerDavid Robillard <d@drobilla.net>2009-11-12 06:56:26 +0000
commit64bd557e75113743f179086b365ea7d97b72ee3e (patch)
tree6a6f5b72a8ce97616cd5ccff188f2e44e92d1ba8 /src/engine/events/SetPortValue.cpp
parent023dcf4cb297928879eb0e53cf0216edb562f6fa (diff)
downloadingen-64bd557e75113743f179086b365ea7d97b72ee3e.tar.gz
ingen-64bd557e75113743f179086b365ea7d97b72ee3e.tar.bz2
ingen-64bd557e75113743f179086b365ea7d97b72ee3e.zip
String port support.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2255 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/events/SetPortValue.cpp')
-rw-r--r--src/engine/events/SetPortValue.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp
index eacf172b..1964880d 100644
--- a/src/engine/events/SetPortValue.cpp
+++ b/src/engine/events/SetPortValue.cpp
@@ -31,6 +31,7 @@
#include "ProcessContext.hpp"
#include "Responder.hpp"
#include "SetPortValue.hpp"
+#include "StringBuffer.hpp"
using namespace std;
using namespace Raul;
@@ -169,21 +170,18 @@ SetPortValue::apply(uint32_t start, uint32_t nframes)
return;
}
- EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf);
-
const LV2Features::Feature* f = _engine.world()->lv2_features->feature(LV2_URI_MAP_URI);
LV2URIMap* map = (LV2URIMap*)f->controller;
- // FIXME: eliminate lookups
- // FIXME: need a proper prefix system
- if (ebuf && _value.type() == Atom::BLOB) {
+ // TODO: eliminate lookups
+ EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf);
+ if (ebuf) {
const uint32_t frames = std::max(
- (uint32_t)(_time - start),
+ uint32_t(_time - start),
ebuf->latest_frames());
// Size 0 event, pass it along to the plugin as a typed but empty event
if (_value.data_size() == 0) {
- cout << "BANG!" << endl;
const uint32_t type_id = map->uri_to_id(NULL, _value.get_blob_type());
ebuf->append(frames, 0, type_id, 0, NULL);
_port->raise_set_by_user_flag();
@@ -202,6 +200,18 @@ SetPortValue::apply(uint32_t start, uint32_t nframes)
}
}
+ StringBuffer* const sbuf = dynamic_cast<StringBuffer*>(buf);
+ if (sbuf) {
+ if (_value.type() != Atom::STRING) {
+ _error = TYPE_MISMATCH;
+ return;
+ }
+ strncpy(sbuf->data(), _value.get_string(),
+ std::min(sbuf->size(), strlen(_value.get_string())));
+ return;
+ }
+
+
if (_value.type() == Atom::BLOB)
cerr << "WARNING: Unknown value blob type " << _value.get_blob_type() << endl;
else