aboutsummaryrefslogtreecommitdiff
path: root/src/adlmidi_midiplay.cpp
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2017-11-25 04:16:25 +0300
committerWohlstand <admin@wohlnet.ru>2017-11-25 04:16:25 +0300
commit9a9cc5e5ff305114acfb248b65056403ed2e64e6 (patch)
treee1dbc60bb55858656b281d99e679ce6b5fa5af33 /src/adlmidi_midiplay.cpp
parent9166fd48255c7002ba9fbc7a4679a49da544e8c3 (diff)
downloadlibADLMIDI-9a9cc5e5ff305114acfb248b65056403ed2e64e6.tar.gz
libADLMIDI-9a9cc5e5ff305114acfb248b65056403ed2e64e6.tar.bz2
libADLMIDI-9a9cc5e5ff305114acfb248b65056403ed2e64e6.zip
Don't affect percussion chgannels by CC74 Brightness
(As this controller may damage sound of some drums such as DMXOPL3)
Diffstat (limited to 'src/adlmidi_midiplay.cpp')
-rw-r--r--src/adlmidi_midiplay.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp
index c1f40d0..2c10331 100644
--- a/src/adlmidi_midiplay.cpp
+++ b/src/adlmidi_midiplay.cpp
@@ -110,6 +110,11 @@ static const uint8_t PercussionMap[256] =
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
+inline bool isXgPercChannel(uint8_t msb, uint8_t lsb)
+{
+ return (msb == 0x7E || msb == 0x7F) && (lsb == 0);
+}
+
void MIDIplay::AdlChannel::AddAge(int64_t ms)
{
if(users.empty())
@@ -1196,10 +1201,12 @@ void MIDIplay::realTime_Controller(uint8_t channel, uint8_t type, uint8_t value)
case 0: // Set bank msb (GM bank)
Ch[channel].bank_msb = value;
+ Ch[channel].is_xg_percussion = isXgPercChannel(Ch[channel].bank_msb, Ch[channel].bank_lsb);
break;
case 32: // Set bank lsb (XG bank)
Ch[channel].bank_lsb = value;
+ Ch[channel].is_xg_percussion = isXgPercChannel(Ch[channel].bank_msb, Ch[channel].bank_lsb);
break;
case 5: // Set portamento msb
@@ -1455,7 +1462,8 @@ void MIDIplay::NoteUpdate(uint16_t MidCh,
if(props_mask & Upd_Volume)
{
uint32_t volume;
- uint8_t brightness = Ch[MidCh].brightness;
+ bool is_percussion = (MidCh == 9) || Ch[MidCh].is_xg_percussion;
+ uint8_t brightness = is_percussion ? 127 : Ch[MidCh].brightness;
switch(opl.m_volumeScale)
{