aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_midiplay.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r--src/adlmidi_midiplay.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index 3c94d76..2413f39 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -1400,14 +1400,16 @@ void MIDIplay::realTime_PatchChange(uint8_t channel, uint8_t patch)
void MIDIplay::realTime_PitchBend(uint8_t channel, uint16_t pitch)
{
channel = channel % 16;
- Ch[channel].bend = (int(pitch) - 8192) * Ch[channel].bendsense;
+ Ch[channel].bendSrc = (int(pitch) - 8192);
+ Ch[channel].bend = Ch[channel].bendSrc * Ch[channel].bendsense;
NoteUpdate_All(channel, Upd_Pitch);
}
void MIDIplay::realTime_PitchBend(uint8_t channel, uint8_t msb, uint8_t lsb)
{
channel = channel % 16;
- Ch[channel].bend = (int(lsb) + int(msb) * 128 - 8192) * Ch[channel].bendsense;
+ Ch[channel].bendSrc = (int(lsb) + int(msb) * 128 - 8192);
+ Ch[channel].bend = Ch[channel].bendSrc * Ch[channel].bendsense;
NoteUpdate_All(channel, Upd_Pitch);
}
@@ -1641,7 +1643,7 @@ void MIDIplay::NoteUpdate(uint16_t MidCh,
#else
# define BEND_COEFFICIENT 172.4387
#endif
- opl.NoteOn(c, BEND_COEFFICIENT * std::exp(0.057762265 * (tone + bend + phase)));
+ opl.NoteOn(c, BEND_COEFFICIENT * std::exp(0.057762265 * (static_cast<double>(tone) + bend + phase)));
#undef BEND_COEFFICIENT
if(hooks.onNote)
hooks.onNote(hooks.onNote_userData, c, tone, midiins, vol, Ch[MidCh].bend);
@@ -2388,10 +2390,12 @@ void MIDIplay::SetRPN(unsigned MidCh, unsigned value, bool MSB)
case 0x0000 + 0*0x10000 + 1*0x20000: // Pitch-bender sensitivity
Ch[MidCh].bendsense_msb = value;
Ch[MidCh].updateBendSensitivity();
+ NoteUpdate_All(MidCh, Upd_Pitch);
break;
case 0x0000 + 0*0x10000 + 0*0x20000: // Pitch-bender sensitivity LSB
Ch[MidCh].bendsense_lsb = value;
Ch[MidCh].updateBendSensitivity();
+ NoteUpdate_All(MidCh, Upd_Pitch);
break;
case 0x0108 + 1*0x10000 + 1*0x20000: // Vibrato speed
if(value == 64) Ch[MidCh].vibspeed = 1.0;