diff options
author | Sander Vocke <sandervocke@gmail.com> | 2024-07-23 13:23:38 +0200 |
---|---|---|
committer | Sander Vocke <sandervocke@gmail.com> | 2024-07-23 13:23:38 +0200 |
commit | 0e59f90e2396190ec3e3a7195bac9c79e12fd6cc (patch) | |
tree | f7fd25a952c6e64db9108eab2a774e46fd9f0a83 /test | |
parent | 019d478818950f7880d2c0f80d8fc8f963e9736b (diff) |
Add CC-controller openness parameter for hi-hats.
Diffstat (limited to 'test')
-rw-r--r-- | test/dgreftest/midiinputengine.cc | 4 | ||||
-rw-r--r-- | test/midimapparsertest.cc | 12 | ||||
-rw-r--r-- | test/midimappertest.cc | 21 |
3 files changed, 23 insertions, 14 deletions
diff --git a/test/dgreftest/midiinputengine.cc b/test/dgreftest/midiinputengine.cc index dbffec9..8d1df8e 100644 --- a/test/dgreftest/midiinputengine.cc +++ b/test/dgreftest/midiinputengine.cc @@ -143,6 +143,7 @@ void MidifileInputEngine::run(size_t pos, size_t len, std::vector<event_t>& even current_event = smf_get_next_event(smf); } + // FIXME: not sure if this section should support CC control? while(current_event && current_event->time_seconds < current_max_time) { if(!smf_event_is_metadata(current_event)) @@ -155,7 +156,8 @@ 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); + auto entries = mmap.lookup(key, MapFrom::Note, MapTo::PlayInstrument); + auto instruments = mmap.lookup_instruments(entries); for(const auto& instrument_idx : instruments) { events.emplace_back(); diff --git a/test/midimapparsertest.cc b/test/midimapparsertest.cc index 3e77c44..7ec95fb 100644 --- a/test/midimapparsertest.cc +++ b/test/midimapparsertest.cc @@ -59,24 +59,24 @@ public: const auto& midimap = parser.midimap; uASSERT_EQUAL(6u, midimap.size()); - uASSERT_EQUAL(54, midimap[0].note_id); + uASSERT_EQUAL(54, midimap[0].from_id); uASSERT_EQUAL(std::string("Crash_left_tip"), midimap[0].instrument_name); - uASSERT_EQUAL(60, midimap[1].note_id); + uASSERT_EQUAL(60, midimap[1].from_id); uASSERT_EQUAL(std::string("Crash_left_whisker"), midimap[1].instrument_name); - uASSERT_EQUAL(55, midimap[2].note_id); + uASSERT_EQUAL(55, midimap[2].from_id); uASSERT_EQUAL(std::string("Crash_right_tip"), midimap[2].instrument_name); // These next two note numbers are intentionally the same and trigger two // different instruments: - uASSERT_EQUAL(62, midimap[3].note_id); + uASSERT_EQUAL(62, midimap[3].from_id); uASSERT_EQUAL(std::string("Crash_right_whisker"), midimap[3].instrument_name); - uASSERT_EQUAL(62, midimap[4].note_id); + uASSERT_EQUAL(62, midimap[4].from_id); uASSERT_EQUAL(std::string("Hihat_closed"), midimap[4].instrument_name); - uASSERT_EQUAL(56, midimap[5].note_id); + uASSERT_EQUAL(56, midimap[5].from_id); uASSERT_EQUAL(std::string("Hihat_closed"), midimap[5].instrument_name); } diff --git a/test/midimappertest.cc b/test/midimappertest.cc index 703c646..e8f02db 100644 --- a/test/midimappertest.cc +++ b/test/midimappertest.cc @@ -66,25 +66,29 @@ public: mapper.swap(instrmap, midimap); { - auto is = mapper.lookup(54); + auto is = mapper.lookup_instruments( + mapper.lookup(54, MapFrom::Note, MapTo::PlayInstrument)); uASSERT_EQUAL(1u, is.size()); uASSERT_EQUAL(0, is[0]); } { - auto is = mapper.lookup(60); + auto is = mapper.lookup_instruments( + mapper.lookup(60, MapFrom::Note, MapTo::PlayInstrument)); uASSERT_EQUAL(1u, is.size()); uASSERT_EQUAL(1, is[0]); } { - auto is = mapper.lookup(55); + auto is = mapper.lookup_instruments( + mapper.lookup(55, MapFrom::Note, MapTo::PlayInstrument)); uASSERT_EQUAL(1u, is.size()); uASSERT_EQUAL(2, is[0]); } { - auto is = mapper.lookup(62); + auto is = mapper.lookup_instruments( + mapper.lookup(62, MapFrom::Note, MapTo::PlayInstrument)); uASSERT_EQUAL(2u, is.size()); // We don't care about the order, so just count the instances uASSERT_EQUAL(1u, std::count(is.begin(), is.end(), 3)); @@ -92,7 +96,8 @@ public: } { - auto is = mapper.lookup(56); + auto is = mapper.lookup_instruments( + mapper.lookup(56, MapFrom::Note, MapTo::PlayInstrument)); uASSERT_EQUAL(1u, is.size()); uASSERT_EQUAL(4, is[0]); } @@ -124,13 +129,15 @@ public: // no such note id { - auto is = mapper.lookup(42); + auto is = mapper.lookup_instruments( + mapper.lookup(42, MapFrom::Note, MapTo::PlayInstrument)); uASSERT_EQUAL(0u, is.size()); } // no such instrument { - auto is = mapper.lookup(60); + auto is = mapper.lookup_instruments( + mapper.lookup(60, MapFrom::Note, MapTo::PlayInstrument)); uASSERT_EQUAL(0u, is.size()); } } |