Worker results..

This commit is contained in:
Charles J. Cliffe 2014-12-01 01:14:32 -05:00
parent 5fc5e4269c
commit 38b1393c44

View File

@ -113,21 +113,51 @@ void DemodulatorThread::threadMain() {
} }
if (bandwidthChanged) { if (bandwidthChanged) {
// DemodulatorWorkerThreadCommand command(DemodulatorWorkerThreadCommand::DEMOD_WORKER_THREAD_CMD_BUILD_FILTERS); std::cout << "Requesting new filters from worker.." << std::endl;
// command.audioSampleRate = bandwidthParams.audioSampleRate; DemodulatorWorkerThreadCommand command(DemodulatorWorkerThreadCommand::DEMOD_WORKER_THREAD_CMD_BUILD_FILTERS);
// command.bandwidth = bandwidthParams.bandwidth; command.audioSampleRate = bandwidthParams.audioSampleRate;
// command.frequency = bandwidthParams.frequency; command.bandwidth = bandwidthParams.bandwidth;
// command.inputRate = bandwidthParams.inputRate; command.frequency = bandwidthParams.frequency;
command.inputRate = bandwidthParams.inputRate;
// //
// workerQueue->push(command); workerQueue->push(command);
initialize(); // params = bandwidthParams;
while (!inputQueue->empty()) { // catch up // initialize();
inputQueue->pop(inp); // while (!inputQueue->empty()) { // catch up
} // inputQueue->pop(inp);
// }
} }
} }
if (!workerResults->empty()) {
while (!workerResults->empty()) {
DemodulatorWorkerThreadResult result;
workerResults->pop(result);
switch (result.cmd) {
case DemodulatorWorkerThreadResult::DEMOD_WORKER_THREAD_RESULT_FILTERS:
std::cout << "New filters arrived from worker.." << std::endl;
firfilt_crcf_destroy(fir_filter);
msresamp_crcf_destroy(resampler);
msresamp_crcf_destroy(audio_resampler);
fir_filter = result.fir_filter;
resampler = result.resampler;
audio_resampler = result.audio_resampler;
resample_ratio = result.resample_ratio;
audio_resample_ratio = result.audio_resample_ratio;
params.audioSampleRate = result.audioSampleRate;
params.bandwidth = result.bandwidth;
params.inputRate = result.inputRate;
break;
}
}
}
if (!initialized) { if (!initialized) {
continue; continue;
} }