diff --git a/src/demod/DemodulatorInstance.cpp b/src/demod/DemodulatorInstance.cpp index c3440bc..b03ece4 100644 --- a/src/demod/DemodulatorInstance.cpp +++ b/src/demod/DemodulatorInstance.cpp @@ -255,7 +255,9 @@ void DemodulatorInstance::setOutputDevice(int device_id) { int DemodulatorInstance::getOutputDevice() { if (currentOutputDevice == -1) { - currentOutputDevice = audioThread->getOutputDevice(); + if (audioThread) { + currentOutputDevice = audioThread->getOutputDevice(); + } } return currentOutputDevice; @@ -308,7 +310,7 @@ void DemodulatorInstance::setBandwidth(int bw) { bw = AudioThread::deviceSampleRate[getOutputDevice()]; } } - if (!active) { + if (!active && demodulatorPreThread != NULL) { currentBandwidth = bw; checkBandwidth(); demodulatorPreThread->getParams().bandwidth = currentBandwidth; diff --git a/src/visual/WaterfallCanvas.cpp b/src/visual/WaterfallCanvas.cpp index 704f411..8d48418 100644 --- a/src/visual/WaterfallCanvas.cpp +++ b/src/visual/WaterfallCanvas.cpp @@ -79,6 +79,7 @@ void WaterfallCanvas::processInputQueue() { double targetVis = 1.0 / (double)linesPerSecond; lpsIndex += gTimer.lastUpdateSeconds(); + bool updated = false; if (linesPerSecond) { if (lpsIndex >= targetVis) { while (lpsIndex >= targetVis) { @@ -90,6 +91,7 @@ void WaterfallCanvas::processInputQueue() { waterfallPanel.setPoints(vData->spectrum_points); waterfallPanel.step(); vData->decRefCount(); + updated = true; } lpsIndex-=targetVis; } else { @@ -98,10 +100,11 @@ void WaterfallCanvas::processInputQueue() { } } } - wxClientDC(this); - glContext->SetCurrent(*this); - waterfallPanel.update(); - + if (updated) { + wxClientDC(this); + glContext->SetCurrent(*this); + waterfallPanel.update(); + } tex_update.unlock(); }