diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index 7129e92..0b68e56 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -370,7 +370,7 @@ void AppFrame::OnIdle(wxIdleEvent& event) { } if (demodWaterfallCanvas->getDragState() == WaterfallCanvas::WF_DRAG_NONE) { long long centerFreq = demod->getFrequency(); - unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.5); + unsigned int demodBw = (unsigned int) ceil((float) demod->getBandwidth() * 2.25); if (demod->getDemodulatorType() == DEMOD_TYPE_USB) { demodBw /= 2; @@ -385,8 +385,8 @@ void AppFrame::OnIdle(wxIdleEvent& event) { if (demodBw > wxGetApp().getSampleRate() / 2) { demodBw = wxGetApp().getSampleRate() / 2; } - if (demodBw < 30000) { - demodBw = 30000; + if (demodBw < 20000) { + demodBw = 20000; } if (centerFreq != demodWaterfallCanvas->getCenterFrequency()) { diff --git a/src/CubicSDR.cpp b/src/CubicSDR.cpp index 3ae5cfa..32e42d1 100644 --- a/src/CubicSDR.cpp +++ b/src/CubicSDR.cpp @@ -29,7 +29,7 @@ bool CubicSDR::OnInit() { sdrThread = new SDRThread(threadCmdQueueSDR); sdrPostThread = new SDRPostThread(); - sdrPostThread->setNumVisSamples(16384); + sdrPostThread->setNumVisSamples(16384*2); iqPostDataQueue = new SDRThreadIQDataQueue; iqVisualQueue = new DemodulatorThreadInputQueue; diff --git a/src/demod/DemodulatorThread.cpp b/src/demod/DemodulatorThread.cpp index 88028de..4c257bb 100644 --- a/src/demod/DemodulatorThread.cpp +++ b/src/demod/DemodulatorThread.cpp @@ -73,16 +73,8 @@ void DemodulatorThread::threadMain() { nco_crcf stereoShifter = nco_crcf_create(LIQUID_NCO); double stereoShiftFrequency = 0; - // SSB Half-band filter - nco_crcf ssbShifterUp = nco_crcf_create(LIQUID_NCO); - nco_crcf_set_frequency(ssbShifterUp, (2.0 * M_PI) * 0.25); - - nco_crcf ssbShifterDown = nco_crcf_create(LIQUID_NCO); - nco_crcf_set_frequency(ssbShifterDown, (2.0 * M_PI) * 0.25); - - // half band interp / decimate used for side-band elimination - resamp2_crcf ssbInterp = resamp2_crcf_create(7, 0.0f, -120.0f); - resamp2_crcf ssbDecim = resamp2_crcf_create(7, 0.0f, -120.0f); + // half band filter used for side-band elimination + resamp2_cccf ssbFilt = resamp2_cccf_create(12,-0.25f,60.0f); // Automatic IQ gain iqAutoGain = agc_crcf_create(); @@ -175,37 +167,15 @@ void DemodulatorThread::threadMain() { float p; switch (demodulatorType.load()) { case DEMOD_TYPE_LSB: - for (int i = 0; i < bufSize / 2; i++) { // Reject upper band - nco_crcf_mix_up(ssbShifterUp, inp->data[i * 2], &z[0]); - nco_crcf_step(ssbShifterUp); - nco_crcf_mix_up(ssbShifterUp, inp->data[i * 2 + 1], &z[1]); - nco_crcf_step(ssbShifterUp); - resamp2_crcf_decim_execute(ssbDecim, z, &x); - resamp2_crcf_interp_execute(ssbInterp, x, z); - - nco_crcf_mix_down(ssbShifterDown, z[0], &x); - nco_crcf_step(ssbShifterDown); - nco_crcf_mix_down(ssbShifterDown, z[1], &y); - nco_crcf_step(ssbShifterDown); - ampmodem_demodulate(demodAM, x, &demodOutputData[i * 2]); - ampmodem_demodulate(demodAM, y, &demodOutputData[i * 2 + 1]); + for (int i = 0; i < bufSize; i++) { // Reject upper band + resamp2_cccf_filter_execute(ssbFilt,inp->data[i],&x,&y); + ampmodem_demodulate(demodAM, x, &demodOutputData[i]); } break; case DEMOD_TYPE_USB: - for (int i = 0; i < bufSize / 2; i++) { // Reject lower band - nco_crcf_mix_down(ssbShifterDown, inp->data[i * 2], &z[0]); - nco_crcf_step(ssbShifterDown); - nco_crcf_mix_down(ssbShifterDown, inp->data[i * 2 + 1], &z[1]); - nco_crcf_step(ssbShifterDown); - resamp2_crcf_decim_execute(ssbDecim, z, &x); - resamp2_crcf_interp_execute(ssbInterp, x, z); - - nco_crcf_mix_up(ssbShifterUp, z[0], &x); - nco_crcf_step(ssbShifterUp); - nco_crcf_mix_up(ssbShifterUp, z[1], &y); - nco_crcf_step(ssbShifterUp); - ampmodem_demodulate(demodAM, x, &demodOutputData[i * 2]); - ampmodem_demodulate(demodAM, y, &demodOutputData[i * 2 + 1]); + for (int i = 0; i < bufSize; i++) { // Reject lower band + resamp2_cccf_filter_execute(ssbFilt,inp->data[i],&x,&y); + ampmodem_demodulate(demodAM, y, &demodOutputData[i]); } break; case DEMOD_TYPE_AM: @@ -441,8 +411,7 @@ void DemodulatorThread::threadMain() { firhilbf_destroy(firStereoR2C); firhilbf_destroy(firStereoC2R); nco_crcf_destroy(stereoShifter); - nco_crcf_destroy(ssbShifterUp); - nco_crcf_destroy(ssbShifterDown); + resamp2_cccf_destroy(ssbFilt); while (!outputBuffers.empty()) { AudioThreadInput *audioDataDel = outputBuffers.front(); diff --git a/src/sdr/SDRPostThread.cpp b/src/sdr/SDRPostThread.cpp index 81c9ef4..34b8942 100644 --- a/src/sdr/SDRPostThread.cpp +++ b/src/sdr/SDRPostThread.cpp @@ -6,7 +6,7 @@ #include SDRPostThread::SDRPostThread() : - iqDataOutQueue(NULL), iqDataInQueue(NULL), iqVisualQueue(NULL), terminated(false), dcFilter(NULL), num_vis_samples(16384) { + iqDataOutQueue(NULL), iqDataInQueue(NULL), iqVisualQueue(NULL), terminated(false), dcFilter(NULL), num_vis_samples(16384*2) { // create a lookup table for (unsigned int i = 0; i <= 0xffff; i++) {