diff options
Diffstat (limited to 'test/dgreftest/midiinputengine.cc')
-rw-r--r-- | test/dgreftest/midiinputengine.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/test/dgreftest/midiinputengine.cc b/test/dgreftest/midiinputengine.cc index ca223da..dbffec9 100644 --- a/test/dgreftest/midiinputengine.cc +++ b/test/dgreftest/midiinputengine.cc @@ -155,16 +155,15 @@ void MidifileInputEngine::run(size_t pos, size_t len, std::vector<event_t>& even int key = current_event->midi_buffer[1]; int velocity = current_event->midi_buffer[2]; - events.emplace_back(); - auto& event = events.back(); - event.type = EventType::OnSet; - size_t evpos = current_event->time_seconds * (samplerate / speed); - event.offset = evpos - pos; - - int i = mmap.lookup(key); - if(i != -1) + auto instruments = mmap.lookup(key); + for(const auto& instrument_idx : instruments) { - event.instrument = i; + events.emplace_back(); + auto& event = events.back(); + event.type = EventType::OnSet; + size_t evpos = current_event->time_seconds * (samplerate / speed); + event.offset = evpos - pos; + event.instrument = instrument_idx; event.velocity = velocity / 127.0; } } |