diff options
-rw-r--r-- | src/adlmidi_midiplay.cpp | 26 | ||||
-rw-r--r-- | src/adlmidi_private.hpp | 30 |
2 files changed, 23 insertions, 33 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 7911adc..ed7f44a 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -951,20 +951,12 @@ void MIDIplay::realTime_ResetState() for(size_t ch = 0; ch < Ch.size(); ch++) { MIDIchannel &chan = Ch[ch]; + chan.resetAllControllers(); chan.volume = (opl.m_musicMode == OPL3::MODE_RSXX) ? 127 : 100; - chan.expression = 127; - chan.panning = 0x30; - chan.vibrato = 0; - chan.sustain = 0; - chan.bend = 0.0; - chan.bendsense = 2 / 8192.0; chan.vibpos = 0.0; - chan.vibdepth = 0.5 / 127.0; - chan.vibdelay = 0; chan.lastlrpn = 0; chan.lastmrpn = 0; chan.nrpn = false; - chan.brightness = 127; NoteUpdate_All(uint16_t(ch), Upd_All); NoteUpdate_All(uint16_t(ch), Upd_Off); } @@ -1315,24 +1307,14 @@ void MIDIplay::realTime_Controller(uint8_t channel, uint8_t type, uint8_t value) case 10: // Change panning Ch[channel].panning = 0x00; - if(value < 64 + 32) Ch[channel].panning |= 0x10; - if(value >= 64 - 32) Ch[channel].panning |= 0x20; + if(value < 64 + 32) Ch[channel].panning |= OPL_PANNING_LEFT; + if(value >= 64 - 32) Ch[channel].panning |= OPL_PANNING_RIGHT; NoteUpdate_All(channel, Upd_Pan); break; case 121: // Reset all controllers - Ch[channel].bend = 0; - Ch[channel].volume = 100; - Ch[channel].expression = 127; - Ch[channel].sustain = 0; - Ch[channel].vibrato = 0; - Ch[channel].vibspeed = 2 * 3.141592653 * 5.0; - Ch[channel].vibdepth = 0.5 / 127; - Ch[channel].vibdelay = 0; - Ch[channel].panning = 0x30; - Ch[channel].portamento = 0; - Ch[channel].brightness = 127; + Ch[channel].resetAllControllers(); //UpdatePortamento(MidCh); NoteUpdate_All(channel, Upd_Pan + Upd_Volume + Upd_Pitch); // Kill all sustained notes diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index 8e5f060..caaf4f9 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -125,6 +125,10 @@ typedef int32_t ssize_t; #define ADL_UNUSED(x) (void)x +#define OPL_PANNING_LEFT 0x10 +#define OPL_PANNING_RIGHT 0x20 +#define OPL_PANNING_BOTH 0x30 + extern std::string ADLMIDI_ErrorString; /* @@ -587,26 +591,30 @@ public: activenotemap_t activenotes; void reset() { - portamento = 0; + resetAllControllers(); + patch = 0; + vibpos = 0; bank_lsb = 0; bank_msb = 0; - patch = 0; + lastlrpn = 0; + lastmrpn = 0; + nrpn = false; + is_xg_percussion = false; + } + void resetAllControllers() + { + bend = 0.0; + bendsense = 2 / 8192.0; volume = 100; expression = 127; - panning = 0x30; - vibrato = 0; sustain = 0; - bend = 0.0; - bendsense = 2 / 8192.0; - vibpos = 0; + vibrato = 0; vibspeed = 2 * 3.141592653 * 5.0; vibdepth = 0.5 / 127; vibdelay = 0; - lastlrpn = 0; - lastmrpn = 0; - nrpn = false; + panning = OPL_PANNING_BOTH; + portamento = 0; brightness = 127; - is_xg_percussion = false; } MIDIchannel() : activenotes() |