diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | src/adlmidi_midiplay.cpp | 9 |
2 files changed, 8 insertions, 2 deletions
@@ -183,6 +183,7 @@ To build that example you will need to have installed SDL2 library. * Reworked rhythm-mode percussions system, WOPL banks with rhythm-mode percussions * Added Public Domain Opal OPL3 emulator made by Reality (a team who originally made the Reality Adlib Tracker) (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!) * Added LGPL licensed JavaOPL3 emulator made by Robson Cozendey in Java and later rewritten into C++ for GZDoom (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!) + * Fixed an accuracy of the DMX volume model ## 1.4.0 2018-10-01 * Implemented a full support for Portamento! (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!) diff --git a/src/adlmidi_midiplay.cpp b/src/adlmidi_midiplay.cpp index 5b81d83..61bdf95 100644 --- a/src/adlmidi_midiplay.cpp +++ b/src/adlmidi_midiplay.cpp @@ -704,8 +704,13 @@ void MIDIplay::realTime_ChannelAfterTouch(uint8_t channel, uint8_t atVal) void MIDIplay::realTime_Controller(uint8_t channel, uint8_t type, uint8_t value) { Synth &synth = *m_synth; + + if(value > 127) // Allowed values 0~127 only + value = 127; + if(static_cast<size_t>(channel) > m_midiChannels.size()) channel = channel % 16; + switch(type) { case 1: // Adjust vibrato @@ -1311,8 +1316,8 @@ void MIDIplay::noteUpdate(size_t midCh, case Synth::VOLUME_DMX: { - volume = 2 * (m_midiChannels[midCh].volume * m_midiChannels[midCh].expression * m_masterVolume / 16129) + 1; - //volume = 2 * (Ch[MidCh].volume) + 1; + volume = (m_midiChannels[midCh].volume * m_midiChannels[midCh].expression * m_masterVolume) / 16129; + volume = (DMX_volume_mapping_table[volume] + 1) << 1; volume = (DMX_volume_mapping_table[(vol < 128) ? vol : 127] * volume) >> 9; } break; |