mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-29 23:28:39 -05:00
SDRPostThread is better using try_push, restore previous audio-related code in DemodulatorInstance
This commit is contained in:
parent
87077a89c1
commit
030628c5ed
@ -257,16 +257,13 @@ bool DemodulatorInstance::isActive() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DemodulatorInstance::setActive(bool state) {
|
void DemodulatorInstance::setActive(bool state) {
|
||||||
|
|
||||||
//always nudge the adio thread
|
|
||||||
audioThread->setActive(state);
|
|
||||||
|
|
||||||
if (active && !state) {
|
if (active && !state) {
|
||||||
#if ENABLE_DIGITAL_LAB
|
#if ENABLE_DIGITAL_LAB
|
||||||
if (activeOutput) {
|
if (activeOutput) {
|
||||||
activeOutput->Hide();
|
activeOutput->Hide();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
audioThread->setActive(state);
|
||||||
|
|
||||||
DemodulatorThread::releaseSquelchLock(this);
|
DemodulatorThread::releaseSquelchLock(this);
|
||||||
|
|
||||||
@ -276,6 +273,7 @@ void DemodulatorInstance::setActive(bool state) {
|
|||||||
activeOutput->Show();
|
activeOutput->Show();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
audioThread->setActive(state);
|
||||||
}
|
}
|
||||||
if (!state) {
|
if (!state) {
|
||||||
tracking = false;
|
tracking = false;
|
||||||
|
@ -12,9 +12,6 @@
|
|||||||
//50 ms
|
//50 ms
|
||||||
#define HEARTBEAT_CHECK_PERIOD_MICROS (50 * 1000)
|
#define HEARTBEAT_CHECK_PERIOD_MICROS (50 * 1000)
|
||||||
|
|
||||||
//1s
|
|
||||||
#define MAX_BLOCKING_DURATION_MICROS (1000 * 1000)
|
|
||||||
|
|
||||||
SDRPostThread::SDRPostThread() : IOThread(), buffers("SDRPostThreadBuffers"), visualDataBuffers("SDRPostThreadVisualDataBuffers"), frequency(0) {
|
SDRPostThread::SDRPostThread() : IOThread(), buffers("SDRPostThreadBuffers"), visualDataBuffers("SDRPostThreadVisualDataBuffers"), frequency(0) {
|
||||||
iqDataInQueue = nullptr;
|
iqDataInQueue = nullptr;
|
||||||
iqDataOutQueue = nullptr;
|
iqDataOutQueue = nullptr;
|
||||||
@ -292,11 +289,13 @@ void SDRPostThread::runSingleCH(SDRThreadIQData *data_in) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < runDemods.size(); i++) {
|
for (size_t i = 0; i < runDemods.size(); i++) {
|
||||||
//VSO: timed-push
|
// try-push() : we do our best to only stimulate active demods, but some could happen to be dead, full, or indeed non-active.
|
||||||
if (!runDemods[i]->getIQInputDataPipe()->push(demodDataOut , MAX_BLOCKING_DURATION_MICROS, "runSingleCH() runDemods[i]->getIQInputDataPipe()")) {
|
//so in short never block here no matter what.
|
||||||
//some runDemods are no longer there, bail out from runSingleCH() entirely.
|
if (!runDemods[i]->getIQInputDataPipe()->try_push(demodDataOut)) {
|
||||||
resetAllDemodulators();
|
|
||||||
return;
|
std::cout << "SDRPostThread::runSingleCH() attempt to push into demod '" << runDemods[i]->getLabel()
|
||||||
|
<< "' (" << runDemods[i]->getFrequency() << " Hz) failed, demod is either too busy, not-active, or dead..." << std::endl << std::flush;
|
||||||
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -440,11 +439,12 @@ void SDRPostThread::runPFBCH(SDRThreadIQData *data_in) {
|
|||||||
for (size_t j = 0; j < runDemods.size(); j++) {
|
for (size_t j = 0; j < runDemods.size(); j++) {
|
||||||
if (demodChannel[j] == i) {
|
if (demodChannel[j] == i) {
|
||||||
|
|
||||||
//VSO: timed- push
|
// try-push() : we do our best to only stimulate active demods, but some could happen to be dead, full, or indeed non-active.
|
||||||
if (!runDemods[j]->getIQInputDataPipe()->push(demodDataOut , MAX_BLOCKING_DURATION_MICROS, "runPFBCH() runDemods[j]->getIQInputDataPipe()")) {
|
//so in short never block here no matter what.
|
||||||
//Some runDemods are no longer there, bail out from runPFBCH() entirely.
|
if (!runDemods[j]->getIQInputDataPipe()->try_push(demodDataOut)) {
|
||||||
resetAllDemodulators();
|
std::cout << "SDRPostThread::runPFBCH() attempt to push into demod '" << runDemods[i]->getLabel()
|
||||||
return;
|
<< "' (" << runDemods[i]->getFrequency() << " Hz) failed, demod is either too busy, not-active, or dead..." << std::endl << std::flush;
|
||||||
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} //end for
|
} //end for
|
||||||
|
@ -65,7 +65,7 @@ bool TuningCanvas::changed() {
|
|||||||
auto activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
auto activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||||
|
|
||||||
long long current_freq = 0;
|
long long current_freq = 0;
|
||||||
if (activeDemod != NULL) {
|
if (activeDemod != nullptr) {
|
||||||
freq = activeDemod->getFrequency();
|
freq = activeDemod->getFrequency();
|
||||||
}
|
}
|
||||||
long long current_bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
long long current_bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
||||||
@ -96,7 +96,7 @@ void TuningCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) {
|
|||||||
auto activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
auto activeDemod = wxGetApp().getDemodMgr().getLastActiveDemodulator();
|
||||||
|
|
||||||
freq = 0;
|
freq = 0;
|
||||||
if (activeDemod != NULL) {
|
if (activeDemod != nullptr) {
|
||||||
freq = activeDemod->getFrequency();
|
freq = activeDemod->getFrequency();
|
||||||
}
|
}
|
||||||
bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
bw = wxGetApp().getDemodMgr().getLastBandwidth();
|
||||||
|
Loading…
Reference in New Issue
Block a user