From 84c43d517a4ff3a0868f0c94a99c361e87f2f9e3 Mon Sep 17 00:00:00 2001 From: John Greb Date: Mon, 10 Nov 2014 15:57:33 +0000 Subject: [PATCH] Extra samplerates. --- plugins/channel/usb/usbdemod.cpp | 8 ++++++-- plugins/samplesource/rtlsdr/rtlsdrgui.cpp | 4 ++-- plugins/samplesource/rtlsdr/rtlsdrgui.ui | 2 +- plugins/samplesource/rtlsdr/rtlsdrinput.cpp | 2 +- plugins/samplesource/rtlsdr/rtlsdrthread.cpp | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/channel/usb/usbdemod.cpp b/plugins/channel/usb/usbdemod.cpp index c563ba978..76da605cc 100644 --- a/plugins/channel/usb/usbdemod.cpp +++ b/plugins/channel/usb/usbdemod.cpp @@ -55,6 +55,7 @@ void USBDemod::configure(MessageQueue* messageQueue, Real Bandwidth, Real volume /* Fractional Downsample to 48 kHz. * 192 1:4 (3072 / 16) * 144 1:3 (2304 / 16) + * 120 2:5 (1920 / 16) * 96 1:2 (1536 / 16) * 72 2:3 ( 288 / 4) * 64 3:4 (1024 / 16) @@ -64,7 +65,8 @@ double rerate(int rate) switch (rate) { case 64000 : return (3.0 * 64000); break; - case 72000 : return (2.0 * 72000); break; + case 72000 : + case 120000: return (2.0 * rate); break; case 0 : return (1.0 ) ; break; default : return (1.0 * rate ); break; } @@ -83,6 +85,8 @@ void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter samplestep = 3; // !! FFT buffer length is a power of two if ((m_sampleRate == 64000)||(m_sampleRate == 192000)) samplestep = 4; // buffer length should be good + if (m_sampleRate == 120000) + samplestep = 5; for(SampleVector::const_iterator it = begin; it < end; it ++) { a = it->real(); @@ -90,7 +94,7 @@ void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter c = Complex(a / 65536.0, b / 65536.0); n_out = USBFilter->run(c, &sideband, true); - if (m_sampleRate <= 72000) + if ((m_sampleRate <= 72000)||(m_sampleRate == 120000)) n_out += USBFilter->run(c, &sideband, true); if (m_sampleRate == 64000) n_out += USBFilter->run(c, &sideband, true); diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.cpp b/plugins/samplesource/rtlsdr/rtlsdrgui.cpp index 9196761b1..d1bfde6ab 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrgui.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrgui.cpp @@ -95,7 +95,7 @@ bool RTLSDRGui::handleMessage(Message* message) void RTLSDRGui::displaySettings() { ui->centerFrequency->setValue(m_generalSettings.m_centerFrequency / 1000); - ui->samplerate->setValue(m_settings.m_samplerate); + ui->samplerate->setValue(0); if(m_gains.size() > 0) { int dist = abs(m_settings.m_gain - m_gains[0]); @@ -141,7 +141,7 @@ void RTLSDRGui::on_gain_valueChanged(int value) void RTLSDRGui::on_samplerate_valueChanged(int value) { - int Rates[] = {288, 1024, 1536, 0}; + int Rates[] = {288, 1024, 1536, 2048, 2304, 2500 }; int newrate = Rates[value]; ui->samplerateText->setText(tr("%1k").arg(newrate)); m_settings.m_samplerate = newrate * 1000; diff --git a/plugins/samplesource/rtlsdr/rtlsdrgui.ui b/plugins/samplesource/rtlsdr/rtlsdrgui.ui index 9be23107b..f336a8a9e 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrgui.ui +++ b/plugins/samplesource/rtlsdr/rtlsdrgui.ui @@ -111,7 +111,7 @@ Device Samplerate - 2 + 4 1 diff --git a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp index b6a74016d..d079ede77 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrinput.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrinput.cpp @@ -56,7 +56,7 @@ bool RTLSDRInput::Settings::deserialize(const QByteArray& data) if(d.getVersion() == 1) { d.readS32(1, &m_gain, 0); - d.readS32(2, &m_samplerate, 0); + //d.readS32(2, &m_samplerate, 0); return true; } else { resetToDefaults(); diff --git a/plugins/samplesource/rtlsdr/rtlsdrthread.cpp b/plugins/samplesource/rtlsdr/rtlsdrthread.cpp index 72ff6d5d5..778d5acfa 100644 --- a/plugins/samplesource/rtlsdr/rtlsdrthread.cpp +++ b/plugins/samplesource/rtlsdr/rtlsdrthread.cpp @@ -96,7 +96,7 @@ void RTLSDRThread::decimate4(SampleVector::iterator* it, const quint8* buf, qint for (int pos = 0; pos < len + 7; pos += 8) { 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 << 3, yimag << 3 ); + Sample s( xreal << 4, yimag << 4 ); **it = s; (*it)++; }