summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r--src/libs/engine/events/CreatePortEvent.cpp2
-rw-r--r--src/libs/engine/events/SetPortValueEvent.cpp20
-rw-r--r--src/libs/engine/events/SetPortValueEvent.hpp3
-rw-r--r--src/libs/engine/events/SetPortValueQueuedEvent.cpp57
-rw-r--r--src/libs/engine/events/SetPortValueQueuedEvent.hpp17
5 files changed, 68 insertions, 31 deletions
diff --git a/src/libs/engine/events/CreatePortEvent.cpp b/src/libs/engine/events/CreatePortEvent.cpp
index 7c7d671b..272ef561 100644
--- a/src/libs/engine/events/CreatePortEvent.cpp
+++ b/src/libs/engine/events/CreatePortEvent.cpp
@@ -85,7 +85,7 @@ CreatePortEvent::pre_process()
assert(_patch->path() == _path.parent());
size_t buffer_size = 1;
- if (_type != "ingen:control")
+ if (_type != "ingen:Float")
buffer_size = _engine.audio_driver()->buffer_size();
const uint32_t old_num_ports = _patch->num_ports();
diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp
index 36f60809..cf9e60c3 100644
--- a/src/libs/engine/events/SetPortValueEvent.cpp
+++ b/src/libs/engine/events/SetPortValueEvent.cpp
@@ -38,12 +38,14 @@ SetPortValueEvent::SetPortValueEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
const string& port_path,
+ const string& data_type,
uint32_t data_size,
const void* data)
: Event(engine, responder, timestamp)
, _omni(true)
, _voice_num(0)
, _port_path(port_path)
+ , _data_type(data_type)
, _data_size(data_size)
, _data(malloc(data_size))
, _port(NULL)
@@ -59,12 +61,13 @@ SetPortValueEvent::SetPortValueEvent(Engine& engine,
SampleCount timestamp,
uint32_t voice_num,
const string& port_path,
+ const string& data_type,
uint32_t data_size,
const void* data)
: Event(engine, responder, timestamp)
, _omni(false)
, _voice_num(voice_num)
- , _port_path(port_path)
+ , _data_type(data_type)
, _data_size(data_size)
, _data(malloc(data_size))
, _port(NULL)
@@ -109,14 +112,23 @@ SetPortValueEvent::execute(ProcessContext& context)
}
EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf);
- if (ebuf) {
+ // FIXME: eliminate string comparisons
+ if (ebuf && _data_type == "lv2_midi:MidiEvent") {
+ const LV2Features::Feature* f = _engine.world()->lv2_features->feature(LV2_URI_MAP_URI);
+ LV2URIMap* map = (LV2URIMap*)f->controller;
+ const uint32_t type_id = map->uri_to_id(NULL, "http://lv2plug.in/ns/ext/midi#MidiEvent");
const uint32_t frames = std::max((uint32_t)(_time - context.start()), ebuf->latest_frames());
- // FIXME: type
ebuf->prepare_write(context.nframes());
- ebuf->append(frames, 0, 0, _data_size, (const unsigned char*)_data);
+ // FIXME: how should this work? binary over OSC, ick
+ // Message is an event:
+ ebuf->append(frames, 0, type_id, _data_size, (const unsigned char*)_data);
+ // Message is an event buffer:
+ //ebuf->append((LV2_Event_Buffer*)_data);
_port->raise_set_by_user_flag();
return;
}
+
+ cerr << "WARNING: Unknown value type " << _data_type << ", ignoring" << endl;
}
}
diff --git a/src/libs/engine/events/SetPortValueEvent.hpp b/src/libs/engine/events/SetPortValueEvent.hpp
index e6497aa5..d814a55b 100644
--- a/src/libs/engine/events/SetPortValueEvent.hpp
+++ b/src/libs/engine/events/SetPortValueEvent.hpp
@@ -39,6 +39,7 @@ public:
SharedPtr<Responder> responder,
SampleCount timestamp,
const string& port_path,
+ const string& data_type,
uint32_t data_size,
const void* data);
@@ -47,6 +48,7 @@ public:
SampleCount timestamp,
uint32_t voice_num,
const string& port_path,
+ const string& data_type,
uint32_t data_size,
const void* data);
@@ -61,6 +63,7 @@ private:
bool _omni;
uint32_t _voice_num;
const string _port_path;
+ const string _data_type;
uint32_t _data_size;
void* _data;
PortImpl* _port;
diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp
index 28bb6df1..14060134 100644
--- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp
+++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp
@@ -16,6 +16,7 @@
*/
#include <sstream>
+#include <iostream>
#include "SetPortValueQueuedEvent.hpp"
#include "Responder.hpp"
#include "Engine.hpp"
@@ -28,6 +29,8 @@
#include "EventBuffer.hpp"
#include "ProcessContext.hpp"
+using namespace std;
+
namespace Ingen {
@@ -36,16 +39,18 @@ SetPortValueQueuedEvent::SetPortValueQueuedEvent(Engine& engine,
SharedPtr<Responder> responder,
SampleCount timestamp,
const string& port_path,
+ const string& data_type,
uint32_t data_size,
const void* data)
-: QueuedEvent(engine, responder, timestamp),
- _omni(true),
- _voice_num(0),
- _port_path(port_path),
- _data_size(data_size),
- _data(malloc(data_size)),
- _port(NULL),
- _error(NO_ERROR)
+ : QueuedEvent(engine, responder, timestamp)
+ , _omni(true)
+ , _voice_num(0)
+ , _port_path(port_path)
+ , _data_type(data_type)
+ , _data_size(data_size)
+ , _data(malloc(data_size))
+ , _port(NULL)
+ , _error(NO_ERROR)
{
memcpy(_data, data, data_size);
}
@@ -57,16 +62,18 @@ SetPortValueQueuedEvent::SetPortValueQueuedEvent(Engine& engine,
SampleCount timestamp,
uint32_t voice_num,
const string& port_path,
+ const string& data_type,
uint32_t data_size,
const void* data)
-: QueuedEvent(engine, responder, timestamp),
- _omni(false),
- _voice_num(voice_num),
- _port_path(port_path),
- _data_size(data_size),
- _data(malloc(data_size)),
- _port(NULL),
- _error(NO_ERROR)
+ : QueuedEvent(engine, responder, timestamp)
+ , _omni(false)
+ , _voice_num(voice_num)
+ , _port_path(port_path)
+ , _data_type(data_type)
+ , _data_size(data_size)
+ , _data(malloc(data_size))
+ , _port(NULL)
+ , _error(NO_ERROR)
{
memcpy(_data, data, data_size);
}
@@ -112,11 +119,23 @@ SetPortValueQueuedEvent::execute(ProcessContext& context)
}
EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf);
- if (ebuf) {
+ // FIXME: eliminate string comparisons
+ if (ebuf && _data_type == "lv2_midi:MidiEvent") {
+ const LV2Features::Feature* f = _engine.world()->lv2_features->feature(LV2_URI_MAP_URI);
+ LV2URIMap* map = (LV2URIMap*)f->controller;
+ const uint32_t type_id = map->uri_to_id(NULL, "http://lv2plug.in/ns/ext/midi#MidiEvent");
const uint32_t frames = std::max((uint32_t)(_time - context.start()), ebuf->latest_frames());
- // FIXME: type
- ebuf->append(frames, 0, 0, _data_size, (const unsigned char*)_data);
+ ebuf->prepare_write(context.nframes());
+ // FIXME: how should this work? binary over OSC, ick
+ // Message is an event:
+ ebuf->append(frames, 0, type_id, _data_size, (const unsigned char*)_data);
+ // Message is an event buffer:
+ //ebuf->append((LV2_Event_Buffer*)_data);
+ _port->raise_set_by_user_flag();
+ return;
}
+
+ cerr << "WARNING: Unknown value type " << _data_type << ", ignoring" << endl;
}
}
diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.hpp b/src/libs/engine/events/SetPortValueQueuedEvent.hpp
index 382a574e..937a3ad8 100644
--- a/src/libs/engine/events/SetPortValueQueuedEvent.hpp
+++ b/src/libs/engine/events/SetPortValueQueuedEvent.hpp
@@ -39,6 +39,7 @@ public:
SharedPtr<Responder> responder,
SampleCount timestamp,
const string& port_path,
+ const string& data_type,
uint32_t data_size,
const void* data);
@@ -47,6 +48,7 @@ public:
SampleCount timestamp,
uint32_t voice_num,
const string& port_path,
+ const string& data_type,
uint32_t data_size,
const void* data);
@@ -57,13 +59,14 @@ public:
private:
enum ErrorType { NO_ERROR, PORT_NOT_FOUND, NO_SPACE };
- bool _omni;
- uint32_t _voice_num;
- string _port_path;
- uint32_t _data_size;
- void* _data;
- PortImpl* _port;
- ErrorType _error;
+ bool _omni;
+ uint32_t _voice_num;
+ string _port_path;
+ const string _data_type;
+ uint32_t _data_size;
+ void* _data;
+ PortImpl* _port;
+ ErrorType _error;
};