Run without any processing; each demod gets the full SDR bandwidth to handle on it's own
| 246 | |
| 247 | // Run without any processing; each demod gets the full SDR bandwidth to handle on it's own |
| 248 | void SDRPostThread::runSingleCH(SDRThreadIQData *data_in) { |
| 249 | bool refreshed = false; |
| 250 | |
| 251 | if (sampleRate != data_in->sampleRate || doRefresh.load()) { |
| 252 | sampleRate = data_in->sampleRate; |
| 253 | numChannels = 1; |
| 254 | refreshed = true; |
| 255 | } |
| 256 | |
| 257 | if (refreshed || frequency != data_in->frequency) { |
| 258 | frequency = data_in->frequency; |
| 259 | updateActiveDemodulators(); |
| 260 | } |
| 261 | |
| 262 | size_t outSize = data_in->data.size(); |
| 263 | |
| 264 | if (outSize > dataOut.capacity()) { |
| 265 | dataOut.reserve(outSize); |
| 266 | } |
| 267 | if (outSize != dataOut.size()) { |
| 268 | dataOut.resize(outSize); |
| 269 | } |
| 270 | |
| 271 | DemodulatorThreadIQDataPtr demodDataOut = buffers.getBuffer(); |
| 272 | |
| 273 | demodDataOut->frequency = frequency; |
| 274 | demodDataOut->sampleRate = sampleRate; |
| 275 | |
| 276 | if (demodDataOut->data.size() != outSize) { |
| 277 | if (demodDataOut->data.capacity() < outSize) { |
| 278 | demodDataOut->data.reserve(outSize); |
| 279 | } |
| 280 | demodDataOut->data.resize(outSize); |
| 281 | } |
| 282 | |
| 283 | //Only 1 channel, apply DC blocker. |
| 284 | iirfilt_crcf_execute_block(dcFilter, &data_in->data[0], data_in->data.size(), &demodDataOut->data[0]); |
| 285 | |
| 286 | //push the DC-corrected data as Main Spactrum + Waterfall data. |
| 287 | pushVisualData(demodDataOut); |
| 288 | |
| 289 | if (!runDemods.empty() && iqActiveDemodVisualQueue != nullptr) { |
| 290 | //non-blocking push here, we can afford to loose some samples for a ever-changing visual display. |
| 291 | iqActiveDemodVisualQueue->try_push(demodDataOut); |
| 292 | } |
| 293 | |
| 294 | for (auto & runDemod : runDemods) { |
| 295 | // try-push() : we do our best to only stimulate active demods, but some could happen to be dead, full, or indeed non-active. |
| 296 | //so in short never block here no matter what. |
| 297 | runDemod->getIQInputDataPipe()->try_push(demodDataOut); |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | |
| 302 | // Handle active channels, channel 0 offset correction, de-interlacing and push data to demodulators |