mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
FreeDV demodulator: removed more useless parameters
This commit is contained in:
parent
7ffe6da0d1
commit
4faa574faf
@ -47,9 +47,6 @@ const QString FreeDVDemod::m_channelId = "FreeDVDemod";
|
||||
FreeDVDemod::FreeDVDemod(DeviceSourceAPI *deviceAPI) :
|
||||
ChannelSinkAPI(m_channelIdURI),
|
||||
m_deviceAPI(deviceAPI),
|
||||
m_audioBinaual(false),
|
||||
m_audioFlipChannels(false),
|
||||
m_dsb(false),
|
||||
m_audioMute(false),
|
||||
m_agc(12000, agcTarget, 1e-2),
|
||||
m_agcActive(false),
|
||||
@ -66,8 +63,8 @@ FreeDVDemod::FreeDVDemod(DeviceSourceAPI *deviceAPI) :
|
||||
{
|
||||
setObjectName(m_channelId);
|
||||
|
||||
m_Bandwidth = 5000;
|
||||
m_LowCutoff = 300;
|
||||
m_hiCutoff = 5000;
|
||||
m_lowCutoff = 300;
|
||||
m_volume = 2.0;
|
||||
m_spanLog2 = 3;
|
||||
m_inputSampleRate = 48000;
|
||||
@ -81,7 +78,6 @@ FreeDVDemod::FreeDVDemod(DeviceSourceAPI *deviceAPI) :
|
||||
m_undersampleCount = 0;
|
||||
m_sum = 0;
|
||||
|
||||
m_usb = true;
|
||||
m_magsq = 0.0f;
|
||||
m_magsqSum = 0.0f;
|
||||
m_magsqPeak = 0.0f;
|
||||
@ -90,8 +86,7 @@ FreeDVDemod::FreeDVDemod(DeviceSourceAPI *deviceAPI) :
|
||||
m_agc.setClampMax(SDR_RX_SCALED/100.0);
|
||||
m_agc.setClamping(m_agcClamping);
|
||||
|
||||
SSBFilter = new fftfilt(m_LowCutoff / m_audioSampleRate, m_Bandwidth / m_audioSampleRate, ssbFftLen);
|
||||
DSBFilter = new fftfilt((2.0f * m_Bandwidth) / m_audioSampleRate, 2 * ssbFftLen);
|
||||
SSBFilter = new fftfilt(m_lowCutoff / m_audioSampleRate, m_hiCutoff / m_audioSampleRate, ssbFftLen);
|
||||
|
||||
applyChannelSettings(m_inputSampleRate, m_inputFrequencyOffset, true);
|
||||
applySettings(m_settings, true);
|
||||
@ -116,7 +111,6 @@ FreeDVDemod::~FreeDVDemod()
|
||||
delete m_threadedChannelizer;
|
||||
delete m_channelizer;
|
||||
delete SSBFilter;
|
||||
delete DSBFilter;
|
||||
}
|
||||
|
||||
void FreeDVDemod::configure(MessageQueue* messageQueue,
|
||||
@ -170,15 +164,7 @@ void FreeDVDemod::feed(const SampleVector::const_iterator& begin, const SampleVe
|
||||
|
||||
if(m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci))
|
||||
{
|
||||
if (m_dsb)
|
||||
{
|
||||
n_out = DSBFilter->runDSB(ci, &sideband);
|
||||
}
|
||||
else
|
||||
{
|
||||
n_out = SSBFilter->runSSB(ci, &sideband, m_usb);
|
||||
}
|
||||
|
||||
n_out = SSBFilter->runSSB(ci, &sideband, true);
|
||||
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||
}
|
||||
else
|
||||
@ -207,16 +193,7 @@ void FreeDVDemod::feed(const SampleVector::const_iterator& begin, const SampleVe
|
||||
}
|
||||
|
||||
m_magsqCount++;
|
||||
|
||||
if (!m_dsb & !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);
|
||||
}
|
||||
@ -234,27 +211,10 @@ void FreeDVDemod::feed(const SampleVector::const_iterator& begin, const SampleVe
|
||||
else
|
||||
{
|
||||
fftfilt::cmplx z = delayedSample * m_agc.getStepValue();
|
||||
|
||||
if (m_audioBinaual)
|
||||
{
|
||||
if (m_audioFlipChannels)
|
||||
{
|
||||
m_audioBuffer[m_audioBufferFill].r = (qint16)(z.imag() * m_volume);
|
||||
m_audioBuffer[m_audioBufferFill].l = (qint16)(z.real() * m_volume);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_audioBuffer[m_audioBufferFill].r = (qint16)(z.real() * m_volume);
|
||||
m_audioBuffer[m_audioBufferFill].l = (qint16)(z.imag() * m_volume);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Real demod = (z.real() + z.imag()) * 0.7;
|
||||
qint16 sample = (qint16)(demod * m_volume);
|
||||
m_audioBuffer[m_audioBufferFill].l = sample;
|
||||
m_audioBuffer[m_audioBufferFill].r = sample;
|
||||
}
|
||||
Real demod = (z.real() + z.imag()) * 0.7;
|
||||
qint16 sample = (qint16)(demod * m_volume);
|
||||
m_audioBuffer[m_audioBufferFill].l = sample;
|
||||
m_audioBuffer[m_audioBufferFill].r = sample;
|
||||
}
|
||||
|
||||
++m_audioBufferFill;
|
||||
@ -284,7 +244,7 @@ void FreeDVDemod::feed(const SampleVector::const_iterator& begin, const SampleVe
|
||||
|
||||
if (m_sampleSink != 0)
|
||||
{
|
||||
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), !m_dsb);
|
||||
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.end(), true);
|
||||
}
|
||||
|
||||
m_sampleBuffer.clear();
|
||||
@ -386,7 +346,7 @@ void FreeDVDemod::applyChannelSettings(int inputSampleRate, int inputFrequencyOf
|
||||
if ((m_inputSampleRate != inputSampleRate) || force)
|
||||
{
|
||||
m_settingsMutex.lock();
|
||||
m_interpolator.create(16, inputSampleRate, m_Bandwidth * 1.5f, 2.0f);
|
||||
m_interpolator.create(16, inputSampleRate, m_hiCutoff * 1.5f, 2.0f);
|
||||
m_interpolatorDistanceRemain = 0;
|
||||
m_interpolatorDistance = (Real) inputSampleRate / (Real) m_audioSampleRate;
|
||||
m_settingsMutex.unlock();
|
||||
@ -406,12 +366,11 @@ void FreeDVDemod::applyAudioSampleRate(int sampleRate)
|
||||
|
||||
m_settingsMutex.lock();
|
||||
|
||||
m_interpolator.create(16, m_inputSampleRate, m_Bandwidth * 1.5f, 2.0f);
|
||||
m_interpolator.create(16, m_inputSampleRate, m_hiCutoff * 1.5f, 2.0f);
|
||||
m_interpolatorDistanceRemain = 0;
|
||||
m_interpolatorDistance = (Real) m_inputSampleRate / (Real) sampleRate;
|
||||
|
||||
SSBFilter->create_filter(m_LowCutoff / (float) sampleRate, m_Bandwidth / (float) sampleRate);
|
||||
DSBFilter->create_dsb_filter((2.0f * m_Bandwidth) / (float) sampleRate);
|
||||
SSBFilter->create_filter(m_lowCutoff / (float) sampleRate, m_hiCutoff / (float) sampleRate);
|
||||
|
||||
int agcNbSamples = (sampleRate / 1000) * (1<<m_settings.m_agcTimeLog2);
|
||||
int agcThresholdGate = (sampleRate / 1000) * m_settings.m_agcThresholdGate; // ms
|
||||
|
@ -273,18 +273,14 @@ private:
|
||||
DownChannelizer* m_channelizer;
|
||||
FreeDVDemodSettings m_settings;
|
||||
|
||||
Real m_Bandwidth;
|
||||
Real m_LowCutoff;
|
||||
Real m_hiCutoff;
|
||||
Real m_lowCutoff;
|
||||
Real m_volume;
|
||||
int m_spanLog2;
|
||||
fftfilt::cmplx m_sum;
|
||||
int m_undersampleCount;
|
||||
int m_inputSampleRate;
|
||||
int m_inputFrequencyOffset;
|
||||
bool m_audioBinaual;
|
||||
bool m_audioFlipChannels;
|
||||
bool m_usb;
|
||||
bool m_dsb;
|
||||
bool m_audioMute;
|
||||
double m_magsq;
|
||||
double m_magsqSum;
|
||||
@ -305,7 +301,6 @@ private:
|
||||
Real m_interpolatorDistance;
|
||||
Real m_interpolatorDistanceRemain;
|
||||
fftfilt* SSBFilter;
|
||||
fftfilt* DSBFilter;
|
||||
|
||||
BasebandSampleSink* m_sampleSink;
|
||||
SampleVector m_sampleBuffer;
|
||||
|
@ -366,109 +366,6 @@ void FreeDVDemodGUI::applyBandwidths(int spanLog2, bool force)
|
||||
m_settings.m_spanLog2 = spanLog2;
|
||||
|
||||
applySettings(force);
|
||||
|
||||
// bool dsb = ui->dsb->isChecked();
|
||||
// //int spanLog2 = ui->spanLog2->value();
|
||||
// m_spectrumRate = m_freeDVDemod->getAudioSampleRate() / (1<<spanLog2);
|
||||
// int bw = ui->BW->value();
|
||||
// int lw = ui->lowCut->value();
|
||||
// int bwMax = m_freeDVDemod->getAudioSampleRate() / (100*(1<<spanLog2));
|
||||
// int tickInterval = m_spectrumRate / 1200;
|
||||
// tickInterval = tickInterval == 0 ? 1 : tickInterval;
|
||||
//
|
||||
// qDebug() << "FreeDVDemodGUI::applyBandwidths:"
|
||||
// << " dsb: " << dsb
|
||||
// << " spanLog2: " << spanLog2
|
||||
// << " m_spectrumRate: " << m_spectrumRate
|
||||
// << " bw: " << bw
|
||||
// << " lw: " << lw
|
||||
// << " bwMax: " << bwMax
|
||||
// << " tickInterval: " << tickInterval;
|
||||
//
|
||||
// ui->BW->setTickInterval(tickInterval);
|
||||
// ui->lowCut->setTickInterval(tickInterval);
|
||||
//
|
||||
// bw = bw < -bwMax ? -bwMax : bw > bwMax ? bwMax : bw;
|
||||
//
|
||||
// if (bw < 0) {
|
||||
// lw = lw < bw+1 ? bw+1 : lw < 0 ? lw : 0;
|
||||
// } else if (bw > 0) {
|
||||
// lw = lw > bw-1 ? bw-1 : lw < 0 ? 0 : lw;
|
||||
// } else {
|
||||
// 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->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);
|
||||
//
|
||||
// ui->channelPowerMeter->setRange(FreeDVDemodSettings::m_minPowerThresholdDB, 0);
|
||||
//
|
||||
// m_settings.m_dsb = dsb;
|
||||
// m_settings.m_spanLog2 = spanLog2;
|
||||
// m_settings.m_rfBandwidth = bw * 100;
|
||||
// m_settings.m_lowCutoff = lw * 100;
|
||||
//
|
||||
// applySettings(force);
|
||||
//
|
||||
// bool wasBlocked = 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(wasBlocked);
|
||||
}
|
||||
|
||||
void FreeDVDemodGUI::displaySettings()
|
||||
|
Loading…
Reference in New Issue
Block a user