summaryrefslogtreecommitdiffstats
path: root/src/libs/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-09-29 03:17:06 +0000
committerDavid Robillard <d@drobilla.net>2008-09-29 03:17:06 +0000
commit8ef6955d43a441a5873abaa27049041dea18f79e (patch)
treee8f7c61e586939f64336ed67c5a0921702159106 /src/libs/engine
parent3593abd69807674d9949134f1ad2b7f5a9f69dc2 (diff)
downloadingen-8ef6955d43a441a5873abaa27049041dea18f79e.tar.gz
ingen-8ef6955d43a441a5873abaa27049041dea18f79e.tar.bz2
ingen-8ef6955d43a441a5873abaa27049041dea18f79e.zip
* Context extension work.
* Better support for set_port_value on event ports. * Don't pop audio ports when clicking in event mode. * Clicking an event port in event mode will 'bang' the event port (example 'bang' plugin prints when it receives one). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1534 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine')
-rw-r--r--src/libs/engine/LV2Info.cpp2
-rw-r--r--src/libs/engine/LV2Info.hpp3
-rw-r--r--src/libs/engine/LV2Node.cpp7
-rw-r--r--src/libs/engine/OSCEngineReceiver.cpp6
-rw-r--r--src/libs/engine/events/SetPortValueEvent.cpp45
5 files changed, 48 insertions, 15 deletions
diff --git a/src/libs/engine/LV2Info.cpp b/src/libs/engine/LV2Info.cpp
index 4d934855..43dd014b 100644
--- a/src/libs/engine/LV2Info.cpp
+++ b/src/libs/engine/LV2Info.cpp
@@ -34,6 +34,8 @@ LV2Info::LV2Info(Ingen::Shared::World* world)
, event_class(slv2_value_new_uri(world->slv2_world, SLV2_PORT_CLASS_EVENT))
, _world(world)
{
+ assert(world);
+
LV2_Event_Feature* ev_data = (LV2_Event_Feature*)malloc(sizeof(LV2_Event_Feature));
ev_data->lv2_event_ref = &LV2Info::event_ref;
ev_data->lv2_event_unref = &LV2Info::event_ref;
diff --git a/src/libs/engine/LV2Info.hpp b/src/libs/engine/LV2Info.hpp
index d7da8185..f4859ac7 100644
--- a/src/libs/engine/LV2Info.hpp
+++ b/src/libs/engine/LV2Info.hpp
@@ -47,6 +47,9 @@ public:
SLV2Value control_class;
SLV2Value audio_class;
SLV2Value event_class;
+
+ Ingen::Shared::World& world() { return *_world; }
+ SLV2World lv2_world() { return _world->slv2_world; }
static uint32_t event_ref(LV2_Event_Callback_Data callback_data,
LV2_Event* event);
diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp
index d784f1d2..a3c20a95 100644
--- a/src/libs/engine/LV2Node.cpp
+++ b/src/libs/engine/LV2Node.cpp
@@ -198,6 +198,13 @@ LV2Node::instantiate()
if (direction == INPUT && data_type == DataType::CONTROL)
((AudioBuffer*)port->buffer(0))->set_value(def, 0, 0);
+
+ SLV2Value pred = slv2_value_new_uri(info->lv2_world(),
+ "http://lv2plug.in/ns/dev/contexts#context");
+ SLV2Values contexts = slv2_port_get_value(plug, id, pred);
+ if (slv2_values_size(contexts) > 0) {
+ cout << "PORT HAS CONTEXT!" << endl;
+ }
_ports->at(j) = port;
}
diff --git a/src/libs/engine/OSCEngineReceiver.cpp b/src/libs/engine/OSCEngineReceiver.cpp
index dbdb388d..04352c2f 100644
--- a/src/libs/engine/OSCEngineReceiver.cpp
+++ b/src/libs/engine/OSCEngineReceiver.cpp
@@ -612,6 +612,12 @@ OSCEngineReceiver::_set_port_value_cb(const char* path, const char* types, lo_ar
size_t data_size = lo_blob_datasize(b);
void* data = lo_blob_dataptr(b);
set_voice_value(port_path, argv[2]->i, Atom(type, data_size, data));
+ } else if (!strcmp(types, "issN")) { // empty event (type only), all voices
+ const char* type = &argv[2]->s;
+ set_port_value(port_path, Atom(type, 0, NULL));
+ } else if (!strcmp(types, "isisN")) { // empty event (type only), specific voice
+ const char* type = &argv[3]->s;
+ set_voice_value(port_path, argv[2]->i, Atom(type, 0, NULL));
} else {
return 1;
}
diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp
index f69ba9a3..90e66c1c 100644
--- a/src/libs/engine/events/SetPortValueEvent.cpp
+++ b/src/libs/engine/events/SetPortValueEvent.cpp
@@ -138,21 +138,36 @@ SetPortValueEvent::execute(ProcessContext& context)
}
EventBuffer* const ebuf = dynamic_cast<EventBuffer*>(buf);
- // FIXME: eliminate string comparisons
- if (ebuf && _value.type() == Atom::BLOB
- && !strcmp(_value.get_blob_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());
- ebuf->prepare_write(context.start(), context.nframes());
- // FIXME: how should this work? binary over OSC, ick
- // Message is an event:
- ebuf->append(frames, 0, type_id, _value.data_size(), (const uint8_t*)_value.get_blob());
- // Message is an event buffer:
- //ebuf->append((LV2_Event_Buffer*)_data);
- _port->raise_set_by_user_flag();
- return;
+
+ 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) {
+ const uint32_t frames = std::max(
+ (uint32_t)(_time - context.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();
+ return;
+
+ } else if (!strcmp(_value.get_blob_type(), "lv2_midi:MidiEvent")) {
+ const uint32_t type_id = map->uri_to_id(NULL,
+ "http://lv2plug.in/ns/ext/midi#MidiEvent");
+
+ ebuf->prepare_write(context.start(), context.nframes());
+ // FIXME: use OSC midi type? avoid MIDI over OSC entirely?
+ ebuf->append(frames, 0, type_id, _value.data_size(),
+ (const uint8_t*)_value.get_blob());
+ _port->raise_set_by_user_flag();
+ return;
+ }
}