From 9cbcbb14713903a82333299a7f3afbfe33398974 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 13 Apr 2020 21:00:26 +0200 Subject: [PATCH] the unit of the mixer faders is now dB using the range -50 dB to 0 dB --- ChangeLog | 4 ++-- src/audiomixerboard.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92676b10..1f7ce2ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,11 +8,11 @@ * refresh server list if the Central Server address type is changed + * the unit of the mixer faders is now dB using the range -50 dB to 0 dB + * bug fix: the server welcome message may appear twice if the server list was double clicked -TODO mixer faders linear -> log gain is better: CalcFaderGain() -> x = -50:1:0; plot(x, (10 .^ (x / 10))) - TODO offer the Jamulus ASIO settingspanel in case of an ASIO ERROR to fix, e.g., incorrect sample rate (https://sourceforge.net/p/llcon/discussion/533517/thread/777663cf94/#035f) TODO issue with Mac audio interface: https://sourceforge.net/p/llcon/discussion/software/thread/7c443f2ed9/#eeab diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index ad69fcc6..e699874a 100755 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -506,7 +506,17 @@ double CChannelFader::CalcFaderGain ( const int value ) { // convert actual slider range in gain values // and normalize so that maximum gain is 1 - return static_cast ( value ) / AUD_MIX_FADER_MAX; + const double dInValueRange0_1 = static_cast ( value ) / AUD_MIX_FADER_MAX; + + // map range from 0..1 to range -50..0 dB and calculate linear gain + if ( value == 0 ) + { + return 0; // -infinity + } + else + { + return pow ( 10, ( dInValueRange0_1 * 50 - 50 ) / 20 ); + } }