diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index 2062eea..ab04eab 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -1478,6 +1478,9 @@ void AppFrame::OnIdle(wxIdleEvent& event) { int peakHoldMode = peakHoldButton->getSelection(); if (peakHoldButton->modeChanged()) { wxGetApp().getSpectrumProcessor()->setPeakHold(peakHoldMode == 1); + + //make the peak hold act on the current dmod also, like a zoomed-in version. + wxGetApp().getDemodSpectrumProcessor()->setPeakHold(peakHoldMode == 1); peakHoldButton->clearModeChanged(); } diff --git a/src/CubicSDR.cpp b/src/CubicSDR.cpp index db3035b..ba55084 100644 --- a/src/CubicSDR.cpp +++ b/src/CubicSDR.cpp @@ -24,6 +24,8 @@ IMPLEMENT_APP(CubicSDR) +#include + //#ifdef ENABLE_DIGITAL_LAB //// console output buffer for windows //#ifdef _WINDOWS @@ -156,18 +158,21 @@ bool CubicSDR::OnInit() { return false; } -//#ifdef ENABLE_DIGITAL_LAB -// // console output for windows -// #ifdef _WINDOWS -// if (AllocConsole()) { -// freopen("CONOUT$", "w", stdout); -// SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED); -// } -// outbuf ob; -// std::streambuf *sb = std::cout.rdbuf(&ob); -// std::cout.rdbuf(sb); -// #endif -//#endif + // // console output for Windows: available in DEBUG or in case of ENABLE_DIGITAL_LAB +#if (defined(WIN32) && (defined(ENABLE_DIGITAL_LAB) || defined(_DEBUG))) + if (AllocConsole()) { + freopen("CONOUT$", "w", stdout); + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED); + SetConsoleTitle(L"CubicSDR: stdout"); + + } + + //refresh + ofstream ob; + std::streambuf *sb = std::cout.rdbuf(); + std::cout.rdbuf(sb); +#endif + wxApp::SetAppName("CubicSDR"); @@ -448,6 +453,9 @@ void CubicSDR::setFrequency(long long freq) { frequency = freq; sdrThread->setFrequency(freq); getSpectrumProcessor()->setPeakHold(getSpectrumProcessor()->getPeakHold()); + + //make the peak hold act on the current dmod also, like a zoomed-in version. + getDemodSpectrumProcessor()->setPeakHold(getSpectrumProcessor()->getPeakHold()); } long long CubicSDR::getOffset() { diff --git a/src/IOThread.h b/src/IOThread.h index 0197894..f4645a8 100644 --- a/src/IOThread.h +++ b/src/IOThread.h @@ -23,6 +23,11 @@ struct map_string_less : public std::binary_function lock(m_mutex); @@ -139,8 +144,8 @@ public: std::cout << "Warning: ReBuffer '" << bufferId << "' count '" << outputBuffers.size() << "' exceeds threshold of '" << REBUFFER_WARNING_THRESHOLD << "'" << std::endl; } + //by default created with refcount = 1 buf = new BufferType(); - buf->setRefCount(1); // buf->setIndex(indexCounter++); outputBuffers.push_back(buf); diff --git a/src/demod/DemodulatorPreThread.cpp b/src/demod/DemodulatorPreThread.cpp index e1a438c..554b221 100644 --- a/src/demod/DemodulatorPreThread.cpp +++ b/src/demod/DemodulatorPreThread.cpp @@ -198,7 +198,6 @@ void DemodulatorPreThread::run() { unsigned int numWritten; msresamp_crcf_execute(iqResampler, in_buf, bufSize, &resampledData[0], &numWritten); - resamp->setRefCount(1); resamp->data.assign(resampledData.begin(), resampledData.begin() + numWritten); resamp->modemType = cModem->getType(); diff --git a/src/demod/DemodulatorThread.cpp b/src/demod/DemodulatorThread.cpp index 9ec0cab..c9b8a96 100644 --- a/src/demod/DemodulatorThread.cpp +++ b/src/demod/DemodulatorThread.cpp @@ -120,7 +120,6 @@ void DemodulatorThread::run() { modemData.sampleRate = inp->sampleRate; modemData.data.assign(inputData->begin(), inputData->end()); - modemData.setRefCount(1); AudioThreadInput *ati = nullptr; @@ -186,7 +185,6 @@ void DemodulatorThread::run() { if (ati && localAudioVisOutputQueue != nullptr && localAudioVisOutputQueue->empty()) { AudioThreadInput *ati_vis = new AudioThreadInput; - ati_vis->setRefCount(1); ati_vis->sampleRate = inp->sampleRate; ati_vis->inputRate = inp->sampleRate; diff --git a/src/sdr/SoapySDRThread.cpp b/src/sdr/SoapySDRThread.cpp index d3a1620..f283b53 100644 --- a/src/sdr/SoapySDRThread.cpp +++ b/src/sdr/SoapySDRThread.cpp @@ -207,7 +207,6 @@ void SDRThread::readStream(SDRThreadIQDataQueue* iqDataOutQueue) { dataOut->data.assign(inpBuffer.data.begin(), inpBuffer.data.begin()+n_read); } - dataOut->setRefCount(1); dataOut->frequency = frequency.load(); dataOut->sampleRate = sampleRate.load(); dataOut->dcCorrected = hasHardwareDC.load(); diff --git a/src/visual/SpectrumCanvas.cpp b/src/visual/SpectrumCanvas.cpp index faad1cb..678b0c1 100644 --- a/src/visual/SpectrumCanvas.cpp +++ b/src/visual/SpectrumCanvas.cpp @@ -293,6 +293,9 @@ void SpectrumCanvas::OnMouseRightReleased(wxMouseEvent& event) { if (!mouseTracker.getOriginDeltaMouseY()) { resetScaleFactor = true; wxGetApp().getSpectrumProcessor()->setPeakHold(wxGetApp().getSpectrumProcessor()->getPeakHold()); + + //make the peak hold act on the current dmod also, like a zoomed-in version. + wxGetApp().getDemodSpectrumProcessor()->setPeakHold(wxGetApp().getSpectrumProcessor()->getPeakHold()); } mouseTracker.OnMouseRightReleased(event); }