FreeDV modulator: removed some SSB specific things

This commit is contained in:
f4exb 2019-02-22 10:54:50 +01:00
parent 632feb75c5
commit 97d12182c2
13 changed files with 41 additions and 1354 deletions

View File

@ -58,11 +58,8 @@ FreeDVMod::FreeDVMod(DeviceSinkAPI *deviceAPI) :
m_outputSampleRate(48000),
m_inputFrequencyOffset(0),
m_SSBFilter(0),
m_DSBFilter(0),
m_SSBFilterBuffer(0),
m_DSBFilterBuffer(0),
m_SSBFilterBufferIndex(0),
m_DSBFilterBufferIndex(0),
m_sampleSink(0),
m_audioFifo(4800),
m_settingsMutex(QMutex::Recursive),
@ -71,9 +68,7 @@ FreeDVMod::FreeDVMod(DeviceSinkAPI *deviceAPI) :
m_sampleRate(48000),
m_levelCalcCount(0),
m_peakLevel(0.0f),
m_levelSum(0.0f),
m_inAGC(9600, 0.2, 1e-4),
m_agcStepLength(2400)
m_levelSum(0.0f)
{
setObjectName(m_channelId);
@ -81,11 +76,8 @@ FreeDVMod::FreeDVMod(DeviceSinkAPI *deviceAPI) :
m_audioSampleRate = DSPEngine::instance()->getAudioDeviceManager()->getInputSampleRate();
m_SSBFilter = new fftfilt(m_settings.m_lowCutoff / m_audioSampleRate, m_settings.m_bandwidth / m_audioSampleRate, m_ssbFftLen);
m_DSBFilter = new fftfilt((2.0f * m_settings.m_bandwidth) / m_audioSampleRate, 2 * m_ssbFftLen);
m_SSBFilterBuffer = new Complex[m_ssbFftLen>>1]; // filter returns data exactly half of its size
m_DSBFilterBuffer = new Complex[m_ssbFftLen];
std::fill(m_SSBFilterBuffer, m_SSBFilterBuffer+(m_ssbFftLen>>1), Complex{0,0});
std::fill(m_DSBFilterBuffer, m_DSBFilterBuffer+m_ssbFftLen, Complex{0,0});
m_audioBuffer.resize(1<<14);
m_audioBufferFill = 0;
@ -104,10 +96,6 @@ FreeDVMod::FreeDVMod(DeviceSinkAPI *deviceAPI) :
m_cwKeyer.setWPM(13);
m_cwKeyer.setMode(CWKeyerSettings::CWNone);
m_inAGC.setGate(m_settings.m_agcThresholdGate);
m_inAGC.setStepDownDelay(m_settings.m_agcThresholdDelay);
m_inAGC.setClamping(true);
applyChannelSettings(m_basebandSampleRate, m_outputSampleRate, m_inputFrequencyOffset, true);
applySettings(m_settings, true);
@ -133,9 +121,7 @@ FreeDVMod::~FreeDVMod()
delete m_channelizer;
delete m_SSBFilter;
delete m_DSBFilter;
delete[] m_SSBFilterBuffer;
delete[] m_DSBFilterBuffer;
}
void FreeDVMod::pull(Sample& sample)
@ -216,28 +202,9 @@ void FreeDVMod::pullAF(Complex& sample)
switch (m_settings.m_modAFInput)
{
case FreeDVModSettings::FreeDVModInputTone:
if (m_settings.m_dsb)
{
Real t = m_toneNco.next()/1.25;
sample.real(t);
sample.imag(t);
}
else
{
if (m_settings.m_usb) {
sample = m_toneNco.nextIQ();
} else {
sample = m_toneNco.nextQI();
}
}
sample = m_toneNco.nextIQ();
break;
case FreeDVModSettings::FreeDVModInputFile:
// Monaural (mono):
// sox f4exb_call.wav --encoding float --endian little f4exb_call.raw
// ffplay -f f32le -ar 48k -ac 1 f4exb_call.raw
// Binaural (stereo):
// sox f4exb_call.wav --encoding float --endian little f4exb_call.raw
// ffplay -f f32le -ar 48k -ac 2 f4exb_call.raw
if (m_ifstream.is_open())
{
if (m_ifstream.eof())
@ -256,39 +223,10 @@ void FreeDVMod::pullAF(Complex& sample)
}
else
{
if (m_settings.m_audioBinaural)
{
Complex c;
m_ifstream.read(reinterpret_cast<char*>(&c), sizeof(Complex));
if (m_settings.m_audioFlipChannels)
{
ci.real(c.imag() * m_settings.m_volumeFactor);
ci.imag(c.real() * m_settings.m_volumeFactor);
}
else
{
ci = c * m_settings.m_volumeFactor;
}
}
else
{
Real real;
m_ifstream.read(reinterpret_cast<char*>(&real), sizeof(Real));
if (m_settings.m_agc)
{
ci.real(real);
ci.imag(0.0f);
m_inAGC.feed(ci);
ci *= m_settings.m_volumeFactor;
}
else
{
ci.real(real * m_settings.m_volumeFactor);
ci.imag(0.0f);
}
}
Real real;
m_ifstream.read(reinterpret_cast<char*>(&real), sizeof(Real));
ci.real(real * m_settings.m_volumeFactor);
ci.imag(0.0f);
}
}
else
@ -298,35 +236,8 @@ void FreeDVMod::pullAF(Complex& sample)
}
break;
case FreeDVModSettings::FreeDVModInputAudio:
if (m_settings.m_audioBinaural)
{
if (m_settings.m_audioFlipChannels)
{
ci.real((m_audioBuffer[m_audioBufferFill].r / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
ci.imag((m_audioBuffer[m_audioBufferFill].l / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
}
else
{
ci.real((m_audioBuffer[m_audioBufferFill].l / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
ci.imag((m_audioBuffer[m_audioBufferFill].r / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
}
}
else
{
if (m_settings.m_agc)
{
ci.real(((m_audioBuffer[m_audioBufferFill].l + m_audioBuffer[m_audioBufferFill].r) / 65536.0f));
ci.imag(0.0f);
m_inAGC.feed(ci);
ci *= m_settings.m_volumeFactor;
}
else
{
ci.real(((m_audioBuffer[m_audioBufferFill].l + m_audioBuffer[m_audioBufferFill].r) / 65536.0f) * m_settings.m_volumeFactor);
ci.imag(0.0f);
}
}
ci.real(((m_audioBuffer[m_audioBufferFill].l + m_audioBuffer[m_audioBufferFill].r) / 65536.0f) * m_settings.m_volumeFactor);
ci.imag(0.0f);
break;
case FreeDVModSettings::FreeDVModInputCWTone:
Real fadeFactor;
@ -334,40 +245,13 @@ void FreeDVMod::pullAF(Complex& sample)
if (m_cwKeyer.getSample())
{
m_cwKeyer.getCWSmoother().getFadeSample(true, fadeFactor);
if (m_settings.m_dsb)
{
Real t = m_toneNco.next() * fadeFactor;
sample.real(t);
sample.imag(t);
}
else
{
if (m_settings.m_usb) {
sample = m_toneNco.nextIQ() * fadeFactor;
} else {
sample = m_toneNco.nextQI() * fadeFactor;
}
}
sample = m_toneNco.nextIQ() * fadeFactor;
}
else
{
if (m_cwKeyer.getCWSmoother().getFadeSample(false, fadeFactor))
{
if (m_settings.m_dsb)
{
Real t = (m_toneNco.next() * fadeFactor)/1.25;
sample.real(t);
sample.imag(t);
}
else
{
if (m_settings.m_usb) {
sample = m_toneNco.nextIQ() * fadeFactor;
} else {
sample = m_toneNco.nextQI() * fadeFactor;
}
}
sample = m_toneNco.nextIQ() * fadeFactor;
}
else
{
@ -388,32 +272,16 @@ void FreeDVMod::pullAF(Complex& sample)
if ((m_settings.m_modAFInput == FreeDVModSettings::FreeDVModInputFile)
|| (m_settings.m_modAFInput == FreeDVModSettings::FreeDVModInputAudio)) // real audio
{
if (m_settings.m_dsb)
{
n_out = m_DSBFilter->runDSB(ci, &filtered);
n_out = m_SSBFilter->runSSB(ci, &filtered, true); // USB
if (n_out > 0)
{
memcpy((void *) m_DSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
m_DSBFilterBufferIndex = 0;
}
if (n_out > 0)
{
memcpy((void *) m_SSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
m_SSBFilterBufferIndex = 0;
}
sample = m_DSBFilterBuffer[m_DSBFilterBufferIndex];
m_DSBFilterBufferIndex++;
}
else
{
n_out = m_SSBFilter->runSSB(ci, &filtered, m_settings.m_usb);
if (n_out > 0)
{
memcpy((void *) m_SSBFilterBuffer, (const void *) filtered, n_out*sizeof(Complex));
m_SSBFilterBufferIndex = 0;
}
sample = m_SSBFilterBuffer[m_SSBFilterBufferIndex];
m_SSBFilterBufferIndex++;
}
sample = m_SSBFilterBuffer[m_SSBFilterBufferIndex];
m_SSBFilterBufferIndex++;
if (n_out > 0)
{
@ -428,16 +296,7 @@ void FreeDVMod::pullAF(Complex& sample)
{
Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_TX_SCALEF;
if (!m_settings.m_dsb & !m_settings.m_usb)
{ // invert spectrum for LSB
m_sampleBuffer.push_back(Sample(avgi, avgr));
}
else
{
m_sampleBuffer.push_back(Sample(avgr, avgi));
}
m_sampleBuffer.push_back(Sample(avgr, avgi));
m_sum.real(0.0);
m_sum.imag(0.0);
}
@ -453,21 +312,12 @@ void FreeDVMod::pullAF(Complex& sample)
{
Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_TX_SCALEF;
if (!m_settings.m_dsb & !m_settings.m_usb)
{ // invert spectrum for LSB
m_sampleBuffer.push_back(Sample(avgi, avgr));
}
else
{
m_sampleBuffer.push_back(Sample(avgr, avgi));
}
m_sampleBuffer.push_back(Sample(avgr, avgi));
m_sum.real(0.0);
m_sum.imag(0.0);
}
if (m_sumCount < (m_settings.m_dsb ? m_ssbFftLen : m_ssbFftLen>>1))
if (m_sumCount < (m_ssbFftLen>>1))
{
n_out = 0;
m_sumCount++;
@ -483,7 +333,7 @@ void FreeDVMod::pullAF(Complex& sample)
{
if (m_sampleSink != 0)
{
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), !m_settings.m_dsb);
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), true); // SSB
}
m_sampleBuffer.clear();
@ -680,18 +530,6 @@ void FreeDVMod::applyAudioSampleRate(int sampleRate)
float band = m_settings.m_bandwidth;
float lowCutoff = m_settings.m_lowCutoff;
bool usb = m_settings.m_usb;
if (band < 0) // negative means LSB
{
band = -band; // turn to positive
lowCutoff = -lowCutoff;
usb = false; // and take note of side band
}
else
{
usb = true;
}
if (band < 100.0f) // at least 100 Hz
{
@ -704,17 +542,13 @@ void FreeDVMod::applyAudioSampleRate(int sampleRate)
}
m_SSBFilter->create_filter(lowCutoff / sampleRate, band / sampleRate);
m_DSBFilter->create_dsb_filter((2.0f * band) / sampleRate);
m_settings.m_bandwidth = band;
m_settings.m_lowCutoff = lowCutoff;
m_settings.m_usb = usb;
m_toneNco.setFreq(m_settings.m_toneFrequency, sampleRate);
m_cwKeyer.setSampleRate(sampleRate);
m_agcStepLength = std::min(sampleRate/20, m_settings.m_agcTime/2); // 50 ms or half the AGC length whichever is smaller
m_settingsMutex.unlock();
m_audioSampleRate = sampleRate;
@ -760,7 +594,6 @@ void FreeDVMod::applySettings(const FreeDVModSettings& settings, bool force)
{
float band = settings.m_bandwidth;
float lowCutoff = settings.m_lowCutoff;
bool usb = settings.m_usb;
QList<QString> reverseAPIKeys;
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
@ -772,9 +605,6 @@ void FreeDVMod::applySettings(const FreeDVModSettings& settings, bool force)
if ((settings.m_lowCutoff != m_settings.m_lowCutoff) || force) {
reverseAPIKeys.append("lowCutoff");
}
if ((settings.m_usb != m_settings.m_usb) || force) {
reverseAPIKeys.append("usb");
}
if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) {
reverseAPIKeys.append("toneFrequency");
}
@ -784,42 +614,12 @@ void FreeDVMod::applySettings(const FreeDVModSettings& settings, bool force)
if ((settings.m_spanLog2 != m_settings.m_spanLog2) || force) {
reverseAPIKeys.append("spanLog2");
}
if ((settings.m_audioBinaural != m_settings.m_audioBinaural) || force) {
reverseAPIKeys.append("audioBinaural");
}
if ((settings.m_audioFlipChannels != m_settings.m_audioFlipChannels) || force) {
reverseAPIKeys.append("audioFlipChannels");
}
if ((settings.m_dsb != m_settings.m_dsb) || force) {
reverseAPIKeys.append("dsb");
}
if ((settings.m_audioMute != m_settings.m_audioMute) || force) {
reverseAPIKeys.append("audioMute");
}
if ((settings.m_playLoop != m_settings.m_playLoop) || force) {
reverseAPIKeys.append("playLoop");
}
if ((settings.m_agc != m_settings.m_agc) || force) {
reverseAPIKeys.append("agc");
}
if ((settings.m_agcOrder != m_settings.m_agcOrder) || force) {
reverseAPIKeys.append("agcOrder");
}
if ((settings.m_agcTime != m_settings.m_agcTime) || force) {
reverseAPIKeys.append("agcTime");
}
if ((settings.m_agcThresholdEnable != m_settings.m_agcThresholdEnable) || force) {
reverseAPIKeys.append("agcThresholdEnable");
}
if ((settings.m_agcThreshold != m_settings.m_agcThreshold) || force) {
reverseAPIKeys.append("agcThreshold");
}
if ((settings.m_agcThresholdGate != m_settings.m_agcThresholdGate) || force) {
reverseAPIKeys.append("agcThresholdGate");
}
if ((settings.m_agcThresholdDelay != m_settings.m_agcThresholdDelay) || force) {
reverseAPIKeys.append("agcThresholdDelay");
}
if ((settings.m_rgbColor != m_settings.m_rgbColor) || force) {
reverseAPIKeys.append("rgbColor");
}
@ -836,17 +636,6 @@ void FreeDVMod::applySettings(const FreeDVModSettings& settings, bool force)
if ((settings.m_bandwidth != m_settings.m_bandwidth) ||
(settings.m_lowCutoff != m_settings.m_lowCutoff) || force)
{
if (band < 0) // negative means LSB
{
band = -band; // turn to positive
lowCutoff = -lowCutoff;
usb = false; // and take note of side band
}
else
{
usb = true;
}
if (band < 100.0f) // at least 100 Hz
{
band = 100.0f;
@ -863,7 +652,6 @@ void FreeDVMod::applySettings(const FreeDVModSettings& settings, bool force)
m_interpolatorDistance = (Real) m_audioSampleRate / (Real) m_outputSampleRate;
m_interpolator.create(48, m_audioSampleRate, band, 3.0);
m_SSBFilter->create_filter(lowCutoff / m_audioSampleRate, band / m_audioSampleRate);
m_DSBFilter->create_dsb_filter((2.0f * band) / m_audioSampleRate);
m_settingsMutex.unlock();
}
@ -874,48 +662,6 @@ void FreeDVMod::applySettings(const FreeDVModSettings& settings, bool force)
m_settingsMutex.unlock();
}
if ((settings.m_dsb != m_settings.m_dsb) || force)
{
if (settings.m_dsb)
{
std::fill(m_DSBFilterBuffer, m_DSBFilterBuffer+m_ssbFftLen, Complex{0,0});
m_DSBFilterBufferIndex = 0;
}
else
{
std::fill(m_SSBFilterBuffer, m_SSBFilterBuffer+(m_ssbFftLen>>1), Complex{0,0});
m_SSBFilterBufferIndex = 0;
}
}
if ((settings.m_agcTime != m_settings.m_agcTime) ||
(settings.m_agcOrder != m_settings.m_agcOrder) || force)
{
m_settingsMutex.lock();
m_inAGC.resize(settings.m_agcTime, m_agcStepLength, settings.m_agcOrder);
m_settingsMutex.unlock();
}
if ((settings.m_agcThresholdEnable != m_settings.m_agcThresholdEnable) || force)
{
m_inAGC.setThresholdEnable(settings.m_agcThresholdEnable);
}
if ((settings.m_agcThreshold != m_settings.m_agcThreshold) || force)
{
m_inAGC.setThreshold(settings.m_agcThreshold);
}
if ((settings.m_agcThresholdGate != m_settings.m_agcThresholdGate) || force)
{
m_inAGC.setGate(settings.m_agcThresholdGate);
}
if ((settings.m_agcThresholdDelay != m_settings.m_agcThresholdDelay) || force)
{
m_inAGC.setStepDownDelay(settings.m_agcThresholdDelay);
}
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
{
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
@ -941,7 +687,6 @@ void FreeDVMod::applySettings(const FreeDVModSettings& settings, bool force)
m_settings = settings;
m_settings.m_bandwidth = band;
m_settings.m_lowCutoff = lowCutoff;
m_settings.m_usb = usb;
}
QByteArray FreeDVMod::serialize() const
@ -998,9 +743,6 @@ int FreeDVMod::webapiSettingsPutPatch(
if (channelSettingsKeys.contains("lowCutoff")) {
settings.m_lowCutoff = response.getFreeDvModSettings()->getLowCutoff();
}
if (channelSettingsKeys.contains("usb")) {
settings.m_usb = response.getFreeDvModSettings()->getUsb() != 0;
}
if (channelSettingsKeys.contains("toneFrequency")) {
settings.m_toneFrequency = response.getFreeDvModSettings()->getToneFrequency();
}
@ -1010,42 +752,12 @@ int FreeDVMod::webapiSettingsPutPatch(
if (channelSettingsKeys.contains("spanLog2")) {
settings.m_spanLog2 = response.getFreeDvModSettings()->getSpanLog2();
}
if (channelSettingsKeys.contains("audioBinaural")) {
settings.m_audioBinaural = response.getFreeDvModSettings()->getAudioBinaural() != 0;
}
if (channelSettingsKeys.contains("audioFlipChannels")) {
settings.m_audioFlipChannels = response.getFreeDvModSettings()->getAudioFlipChannels() != 0;
}
if (channelSettingsKeys.contains("dsb")) {
settings.m_dsb = response.getFreeDvModSettings()->getDsb() != 0;
}
if (channelSettingsKeys.contains("audioMute")) {
settings.m_audioMute = response.getFreeDvModSettings()->getAudioMute() != 0;
}
if (channelSettingsKeys.contains("playLoop")) {
settings.m_playLoop = response.getFreeDvModSettings()->getPlayLoop() != 0;
}
if (channelSettingsKeys.contains("agc")) {
settings.m_agc = response.getFreeDvModSettings()->getAgc() != 0;
}
if (channelSettingsKeys.contains("agcOrder")) {
settings.m_agcOrder = response.getFreeDvModSettings()->getAgcOrder();
}
if (channelSettingsKeys.contains("agcTime")) {
settings.m_agcTime = response.getFreeDvModSettings()->getAgcTime();
}
if (channelSettingsKeys.contains("agcThresholdEnable")) {
settings.m_agcThresholdEnable = response.getFreeDvModSettings()->getAgcThresholdEnable() != 0;
}
if (channelSettingsKeys.contains("agcThreshold")) {
settings.m_agcThreshold = response.getFreeDvModSettings()->getAgcThreshold();
}
if (channelSettingsKeys.contains("agcThresholdGate")) {
settings.m_agcThresholdGate = response.getFreeDvModSettings()->getAgcThresholdGate();
}
if (channelSettingsKeys.contains("agcThresholdDelay")) {
settings.m_agcThresholdDelay = response.getFreeDvModSettings()->getAgcThresholdDelay();
}
if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getFreeDvModSettings()->getRgbColor();
}
@ -1145,22 +857,11 @@ void FreeDVMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& res
response.getFreeDvModSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
response.getFreeDvModSettings()->setBandwidth(settings.m_bandwidth);
response.getFreeDvModSettings()->setLowCutoff(settings.m_lowCutoff);
response.getFreeDvModSettings()->setUsb(settings.m_usb ? 1 : 0);
response.getFreeDvModSettings()->setToneFrequency(settings.m_toneFrequency);
response.getFreeDvModSettings()->setVolumeFactor(settings.m_volumeFactor);
response.getFreeDvModSettings()->setSpanLog2(settings.m_spanLog2);
response.getFreeDvModSettings()->setAudioBinaural(settings.m_audioBinaural ? 1 : 0);
response.getFreeDvModSettings()->setAudioFlipChannels(settings.m_audioFlipChannels ? 1 : 0);
response.getFreeDvModSettings()->setDsb(settings.m_dsb ? 1 : 0);
response.getFreeDvModSettings()->setAudioMute(settings.m_audioMute ? 1 : 0);
response.getFreeDvModSettings()->setPlayLoop(settings.m_playLoop ? 1 : 0);
response.getFreeDvModSettings()->setAgc(settings.m_agc ? 1 : 0);
response.getFreeDvModSettings()->setAgcOrder(settings.m_agcOrder);
response.getFreeDvModSettings()->setAgcTime(settings.m_agcTime);
response.getFreeDvModSettings()->setAgcThresholdEnable(settings.m_agcThresholdEnable ? 1 : 0);
response.getFreeDvModSettings()->setAgcThreshold(settings.m_agcThreshold);
response.getFreeDvModSettings()->setAgcThresholdGate(settings.m_agcThresholdGate);
response.getFreeDvModSettings()->setAgcThresholdDelay(settings.m_agcThresholdDelay);
response.getFreeDvModSettings()->setRgbColor(settings.m_rgbColor);
if (response.getFreeDvModSettings()->getTitle()) {
@ -1234,9 +935,6 @@ void FreeDVMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, c
if (channelSettingsKeys.contains("lowCutoff") || force) {
swgFreeDVModSettings->setLowCutoff(settings.m_lowCutoff);
}
if (channelSettingsKeys.contains("usb") || force) {
swgFreeDVModSettings->setUsb(settings.m_usb ? 1 : 0);
}
if (channelSettingsKeys.contains("toneFrequency") || force) {
swgFreeDVModSettings->setToneFrequency(settings.m_toneFrequency);
}
@ -1246,42 +944,12 @@ void FreeDVMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, c
if (channelSettingsKeys.contains("spanLog2") || force) {
swgFreeDVModSettings->setSpanLog2(settings.m_spanLog2);
}
if (channelSettingsKeys.contains("audioBinaural") || force) {
swgFreeDVModSettings->setAudioBinaural(settings.m_audioBinaural ? 1 : 0);
}
if (channelSettingsKeys.contains("audioFlipChannels") || force) {
swgFreeDVModSettings->setAudioFlipChannels(settings.m_audioFlipChannels ? 1 : 0);
}
if (channelSettingsKeys.contains("dsb") || force) {
swgFreeDVModSettings->setDsb(settings.m_dsb ? 1 : 0);
}
if (channelSettingsKeys.contains("audioMute") || force) {
swgFreeDVModSettings->setAudioMute(settings.m_audioMute ? 1 : 0);
}
if (channelSettingsKeys.contains("playLoop") || force) {
swgFreeDVModSettings->setPlayLoop(settings.m_playLoop ? 1 : 0);
}
if (channelSettingsKeys.contains("agc") || force) {
swgFreeDVModSettings->setAgc(settings.m_agc ? 1 : 0);
}
if (channelSettingsKeys.contains("agcOrder") || force) {
swgFreeDVModSettings->setAgcOrder(settings.m_agcOrder);
}
if (channelSettingsKeys.contains("agcTime") || force) {
swgFreeDVModSettings->setAgcTime(settings.m_agcTime);
}
if (channelSettingsKeys.contains("agcThresholdEnable") || force) {
swgFreeDVModSettings->setAgcThresholdEnable(settings.m_agcThresholdEnable ? 1 : 0);
}
if (channelSettingsKeys.contains("agcThreshold") || force) {
swgFreeDVModSettings->setAgcThreshold(settings.m_agcThreshold);
}
if (channelSettingsKeys.contains("agcThresholdGate") || force) {
swgFreeDVModSettings->setAgcThresholdGate(settings.m_agcThresholdGate);
}
if (channelSettingsKeys.contains("agcThresholdDelay") || force) {
swgFreeDVModSettings->setAgcThresholdDelay(settings.m_agcThresholdDelay);
}
if (channelSettingsKeys.contains("rgbColor") || force) {
swgFreeDVModSettings->setRgbColor(settings.m_rgbColor);
}

View File

@ -276,11 +276,8 @@ private:
Real m_interpolatorDistanceRemain;
bool m_interpolatorConsumed;
fftfilt* m_SSBFilter;
fftfilt* m_DSBFilter;
Complex* m_SSBFilterBuffer;
Complex* m_DSBFilterBuffer;
int m_SSBFilterBufferIndex;
int m_DSBFilterBufferIndex;
static const int m_ssbFftLen;
BasebandSampleSink* m_sampleSink;
@ -310,9 +307,6 @@ private:
Real m_levelSum;
CWKeyer m_cwKeyer;
MagAGC m_inAGC;
int m_agcStepLength;
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;

View File

@ -173,33 +173,6 @@ void FreeDVModGUI::on_deltaFrequency_changed(qint64 value)
applySettings();
}
void FreeDVModGUI::on_flipSidebands_clicked(bool checked)
{
(void) checked;
int bwValue = ui->BW->value();
int lcValue = ui->lowCut->value();
ui->BW->setValue(-bwValue);
ui->lowCut->setValue(-lcValue);
}
void FreeDVModGUI::on_dsb_toggled(bool dsb)
{
ui->flipSidebands->setEnabled(!dsb);
applyBandwidths(5 - ui->spanLog2->value());
}
void FreeDVModGUI::on_audioBinaural_toggled(bool checked)
{
m_settings.m_audioBinaural = checked;
applySettings();
}
void FreeDVModGUI::on_audioFlipChannels_toggled(bool checked)
{
m_settings.m_audioFlipChannels = checked;
applySettings();
}
void FreeDVModGUI::on_spanLog2_valueChanged(int value)
{
if ((value < 0) || (value > 4)) {
@ -285,49 +258,6 @@ void FreeDVModGUI::on_mic_toggled(bool checked)
applySettings();
}
void FreeDVModGUI::on_agc_toggled(bool checked)
{
m_settings.m_agc = checked;
applySettings();
}
void FreeDVModGUI::on_agcOrder_valueChanged(int value){
QString s = QString::number(value / 100.0, 'f', 2);
ui->agcOrderText->setText(s);
m_settings.m_agcOrder = value / 100.0;
applySettings();
}
void FreeDVModGUI::on_agcTime_valueChanged(int value){
QString s = QString::number(FreeDVModSettings::getAGCTimeConstant(value), 'f', 0);
ui->agcTimeText->setText(s);
m_settings.m_agcTime = FreeDVModSettings::getAGCTimeConstant(value) * 48;
applySettings();
}
void FreeDVModGUI::on_agcThreshold_valueChanged(int value)
{
m_settings.m_agcThreshold = value; // dB
displayAGCPowerThreshold();
applySettings();
}
void FreeDVModGUI::on_agcThresholdGate_valueChanged(int value)
{
QString s = QString::number(value, 'f', 0);
ui->agcThresholdGateText->setText(s);
m_settings.m_agcThresholdGate = value * 48;
applySettings();
}
void FreeDVModGUI::on_agcThresholdDelay_valueChanged(int value)
{
QString s = QString::number(value * 10, 'f', 0);
ui->agcThresholdDelayText->setText(s);
m_settings.m_agcThresholdDelay = value * 480;
applySettings();
}
void FreeDVModGUI::on_navTimeSlider_valueChanged(int value)
{
if (m_enableNavTime && ((value >= 0) && (value <= 100)))
@ -504,7 +434,6 @@ void FreeDVModGUI::applySettings(bool force)
void FreeDVModGUI::applyBandwidths(int spanLog2, bool force)
{
bool dsb = ui->dsb->isChecked();
m_spectrumRate = m_freeDVMod->getAudioSampleRate() / (1<<spanLog2);
int bw = ui->BW->value();
int lw = ui->lowCut->value();
@ -513,7 +442,6 @@ void FreeDVModGUI::applyBandwidths(int spanLog2, bool force)
tickInterval = tickInterval == 0 ? 1 : tickInterval;
qDebug() << "FreeDVModGUI::applyBandwidths:"
<< " dsb: " << dsb
<< " spanLog2: " << spanLog2
<< " m_spectrumRate: " << m_spectrumRate
<< " bw: " << bw
@ -534,64 +462,33 @@ void FreeDVModGUI::applyBandwidths(int spanLog2, bool force)
lw = 0;
}
if (dsb)
{
bw = bw < 0 ? -bw : bw;
lw = 0;
}
QString spanStr = QString::number(bwMax/10.0, 'f', 1);
QString bwStr = QString::number(bw/10.0, 'f', 1);
QString lwStr = QString::number(lw/10.0, 'f', 1);
if (dsb)
{
ui->BWText->setText(tr("%1%2k").arg(QChar(0xB1, 0x00)).arg(bwStr));
ui->spanText->setText(tr("%1%2k").arg(QChar(0xB1, 0x00)).arg(spanStr));
ui->scaleMinus->setText("0");
ui->scaleCenter->setText("");
ui->scalePlus->setText(tr("%1").arg(QChar(0xB1, 0x00)));
ui->lsbLabel->setText("");
ui->usbLabel->setText("");
ui->glSpectrum->setCenterFrequency(0);
ui->glSpectrum->setSampleRate(2*m_spectrumRate);
ui->glSpectrum->setSsbSpectrum(false);
ui->glSpectrum->setLsbDisplay(false);
}
else
{
ui->BWText->setText(tr("%1k").arg(bwStr));
ui->spanText->setText(tr("%1k").arg(spanStr));
ui->scaleMinus->setText("-");
ui->scaleCenter->setText("0");
ui->scalePlus->setText("+");
ui->lsbLabel->setText("LSB");
ui->usbLabel->setText("USB");
ui->glSpectrum->setCenterFrequency(m_spectrumRate/2);
ui->glSpectrum->setSampleRate(m_spectrumRate);
ui->glSpectrum->setSsbSpectrum(true);
ui->glSpectrum->setLsbDisplay(bw < 0);
}
ui->BWText->setText(tr("%1k").arg(bwStr));
ui->spanText->setText(tr("%1k").arg(spanStr));
ui->scaleMinus->setText("-");
ui->scaleCenter->setText("0");
ui->scalePlus->setText("+");
ui->lsbLabel->setText("LSB");
ui->usbLabel->setText("USB");
ui->glSpectrum->setCenterFrequency(m_spectrumRate/2);
ui->glSpectrum->setSampleRate(m_spectrumRate);
ui->glSpectrum->setSsbSpectrum(true);
ui->glSpectrum->setLsbDisplay(bw < 0);
ui->lowCutText->setText(tr("%1k").arg(lwStr));
ui->BW->blockSignals(true);
ui->lowCut->blockSignals(true);
ui->BW->setMaximum(bwMax);
ui->BW->setMinimum(dsb ? 0 : -bwMax);
ui->BW->setValue(bw);
ui->lowCut->setMaximum(dsb ? 0 : bwMax);
ui->lowCut->setMinimum(dsb ? 0 : -bwMax);
ui->lowCut->setValue(lw);
ui->lowCut->blockSignals(false);
ui->BW->blockSignals(false);
m_settings.m_dsb = dsb;
m_settings.m_spanLog2 = spanLog2;
m_settings.m_bandwidth = bw * 100;
m_settings.m_lowCutoff = lw * 100;
@ -600,9 +497,6 @@ void FreeDVModGUI::applyBandwidths(int spanLog2, bool force)
bool applySettingsWereBlocked = blockApplySettings(true);
m_channelMarker.setBandwidth(bw * 200);
m_channelMarker.setSidebands(dsb ? ChannelMarker::dsb : bw < 0 ? ChannelMarker::lsb : ChannelMarker::usb);
ui->dsb->setIcon(bw < 0 ? m_iconDSBLSB : m_iconDSBUSB);
if (!dsb) { m_channelMarker.setLowCutoff(lw * 100); }
blockApplySettings(applySettingsWereBlocked);
}
@ -614,18 +508,10 @@ void FreeDVModGUI::displaySettings()
m_channelMarker.setBandwidth(m_settings.m_bandwidth * 2);
m_channelMarker.setLowCutoff(m_settings.m_lowCutoff);
ui->flipSidebands->setEnabled(!m_settings.m_dsb);
if (m_settings.m_dsb) {
m_channelMarker.setSidebands(ChannelMarker::dsb);
if (m_settings.m_bandwidth < 0) {
m_channelMarker.setSidebands(ChannelMarker::lsb);
} else {
if (m_settings.m_bandwidth < 0) {
m_channelMarker.setSidebands(ChannelMarker::lsb);
ui->dsb->setIcon(m_iconDSBLSB);
} else {
m_channelMarker.setSidebands(ChannelMarker::usb);
ui->dsb->setIcon(m_iconDSBUSB);
}
m_channelMarker.setSidebands(ChannelMarker::usb);
}
m_channelMarker.blockSignals(false);
@ -636,48 +522,21 @@ void FreeDVModGUI::displaySettings()
blockApplySettings(true);
QString s = QString::number(m_settings.m_agcTime / 48, 'f', 0);
ui->agcTimeText->setText(s);
ui->agcTime->setValue(FreeDVModSettings::getAGCTimeConstantIndex(m_settings.m_agcTime / 48));
displayAGCPowerThreshold();
s = QString::number(m_settings.m_agcThresholdGate / 48, 'f', 0);
ui->agcThresholdGateText->setText(s);
ui->agcThresholdGate->setValue(m_settings.m_agcThresholdGate / 48);
s = QString::number(m_settings.m_agcThresholdDelay / 48, 'f', 0);
ui->agcThresholdDelayText->setText(s);
ui->agcThresholdDelay->setValue(m_settings.m_agcThresholdDelay / 480);
s = QString::number(m_settings.m_agcOrder, 'f', 2);
ui->agcOrderText->setText(s);
ui->agcOrder->setValue(roundf(m_settings.m_agcOrder * 100.0));
ui->agc->setChecked(m_settings.m_agc);
ui->audioBinaural->setChecked(m_settings.m_audioBinaural);
ui->audioFlipChannels->setChecked(m_settings.m_audioFlipChannels);
ui->audioMute->setChecked(m_settings.m_audioMute);
ui->playLoop->setChecked(m_settings.m_playLoop);
// Prevent uncontrolled triggering of applyBandwidths
ui->spanLog2->blockSignals(true);
ui->dsb->blockSignals(true);
ui->BW->blockSignals(true);
ui->dsb->setChecked(m_settings.m_dsb);
ui->spanLog2->setValue(5 - m_settings.m_spanLog2);
ui->BW->setValue(roundf(m_settings.m_bandwidth/100.0));
s = QString::number(m_settings.m_bandwidth/1000.0, 'f', 1);
QString s = QString::number(m_settings.m_bandwidth/1000.0, 'f', 1);
if (m_settings.m_dsb)
{
ui->BWText->setText(tr("%1%2k").arg(QChar(0xB1, 0x00)).arg(s));
}
else
{
ui->BWText->setText(tr("%1k").arg(s));
}
ui->BWText->setText(tr("%1k").arg(s));
ui->spanLog2->blockSignals(false);
ui->dsb->blockSignals(false);
ui->BW->blockSignals(false);
// The only one of the four signals triggering applyBandwidths will trigger it once only with all other values
@ -710,21 +569,6 @@ void FreeDVModGUI::displaySettings()
blockApplySettings(false);
}
void FreeDVModGUI::displayAGCPowerThreshold()
{
if (m_settings.m_agcThreshold == -99)
{
ui->agcThresholdText->setText("---");
}
else
{
QString s = QString::number(m_settings.m_agcThreshold, 'f', 0);
ui->agcThresholdText->setText(s);
}
ui->agcThreshold->setValue(m_settings.m_agcThreshold);
}
void FreeDVModGUI::leaveEvent(QEvent*)
{
m_channelMarker.setHighlighted(false);

View File

@ -89,7 +89,6 @@ private:
void applySettings(bool force = false);
void applyBandwidths(int spanLog2, bool force = false);
void displaySettings();
void displayAGCPowerThreshold();
void updateWithStreamData();
void updateWithStreamTime();
void channelMarkerUpdate();
@ -100,10 +99,6 @@ private:
private slots:
void handleSourceMessages();
void on_deltaFrequency_changed(qint64 value);
void on_flipSidebands_clicked(bool checked);
void on_dsb_toggled(bool checked);
void on_audioBinaural_toggled(bool checked);
void on_audioFlipChannels_toggled(bool checked);
void on_spanLog2_valueChanged(int value);
void on_BW_valueChanged(int value);
void on_lowCut_valueChanged(int value);
@ -112,12 +107,6 @@ private slots:
void on_tone_toggled(bool checked);
void on_toneFrequency_valueChanged(int value);
void on_mic_toggled(bool checked);
void on_agc_toggled(bool checked);
void on_agcOrder_valueChanged(int value);
void on_agcTime_valueChanged(int value);
void on_agcThreshold_valueChanged(int value);
void on_agcThresholdGate_valueChanged(int value);
void on_agcThresholdDelay_valueChanged(int value);
void on_play_toggled(bool checked);
void on_playLoop_toggled(bool checked);
void on_morseKeyer_toggled(bool checked);

View File

@ -161,90 +161,7 @@
</widget>
</item>
<item>
<widget class="Line" name="audioVLine">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="audioOptionsLayout">
<item>
<widget class="QToolButton" name="audioBinaural">
<property name="toolTip">
<string>Toggle btw Mono and Binaural I/Q audio</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/mono.png</normaloff>
<normalon>:/stereo.png</normalon>:/mono.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="audioFlipChannels">
<property name="toolTip">
<string>Flip left/right audio channels</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/flip_lr.png</normaloff>
<normalon>:/flip_rl.png</normalon>:/flip_lr.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="flipSidebands">
<property name="toolTip">
<string>Flip sidebands in SSB mode (LSB-&gt;USB or USB-&gt;LSB)</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/flip_sidebands.png</normaloff>:/flip_sidebands.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="dsb">
<property name="toolTip">
<string>DSB/SSB toggle</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/usb.png</normaloff>
<normalon>:/dsb.png</normalon>:/usb.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
<layout class="QHBoxLayout" name="audioOptionsLayout"/>
</item>
</layout>
</item>
@ -717,232 +634,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_agc">
<item>
<widget class="ButtonSwitch" name="agc">
<property name="toolTip">
<string>Toggle audio compressor</string>
</property>
<property name="text">
<string>CMP</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="agcOrder">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>AGC volume order in fraction of maximum amplitude</string>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>20</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="agcOrderText">
<property name="toolTip">
<string>AGC volume order in fraction of maximum amplitude</string>
</property>
<property name="text">
<string>0.00</string>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="agcTime">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Compressor time constant (attack) in ms</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>9</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>7</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="agcTimeText">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Compressor time constant in ms</string>
</property>
<property name="text">
<string>000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="agcThreshold">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Audio squelch threshold (db power)</string>
</property>
<property name="minimum">
<number>-99</number>
</property>
<property name="maximum">
<number>0</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>-40</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="agcThresholdText">
<property name="minimumSize">
<size>
<width>14</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Audio squelch threshold (dB power)</string>
</property>
<property name="text">
<string>-00</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="agcThresholdGate">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Audio squelch gate in ms</string>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>4</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="agcThresholdGateText">
<property name="minimumSize">
<size>
<width>18</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Audio squelch gate in ms</string>
</property>
<property name="text">
<string>00</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="agcThresholdDelay">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Audio squelch delay (release) in ms</string>
</property>
<property name="pageStep">
<number>1</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="agcThresholdDelayText">
<property name="minimumSize">
<size>
<width>25</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Audio squelch delay in ms</string>
</property>
<property name="text">
<string>000</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">

View File

@ -21,20 +21,6 @@
#include "settings/serializable.h"
#include "freedvmodsettings.h"
const int FreeDVModSettings::m_agcTimeConstant[] = {
1,
2,
5,
10,
20,
50,
100,
200,
500,
990};
const int FreeDVModSettings::m_nbAGCTimeConstants = 10;
FreeDVModSettings::FreeDVModSettings() :
m_channelMarker(0),
m_spectrumGUI(0),
@ -48,22 +34,11 @@ void FreeDVModSettings::resetToDefaults()
m_inputFrequencyOffset = 0;
m_bandwidth = 3000.0;
m_lowCutoff = 300.0;
m_usb = true;
m_toneFrequency = 1000.0;
m_volumeFactor = 1.0;
m_spanLog2 = 3;
m_audioBinaural = false;
m_audioFlipChannels = false;
m_dsb = false;
m_audioMute = false;
m_playLoop = false;
m_agc = false;
m_agcOrder = 0.2;
m_agcTime = 9600;
m_agcThresholdEnable = true;
m_agcThreshold = -40; // dB
m_agcThresholdGate = 192;
m_agcThresholdDelay = 2400;
m_rgbColor = QColor(0, 255, 204).rgb();
m_title = "FreeDV Modulator";
m_modAFInput = FreeDVModInputAF::FreeDVModInputNone;
@ -95,15 +70,6 @@ QByteArray FreeDVModSettings::serialize() const
s.writeS32(7, roundf(m_lowCutoff / 100.0));
s.writeS32(8, m_spanLog2);
s.writeBool(9, m_audioBinaural);
s.writeBool(10, m_audioFlipChannels);
s.writeBool(11, m_dsb);
s.writeBool(12, m_agc);
s.writeS32(13, getAGCTimeConstantIndex(m_agcTime/48));
s.writeS32(14, m_agcThreshold); // dB
s.writeS32(15, m_agcThresholdGate / 48);
s.writeS32(16, m_agcThresholdDelay / 48);
s.writeS32(17, roundf(m_agcOrder * 100.0));
if (m_channelMarker) {
s.writeBlob(18, m_channelMarker->serialize());
@ -163,19 +129,6 @@ bool FreeDVModSettings::deserialize(const QByteArray& data)
m_lowCutoff = tmp * 100.0;
d.readS32(8, &m_spanLog2, 3);
d.readBool(9, &m_audioBinaural, false);
d.readBool(10, &m_audioFlipChannels, false);
d.readBool(11, &m_dsb, false);
d.readBool(12, &m_agc, false);
d.readS32(13, &tmp, 7);
m_agcTime = getAGCTimeConstant(tmp) * 48;
d.readS32(14, &m_agcThreshold, -40);
d.readS32(15, &tmp, 4);
m_agcThresholdGate = tmp * 48;
d.readS32(16, &tmp, 5);
m_agcThresholdDelay = tmp * 48;
d.readS32(17, &tmp, 20);
m_agcOrder = tmp / 100.0;
if (m_channelMarker) {
d.readBlob(18, &bytetmp);
@ -215,27 +168,3 @@ bool FreeDVModSettings::deserialize(const QByteArray& data)
return false;
}
}
int FreeDVModSettings::getAGCTimeConstant(int index)
{
if (index < 0) {
return m_agcTimeConstant[0];
} else if (index < m_nbAGCTimeConstants) {
return m_agcTimeConstant[index];
} else {
return m_agcTimeConstant[m_nbAGCTimeConstants-1];
}
}
int FreeDVModSettings::getAGCTimeConstantIndex(int agcTimeConstant)
{
for (int i = 0; i < m_nbAGCTimeConstants; i++)
{
if (agcTimeConstant <= m_agcTimeConstant[i])
{
return i;
}
}
return m_nbAGCTimeConstants-1;
}

View File

@ -34,28 +34,14 @@ struct FreeDVModSettings
FreeDVModInputCWTone
} FreeDVModInputAF;
static const int m_nbAGCTimeConstants;
static const int m_agcTimeConstant[];
qint64 m_inputFrequencyOffset;
Real m_bandwidth;
Real m_lowCutoff;
bool m_usb;
float m_toneFrequency;
float m_volumeFactor;
int m_spanLog2;
bool m_audioBinaural;
bool m_audioFlipChannels;
bool m_dsb;
bool m_audioMute;
bool m_playLoop;
bool m_agc;
float m_agcOrder;
int m_agcTime;
bool m_agcThresholdEnable;
int m_agcThreshold;
int m_agcThresholdGate;
int m_agcThresholdDelay;
quint32 m_rgbColor;
QString m_title;
@ -79,9 +65,6 @@ struct FreeDVModSettings
void setCWKeyerGUI(Serializable *cwKeyerGUI) { m_cwKeyerGUI = cwKeyerGUI; }
QByteArray serialize() const;
bool deserialize(const QByteArray& data);
static int getAGCTimeConstant(int index);
static int getAGCTimeConstantIndex(int agcTimeConstant);
};

View File

@ -2576,9 +2576,6 @@ margin-bottom: 20px;
"type" : "number",
"format" : "float"
},
"usb" : {
"type" : "integer"
},
"toneFrequency" : {
"type" : "number",
"format" : "float"
@ -2590,43 +2587,12 @@ margin-bottom: 20px;
"spanLog2" : {
"type" : "integer"
},
"audioBinaural" : {
"type" : "integer"
},
"audioFlipChannels" : {
"type" : "integer"
},
"dsb" : {
"type" : "integer"
},
"audioMute" : {
"type" : "integer"
},
"playLoop" : {
"type" : "integer"
},
"agc" : {
"type" : "integer"
},
"agcOrder" : {
"type" : "number",
"format" : "float"
},
"agcTime" : {
"type" : "integer"
},
"agcThresholdEnable" : {
"type" : "integer"
},
"agcThreshold" : {
"type" : "integer"
},
"agcThresholdGate" : {
"type" : "integer"
},
"agcThresholdDelay" : {
"type" : "integer"
},
"rgbColor" : {
"type" : "integer"
},
@ -24502,7 +24468,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2019-02-22T06:26:26.189+01:00
Generated 2019-02-22T10:50:46.075+01:00
</div>
</div>
</div>

View File

@ -10,8 +10,6 @@ FreeDVModSettings:
lowCutoff:
type: number
format: float
usb:
type: integer
toneFrequency:
type: number
format: float
@ -20,31 +18,10 @@ FreeDVModSettings:
format: float
spanLog2:
type: integer
audioBinaural:
type: integer
audioFlipChannels:
type: integer
dsb:
type: integer
audioMute:
type: integer
playLoop:
type: integer
agc:
type: integer
agcOrder:
type: number
format: float
agcTime:
type: integer
agcThresholdEnable:
type: integer
agcThreshold:
type: integer
agcThresholdGate:
type: integer
agcThresholdDelay:
type: integer
rgbColor:
type: integer
title:

View File

@ -10,8 +10,6 @@ FreeDVModSettings:
lowCutoff:
type: number
format: float
usb:
type: integer
toneFrequency:
type: number
format: float
@ -20,31 +18,10 @@ FreeDVModSettings:
format: float
spanLog2:
type: integer
audioBinaural:
type: integer
audioFlipChannels:
type: integer
dsb:
type: integer
audioMute:
type: integer
playLoop:
type: integer
agc:
type: integer
agcOrder:
type: number
format: float
agcTime:
type: integer
agcThresholdEnable:
type: integer
agcThreshold:
type: integer
agcThresholdGate:
type: integer
agcThresholdDelay:
type: integer
rgbColor:
type: integer
title:

View File

@ -2576,9 +2576,6 @@ margin-bottom: 20px;
"type" : "number",
"format" : "float"
},
"usb" : {
"type" : "integer"
},
"toneFrequency" : {
"type" : "number",
"format" : "float"
@ -2590,43 +2587,12 @@ margin-bottom: 20px;
"spanLog2" : {
"type" : "integer"
},
"audioBinaural" : {
"type" : "integer"
},
"audioFlipChannels" : {
"type" : "integer"
},
"dsb" : {
"type" : "integer"
},
"audioMute" : {
"type" : "integer"
},
"playLoop" : {
"type" : "integer"
},
"agc" : {
"type" : "integer"
},
"agcOrder" : {
"type" : "number",
"format" : "float"
},
"agcTime" : {
"type" : "integer"
},
"agcThresholdEnable" : {
"type" : "integer"
},
"agcThreshold" : {
"type" : "integer"
},
"agcThresholdGate" : {
"type" : "integer"
},
"agcThresholdDelay" : {
"type" : "integer"
},
"rgbColor" : {
"type" : "integer"
},
@ -24502,7 +24468,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2019-02-22T06:26:26.189+01:00
Generated 2019-02-22T10:50:46.075+01:00
</div>
</div>
</div>

View File

@ -34,38 +34,16 @@ SWGFreeDVModSettings::SWGFreeDVModSettings() {
m_bandwidth_isSet = false;
low_cutoff = 0.0f;
m_low_cutoff_isSet = false;
usb = 0;
m_usb_isSet = false;
tone_frequency = 0.0f;
m_tone_frequency_isSet = false;
volume_factor = 0.0f;
m_volume_factor_isSet = false;
span_log2 = 0;
m_span_log2_isSet = false;
audio_binaural = 0;
m_audio_binaural_isSet = false;
audio_flip_channels = 0;
m_audio_flip_channels_isSet = false;
dsb = 0;
m_dsb_isSet = false;
audio_mute = 0;
m_audio_mute_isSet = false;
play_loop = 0;
m_play_loop_isSet = false;
agc = 0;
m_agc_isSet = false;
agc_order = 0.0f;
m_agc_order_isSet = false;
agc_time = 0;
m_agc_time_isSet = false;
agc_threshold_enable = 0;
m_agc_threshold_enable_isSet = false;
agc_threshold = 0;
m_agc_threshold_isSet = false;
agc_threshold_gate = 0;
m_agc_threshold_gate_isSet = false;
agc_threshold_delay = 0;
m_agc_threshold_delay_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
title = nullptr;
@ -100,38 +78,16 @@ SWGFreeDVModSettings::init() {
m_bandwidth_isSet = false;
low_cutoff = 0.0f;
m_low_cutoff_isSet = false;
usb = 0;
m_usb_isSet = false;
tone_frequency = 0.0f;
m_tone_frequency_isSet = false;
volume_factor = 0.0f;
m_volume_factor_isSet = false;
span_log2 = 0;
m_span_log2_isSet = false;
audio_binaural = 0;
m_audio_binaural_isSet = false;
audio_flip_channels = 0;
m_audio_flip_channels_isSet = false;
dsb = 0;
m_dsb_isSet = false;
audio_mute = 0;
m_audio_mute_isSet = false;
play_loop = 0;
m_play_loop_isSet = false;
agc = 0;
m_agc_isSet = false;
agc_order = 0.0f;
m_agc_order_isSet = false;
agc_time = 0;
m_agc_time_isSet = false;
agc_threshold_enable = 0;
m_agc_threshold_enable_isSet = false;
agc_threshold = 0;
m_agc_threshold_isSet = false;
agc_threshold_gate = 0;
m_agc_threshold_gate_isSet = false;
agc_threshold_delay = 0;
m_agc_threshold_delay_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
title = new QString("");
@ -165,17 +121,6 @@ SWGFreeDVModSettings::cleanup() {
if(title != nullptr) {
delete title;
}
@ -212,38 +157,16 @@ SWGFreeDVModSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&low_cutoff, pJson["lowCutoff"], "float", "");
::SWGSDRangel::setValue(&usb, pJson["usb"], "qint32", "");
::SWGSDRangel::setValue(&tone_frequency, pJson["toneFrequency"], "float", "");
::SWGSDRangel::setValue(&volume_factor, pJson["volumeFactor"], "float", "");
::SWGSDRangel::setValue(&span_log2, pJson["spanLog2"], "qint32", "");
::SWGSDRangel::setValue(&audio_binaural, pJson["audioBinaural"], "qint32", "");
::SWGSDRangel::setValue(&audio_flip_channels, pJson["audioFlipChannels"], "qint32", "");
::SWGSDRangel::setValue(&dsb, pJson["dsb"], "qint32", "");
::SWGSDRangel::setValue(&audio_mute, pJson["audioMute"], "qint32", "");
::SWGSDRangel::setValue(&play_loop, pJson["playLoop"], "qint32", "");
::SWGSDRangel::setValue(&agc, pJson["agc"], "qint32", "");
::SWGSDRangel::setValue(&agc_order, pJson["agcOrder"], "float", "");
::SWGSDRangel::setValue(&agc_time, pJson["agcTime"], "qint32", "");
::SWGSDRangel::setValue(&agc_threshold_enable, pJson["agcThresholdEnable"], "qint32", "");
::SWGSDRangel::setValue(&agc_threshold, pJson["agcThreshold"], "qint32", "");
::SWGSDRangel::setValue(&agc_threshold_gate, pJson["agcThresholdGate"], "qint32", "");
::SWGSDRangel::setValue(&agc_threshold_delay, pJson["agcThresholdDelay"], "qint32", "");
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
@ -289,9 +212,6 @@ SWGFreeDVModSettings::asJsonObject() {
if(m_low_cutoff_isSet){
obj->insert("lowCutoff", QJsonValue(low_cutoff));
}
if(m_usb_isSet){
obj->insert("usb", QJsonValue(usb));
}
if(m_tone_frequency_isSet){
obj->insert("toneFrequency", QJsonValue(tone_frequency));
}
@ -301,42 +221,12 @@ SWGFreeDVModSettings::asJsonObject() {
if(m_span_log2_isSet){
obj->insert("spanLog2", QJsonValue(span_log2));
}
if(m_audio_binaural_isSet){
obj->insert("audioBinaural", QJsonValue(audio_binaural));
}
if(m_audio_flip_channels_isSet){
obj->insert("audioFlipChannels", QJsonValue(audio_flip_channels));
}
if(m_dsb_isSet){
obj->insert("dsb", QJsonValue(dsb));
}
if(m_audio_mute_isSet){
obj->insert("audioMute", QJsonValue(audio_mute));
}
if(m_play_loop_isSet){
obj->insert("playLoop", QJsonValue(play_loop));
}
if(m_agc_isSet){
obj->insert("agc", QJsonValue(agc));
}
if(m_agc_order_isSet){
obj->insert("agcOrder", QJsonValue(agc_order));
}
if(m_agc_time_isSet){
obj->insert("agcTime", QJsonValue(agc_time));
}
if(m_agc_threshold_enable_isSet){
obj->insert("agcThresholdEnable", QJsonValue(agc_threshold_enable));
}
if(m_agc_threshold_isSet){
obj->insert("agcThreshold", QJsonValue(agc_threshold));
}
if(m_agc_threshold_gate_isSet){
obj->insert("agcThresholdGate", QJsonValue(agc_threshold_gate));
}
if(m_agc_threshold_delay_isSet){
obj->insert("agcThresholdDelay", QJsonValue(agc_threshold_delay));
}
if(m_rgb_color_isSet){
obj->insert("rgbColor", QJsonValue(rgb_color));
}
@ -401,16 +291,6 @@ SWGFreeDVModSettings::setLowCutoff(float low_cutoff) {
this->m_low_cutoff_isSet = true;
}
qint32
SWGFreeDVModSettings::getUsb() {
return usb;
}
void
SWGFreeDVModSettings::setUsb(qint32 usb) {
this->usb = usb;
this->m_usb_isSet = true;
}
float
SWGFreeDVModSettings::getToneFrequency() {
return tone_frequency;
@ -441,36 +321,6 @@ SWGFreeDVModSettings::setSpanLog2(qint32 span_log2) {
this->m_span_log2_isSet = true;
}
qint32
SWGFreeDVModSettings::getAudioBinaural() {
return audio_binaural;
}
void
SWGFreeDVModSettings::setAudioBinaural(qint32 audio_binaural) {
this->audio_binaural = audio_binaural;
this->m_audio_binaural_isSet = true;
}
qint32
SWGFreeDVModSettings::getAudioFlipChannels() {
return audio_flip_channels;
}
void
SWGFreeDVModSettings::setAudioFlipChannels(qint32 audio_flip_channels) {
this->audio_flip_channels = audio_flip_channels;
this->m_audio_flip_channels_isSet = true;
}
qint32
SWGFreeDVModSettings::getDsb() {
return dsb;
}
void
SWGFreeDVModSettings::setDsb(qint32 dsb) {
this->dsb = dsb;
this->m_dsb_isSet = true;
}
qint32
SWGFreeDVModSettings::getAudioMute() {
return audio_mute;
@ -491,76 +341,6 @@ SWGFreeDVModSettings::setPlayLoop(qint32 play_loop) {
this->m_play_loop_isSet = true;
}
qint32
SWGFreeDVModSettings::getAgc() {
return agc;
}
void
SWGFreeDVModSettings::setAgc(qint32 agc) {
this->agc = agc;
this->m_agc_isSet = true;
}
float
SWGFreeDVModSettings::getAgcOrder() {
return agc_order;
}
void
SWGFreeDVModSettings::setAgcOrder(float agc_order) {
this->agc_order = agc_order;
this->m_agc_order_isSet = true;
}
qint32
SWGFreeDVModSettings::getAgcTime() {
return agc_time;
}
void
SWGFreeDVModSettings::setAgcTime(qint32 agc_time) {
this->agc_time = agc_time;
this->m_agc_time_isSet = true;
}
qint32
SWGFreeDVModSettings::getAgcThresholdEnable() {
return agc_threshold_enable;
}
void
SWGFreeDVModSettings::setAgcThresholdEnable(qint32 agc_threshold_enable) {
this->agc_threshold_enable = agc_threshold_enable;
this->m_agc_threshold_enable_isSet = true;
}
qint32
SWGFreeDVModSettings::getAgcThreshold() {
return agc_threshold;
}
void
SWGFreeDVModSettings::setAgcThreshold(qint32 agc_threshold) {
this->agc_threshold = agc_threshold;
this->m_agc_threshold_isSet = true;
}
qint32
SWGFreeDVModSettings::getAgcThresholdGate() {
return agc_threshold_gate;
}
void
SWGFreeDVModSettings::setAgcThresholdGate(qint32 agc_threshold_gate) {
this->agc_threshold_gate = agc_threshold_gate;
this->m_agc_threshold_gate_isSet = true;
}
qint32
SWGFreeDVModSettings::getAgcThresholdDelay() {
return agc_threshold_delay;
}
void
SWGFreeDVModSettings::setAgcThresholdDelay(qint32 agc_threshold_delay) {
this->agc_threshold_delay = agc_threshold_delay;
this->m_agc_threshold_delay_isSet = true;
}
qint32
SWGFreeDVModSettings::getRgbColor() {
return rgb_color;
@ -669,22 +449,11 @@ SWGFreeDVModSettings::isSet(){
if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
if(m_bandwidth_isSet){ isObjectUpdated = true; break;}
if(m_low_cutoff_isSet){ isObjectUpdated = true; break;}
if(m_usb_isSet){ isObjectUpdated = true; break;}
if(m_tone_frequency_isSet){ isObjectUpdated = true; break;}
if(m_volume_factor_isSet){ isObjectUpdated = true; break;}
if(m_span_log2_isSet){ isObjectUpdated = true; break;}
if(m_audio_binaural_isSet){ isObjectUpdated = true; break;}
if(m_audio_flip_channels_isSet){ isObjectUpdated = true; break;}
if(m_dsb_isSet){ isObjectUpdated = true; break;}
if(m_audio_mute_isSet){ isObjectUpdated = true; break;}
if(m_play_loop_isSet){ isObjectUpdated = true; break;}
if(m_agc_isSet){ isObjectUpdated = true; break;}
if(m_agc_order_isSet){ isObjectUpdated = true; break;}
if(m_agc_time_isSet){ isObjectUpdated = true; break;}
if(m_agc_threshold_enable_isSet){ isObjectUpdated = true; break;}
if(m_agc_threshold_isSet){ isObjectUpdated = true; break;}
if(m_agc_threshold_gate_isSet){ isObjectUpdated = true; break;}
if(m_agc_threshold_delay_isSet){ isObjectUpdated = true; break;}
if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}

View File

@ -52,9 +52,6 @@ public:
float getLowCutoff();
void setLowCutoff(float low_cutoff);
qint32 getUsb();
void setUsb(qint32 usb);
float getToneFrequency();
void setToneFrequency(float tone_frequency);
@ -64,42 +61,12 @@ public:
qint32 getSpanLog2();
void setSpanLog2(qint32 span_log2);
qint32 getAudioBinaural();
void setAudioBinaural(qint32 audio_binaural);
qint32 getAudioFlipChannels();
void setAudioFlipChannels(qint32 audio_flip_channels);
qint32 getDsb();
void setDsb(qint32 dsb);
qint32 getAudioMute();
void setAudioMute(qint32 audio_mute);
qint32 getPlayLoop();
void setPlayLoop(qint32 play_loop);
qint32 getAgc();
void setAgc(qint32 agc);
float getAgcOrder();
void setAgcOrder(float agc_order);
qint32 getAgcTime();
void setAgcTime(qint32 agc_time);
qint32 getAgcThresholdEnable();
void setAgcThresholdEnable(qint32 agc_threshold_enable);
qint32 getAgcThreshold();
void setAgcThreshold(qint32 agc_threshold);
qint32 getAgcThresholdGate();
void setAgcThresholdGate(qint32 agc_threshold_gate);
qint32 getAgcThresholdDelay();
void setAgcThresholdDelay(qint32 agc_threshold_delay);
qint32 getRgbColor();
void setRgbColor(qint32 rgb_color);
@ -143,9 +110,6 @@ private:
float low_cutoff;
bool m_low_cutoff_isSet;
qint32 usb;
bool m_usb_isSet;
float tone_frequency;
bool m_tone_frequency_isSet;
@ -155,42 +119,12 @@ private:
qint32 span_log2;
bool m_span_log2_isSet;
qint32 audio_binaural;
bool m_audio_binaural_isSet;
qint32 audio_flip_channels;
bool m_audio_flip_channels_isSet;
qint32 dsb;
bool m_dsb_isSet;
qint32 audio_mute;
bool m_audio_mute_isSet;
qint32 play_loop;
bool m_play_loop_isSet;
qint32 agc;
bool m_agc_isSet;
float agc_order;
bool m_agc_order_isSet;
qint32 agc_time;
bool m_agc_time_isSet;
qint32 agc_threshold_enable;
bool m_agc_threshold_enable_isSet;
qint32 agc_threshold;
bool m_agc_threshold_isSet;
qint32 agc_threshold_gate;
bool m_agc_threshold_gate_isSet;
qint32 agc_threshold_delay;
bool m_agc_threshold_delay_isSet;
qint32 rgb_color;
bool m_rgb_color_isSet;