summaryrefslogtreecommitdiffstats
path: root/src/server/events/SetPortValue.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-19 20:16:46 +0000
committerDavid Robillard <d@drobilla.net>2012-03-19 20:16:46 +0000
commit254b434f0a79fea54bd963e8ff2e845a5b0cd3a6 (patch)
treeddf849fc5b64d1096846c28c1f1a742f54c3adff /src/server/events/SetPortValue.cpp
parentbc3afd8380d59c750c8f8e9bf1ed1b8d4a6826e9 (diff)
downloadingen-254b434f0a79fea54bd963e8ff2e845a5b0cd3a6.tar.gz
ingen-254b434f0a79fea54bd963e8ff2e845a5b0cd3a6.tar.bz2
ingen-254b434f0a79fea54bd963e8ff2e845a5b0cd3a6.zip
Partially functioning communication between Ingen LV2 plugin and UI.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4078 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events/SetPortValue.cpp')
-rw-r--r--src/server/events/SetPortValue.cpp45
1 files changed, 3 insertions, 42 deletions
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index ecf9416e..00f72a51 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -22,7 +22,6 @@
#include "ingen/shared/LV2URIMap.hpp"
#include "ingen/shared/URIs.hpp"
#include "ingen/shared/World.hpp"
-#include "lv2/lv2plug.in/ns/ext/event/event.h"
#include "raul/log.hpp"
#include "AudioBuffer.hpp"
@@ -31,10 +30,8 @@
#include "Driver.hpp"
#include "Engine.hpp"
#include "EngineStore.hpp"
-#include "EventBuffer.hpp"
#include "MessageContext.hpp"
#include "NodeImpl.hpp"
-#include "ObjectBuffer.hpp"
#include "PortImpl.hpp"
#include "ProcessContext.hpp"
#include "SetPortValue.hpp"
@@ -129,6 +126,8 @@ SetPortValue::apply(Context& context)
if (_status == SUCCESS && !_port)
_port = _engine.engine_store()->find_port(_port_path);
+ Ingen::Shared::URIs& uris = *_engine.world()->uris().get();
+
if (!_port) {
if (_status == SUCCESS)
_status = PORT_NOT_FOUND;
@@ -138,7 +137,7 @@ SetPortValue::apply(Context& context)
Buffer* const buf = _port->buffer(0).get();
AudioBuffer* const abuf = dynamic_cast<AudioBuffer*>(buf);
if (abuf) {
- if (_value.type() != Atom::FLOAT) {
+ if (_value.type() != uris.forge.Float) {
_status = TYPE_MISMATCH;
return;
}
@@ -150,44 +149,6 @@ SetPortValue::apply(Context& context)
return;
}
- Ingen::Shared::URIs& uris = *_engine.world()->uris().get();
- Ingen::Shared::LV2URIMap& uri_map = *_engine.world()->lv2_uri_map().get();
-
- EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf);
- if (ebuf && _value.type() == Atom::BLOB) {
- const uint32_t frames = std::max(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) {
- const uint32_t type_id = uri_map.uri_to_id(NULL, _value.get_blob_type());
- ebuf->append(frames, 0, type_id, 0, NULL);
- _port->raise_set_by_user_flag();
- return;
-
- } else if (!strcmp(_value.get_blob_type(),
- "http://lv2plug.in/ns/ext/midi#MidiEvent")) {
- ebuf->prepare_write(context);
- ebuf->append(frames, 0,
- uri_map.global_to_event(uris.midi_MidiEvent.id).second,
- _value.data_size(),
- (const uint8_t*)_value.get_blob());
- _port->raise_set_by_user_flag();
- return;
- }
- }
-
- ObjectBuffer* const obuf = dynamic_cast<ObjectBuffer*>(buf);
- if (obuf) {
- obuf->atom()->size = obuf->size() - sizeof(LV2_Atom);
- if (Ingen::Shared::LV2Atom::from_atom(uris, _value, obuf->atom())) {
- debug << "Converted atom " << _value << " :: " << obuf->atom()->type
- << " * " << obuf->atom()->size << " @ " << obuf->atom() << endl;
- return;
- } else {
- warn << "Failed to convert atom to LV2 object" << endl;
- }
- }
-
warn << "Unknown value type " << (int)_value.type() << endl;
}
}