From 8bcd92e8b306fedb86d574e17e9d5e6ad0909252 Mon Sep 17 00:00:00 2001 From: probonopd Date: Fri, 18 Apr 2025 21:34:33 +0200 Subject: [PATCH] Apply logarithmic scaling To match perceived loudness --- src/minidexed.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 609b688..1219241 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -1786,14 +1786,17 @@ void CMiniDexed::getSysExVoiceDump(uint8_t* dest, uint8_t nTG) dest[162] = 0xF7; // SysEx end } -void CMiniDexed::setMasterVolume (float32_t vol) +void CMiniDexed::setMasterVolume(float32_t vol) { - if(vol < 0.0) - vol = 0.0; - else if(vol > 1.0) - vol = 1.0; + if (vol < 0.0) + vol = 0.0; + else if (vol > 1.0) + vol = 1.0; - nMasterVolume=vol; + // Apply logarithmic scaling to match perceived loudness + vol = powf(vol, 2.0f); + + nMasterVolume = vol; } std::string CMiniDexed::GetPerformanceFileName(unsigned nID)