diff --git a/plugins/samplesink/filesink/filesinkgui.cpp b/plugins/samplesink/filesink/filesinkgui.cpp index eb21529e4..8e316a226 100644 --- a/plugins/samplesink/filesink/filesinkgui.cpp +++ b/plugins/samplesink/filesink/filesinkgui.cpp @@ -327,7 +327,7 @@ void FileSinkGui::tick() } } -unsigned int FileSinkSampleRates::m_rates[] = {32, 36, 48, 64, 72}; +unsigned int FileSinkSampleRates::m_rates[] = {32, 48, 64, 72, 128}; unsigned int FileSinkSampleRates::m_nb_rates = 5; unsigned int FileSinkSampleRates::getRate(unsigned int rate_index) diff --git a/sdrbase/dsp/inthalfbandfilter.h b/sdrbase/dsp/inthalfbandfilter.h index 64ccd9bcc..0d1e589a6 100644 --- a/sdrbase/dsp/inthalfbandfilter.h +++ b/sdrbase/dsp/inthalfbandfilter.h @@ -376,7 +376,7 @@ public: } } - // upsample by 2, from upper half of original spectrum + // upsample by 2, move original spectrum to upper half bool workInterpolateUpperHalf(Sample* sampleIn, Sample *sampleOut) { switch(m_state) @@ -400,8 +400,8 @@ public: case 1: // insert sample into ring-buffer - m_samples[m_ptr][0] = -sampleIn->real(); - m_samples[m_ptr][1] = -sampleIn->imag(); + m_samples[m_ptr][0] = sampleIn->imag(); + m_samples[m_ptr][1] = -sampleIn->real(); // save result doFIR(sampleOut); @@ -432,10 +432,78 @@ public: // tell caller we didn't consume the sample return false; + case 3: + // insert sample into ring-buffer + m_samples[m_ptr][0] = -sampleIn->real(); + m_samples[m_ptr][1] = -sampleIn->imag(); + + // save result + doFIR(sampleOut); + + // advance write-pointer + m_ptr = (m_ptr + HB_FILTERORDER) % (HB_FILTERORDER + 1); + + // next state + m_state = 4; + + // tell caller we consumed the sample + return true; + + case 4: + // insert sample into ring-buffer + m_samples[m_ptr][0] = 0; + m_samples[m_ptr][1] = 0; + + // save result + doFIR(sampleOut); + + // advance write-pointer + m_ptr = (m_ptr + HB_FILTERORDER) % (HB_FILTERORDER + 1); + + // next state + m_state = 5; + + // tell caller we didn't consume the sample + return false; + + case 5: + // insert sample into ring-buffer + m_samples[m_ptr][0] = -sampleIn->imag(); + m_samples[m_ptr][1] = sampleIn->real(); + + // save result + doFIR(sampleOut); + + // advance write-pointer + m_ptr = (m_ptr + HB_FILTERORDER) % (HB_FILTERORDER + 1); + + // next state + m_state = 6; + + // tell caller we consumed the sample + return true; + + case 6: + // insert sample into ring-buffer + m_samples[m_ptr][0] = 0; + m_samples[m_ptr][1] = 0; + + // save result + doFIR(sampleOut); + + // advance write-pointer + m_ptr = (m_ptr + HB_FILTERORDER) % (HB_FILTERORDER + 1); + + // next state + m_state = 7; + + // tell caller we didn't consume the sample + return false; + default: // insert sample into ring-buffer - m_samples[m_ptr][0] = sampleIn->real(); - m_samples[m_ptr][1] = sampleIn->imag(); + m_samples[m_ptr][0] = sampleIn->real(); + m_samples[m_ptr][1] = sampleIn->imag(); // save result doFIR(sampleOut); diff --git a/sdrbase/dsp/upchannelizer.cpp b/sdrbase/dsp/upchannelizer.cpp index 5353d39ab..0f5054f6a 100644 --- a/sdrbase/dsp/upchannelizer.cpp +++ b/sdrbase/dsp/upchannelizer.cpp @@ -63,14 +63,23 @@ void UpChannelizer::pull(Sample& sample) { m_mutex.lock(); - // TODO: handle multiple stages - FilterStages::iterator stage = m_filterStages.begin(); + FilterStages::iterator last = m_filterStages.end(); + last--; - if ((*stage)->work(&m_sampleIn, &sample)) - { - m_sampleSource->pull(m_sampleIn); - } + // m_sampleIn + + for (; stage != m_filterStages.end(); ++stage) + { + // let's make it work for one stage only (96 kS/s < SR < 192 kS/s) + if(stage == last) + { + if ((*stage)->work(&m_sampleIn, &sample)) + { + m_sampleSource->pull(m_sampleIn); // get new input sample + } + } + } m_mutex.unlock(); } @@ -162,9 +171,9 @@ void UpChannelizer::applyConfiguration() m_currentInputSampleRate = m_outputSampleRate / (1 << m_filterStages.size()); - qDebug() << "UpChannelizer::applyConfiguration in=" << m_outputSampleRate + qDebug() << "UpChannelizer::applyConfiguration out=" << m_outputSampleRate << ", req=" << m_requestedInputSampleRate - << ", out=" << m_currentInputSampleRate + << ", in=" << m_currentInputSampleRate << ", fc=" << m_currentCenterFrequency; if (m_sampleSource != 0)