diff options
author | Vitaly Novichkov <admin@wohlnet.ru> | 2018-05-14 03:45:19 +0300 |
---|---|---|
committer | Vitaly Novichkov <admin@wohlnet.ru> | 2018-05-14 03:45:19 +0300 |
commit | 372f2c17e15e846def959f34f67c61f679ee7bc4 (patch) | |
tree | 4c1014f3853edbff1af2d2992d66477be0b00f0f /src | |
parent | 802e07b3c276d1e535556146c9201dea29051e3e (diff) | |
parent | 74929e3fb33926cfe29fa607726cbd3fec8abaae (diff) | |
download | libADLMIDI-372f2c17e15e846def959f34f67c61f679ee7bc4.tar.gz libADLMIDI-372f2c17e15e846def959f34f67c61f679ee7bc4.tar.bz2 libADLMIDI-372f2c17e15e846def959f34f67c61f679ee7bc4.zip |
Merge branch 'master' of github.com:Wohlstand/libADLMIDI
Diffstat (limited to 'src')
-rw-r--r-- | src/adlmidi_midiplay.cpp | 9 | ||||
-rw-r--r-- | src/adlmidi_private.hpp | 10 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 7c40fa0..6bc2366 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -1393,7 +1393,7 @@ 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 = (uint32_t(pitch) - 8192) * Ch[channel].bendsense; + Ch[channel].bend = (int(pitch) - 8192) * Ch[channel].bendsense; NoteUpdate_All(channel, Upd_Pitch); } @@ -2358,7 +2358,12 @@ void MIDIplay::SetRPN(unsigned MidCh, unsigned value, bool MSB) switch(addr + nrpn * 0x10000 + MSB * 0x20000) { case 0x0000 + 0*0x10000 + 1*0x20000: // Pitch-bender sensitivity - Ch[MidCh].bendsense = value / 8192.0; + Ch[MidCh].bendsense_msb = value; + Ch[MidCh].updateBendSensitivity(); + break; + case 0x0000 + 0*0x10000 + 0*0x20000: // Pitch-bender sensitivity LSB + Ch[MidCh].bendsense_lsb = value; + Ch[MidCh].updateBendSensitivity(); break; case 0x0108 + 1*0x10000 + 1*0x20000: // Vibrato speed if(value == 64) Ch[MidCh].vibspeed = 1.0; diff --git a/src/adlmidi_private.hpp b/src/adlmidi_private.hpp index d66daf4..65cb4bc 100644 --- a/src/adlmidi_private.hpp +++ b/src/adlmidi_private.hpp @@ -617,6 +617,7 @@ public: uint8_t panning, vibrato, sustain; char ____padding[6]; double bend, bendsense; + int bendsense_lsb, bendsense_msb; double vibpos, vibspeed, vibdepth; int64_t vibdelay; uint8_t lastlrpn, lastmrpn; @@ -809,7 +810,9 @@ public: void resetAllControllers() { bend = 0.0; - bendsense = 2 / 8192.0; + bendsense_msb = 2; + bendsense_lsb = 0; + updateBendSensitivity(); volume = 100; expression = 127; sustain = 0; @@ -821,6 +824,11 @@ public: portamento = 0; brightness = 127; } + void updateBendSensitivity() + { + int cent = bendsense_msb * 100 + bendsense_lsb; + bendsense = cent * (0.01 / 8192.0); + } MIDIchannel() { activenotes_clear(); |