aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_midiplay.cpp
diff options
context:
space:
mode:
authorVitaly Novichkov <admin@wohlnet.ru>2018-04-11 03:45:12 +0300
committerVitaly Novichkov <admin@wohlnet.ru>2018-04-11 03:45:12 +0300
commit47e2f73719ab55075d2d479daea3e9269370d421 (patch)
tree192467ca9da51ce57eead2cbf0d2f66f96c2408a /src/adlmidi_midiplay.cpp
parentff0982dd98cd7a828730a3498e3e7b9cd1daf868 (diff)
downloadlibADLMIDI-47e2f73719ab55075d2d479daea3e9269370d421.tar.gz
libADLMIDI-47e2f73719ab55075d2d479daea3e9269370d421.tar.bz2
libADLMIDI-47e2f73719ab55075d2d479daea3e9269370d421.zip
Move controls reset into same function
Also, fixed non-reseted bend sensitivity which distorts pitch on attempt to play another MIDI file
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r--src/adlmidi_midiplay.cpp26
1 files changed, 4 insertions, 22 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