mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Tidy.
This commit is contained in:
parent
c5fc860be9
commit
d84f9a6da5
@ -28,17 +28,17 @@ SSBDemod::SSBDemod(AudioFifo* audioFifo, SampleSink* sampleSink) :
|
||||
m_sampleSink(sampleSink),
|
||||
m_audioFifo(audioFifo)
|
||||
{
|
||||
m_Bandwidth = 10000;
|
||||
m_Bandwidth = 5000;
|
||||
m_volume = 2.0;
|
||||
m_sampleRate = 96000;
|
||||
m_frequency = 0;
|
||||
m_nco.setFreq(m_frequency, m_sampleRate);
|
||||
m_interpolator.create(16, m_sampleRate, 10000);
|
||||
m_interpolator.create(16, m_sampleRate, 5000);
|
||||
m_sampleDistanceRemain = (Real)m_sampleRate / 48000.0;
|
||||
|
||||
m_lowpass.create(21, 48000, 10000);
|
||||
m_lowpass.create(21, 48000, 5000);
|
||||
|
||||
m_audioBuffer.resize(256);
|
||||
m_audioBuffer.resize(512);
|
||||
m_audioBufferFill = 0;
|
||||
}
|
||||
|
||||
@ -52,6 +52,7 @@ void SSBDemod::configure(MessageQueue* messageQueue, Real Bandwidth, Real volume
|
||||
cmd->submit(messageQueue, this);
|
||||
}
|
||||
|
||||
int undersamplecount = 0;
|
||||
void SSBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool firstOfBurst)
|
||||
{
|
||||
Complex ci;
|
||||
@ -65,12 +66,13 @@ void SSBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter
|
||||
// could squelch audio if RTL_SDR samplerate is not being fully decimated.
|
||||
if(m_interpolator.interpolate(&m_sampleDistanceRemain, c, &consumed, &ci)) {
|
||||
Real demod = ci.imag() + ci.real();
|
||||
demod = m_lowpass.filter(demod * 0.5);
|
||||
m_sampleBuffer.push_back(Sample(demod * 32768.0, demod * 32768.0));
|
||||
demod = 32768.0 * m_lowpass.filter(demod * 0.7);
|
||||
|
||||
demod *= m_volume;
|
||||
qint16 sample = demod * 16384;
|
||||
// Downsample by 4x for audio display
|
||||
if (!(undersamplecount++ & 3))
|
||||
m_sampleBuffer.push_back(Sample(demod, 0.0));
|
||||
|
||||
qint16 sample = (qint16)(demod * m_volume);
|
||||
m_audioBuffer[m_audioBufferFill].l = sample;
|
||||
m_audioBuffer[m_audioBufferFill].r = sample;
|
||||
++m_audioBufferFill;
|
||||
|
@ -91,7 +91,7 @@ void SSBDemodGUI::viewChanged()
|
||||
void SSBDemodGUI::on_BW_valueChanged(int value)
|
||||
{
|
||||
ui->BWText->setText(QString("%1 kHz").arg(value));
|
||||
m_channelMarker->setBandwidth(value * 1000);
|
||||
m_channelMarker->setBandwidth(value * 1000 * 2);
|
||||
applySettings();
|
||||
}
|
||||
|
||||
@ -138,14 +138,14 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, QWidget* parent) :
|
||||
m_pluginAPI->addSampleSink(m_threadedSampleSink);
|
||||
|
||||
ui->glSpectrum->setCenterFrequency(0);
|
||||
ui->glSpectrum->setSampleRate(48000);
|
||||
ui->glSpectrum->setSampleRate(12000);
|
||||
ui->glSpectrum->setDisplayWaterfall(true);
|
||||
ui->glSpectrum->setDisplayMaxHold(true);
|
||||
ui->glSpectrum->setDisplayMaxHold(false);
|
||||
m_spectrumVis->configure(m_threadedSampleSink->getMessageQueue(), 64, 10, FFTWindow::BlackmanHarris);
|
||||
|
||||
m_channelMarker = new ChannelMarker(this);
|
||||
m_channelMarker->setColor(Qt::red);
|
||||
m_channelMarker->setBandwidth(4000);
|
||||
m_channelMarker->setBandwidth(8000);
|
||||
m_channelMarker->setCenterFrequency(0);
|
||||
m_channelMarker->setVisible(true);
|
||||
connect(m_channelMarker, SIGNAL(changed()), this, SLOT(viewChanged()));
|
||||
|
@ -140,12 +140,12 @@ void RTLSDRThread::decimate2(SampleVector::iterator* it, const quint8* buf, qint
|
||||
for (int pos = 0; pos < len + 7; pos += 8) {
|
||||
xreal = buf[pos+0] - buf[pos+3];
|
||||
yimag = buf[pos+1] + buf[pos+2] - 255;
|
||||
Sample s( xreal << 5, yimag << 5 );
|
||||
Sample s( xreal << 6, yimag << 6 );
|
||||
**it = s;
|
||||
(*it)++;
|
||||
xreal = buf[pos+7] - buf[pos+4];
|
||||
yimag = 255 - buf[pos+5] - buf[pos+6];
|
||||
Sample t( xreal << 5, yimag << 5 );
|
||||
Sample t( xreal << 6, yimag << 6 );
|
||||
**it = t;
|
||||
(*it)++;
|
||||
}
|
||||
@ -189,7 +189,7 @@ void RTLSDRThread::decimate16(SampleVector::iterator* it, const quint8* buf, qin
|
||||
xreal += buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4];
|
||||
yimag += buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6];
|
||||
}
|
||||
Sample s( xreal << 4, yimag << 4 );
|
||||
Sample s( xreal << 3, yimag << 3 );
|
||||
**it = s;
|
||||
(*it)++;
|
||||
}
|
||||
@ -209,10 +209,10 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
||||
phase *= -1;
|
||||
xreal = phase * (buf[pos+0] - 127);
|
||||
yimag = phase * (buf[pos+1] - 127);
|
||||
*it++ = Sample( xreal<<6,yimag<<6);
|
||||
*it++ = Sample( xreal<<7,yimag<<7);
|
||||
xreal = phase * (128 - buf[pos+3]);
|
||||
yimag = phase * (buf[pos+2] - 127);
|
||||
*it++ = Sample( xreal<<6,yimag<<6);
|
||||
*it++ = Sample( xreal<<7,yimag<<7);
|
||||
}
|
||||
break;
|
||||
case 1: // 1:2
|
||||
|
Loading…
Reference in New Issue
Block a user