mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-25 05:08:37 -05:00
Only use audio signal level for AM based modems
This commit is contained in:
parent
9f5c674646
commit
6a9e60efa9
@ -139,21 +139,22 @@ void DemodulatorThread::run() {
|
||||
if (audioOutputQueue != nullptr && ati && ati->data.size()) {
|
||||
float accum = 0;
|
||||
|
||||
for (auto i : ati->data) {
|
||||
accum += abMagnitude(0.948059448969, 0.392699081699, i, 0.0);
|
||||
}
|
||||
if (cModem->useSignalOutput()) {
|
||||
|
||||
for (auto i : ati->data) {
|
||||
accum += abMagnitude(0.948059448969, 0.392699081699, i, 0.0);
|
||||
}
|
||||
|
||||
float audioSignalLevel = linearToDb(accum / float(ati->data.size()));
|
||||
currentSignalLevel = linearToDb(accum / float(ati->data.size()));
|
||||
|
||||
accum = 0;
|
||||
} else {
|
||||
|
||||
for (auto i : inp->data) {
|
||||
accum += abMagnitude(0.948059448969, 0.392699081699, i.real, i.imag);
|
||||
}
|
||||
for (auto i : inp->data) {
|
||||
accum += abMagnitude(0.948059448969, 0.392699081699, i.real, i.imag);
|
||||
}
|
||||
|
||||
float iqSignalLevel = linearToDb(accum / float(inp->data.size()));
|
||||
|
||||
currentSignalLevel = iqSignalLevel>audioSignalLevel?iqSignalLevel:audioSignalLevel;
|
||||
currentSignalLevel = linearToDb(accum / float(inp->data.size()));
|
||||
}
|
||||
|
||||
float sf = signalFloor.load(), sc = signalCeil.load(), sl = squelchLevel.load();
|
||||
|
||||
|
@ -32,7 +32,7 @@ ModemArgInfo::ModemArgInfo(void) {
|
||||
}
|
||||
|
||||
Modem::Modem() {
|
||||
|
||||
useSignalOutput(false);
|
||||
}
|
||||
|
||||
Modem::~Modem() {
|
||||
@ -108,3 +108,12 @@ void Modem::rebuildKit() {
|
||||
void Modem::clearRebuildKit() {
|
||||
refreshKit.store(false);
|
||||
}
|
||||
|
||||
|
||||
bool Modem::useSignalOutput() {
|
||||
return _useSignalOutput.load();
|
||||
}
|
||||
|
||||
void Modem::useSignalOutput(bool useOutput) {
|
||||
_useSignalOutput.store(useOutput);
|
||||
}
|
||||
|
@ -152,8 +152,11 @@ public:
|
||||
void rebuildKit();
|
||||
void clearRebuildKit();
|
||||
|
||||
bool useSignalOutput();
|
||||
void useSignalOutput(bool useOutput);
|
||||
|
||||
private:
|
||||
static ModemFactoryList modemFactories;
|
||||
static DefaultRatesList modemDefaultRates;
|
||||
std::atomic_bool refreshKit;
|
||||
std::atomic_bool refreshKit, _useSignalOutput;
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "ModemAnalog.h"
|
||||
|
||||
ModemAnalog::ModemAnalog() : aOutputCeil(1), aOutputCeilMA(1), aOutputCeilMAA(1) {
|
||||
ModemAnalog::ModemAnalog() : Modem(), aOutputCeil(1), aOutputCeilMA(1), aOutputCeilMAA(1) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ ModemDigitalOutput::ModemDigitalOutput() {
|
||||
|
||||
}
|
||||
|
||||
ModemDigital::ModemDigital() {
|
||||
ModemDigital::ModemDigital() : Modem() {
|
||||
#if ENABLE_DIGITAL_LAB
|
||||
digitalOut = nullptr;
|
||||
#endif
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
ModemAM::ModemAM() : ModemAnalog() {
|
||||
demodAM = ampmodem_create(0.5, 0.0, LIQUID_AMPMODEM_DSB, 0);
|
||||
useSignalOutput(true);
|
||||
}
|
||||
|
||||
ModemAM::~ModemAM() {
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
ModemDSB::ModemDSB() : ModemAnalog() {
|
||||
demodAM_DSB = ampmodem_create(0.5, 0.0, LIQUID_AMPMODEM_DSB, 1);
|
||||
useSignalOutput(true);
|
||||
}
|
||||
|
||||
ModemDSB::~ModemDSB() {
|
||||
|
@ -11,6 +11,7 @@ ModemLSB::ModemLSB() : ModemAnalog() {
|
||||
ssbShift = nco_crcf_create(LIQUID_NCO);
|
||||
nco_crcf_set_frequency(ssbShift, (2.0 * M_PI) * 0.25);
|
||||
c2rFilt = firhilbf_create(5, 90.0);
|
||||
useSignalOutput(true);
|
||||
}
|
||||
|
||||
ModemBase *ModemLSB::factory() {
|
||||
|
@ -11,6 +11,7 @@ ModemUSB::ModemUSB() : ModemAnalog() {
|
||||
ssbShift = nco_crcf_create(LIQUID_NCO);
|
||||
nco_crcf_set_frequency(ssbShift, (2.0f * M_PI) * 0.25f);
|
||||
c2rFilt = firhilbf_create(5, 90.0);
|
||||
useSignalOutput(true);
|
||||
}
|
||||
|
||||
ModemBase *ModemUSB::factory() {
|
||||
|
Loading…
Reference in New Issue
Block a user