diff options
author | David Robillard <d@drobilla.net> | 2008-09-29 03:17:06 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-09-29 03:17:06 +0000 |
commit | 8ef6955d43a441a5873abaa27049041dea18f79e (patch) | |
tree | e8f7c61e586939f64336ed67c5a0921702159106 /src/libs/engine/events | |
parent | 3593abd69807674d9949134f1ad2b7f5a9f69dc2 (diff) | |
download | ingen-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/events')
-rw-r--r-- | src/libs/engine/events/SetPortValueEvent.cpp | 45 |
1 files changed, 30 insertions, 15 deletions
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; + } } |