summaryrefslogtreecommitdiff
path: root/test/dgreftest/midiinputengine.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/dgreftest/midiinputengine.cc')
-rw-r--r--test/dgreftest/midiinputengine.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/dgreftest/midiinputengine.cc b/test/dgreftest/midiinputengine.cc
index dbffec9..4827e5f 100644
--- a/test/dgreftest/midiinputengine.cc
+++ b/test/dgreftest/midiinputengine.cc
@@ -155,9 +155,14 @@ 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];
- auto instruments = mmap.lookup(key);
- for(const auto& instrument_idx : instruments)
+ auto entries = mmap.lookup(key);
+ for(const auto& entry : entries)
{
+ auto instrument_idx = mmap.lookup_instrument(entry.instrument_name);
+ if (instrument_idx < 0)
+ {
+ continue;
+ }
events.emplace_back();
auto& event = events.back();
event.type = EventType::OnSet;
@@ -165,6 +170,10 @@ void MidifileInputEngine::run(size_t pos, size_t len, std::vector<event_t>& even
event.offset = evpos - pos;
event.instrument = instrument_idx;
event.velocity = velocity / 127.0;
+ if (entry.maybe_curve_map)
+ {
+ event.velocity = entry.maybe_curve_map->map(event.velocity);
+ }
}
}
}