| 389 | } |
| 390 | |
| 391 | void GRTimePlotAddon::connectSignalPaths() |
| 392 | { |
| 393 | QList<GRSignalPath *> sigpaths; |
| 394 | |
| 395 | // for through grdevices - get sampleRate; |
| 396 | std::unique_lock lock(refillMutex); |
| 397 | for(auto &sigpath : m_top->signalPaths()) { |
| 398 | qDebug(CAT_GRTIMEPLOTADDON) << "Trying " << sigpath->name(); |
| 399 | if(!sigpath->enabled()) |
| 400 | continue; |
| 401 | if(!sigpath->name().startsWith(name)) |
| 402 | continue; |
| 403 | sigpaths.append(sigpath); |
| 404 | qDebug(CAT_GRTIMEPLOTADDON) << "Appended " << sigpath->name(); |
| 405 | } |
| 406 | |
| 407 | time_sink = time_sink_f::make(m_currentSamplingInfo.plotSize, m_currentSamplingInfo.sampleRate, |
| 408 | name.toStdString(), sigpaths.count()); |
| 409 | time_sink->setRollingMode(m_rollingMode); |
| 410 | time_sink->setSingleShot(m_singleShot); |
| 411 | time_sink->setComputeTags(m_showPlotTags); |
| 412 | |
| 413 | time_sink->setFftComplex(fftComplexMode); |
| 414 | time_sink->setFreqOffset(m_currentSamplingInfo.freqOffset); |
| 415 | updateXAxis(); |
| 416 | |
| 417 | auto fft_size = 1048576; |
| 418 | f2c = gr::blocks::float_to_complex::make(); |
| 419 | auto window = gr::fft::window::build(m_fftwindow, fft_size); |
| 420 | |
| 421 | vector_sink = gr::blocks::vector_sink_f::make(fft_size); |
| 422 | s2v_complex = gr::blocks::stream_to_vector::make(sizeof(gr_complex), fft_size); |
| 423 | fft_complex = gr::fft::fft_v<gr_complex, true>::make(fft_size, window, fftComplexMode); |
| 424 | ctm = gr::blocks::complex_to_mag_squared::make(fft_size); |
| 425 | |
| 426 | mult_const1 = gr::blocks::multiply_const_ff::make(1.0 / (fft_size * fft_size), fft_size); |
| 427 | |
| 428 | nlog10 = gr::blocks::nlog10_ff::make(10.0, fft_size); |
| 429 | |
| 430 | m_top->connect(f2c, 0, s2v_complex, 0); |
| 431 | m_top->connect(s2v_complex, 0, fft_complex, 0); |
| 432 | m_top->connect(fft_complex, 0, ctm, 0); |
| 433 | m_top->connect(ctm, 0, mult_const1, 0); |
| 434 | m_top->connect(mult_const1, 0, nlog10, 0); |
| 435 | m_top->connect(nlog10, 0, vector_sink, 0); |
| 436 | |
| 437 | int i = 0; |
| 438 | time_channel_map.clear(); |
| 439 | for(GRTimeChannelAddon *gr : qAsConst(grChannels)) { |
| 440 | if(gr->signalPath()->enabled()) { |
| 441 | m_top->connect(gr->signalPath()->getGrEndPoint(), 0, time_sink, i); |
| 442 | time_channel_map.insert(gr->signalPath()->name(), i); |
| 443 | |
| 444 | if(!fftComplexMode) { |
| 445 | if(gr == m_fft_source[0]) { |
| 446 | m_top->connect(gr->signalPath()->getGrEndPoint(), 0, f2c, 0); |
| 447 | m_top->connect(gr->signalPath()->getGrEndPoint(), 0, f2c, 1); |
| 448 | } |
nothing calls this directly
no test coverage detected