summaryrefslogtreecommitdiff
path: root/libs/ardour/buffer_set.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-11-18 04:35:31 +0000
committerDavid Robillard <d@drobilla.net>2012-11-18 04:35:31 +0000
commitb47619c458a9b64157a53083b813fdaff52b3e45 (patch)
treeb920ac53f24fec5f8bbd7c2553a066c4f9c731a0 /libs/ardour/buffer_set.cc
parent95bd893d5e1f5fa574799e13905d323bc8b5d531 (diff)
Deliver MIDI events to atom ports that support it, merged with transport events.
Eliminate delivery of non-MIDI events to Ardour MIDI buffers. Fix the general mess of LV2 port flags and types. Unify old MIDI API and new atom API MIDI stuff. Making this work required changing the way we do LV2 MIDI slightly: instead of BufferSet::get_lv2_midi doing the translation automatically, it returns an empty buffer and the caller is responsible for actually filling it. This allows the LV2 code to iterate over the MIDI and transport changes in one go to merge them into the buffer at the correct times. Synth plugins using the new atom API now work and can get accurate transport information along with the MIDI that drives them. git-svn-id: svn://localhost/ardour2/branches/3.0@13522 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/buffer_set.cc')
-rw-r--r--libs/ardour/buffer_set.cc30
1 files changed, 5 insertions, 25 deletions
diff --git a/libs/ardour/buffer_set.cc b/libs/ardour/buffer_set.cc
index c2be5ca007..1f8317ffe2 100644
--- a/libs/ardour/buffer_set.cc
+++ b/libs/ardour/buffer_set.cc
@@ -257,34 +257,11 @@ BufferSet::get_lv2_midi(bool input, size_t i, bool old_api)
{
assert(count().get(DataType::MIDI) > i);
- MidiBuffer& mbuf = get_midi(i);
LV2Buffers::value_type b = _lv2_buffers.at(i * 2 + (input ? 0 : 1));
LV2_Evbuf* evbuf = b.second;
- lv2_evbuf_set_type(evbuf, old_api ? LV2_EVBUF_EVENT : LV2_EVBUF_ATOM);
+ lv2_evbuf_set_type(evbuf, old_api ? LV2_EVBUF_EVENT : LV2_EVBUF_ATOM);
lv2_evbuf_reset(evbuf, input);
- if (input) {
- DEBUG_TRACE(PBD::DEBUG::LV2,
- string_compose("%1 bytes of MIDI waiting @ %2\n",
- mbuf.size(), (void*) mbuf.data()));
-
- LV2_Evbuf_Iterator i = lv2_evbuf_begin(evbuf);
- const uint32_t type = LV2Plugin::urids.midi_MidiEvent;
- for (MidiBuffer::iterator e = mbuf.begin(); e != mbuf.end(); ++e) {
- const Evoral::MIDIEvent<framepos_t> ev(*e, false);
-#ifndef NDEBUG
- DEBUG_TRACE(PBD::DEBUG::LV2,
- string_compose("\tMIDI event of size %1 @ %2\n",
- ev.size(), ev.time()));
- for (uint16_t x = 0; x < ev.size(); ++x) {
- std::stringstream ss;
- ss << "\t\tev[" << x << "] = " << std::hex << (int) ev.buffer()[x] << std::dec << std::endl;
- DEBUG_TRACE (PBD::DEBUG::LV2, ss.str());
- }
-#endif
- lv2_evbuf_write(&i, ev.time(), 0, type, ev.size(), ev.buffer());
- }
- }
return evbuf;
}
@@ -311,7 +288,10 @@ BufferSet::flush_lv2_midi(bool input, size_t i)
DEBUG_TRACE (PBD::DEBUG::LV2, string_compose ("\tByte[%1] = %2\n", x, (int) data[x]));
}
#endif
- mbuf.push_back(frames, size, data);
+ if (type == LV2Plugin::urids.midi_MidiEvent) {
+ // TODO: Make Ardour event buffers generic so plugins can communicate
+ mbuf.push_back(frames, size, data);
+ }
}
}