From 605d2350ea9af44c038ad11280d6d70d5d4d9a9f Mon Sep 17 00:00:00 2001 From: Doug McLain Date: Mon, 14 Feb 2022 12:32:07 -0500 Subject: [PATCH] Fix gain adjust and remove debug output --- Controller.cpp | 4 ++-- DV3000.cpp | 2 -- DVSIDevice.cpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Controller.cpp b/Controller.cpp index 1b42e1c..4acaf4e 100644 --- a/Controller.cpp +++ b/Controller.cpp @@ -25,8 +25,8 @@ #include "TranscoderPacket.h" #include "Controller.h" -#define AMBE_GAIN 0 //dB I use -6 here -#define AMBE2_GAIN 0 //dB I use 6 here +#define AMBE_GAIN 12 //Encoder gain in dB (I use 12 here) +#define AMBE2_GAIN -12 //Encoder gain in dB (I use -12 here) CController::CController() : keep_running(true) {} diff --git a/DV3000.cpp b/DV3000.cpp index cd67fb0..8da0a1b 100644 --- a/DV3000.cpp +++ b/DV3000.cpp @@ -63,8 +63,6 @@ bool CDV3000::SendAudio(const uint8_t /*channel*/, const int16_t *audio, const i p.payload.audio3k.num_samples = 160U; const uint32_t g = abs(gain); - std::cerr << "SendAudio() gain == " << gain << std::endl; - for (int i=0; i<160; i++){ if(gain < 0){ p.payload.audio3k.samples[i] = htons(audio[i] / g); diff --git a/DVSIDevice.cpp b/DVSIDevice.cpp index 245b2dd..190bd41 100644 --- a/DVSIDevice.cpp +++ b/DVSIDevice.cpp @@ -38,7 +38,7 @@ int16_t calcGainVal(float db) { - float ratio = powf(10.0, (db/10.0)); + float ratio = powf(10.0, (db/20.0)); if(db < 0){ ratio = (1/ratio) * (-1);