diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/IMidiChannel.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/IMidiChannel.hpp index 9139c553..d48d713b 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/IMidiChannel.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/IMidiChannel.hpp @@ -1,7 +1,6 @@ #pragma once #include -//#include #include namespace HyperSonicDrivers::drivers::midi diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/IMidiDriver.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/IMidiDriver.cpp index fb9bded8..e227682a 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/IMidiDriver.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/IMidiDriver.cpp @@ -9,9 +9,8 @@ namespace HyperSonicDrivers::drivers::midi void IMidiDriver::send(const audio::midi::MIDIEvent& e) noexcept { - // TODO review, this might be the master send. - // so it can address also SysEx commands - // TODO: change that sysEx is a normal send event + // TODO: sysEx must be reviewed if ok, probably shoudl check + // also if last byte is meta sysEx end ... using audio::midi::TO_HIGH; using audio::midi::MIDI_EVENT_TYPES_HIGH; @@ -117,14 +116,10 @@ namespace HyperSonicDrivers::drivers::midi ctrl_sustain(chan, value); break; case REVERB: - // Effects level. Not supported. - //effectLevel(value); - logW(std::format("effect level value {}", value)); + ctrl_reverb(chan, value); break; case CHORUS: - // Chorus level. Not supported. - //chorusLevel(value); - logW(std::format("chorus level value {}", value)); + ctrl_chorus(chan, value); break; case RESET_ALL_CONTROLLERS: // reset all controllers diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplChannel.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplChannel.cpp index dc4db114..15804efc 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplChannel.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplChannel.cpp @@ -4,44 +4,8 @@ namespace HyperSonicDrivers::drivers::midi::opl { - OplChannel::OplChannel(const uint8_t channel/*, std::vector>& voices*/) : - IMidiChannel(channel)/*, m_oplVoices(voices)*/ + OplChannel::OplChannel(const uint8_t channel) : + IMidiChannel(channel) { } - - //void OplChannel::noteOff(const uint8_t note) noexcept - //{ - // /*for (auto it = m_voices.begin(); it!=m_voices.end();) - // { - // auto& v = dynamic_cast(*it); - // if (v.noteOff(note, sustain)) - // m_voices.erase(it); - // else - // ++it; - // }*/ - //} - - //void OplChannel::noteOn(const uint8_t note, const uint8_t vol) noexcept - //{ - // - //} - // - //void OplChannel::controller(const uint8_t ctrl, uint8_t value) noexcept - //{ - //} - // - //void OplChannel::programChange(const uint8_t program) noexcept - //{ - //} - // - //void OplChannel::pitchBend(const uint16_t bend) noexcept - //{ - //} - // - //int OplChannel::allocateVoice(const uint8_t slot, const uint8_t channel, const uint8_t note, const uint8_t volume, const audio::opl::banks::Op2BankInstrument_t* instrument, const bool secondary) noexcept - //{ - // //OplVoice v() - // //return m_voices[slot]->allocate(this, ch, note, volume, instrument, secondary); - // return -1; - //} } diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplChannel.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplChannel.hpp index 4bcd5875..7bcf4cfc 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplChannel.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplChannel.hpp @@ -1,7 +1,6 @@ #pragma once #include -//#include #include #include #include @@ -11,22 +10,6 @@ namespace HyperSonicDrivers::drivers::midi::opl class OplChannel : public IMidiChannel { public: - explicit OplChannel(const uint8_t channel/*, std::vector>& voices*/); - - protected: - //void noteOff(const uint8_t note) noexcept override; - //void noteOn(const uint8_t note, const uint8_t vol) noexcept override; - //void controller(const uint8_t ctrl, uint8_t value) noexcept override; - //void programChange(const uint8_t program) noexcept override; - //void pitchBend(const uint16_t bend) noexcept override; - - private: - //std::vector>& m_oplVoices; - //audio::opl::banks::Op2BankInstrument_t* m_instrPtr = nullptr; - - //int allocateVoice(const uint8_t slot, const uint8_t channel, - // const uint8_t note, const uint8_t volume, - // const audio::opl::banks::Op2BankInstrument_t* instrument, - // const bool secondary) noexcept; + explicit OplChannel(const uint8_t channel); }; } diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplDriver.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplDriver.cpp index c851df30..47b91d94 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplDriver.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplDriver.cpp @@ -34,7 +34,7 @@ namespace HyperSonicDrivers::drivers::midi::opl } for (uint8_t i = 0; i < audio::midi::MIDI_MAX_CHANNELS; ++i) { - m_channels[i] = std::make_unique(i/*, m_voices*/); + m_channels[i] = std::make_unique(i); } } @@ -116,7 +116,7 @@ namespace HyperSonicDrivers::drivers::midi::opl for (auto it = m_voicesInUseIndex.begin(); it != m_voicesInUseIndex.end();) { - if (m_voices[*it]->getChannelNum() == chan && m_voices[*it]->noteOff(/*chan,*/ note, sustain)) + if (m_voices[*it]->getChannelNum() == chan && m_voices[*it]->noteOff(note, sustain)) { m_voicesFreeIndex.push_back(*it); it = m_voicesInUseIndex.erase(it); diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplDriver.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplDriver.hpp index ef5d1e0c..cd045597 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplDriver.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/opl/OplDriver.hpp @@ -37,10 +37,6 @@ namespace HyperSonicDrivers::drivers::midi::opl inline void setOP2Bank(const std::shared_ptr& op2Bank) noexcept { m_op2Bank = op2Bank; }; - //void send(const audio::midi::MIDIEvent& e) noexcept override; - //void send(uint32_t msg) noexcept override; - //void send(int8_t channel, uint32_t msg) noexcept override; - void pause() const noexcept override; void resume() const noexcept override; @@ -49,13 +45,9 @@ namespace HyperSonicDrivers::drivers::midi::opl protected: void onCallback() noexcept override; - // TODO: every MIDI function that has channel put into IMidiChannel interface - // ------ // MIDI Events void noteOff(const uint8_t chan, const uint8_t note) noexcept override; void noteOn(const uint8_t chan, const uint8_t note, const uint8_t vol) noexcept override; - //void controller(const uint8_t chan, const uint8_t ctrl, uint8_t value) noexcept override; - //void programChange(const uint8_t chan, const uint8_t program) noexcept override; void pitchBend(const uint8_t chan, const uint16_t bend) noexcept override; // MIDI Controller Events diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/scummvm/AdLibPart.hpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/scummvm/AdLibPart.hpp index cea1a44e..1b78af75 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/scummvm/AdLibPart.hpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/scummvm/AdLibPart.hpp @@ -12,7 +12,7 @@ namespace HyperSonicDrivers::drivers::midi::scummvm class AdLibPart : public IMidiChannel { public: - AdLibPart(const uint8_t channel); + explicit AdLibPart(const uint8_t channel); inline const AdLibInstrument* getInstr() const noexcept { return &_partInstr; }; inline const AdLibInstrument* getInstrSecondary() const noexcept { return &_partInstrSecondary; }; diff --git a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/scummvm/MidiDriver_ADLIB.cpp b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/scummvm/MidiDriver_ADLIB.cpp index fdd3bcac..650c72d3 100644 --- a/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/scummvm/MidiDriver_ADLIB.cpp +++ b/sdl2-hyper-sonic-drivers/src/HyperSonicDrivers/drivers/midi/scummvm/MidiDriver_ADLIB.cpp @@ -107,7 +107,7 @@ namespace HyperSonicDrivers::drivers::midi::scummvm return opl->getOpl(); }()), - m_opl3Mode(m_opl->type == OplType::OPL3) + m_opl3Mode(m_opl->type != OplType::OPL2) { using audio::midi::MIDI_PERCUSSION_CHANNEL; using audio::midi::MIDI_MAX_CHANNELS; @@ -337,7 +337,6 @@ namespace HyperSonicDrivers::drivers::midi::scummvm if (!m_opl3Mode) { inst = m_percussion->getInstrument(note); - note_ = m_percussion->getNote(note_); } if (!inst) @@ -432,11 +431,10 @@ namespace HyperSonicDrivers::drivers::midi::scummvm void MidiDriver_ADLIB::programChange(const uint8_t chan, const uint8_t program) noexcept { - auto part = getChannel(chan); - if (program > 127) return; + auto part = getChannel(chan); part->program = program; part->setInstr(m_opl3Mode); }