コード例 #1
0
ファイル: receiver.cpp プロジェクト: pr0gg3d/gqrx
/*! \brief Start data sniffer.
 *  \param buffsize The buffer that should be used in the sniffer.
 *  \return STATUS_OK if the sniffer was started, STATUS_ERROR if the sniffer is already in use.
 */
receiver::status receiver::start_sniffer(unsigned int samprate, int buffsize)
{
    if (d_sniffer_active) {
        /* sniffer already in use */
        return STATUS_ERROR;
    }

    sniffer->set_buffer_size(buffsize);
    sniffer_rr = make_resampler_ff((float)samprate/(float)d_audio_rate);
    tb->lock();
    tb->connect(rx, 0, sniffer_rr, 0);
    tb->connect(sniffer_rr, 0, sniffer, 0);
    tb->unlock();
    d_sniffer_active = true;

    return STATUS_OK;
}
コード例 #2
0
ファイル: stereo_demod.cpp プロジェクト: Analias/gqrx
/*! \brief Create stereo demodulator object.
 *
 * Use make_stereo_demod() instead.
 */
stereo_demod::stereo_demod(float input_rate, float audio_rate, bool stereo, bool oirt)
    : gr::hier_block2("stereo_demod",
                     gr::io_signature::make (MIN_IN,  MAX_IN,  sizeof (float)),
                     gr::io_signature::make (MIN_OUT, MAX_OUT, sizeof (float))),
    d_input_rate(input_rate),
    d_audio_rate(audio_rate),
    d_stereo(stereo),
    d_oirt(oirt)
{
  double cutof_freq = d_oirt ? 15e3 : 17e3;
  lpf0 = make_lpf_ff(d_input_rate, cutof_freq, 2e3); // FIXME
  audio_rr0 = make_resampler_ff(d_audio_rate/d_input_rate);

  if (d_stereo)
  {
    lpf1 = make_lpf_ff(d_input_rate, cutof_freq, 2e3); // FIXME
    audio_rr1 = make_resampler_ff(d_audio_rate/d_input_rate);

    if (!d_oirt)
    {
        d_tone_taps = gr::filter::firdes::complex_band_pass(
                                       1.0,          // gain,
		                                   d_input_rate, // sampling_freq
                                       18800.,       // low_cutoff_freq
                                       19200.,       // high_cutoff_freq
                                       300.);        // transition_width
        pll = gr::analog::pll_refout_cc::make(0.001,    // loop_bw FIXME
                                2*M_PI * 19200 / input_rate,  // max_freq
                                2*M_PI * 18800 / input_rate); // min_freq
        subtone = gr::blocks::multiply_cc::make();
    } else {
        d_tone_taps = gr::filter::firdes::complex_band_pass(
                                       1.0,          // gain,
                                           d_input_rate, // sampling_freq
                                       31200.,       // low_cutoff_freq
                                       31300.,       // high_cutoff_freq
                                       100.);        // transition_width
        pll = gr::analog::pll_refout_cc::make(0.001,    // loop_bw FIXME
                                2*M_PI * 31200 / input_rate,  // max_freq
                                2*M_PI * 31300 / input_rate); // min_freq
    }

    tone = gr::filter::fir_filter_fcc::make(1, d_tone_taps);

    lo = gr::blocks::complex_to_imag::make();

#ifdef STEREO_DEMOD_PARANOIC
    d_pll_taps = gr::filter::firdes::band_pass(
                                       1.0,          // gain,
		                                   d_input_rate, // sampling_freq
                                       37600.,       // low_cutoff_freq
                                       38400.,       // high_cutoff_freq
                                       400.);        // transition_width
    lo2 = gr::filter::fir_filter_fff::make(1, d_pll_taps);
#endif

    mixer = gr::blocks::multiply_ff::make();

    cdp = gr::blocks::multiply_const_ff::make( 5.5); // FIXME
    cdm = gr::blocks::multiply_const_ff::make(-5.5); // FIXME

    add0 = gr::blocks::add_ff::make();
    add1 = gr::blocks::add_ff::make();

    /* connect block */
    if (!d_oirt) {
        connect(self(), 0, tone, 0);
        connect(tone, 0, pll, 0);
        connect(pll, 0, subtone, 0);
        connect(pll, 0, subtone, 1);
        connect(subtone, 0, lo, 0);
    
#ifdef STEREO_DEMOD_PARANOIC
        connect(lo,  0, lo2, 0);
        connect(lo2, 0, mixer, 0);
#else
        connect(lo, 0, mixer, 0);
#endif
    } else {
        connect(self(), 0, tone, 0);
        connect(tone, 0, pll, 0);
        connect(pll, 0, lo, 0);
        connect(lo, 0, mixer, 0);
    } 

    connect(self(), 0, mixer, 1);

    connect(self(), 0, lpf0, 0);
    connect(mixer,  0, lpf1, 0);

    connect(lpf0, 0, audio_rr0, 0); // sum
    connect(lpf1, 0, audio_rr1, 0);

    connect(audio_rr1, 0, cdp,  0); // +delta
    connect(audio_rr1, 0, cdm,  0); // -delta

    connect(audio_rr0, 0, add0,   0);
    connect(cdp,       0, add0,   1);
    connect(add0,      0, self(), 0); // left = sum + delta

    connect(audio_rr0, 0, add1,   0);
    connect(cdm,       0, add1,   1);
    connect(add1,      0, self(), 1); // right = sum + delta
  }
  else // if (!d_stereo)
  {
    /* connect block */
    connect(self(), 0, lpf0, 0);
    connect(lpf0,   0, audio_rr0, 0);
    connect(audio_rr0, 0, self(), 0);
    connect(audio_rr0, 0, self(), 1);
  }
}