diff --git a/src/mididevice.cpp b/src/mididevice.cpp index 58209d9..9e93e8c 100644 --- a/src/mididevice.cpp +++ b/src/mididevice.cpp @@ -426,9 +426,9 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign { LOGNOTE("MIDI-SYSEX: Set Audio Output Level Attenuator %d to %d", nTG, val & 0x0F); // Example: F0 43 10 04 1A 00 F7 to F0 43 10 04 1A 07 F7 - // Apply logarithmic scaling for volume + // Exponential mapping like on the TX816: 7=127, 6=63, 5=31, ... 0=0 unsigned attenVal = val & 0x07; - unsigned newVolume = (unsigned)(127.0 * pow(attenVal / 7.0, 2.0) + 0.5); // Logarithmic mapping + unsigned newVolume = (attenVal == 0) ? 0 : (127 >> (7 - attenVal)); m_pSynthesizer->SetVolume(newVolume, nTG); } break;