mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-07-31 12:52:25 -04:00
Minor warning/formatting clean-up
This commit is contained in:
parent
95b7a86ed9
commit
a174db1725
@ -18,8 +18,7 @@ ModemCW::ModemCW()
|
||||
mGain(15.0),
|
||||
mAutoGain(true),
|
||||
mLO(nullptr),
|
||||
mToReal(nullptr)
|
||||
{
|
||||
mToReal(nullptr) {
|
||||
mLO = nco_crcf_create(LIQUID_NCO);
|
||||
mToReal = firhilbf_create(5, 60.0f);
|
||||
useSignalOutput(true);
|
||||
@ -32,8 +31,7 @@ ModemCW::~ModemCW() {
|
||||
firhilbf_destroy(mToReal);
|
||||
}
|
||||
|
||||
ModemArgInfoList ModemCW::getSettings()
|
||||
{
|
||||
ModemArgInfoList ModemCW::getSettings() {
|
||||
ModemArgInfoList args;
|
||||
|
||||
ModemArgInfo offsetArg;
|
||||
@ -41,7 +39,7 @@ ModemArgInfoList ModemCW::getSettings()
|
||||
offsetArg.name = "Frequency Offset";
|
||||
offsetArg.value = std::to_string(mBeepFrequency);
|
||||
offsetArg.units = "Hz";
|
||||
offsetArg.description = "Frequency Offset / Beep frequency";
|
||||
offsetArg.description = "Frequency Offset / Beep frequency (200-1000Hz)";
|
||||
offsetArg.type = ModemArgInfo::FLOAT;
|
||||
offsetArg.range = ModemRange(200.0, 1000.0);
|
||||
args.push_back(offsetArg);
|
||||
@ -63,36 +61,30 @@ ModemArgInfoList ModemCW::getSettings()
|
||||
gain.name = "Audio Gain";
|
||||
gain.value = "15";
|
||||
gain.units = "dB";
|
||||
gain.description = "Gain Setting";
|
||||
gain.description = "Gain Setting (0-40dB)";
|
||||
gain.range = ModemRange(0.0, 40.0);
|
||||
gain.type = ModemArgInfo::FLOAT;
|
||||
args.push_back(gain);
|
||||
return args;
|
||||
}
|
||||
|
||||
void ModemCW::writeSetting(std::string setting, std::string value)
|
||||
{
|
||||
void ModemCW::writeSetting(std::string setting, std::string value) {
|
||||
if (setting == "offset") {
|
||||
mBeepFrequency = std::stof(value);
|
||||
rebuildKit();
|
||||
} else
|
||||
if (setting == "auto") {
|
||||
mAutoGain = (value=="on")?true:false;
|
||||
} else
|
||||
if (setting == "gain") {
|
||||
} else if (setting == "auto") {
|
||||
mAutoGain = (value == "on");
|
||||
} else if (setting == "gain") {
|
||||
mGain = std::stof(value);
|
||||
}
|
||||
}
|
||||
|
||||
std::string ModemCW::readSetting(std::string setting)
|
||||
{
|
||||
std::string ModemCW::readSetting(std::string setting) {
|
||||
if (setting == "offset") {
|
||||
return std::to_string(mBeepFrequency);
|
||||
} else
|
||||
if (setting == "auto") {
|
||||
} else if (setting == "auto") {
|
||||
return (mAutoGain) ? "on" : "off";
|
||||
} else
|
||||
if (setting == "gain") {
|
||||
} else if (setting == "gain") {
|
||||
return std::to_string(mGain);
|
||||
}
|
||||
return "";
|
||||
@ -106,8 +98,7 @@ std::string ModemCW::getName() {
|
||||
return "CW";
|
||||
}
|
||||
|
||||
int ModemCW::checkSampleRate (long long srate, int arate)
|
||||
{
|
||||
int ModemCW::checkSampleRate(long long srate, int /* arate */) {
|
||||
if (srate < MIN_BANDWIDTH)
|
||||
return MIN_BANDWIDTH;
|
||||
return srate;
|
||||
@ -124,8 +115,7 @@ int ModemCW::getDefaultSampleRate() {
|
||||
// one doesn't have the bandwidth for these tones. So we need to interpolate
|
||||
// the input IQ to audioOut, frequency shift, then pass the real part.
|
||||
// Simple solution is just interpolate the IQ data to the audio sample rate.
|
||||
ModemKit *ModemCW::buildKit (long long sampleRate, int audioSampleRate)
|
||||
{
|
||||
ModemKit *ModemCW::buildKit(long long sampleRate, int audioSampleRate) {
|
||||
ModemKitCW *kit = new ModemKitCW();
|
||||
float As = 60.0f;
|
||||
double ratio = double(audioSampleRate) / double(sampleRate);
|
||||
@ -136,15 +126,13 @@ ModemKit *ModemCW::buildKit (long long sampleRate, int audioSampleRate)
|
||||
return kit;
|
||||
}
|
||||
|
||||
void ModemCW::disposeKit (ModemKit *kit)
|
||||
{
|
||||
void ModemCW::disposeKit(ModemKit *kit) {
|
||||
ModemKitCW *cwkit = (ModemKitCW *) kit;
|
||||
msresamp_cccf_destroy(cwkit->mInputResampler);
|
||||
delete kit;
|
||||
}
|
||||
|
||||
void ModemCW::initOutputBuffers(ModemKitAnalog *akit, ModemIQData *input)
|
||||
{
|
||||
void ModemCW::initOutputBuffers(ModemKitAnalog *akit, ModemIQData *input) {
|
||||
bufSize = input->data.size();
|
||||
|
||||
if (!bufSize) {
|
||||
@ -189,7 +177,7 @@ void ModemCW::demodulate(ModemKit *kit, ModemIQData *input, AudioThreadInput *au
|
||||
nco_crcf_set_frequency(mLO, 2.0 * M_PI * mBeepFrequency / kit->audioSampleRate);
|
||||
|
||||
// Mix up from base band by beep frequency. Extract real part
|
||||
for (int i = 0; i < outSize; i++) {
|
||||
for (unsigned int i = 0; i < outSize; i++) {
|
||||
nco_crcf_mix_up(mLO, mInput[i], &sig);
|
||||
nco_crcf_step(mLO);
|
||||
firhilbf_c2r_execute(mToReal, sig, &lsb, &demodOutputData[i]);
|
||||
|
@ -2,11 +2,11 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Modem.h"
|
||||
#include "ModemAnalog.h"
|
||||
|
||||
class ModemKitCW : public ModemKitAnalog
|
||||
{
|
||||
class ModemKitCW : public ModemKitAnalog {
|
||||
public:
|
||||
ModemKitCW() : ModemKitAnalog() {
|
||||
};
|
||||
@ -16,6 +16,7 @@ public:
|
||||
class ModemCW : public ModemAnalog {
|
||||
public:
|
||||
ModemCW();
|
||||
|
||||
~ModemCW();
|
||||
|
||||
std::string getName();
|
||||
@ -44,9 +45,9 @@ public:
|
||||
std::vector<float> *getResampledOutputData() { return &demodOutputData; }
|
||||
|
||||
private:
|
||||
bool mAutoGain;
|
||||
float mGain;
|
||||
float mBeepFrequency;
|
||||
float mGain;
|
||||
bool mAutoGain;
|
||||
nco_crcf mLO;
|
||||
firhilbf mToReal;
|
||||
std::vector<liquid_float_complex> mInput;
|
||||
|
Loading…
x
Reference in New Issue
Block a user