diff options
author | Christian Glöckner <cgloeckner@freenet.de> | 2016-01-25 16:20:30 +0100 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2016-02-09 09:03:17 +0100 |
commit | c9edca027eb2d2e257ff4a13fc257385d7c64d39 (patch) | |
tree | f2f003225fc5177fa45bb61e8058aa5acb3be798 /drumgizmo/input/midifile.cc | |
parent | d3554736c13531898fb720b34772a595620e661a (diff) |
Base Midi-Engines on Midi-Engine Base Class (+ Minor Renaming)
Diffstat (limited to 'drumgizmo/input/midifile.cc')
-rw-r--r-- | drumgizmo/input/midifile.cc | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/drumgizmo/input/midifile.cc b/drumgizmo/input/midifile.cc index 4e36c9d..7d27998 100644 --- a/drumgizmo/input/midifile.cc +++ b/drumgizmo/input/midifile.cc @@ -31,10 +31,10 @@ static int const NOTE_ON = 0x90; MidifileInputEngine::MidifileInputEngine() - : smf{nullptr} + : AudioInputEngineMidi{} + , smf{nullptr} , current_event{nullptr} , file{} - , midimap{} , speed{1.f} , track{-1} // all tracks , loop{false} @@ -50,11 +50,6 @@ MidifileInputEngine::~MidifileInputEngine() } } -bool MidifileInputEngine::isMidiEngine() -{ - return true; -} - bool MidifileInputEngine::init(Instruments& instruments) { if (file == "") @@ -74,19 +69,11 @@ bool MidifileInputEngine::init(Instruments& instruments) << "'\n"; return false; } - MidiMapParser p{midimap}; - if (p.parse()) - { + if (!loadMidiMap(midimap, instruments)) { std::cerr << "[MidifileInputEngine] Failed to parse midimap '" << midimap << "'\n"; return false; } - midi_mapper.midimap = p.midimap; - for (auto i = 0u; i < instruments.size(); ++i) - { - auto name = instruments[i]->name(); - midi_mapper.instrmap[name] = i; - } return true; } @@ -176,7 +163,7 @@ event_t *MidifileInputEngine::run(size_t pos, size_t len, size_t *nevents) size_t evpos = current_event->time_seconds * (44100.0 / speed); evs[num_events].offset = evpos - pos; - int i = midi_mapper.lookup(key); + int i = mmap.lookup(key); if (i != -1) { evs[num_events].instrument = i; |