diff options
Diffstat (limited to 'gr-analog/include')
35 files changed, 1388 insertions, 1382 deletions
diff --git a/gr-analog/include/gnuradio/analog/agc.h b/gr-analog/include/gnuradio/analog/agc.h index 1e9759c454..a394bf8cc5 100644 --- a/gr-analog/include/gnuradio/analog/agc.h +++ b/gr-analog/include/gnuradio/analog/agc.h @@ -28,127 +28,129 @@ #include <cmath> namespace gr { - namespace analog { - namespace kernel { - - /*! - * \brief high performance Automatic Gain Control class for complex signals. - * \ingroup level_controllers_blk - * - * \details - * For Power the absolute value of the complex number is used. - */ - class ANALOG_API agc_cc - { - public: - /*! - * Construct a complex value AGC loop implementation object. - * - * \param rate the update rate of the loop. - * \param reference reference value to adjust signal power to. - * \param gain initial gain value. - * \param max_gain maximum gain value (0 for unlimited). - */ - agc_cc(float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _rate(rate), _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - virtual ~agc_cc() {}; - - float rate() const { return _rate; } - float reference() const { return _reference; } - float gain() const { return _gain; } - float max_gain() const { return _max_gain; } - - void set_rate(float rate) { _rate = rate; } - void set_reference(float reference) { _reference = reference; } - void set_gain(float gain) { _gain = gain; } - void set_max_gain(float max_gain) { _max_gain = max_gain; } - - gr_complex scale(gr_complex input) - { - gr_complex output = input * _gain; - - _gain += _rate * (_reference - std::sqrt(output.real()*output.real() + - output.imag()*output.imag())); - if(_max_gain > 0.0 && _gain > _max_gain) { - _gain = _max_gain; - } - return output; - } - - void scaleN(gr_complex output[], const gr_complex input[], unsigned n) - { - for(unsigned i = 0; i < n; i++) { - output[i] = scale (input[i]); - } - } - - protected: - float _rate; // adjustment rate - float _reference; // reference value - float _gain; // current gain - float _max_gain; // max allowable gain - }; - - /*! - * \brief high performance Automatic Gain Control class for float signals. - * - * Power is approximated by absolute value - */ - class ANALOG_API agc_ff - { - public: - /*! - * Construct a floating point value AGC loop implementation object. - * - * \param rate the update rate of the loop. - * \param reference reference value to adjust signal power to. - * \param gain initial gain value. - * \param max_gain maximum gain value (0 for unlimited). - */ - agc_ff(float rate = 1e-4, float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _rate(rate), _reference(reference), _gain(gain), - _max_gain(max_gain) {}; - - ~agc_ff() {}; - - float rate () const { return _rate; } - float reference () const { return _reference; } - float gain () const { return _gain; } - float max_gain () const { return _max_gain; } - - void set_rate (float rate) { _rate = rate; } - void set_reference (float reference) { _reference = reference; } - void set_gain (float gain) { _gain = gain; } - void set_max_gain (float max_gain) { _max_gain = max_gain; } - - float scale (float input) - { - float output = input * _gain; - _gain += (_reference - fabsf (output)) * _rate; - if(_max_gain > 0.0 && _gain > _max_gain) - _gain = _max_gain; - return output; - } - - void scaleN(float output[], const float input[], unsigned n) - { - for(unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _rate; // adjustment rate - float _reference; // reference value - float _gain; // current gain - float _max_gain; // maximum gain - }; - - } /* namespace kernel */ - } /* namespace analog */ +namespace analog { +namespace kernel { + +/*! + * \brief high performance Automatic Gain Control class for complex signals. + * \ingroup level_controllers_blk + * + * \details + * For Power the absolute value of the complex number is used. + */ +class ANALOG_API agc_cc +{ +public: + /*! + * Construct a complex value AGC loop implementation object. + * + * \param rate the update rate of the loop. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + agc_cc(float rate = 1e-4, + float reference = 1.0, + float gain = 1.0, + float max_gain = 0.0) + : _rate(rate), _reference(reference), _gain(gain), _max_gain(max_gain){}; + + virtual ~agc_cc(){}; + + float rate() const { return _rate; } + float reference() const { return _reference; } + float gain() const { return _gain; } + float max_gain() const { return _max_gain; } + + void set_rate(float rate) { _rate = rate; } + void set_reference(float reference) { _reference = reference; } + void set_gain(float gain) { _gain = gain; } + void set_max_gain(float max_gain) { _max_gain = max_gain; } + + gr_complex scale(gr_complex input) + { + gr_complex output = input * _gain; + + _gain += _rate * (_reference - std::sqrt(output.real() * output.real() + + output.imag() * output.imag())); + if (_max_gain > 0.0 && _gain > _max_gain) { + _gain = _max_gain; + } + return output; + } + + void scaleN(gr_complex output[], const gr_complex input[], unsigned n) + { + for (unsigned i = 0; i < n; i++) { + output[i] = scale(input[i]); + } + } + +protected: + float _rate; // adjustment rate + float _reference; // reference value + float _gain; // current gain + float _max_gain; // max allowable gain +}; + +/*! + * \brief high performance Automatic Gain Control class for float signals. + * + * Power is approximated by absolute value + */ +class ANALOG_API agc_ff +{ +public: + /*! + * Construct a floating point value AGC loop implementation object. + * + * \param rate the update rate of the loop. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + agc_ff(float rate = 1e-4, + float reference = 1.0, + float gain = 1.0, + float max_gain = 0.0) + : _rate(rate), _reference(reference), _gain(gain), _max_gain(max_gain){}; + + ~agc_ff(){}; + + float rate() const { return _rate; } + float reference() const { return _reference; } + float gain() const { return _gain; } + float max_gain() const { return _max_gain; } + + void set_rate(float rate) { _rate = rate; } + void set_reference(float reference) { _reference = reference; } + void set_gain(float gain) { _gain = gain; } + void set_max_gain(float max_gain) { _max_gain = max_gain; } + + float scale(float input) + { + float output = input * _gain; + _gain += (_reference - fabsf(output)) * _rate; + if (_max_gain > 0.0 && _gain > _max_gain) + _gain = _max_gain; + return output; + } + + void scaleN(float output[], const float input[], unsigned n) + { + for (unsigned i = 0; i < n; i++) + output[i] = scale(input[i]); + } + +protected: + float _rate; // adjustment rate + float _reference; // reference value + float _gain; // current gain + float _max_gain; // maximum gain +}; + +} /* namespace kernel */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_AGC_H */ diff --git a/gr-analog/include/gnuradio/analog/agc2.h b/gr-analog/include/gnuradio/analog/agc2.h index f7a43ba9f6..a72866d4a6 100644 --- a/gr-analog/include/gnuradio/analog/agc2.h +++ b/gr-analog/include/gnuradio/analog/agc2.h @@ -28,153 +28,161 @@ #include <math.h> namespace gr { - namespace analog { - namespace kernel { - - /*! - * \brief high performance Automatic Gain Control class - * \ingroup level_controllers_blk - * - * \details - * For Power the absolute value of the complex number is used. - */ - class ANALOG_API agc2_cc - { - public: - /*! - * Construct a comple value AGC loop implementation object. - * - * \param attack_rate the update rate of the loop when in attack mode. - * \param decay_rate the update rate of the loop when in decay mode. - * \param reference reference value to adjust signal power to. - * \param gain initial gain value. - * \param max_gain maximum gain value (0 for unlimited). - */ - agc2_cc(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _attack_rate(attack_rate), _decay_rate(decay_rate), - _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - float decay_rate() const { return _decay_rate; } - float attack_rate() const { return _attack_rate; } - float reference() const { return _reference; } - float gain() const { return _gain; } - float max_gain() const { return _max_gain; } - - void set_decay_rate(float rate) { _decay_rate = rate; } - void set_attack_rate(float rate) { _attack_rate = rate; } - void set_reference(float reference) { _reference = reference; } - void set_gain(float gain) { _gain = gain; } - void set_max_gain(float max_gain) { _max_gain = max_gain; } - - gr_complex scale(gr_complex input) - { - gr_complex output = input * _gain; - - float tmp = -_reference + sqrt(output.real()*output.real() + - output.imag()*output.imag()); - float rate = _decay_rate; - if((tmp) > _gain) { - rate = _attack_rate; - } - _gain -= tmp*rate; - - // Not sure about this; will blow up if _gain < 0 (happens - // when rates are too high), but is this the solution? - if(_gain < 0.0) - _gain = 10e-5; - - if(_max_gain > 0.0 && _gain > _max_gain) { - _gain = _max_gain; - } - return output; - } - - void scaleN(gr_complex output[], const gr_complex input[], unsigned n) - { - for(unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _attack_rate; // attack rate for fast changing signals - float _decay_rate; // decay rate for slow changing signals - float _reference; // reference value - float _gain; // current gain - float _max_gain; // max allowable gain - }; - - - class ANALOG_API agc2_ff - { - public: - /*! - * Construct a floating point value AGC loop implementation object. - * - * \param attack_rate the update rate of the loop when in attack mode. - * \param decay_rate the update rate of the loop when in decay mode. - * \param reference reference value to adjust signal power to. - * \param gain initial gain value. - * \param max_gain maximum gain value (0 for unlimited). - */ - agc2_ff(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, - float gain = 1.0, float max_gain = 0.0) - : _attack_rate(attack_rate), _decay_rate(decay_rate), - _reference(reference), - _gain(gain), _max_gain(max_gain) {}; - - float attack_rate() const { return _attack_rate; } - float decay_rate() const { return _decay_rate; } - float reference() const { return _reference; } - float gain() const { return _gain; } - float max_gain() const { return _max_gain; } - - void set_attack_rate(float rate) { _attack_rate = rate; } - void set_decay_rate(float rate) { _decay_rate = rate; } - void set_reference(float reference) { _reference = reference; } - void set_gain(float gain) { _gain = gain; } - void set_max_gain(float max_gain) { _max_gain = max_gain; } - - float scale(float input) - { - float output = input * _gain; - - float tmp = (fabsf(output)) - _reference; - float rate = _decay_rate; - if(fabsf(tmp) > _gain) { - rate = _attack_rate; - } - _gain -= tmp*rate; - - // Not sure about this - if(_gain < 0.0) - _gain = 10e-5; - - if(_max_gain > 0.0 && _gain > _max_gain) { - _gain = _max_gain; - } - return output; - } - - void scaleN(float output[], const float input[], unsigned n) - { - for(unsigned i = 0; i < n; i++) - output[i] = scale (input[i]); - } - - protected: - float _attack_rate; // attack_rate for fast changing signals - float _decay_rate; // decay rate for slow changing signals - float _reference; // reference value - float _gain; // current gain - float _max_gain; // maximum gain - }; - - } /* namespace kernel */ - } /* namespace analog */ +namespace analog { +namespace kernel { + +/*! + * \brief high performance Automatic Gain Control class + * \ingroup level_controllers_blk + * + * \details + * For Power the absolute value of the complex number is used. + */ +class ANALOG_API agc2_cc +{ +public: + /*! + * Construct a comple value AGC loop implementation object. + * + * \param attack_rate the update rate of the loop when in attack mode. + * \param decay_rate the update rate of the loop when in decay mode. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + agc2_cc(float attack_rate = 1e-1, + float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, + float max_gain = 0.0) + : _attack_rate(attack_rate), + _decay_rate(decay_rate), + _reference(reference), + _gain(gain), + _max_gain(max_gain){}; + + float decay_rate() const { return _decay_rate; } + float attack_rate() const { return _attack_rate; } + float reference() const { return _reference; } + float gain() const { return _gain; } + float max_gain() const { return _max_gain; } + + void set_decay_rate(float rate) { _decay_rate = rate; } + void set_attack_rate(float rate) { _attack_rate = rate; } + void set_reference(float reference) { _reference = reference; } + void set_gain(float gain) { _gain = gain; } + void set_max_gain(float max_gain) { _max_gain = max_gain; } + + gr_complex scale(gr_complex input) + { + gr_complex output = input * _gain; + + float tmp = -_reference + + sqrt(output.real() * output.real() + output.imag() * output.imag()); + float rate = _decay_rate; + if ((tmp) > _gain) { + rate = _attack_rate; + } + _gain -= tmp * rate; + + // Not sure about this; will blow up if _gain < 0 (happens + // when rates are too high), but is this the solution? + if (_gain < 0.0) + _gain = 10e-5; + + if (_max_gain > 0.0 && _gain > _max_gain) { + _gain = _max_gain; + } + return output; + } + + void scaleN(gr_complex output[], const gr_complex input[], unsigned n) + { + for (unsigned i = 0; i < n; i++) + output[i] = scale(input[i]); + } + +protected: + float _attack_rate; // attack rate for fast changing signals + float _decay_rate; // decay rate for slow changing signals + float _reference; // reference value + float _gain; // current gain + float _max_gain; // max allowable gain +}; + + +class ANALOG_API agc2_ff +{ +public: + /*! + * Construct a floating point value AGC loop implementation object. + * + * \param attack_rate the update rate of the loop when in attack mode. + * \param decay_rate the update rate of the loop when in decay mode. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param max_gain maximum gain value (0 for unlimited). + */ + agc2_ff(float attack_rate = 1e-1, + float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, + float max_gain = 0.0) + : _attack_rate(attack_rate), + _decay_rate(decay_rate), + _reference(reference), + _gain(gain), + _max_gain(max_gain){}; + + float attack_rate() const { return _attack_rate; } + float decay_rate() const { return _decay_rate; } + float reference() const { return _reference; } + float gain() const { return _gain; } + float max_gain() const { return _max_gain; } + + void set_attack_rate(float rate) { _attack_rate = rate; } + void set_decay_rate(float rate) { _decay_rate = rate; } + void set_reference(float reference) { _reference = reference; } + void set_gain(float gain) { _gain = gain; } + void set_max_gain(float max_gain) { _max_gain = max_gain; } + + float scale(float input) + { + float output = input * _gain; + + float tmp = (fabsf(output)) - _reference; + float rate = _decay_rate; + if (fabsf(tmp) > _gain) { + rate = _attack_rate; + } + _gain -= tmp * rate; + + // Not sure about this + if (_gain < 0.0) + _gain = 10e-5; + + if (_max_gain > 0.0 && _gain > _max_gain) { + _gain = _max_gain; + } + return output; + } + + void scaleN(float output[], const float input[], unsigned n) + { + for (unsigned i = 0; i < n; i++) + output[i] = scale(input[i]); + } + +protected: + float _attack_rate; // attack_rate for fast changing signals + float _decay_rate; // decay rate for slow changing signals + float _reference; // reference value + float _gain; // current gain + float _max_gain; // maximum gain +}; + +} /* namespace kernel */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_AGC2_H */ diff --git a/gr-analog/include/gnuradio/analog/agc2_cc.h b/gr-analog/include/gnuradio/analog/agc2_cc.h index d280fc0836..d494f13a0b 100644 --- a/gr-analog/include/gnuradio/analog/agc2_cc.h +++ b/gr-analog/include/gnuradio/analog/agc2_cc.h @@ -28,47 +28,49 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief high performance Automatic Gain Control class with + * attack and decay rates. + * \ingroup level_controllers_blk + * + * \details + * For Power the absolute value of the complex number is used. + */ +class ANALOG_API agc2_cc : virtual public sync_block +{ +public: + // gr::analog::agc2_cc::sptr + typedef boost::shared_ptr<agc2_cc> sptr; /*! - * \brief high performance Automatic Gain Control class with - * attack and decay rates. - * \ingroup level_controllers_blk + * Build a complex value AGC loop block with attack and decay rates. * - * \details - * For Power the absolute value of the complex number is used. + * \param attack_rate the update rate of the loop when in attack mode. + * \param decay_rate the update rate of the loop when in decay mode. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. */ - class ANALOG_API agc2_cc : virtual public sync_block - { - public: - // gr::analog::agc2_cc::sptr - typedef boost::shared_ptr<agc2_cc> sptr; - - /*! - * Build a complex value AGC loop block with attack and decay rates. - * - * \param attack_rate the update rate of the loop when in attack mode. - * \param decay_rate the update rate of the loop when in decay mode. - * \param reference reference value to adjust signal power to. - * \param gain initial gain value. - */ - static sptr make(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, float gain = 1.0); + static sptr make(float attack_rate = 1e-1, + float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0); - virtual float attack_rate() const = 0; - virtual float decay_rate() const = 0; - virtual float reference() const = 0; - virtual float gain() const = 0; - virtual float max_gain() const = 0; + virtual float attack_rate() const = 0; + virtual float decay_rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; - virtual void set_attack_rate(float rate) = 0; - virtual void set_decay_rate(float rate) = 0; - virtual void set_reference(float reference) = 0; - virtual void set_gain(float gain) = 0; - virtual void set_max_gain(float max_gain) = 0; - }; + virtual void set_attack_rate(float rate) = 0; + virtual void set_decay_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_AGC2_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/agc2_ff.h b/gr-analog/include/gnuradio/analog/agc2_ff.h index 2a11fe7b5c..96d6a119c9 100644 --- a/gr-analog/include/gnuradio/analog/agc2_ff.h +++ b/gr-analog/include/gnuradio/analog/agc2_ff.h @@ -28,47 +28,49 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief high performance Automatic Gain Control class with + * attack and decay rates. + * \ingroup level_controllers_blk + * + * \details + * Power is approximated by absolute value + */ +class ANALOG_API agc2_ff : virtual public sync_block +{ +public: + // gr::analog::agc2_ff::sptr + typedef boost::shared_ptr<agc2_ff> sptr; /*! - * \brief high performance Automatic Gain Control class with - * attack and decay rates. - * \ingroup level_controllers_blk + * Build a floating point AGC loop block with attack and decay rates. * - * \details - * Power is approximated by absolute value + * \param attack_rate the update rate of the loop when in attack mode. + * \param decay_rate the update rate of the loop when in decay mode. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. */ - class ANALOG_API agc2_ff : virtual public sync_block - { - public: - // gr::analog::agc2_ff::sptr - typedef boost::shared_ptr<agc2_ff> sptr; - - /*! - * Build a floating point AGC loop block with attack and decay rates. - * - * \param attack_rate the update rate of the loop when in attack mode. - * \param decay_rate the update rate of the loop when in decay mode. - * \param reference reference value to adjust signal power to. - * \param gain initial gain value. - */ - static sptr make(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, float gain = 1.0); + static sptr make(float attack_rate = 1e-1, + float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0); - virtual float attack_rate() const = 0; - virtual float decay_rate() const = 0; - virtual float reference() const = 0; - virtual float gain() const = 0; - virtual float max_gain() const = 0; + virtual float attack_rate() const = 0; + virtual float decay_rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; - virtual void set_attack_rate(float rate) = 0; - virtual void set_decay_rate(float rate) = 0; - virtual void set_reference(float reference) = 0; - virtual void set_gain(float gain) = 0; - virtual void set_max_gain(float max_gain) = 0; - }; + virtual void set_attack_rate(float rate) = 0; + virtual void set_decay_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_AGC2_FF_H */ diff --git a/gr-analog/include/gnuradio/analog/agc3_cc.h b/gr-analog/include/gnuradio/analog/agc3_cc.h index 197a22ca04..caba8f5137 100644 --- a/gr-analog/include/gnuradio/analog/agc3_cc.h +++ b/gr-analog/include/gnuradio/analog/agc3_cc.h @@ -27,53 +27,56 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief high performance Automatic Gain Control class with + * attack and decay rates. + * \ingroup level_controllers_blk + * + * \details + * Unlike the AGC2 loop, this uses an initial linear calculation + * at the beginning for very fast initial acquisition. Moves to + * IIR model for tracking purposes. + * + * For Power the absolute value of the complex number is used. + */ +class ANALOG_API agc3_cc : virtual public sync_block +{ +public: + // gr::analog::agc3_cc::sptr + typedef boost::shared_ptr<agc3_cc> sptr; /*! - * \brief high performance Automatic Gain Control class with - * attack and decay rates. - * \ingroup level_controllers_blk - * - * \details - * Unlike the AGC2 loop, this uses an initial linear calculation - * at the beginning for very fast initial acquisition. Moves to - * IIR model for tracking purposes. + * Build a complex value AGC loop block with attack and decay rates. * - * For Power the absolute value of the complex number is used. + * \param attack_rate the update rate of the loop when in attack mode. + * \param decay_rate the update rate of the loop when in decay mode. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. + * \param iir_update_decim stride by this number of samples before + * computing an IIR gain update */ - class ANALOG_API agc3_cc : virtual public sync_block - { - public: - // gr::analog::agc3_cc::sptr - typedef boost::shared_ptr<agc3_cc> sptr; - - /*! - * Build a complex value AGC loop block with attack and decay rates. - * - * \param attack_rate the update rate of the loop when in attack mode. - * \param decay_rate the update rate of the loop when in decay mode. - * \param reference reference value to adjust signal power to. - * \param gain initial gain value. - * \param iir_update_decim stride by this number of samples before - * computing an IIR gain update - */ - static sptr make(float attack_rate = 1e-1, float decay_rate = 1e-2, - float reference = 1.0, float gain = 1.0, int iir_update_decim=1); + static sptr make(float attack_rate = 1e-1, + float decay_rate = 1e-2, + float reference = 1.0, + float gain = 1.0, + int iir_update_decim = 1); - virtual float attack_rate() const = 0; - virtual float decay_rate() const = 0; - virtual float reference() const = 0; - virtual float gain() const = 0; - virtual float max_gain() const = 0; + virtual float attack_rate() const = 0; + virtual float decay_rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; - virtual void set_attack_rate(float rate) = 0; - virtual void set_decay_rate(float rate) = 0; - virtual void set_reference(float reference) = 0; - virtual void set_gain(float gain) = 0; - virtual void set_max_gain(float max_gain) = 0; - }; + virtual void set_attack_rate(float rate) = 0; + virtual void set_decay_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_AGC3_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/agc_cc.h b/gr-analog/include/gnuradio/analog/agc_cc.h index 3048e63fbf..34689c2802 100644 --- a/gr-analog/include/gnuradio/analog/agc_cc.h +++ b/gr-analog/include/gnuradio/analog/agc_cc.h @@ -28,43 +28,42 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief high performance Automatic Gain Control class + * \ingroup level_controllers_blk + * + * \details + * For Power the absolute value of the complex number is used. + */ +class ANALOG_API agc_cc : virtual public sync_block +{ +public: + // gr::analog::agc_cc::sptr + typedef boost::shared_ptr<agc_cc> sptr; /*! - * \brief high performance Automatic Gain Control class - * \ingroup level_controllers_blk + * Build a complex value AGC loop block. * - * \details - * For Power the absolute value of the complex number is used. + * \param rate the update rate of the loop. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. */ - class ANALOG_API agc_cc : virtual public sync_block - { - public: - // gr::analog::agc_cc::sptr - typedef boost::shared_ptr<agc_cc> sptr; - - /*! - * Build a complex value AGC loop block. - * - * \param rate the update rate of the loop. - * \param reference reference value to adjust signal power to. - * \param gain initial gain value. - */ - static sptr make(float rate = 1e-4, float reference = 1.0, - float gain = 1.0); + static sptr make(float rate = 1e-4, float reference = 1.0, float gain = 1.0); - virtual float rate() const = 0; - virtual float reference() const = 0; - virtual float gain() const = 0; - virtual float max_gain() const = 0; + virtual float rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; - virtual void set_rate(float rate) = 0; - virtual void set_reference(float reference) = 0; - virtual void set_gain(float gain) = 0; - virtual void set_max_gain(float max_gain) = 0; - }; + virtual void set_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_AGC_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/agc_ff.h b/gr-analog/include/gnuradio/analog/agc_ff.h index 5f3922d253..3fc92d5956 100644 --- a/gr-analog/include/gnuradio/analog/agc_ff.h +++ b/gr-analog/include/gnuradio/analog/agc_ff.h @@ -28,43 +28,42 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief high performance Automatic Gain Control class + * \ingroup level_controllers_blk + * + * \details + * Power is approximated by absolute value + */ +class ANALOG_API agc_ff : virtual public sync_block +{ +public: + // gr::analog::agc_ff::sptr + typedef boost::shared_ptr<agc_ff> sptr; /*! - * \brief high performance Automatic Gain Control class - * \ingroup level_controllers_blk + * Build a floating point AGC loop block. * - * \details - * Power is approximated by absolute value + * \param rate the update rate of the loop. + * \param reference reference value to adjust signal power to. + * \param gain initial gain value. */ - class ANALOG_API agc_ff : virtual public sync_block - { - public: - // gr::analog::agc_ff::sptr - typedef boost::shared_ptr<agc_ff> sptr; - - /*! - * Build a floating point AGC loop block. - * - * \param rate the update rate of the loop. - * \param reference reference value to adjust signal power to. - * \param gain initial gain value. - */ - static sptr make(float rate = 1e-4, float reference = 1.0, - float gain = 1.0); + static sptr make(float rate = 1e-4, float reference = 1.0, float gain = 1.0); - virtual float rate() const = 0; - virtual float reference() const = 0; - virtual float gain() const = 0; - virtual float max_gain() const = 0; + virtual float rate() const = 0; + virtual float reference() const = 0; + virtual float gain() const = 0; + virtual float max_gain() const = 0; - virtual void set_rate(float rate) = 0; - virtual void set_reference(float reference) = 0; - virtual void set_gain(float gain) = 0; - virtual void set_max_gain(float max_gain) = 0; - }; + virtual void set_rate(float rate) = 0; + virtual void set_reference(float reference) = 0; + virtual void set_gain(float gain) = 0; + virtual void set_max_gain(float max_gain) = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_AGC_FF_H */ diff --git a/gr-analog/include/gnuradio/analog/api.h b/gr-analog/include/gnuradio/analog/api.h index 01107345e6..fe421d0ee3 100644 --- a/gr-analog/include/gnuradio/analog/api.h +++ b/gr-analog/include/gnuradio/analog/api.h @@ -25,9 +25,9 @@ #include <gnuradio/attributes.h> #ifdef gnuradio_analog_EXPORTS -# define ANALOG_API __GR_ATTR_EXPORT +#define ANALOG_API __GR_ATTR_EXPORT #else -# define ANALOG_API __GR_ATTR_IMPORT +#define ANALOG_API __GR_ATTR_IMPORT #endif #endif /* INCLUDED_ANALOG_API_H */ diff --git a/gr-analog/include/gnuradio/analog/cpfsk_bc.h b/gr-analog/include/gnuradio/analog/cpfsk_bc.h index fe28c4536a..0ae3bad461 100644 --- a/gr-analog/include/gnuradio/analog/cpfsk_bc.h +++ b/gr-analog/include/gnuradio/analog/cpfsk_bc.h @@ -25,36 +25,36 @@ #include <gnuradio/sync_interpolator.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief Perform continuous phase 2-level frequency shift keying modulation + * on an input stream of unpacked bits. + * \ingroup modulators_blk + * \ingroup deprecated_blk + */ +class ANALOG_API cpfsk_bc : virtual public sync_interpolator +{ +public: + // gr::analog::cpfsk_bc::sptr + typedef boost::shared_ptr<cpfsk_bc> sptr; /*! - * \brief Perform continuous phase 2-level frequency shift keying modulation - * on an input stream of unpacked bits. - * \ingroup modulators_blk - * \ingroup deprecated_blk + * \brief Make a CPFSK block. + * + * \param k modulation index + * \param ampl output amplitude + * \param samples_per_sym number of output samples per input bit */ - class ANALOG_API cpfsk_bc : virtual public sync_interpolator - { - public: - // gr::analog::cpfsk_bc::sptr - typedef boost::shared_ptr<cpfsk_bc> sptr; - - /*! - * \brief Make a CPFSK block. - * - * \param k modulation index - * \param ampl output amplitude - * \param samples_per_sym number of output samples per input bit - */ - static sptr make(float k, float ampl, int samples_per_sym); - - virtual void set_amplitude(float amplitude) = 0; - virtual float amplitude() = 0; - virtual float freq() = 0; - virtual float phase() = 0; - }; - - } /* namespace analog */ + static sptr make(float k, float ampl, int samples_per_sym); + + virtual void set_amplitude(float amplitude) = 0; + virtual float amplitude() = 0; + virtual float freq() = 0; + virtual float phase() = 0; +}; + +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_CPFSK_BC_H */ diff --git a/gr-analog/include/gnuradio/analog/cpm.h b/gr-analog/include/gnuradio/analog/cpm.h index e3c8341478..0615ec04f8 100644 --- a/gr-analog/include/gnuradio/analog/cpm.h +++ b/gr-analog/include/gnuradio/analog/cpm.h @@ -26,71 +26,64 @@ #include <vector> namespace gr { - namespace analog { +namespace analog { + +/*! \brief Return the taps for an interpolating FIR filter + * (gr::filter::interp_fir_filter_fff). + */ +class ANALOG_API cpm +{ +public: + enum cpm_type { LRC, LSRC, LREC, TFM, GAUSSIAN, GENERIC = 999 }; /*! \brief Return the taps for an interpolating FIR filter * (gr::filter::interp_fir_filter_fff). + * + * \details + * These taps represent the phase response \f$g(k)\f$ for use in a CPM modulator, + * see also gr_cpmmod_bc. + * + * \param type The CPM type (Rectangular, Raised Cosine, + * Spectral Raised Cosine, Tamed FM or Gaussian). + * \param samples_per_sym Samples per symbol. + * \param L The length of the phase response in symbols. + * \param beta For Spectral Raised Cosine, this is the rolloff + * factor. For Gaussian phase responses, this the + * 3dB-time-bandwidth product. For all other cases, + * it is ignored. + * + * Output: returns a vector of length \a K = \p samples_per_sym + * x \p L. This can be used directly in an + * interpolating FIR filter such as + * gr_interp_fir_filter_fff with interpolation factor \p + * samples_per_sym. + * + * All phase responses are normalised s.t. \f$ \sum_{k=0}^{K-1} + * g(k) = 1\f$; this will cause a maximum phase change of \f$ h + * \cdot \pi\f$ between two symbols, where \a h is the + * modulation index. + * + * The following phase responses can be generated: + * - LREC: Rectangular phase response. + * - LRC: Raised cosine phase response, looks like 1 - cos(x). + * - LSRC: Spectral raised cosine. This requires a rolloff factor beta. + * The phase response is the Fourier transform of raised cosine + * function. + * - TFM: Tamed frequency modulation. This scheme minimizes phase change for + * rapidly varying input symbols. + * - GAUSSIAN: A Gaussian phase response. For a modulation index h = 1/2, this + * results in GMSK. + * + * A short description of all these phase responses can be found in [1]. + * + * [1]: Anderson, Aulin and Sundberg; Digital Phase Modulation */ - class ANALOG_API cpm - { - public: - enum cpm_type { - LRC, - LSRC, - LREC, - TFM, - GAUSSIAN, - GENERIC = 999 - }; - - /*! \brief Return the taps for an interpolating FIR filter - * (gr::filter::interp_fir_filter_fff). - * - * \details - * These taps represent the phase response \f$g(k)\f$ for use in a CPM modulator, - * see also gr_cpmmod_bc. - * - * \param type The CPM type (Rectangular, Raised Cosine, - * Spectral Raised Cosine, Tamed FM or Gaussian). - * \param samples_per_sym Samples per symbol. - * \param L The length of the phase response in symbols. - * \param beta For Spectral Raised Cosine, this is the rolloff - * factor. For Gaussian phase responses, this the - * 3dB-time-bandwidth product. For all other cases, - * it is ignored. - * - * Output: returns a vector of length \a K = \p samples_per_sym - * x \p L. This can be used directly in an - * interpolating FIR filter such as - * gr_interp_fir_filter_fff with interpolation factor \p - * samples_per_sym. - * - * All phase responses are normalised s.t. \f$ \sum_{k=0}^{K-1} - * g(k) = 1\f$; this will cause a maximum phase change of \f$ h - * \cdot \pi\f$ between two symbols, where \a h is the - * modulation index. - * - * The following phase responses can be generated: - * - LREC: Rectangular phase response. - * - LRC: Raised cosine phase response, looks like 1 - cos(x). - * - LSRC: Spectral raised cosine. This requires a rolloff factor beta. - * The phase response is the Fourier transform of raised cosine - * function. - * - TFM: Tamed frequency modulation. This scheme minimizes phase change for - * rapidly varying input symbols. - * - GAUSSIAN: A Gaussian phase response. For a modulation index h = 1/2, this - * results in GMSK. - * - * A short description of all these phase responses can be found in [1]. - * - * [1]: Anderson, Aulin and Sundberg; Digital Phase Modulation - */ - static std::vector<float> - phase_response(cpm_type type, unsigned samples_per_sym, - unsigned L, double beta=0.3); - }; - } // namespace analog + static std::vector<float> phase_response(cpm_type type, + unsigned samples_per_sym, + unsigned L, + double beta = 0.3); +}; +} // namespace analog } // namespace gr #endif /* INCLUDED_ANALOG_CPM_H */ - diff --git a/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h b/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h index 2655c845bb..07663ea7ec 100644 --- a/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h +++ b/gr-analog/include/gnuradio/analog/ctcss_squelch_ff.h @@ -28,52 +28,50 @@ #include <gnuradio/block.h> namespace gr { - namespace analog { +namespace analog { - /*! - * \brief gate or zero output if CTCSS tone not present - * \ingroup level_controllers_blk - */ - class ANALOG_API ctcss_squelch_ff : - public squelch_base_ff, virtual public block - { - protected: - virtual void update_state(const float &in) = 0; - virtual bool mute() const = 0; +/*! + * \brief gate or zero output if CTCSS tone not present + * \ingroup level_controllers_blk + */ +class ANALOG_API ctcss_squelch_ff : public squelch_base_ff, virtual public block +{ +protected: + virtual void update_state(const float& in) = 0; + virtual bool mute() const = 0; - public: - // gr::analog::ctcss_squelch_ff::sptr - typedef boost::shared_ptr<ctcss_squelch_ff> sptr; +public: + // gr::analog::ctcss_squelch_ff::sptr + typedef boost::shared_ptr<ctcss_squelch_ff> sptr; - /*! - * \brief Make CTCSS tone squelch block. - * - * \param rate gain of the internal frequency filters. - * \param freq frequency value to use as the squelch tone. - * \param level threshold level for the squelch tone. - * \param len length of the frequency filters. - * \param ramp sets response characteristic. - * \param gate if true, no output if no squelch tone. - * if false, output 0's if no squelch tone. - */ - static sptr make(int rate, float freq, float level, - int len, int ramp, bool gate); + /*! + * \brief Make CTCSS tone squelch block. + * + * \param rate gain of the internal frequency filters. + * \param freq frequency value to use as the squelch tone. + * \param level threshold level for the squelch tone. + * \param len length of the frequency filters. + * \param ramp sets response characteristic. + * \param gate if true, no output if no squelch tone. + * if false, output 0's if no squelch tone. + */ + static sptr make(int rate, float freq, float level, int len, int ramp, bool gate); - virtual std::vector<float> squelch_range() const = 0; - virtual float level() const = 0; - virtual void set_level(float level) = 0; - virtual int len() const = 0; - virtual float frequency() const = 0; - virtual void set_frequency(float frequency) = 0; + virtual std::vector<float> squelch_range() const = 0; + virtual float level() const = 0; + virtual void set_level(float level) = 0; + virtual int len() const = 0; + virtual float frequency() const = 0; + virtual void set_frequency(float frequency) = 0; - virtual int ramp() const = 0; - virtual void set_ramp(int ramp) = 0; - virtual bool gate() const = 0; - virtual void set_gate(bool gate) = 0; - virtual bool unmuted() const = 0; - }; + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_CTCSS_SQUELCH_FF_H */ diff --git a/gr-analog/include/gnuradio/analog/dpll_bb.h b/gr-analog/include/gnuradio/analog/dpll_bb.h index a23816d97f..8e89184bfb 100644 --- a/gr-analog/include/gnuradio/analog/dpll_bb.h +++ b/gr-analog/include/gnuradio/analog/dpll_bb.h @@ -27,34 +27,34 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { - - /*! - * \brief Detect the peak of a signal - * \ingroup peak_detectors_blk - * - * \details - * If a peak is detected, this block outputs a 1, - * or it outputs 0's. - */ - class ANALOG_API dpll_bb : virtual public sync_block - { - public: - // gr::analog::dpll_bb::sptr - typedef boost::shared_ptr<dpll_bb> sptr; - - static sptr make(float period, float gain); - - virtual void set_gain(float gain) = 0; - virtual void set_decision_threshold(float thresh) = 0; - - virtual float gain() const = 0; - virtual float freq() const = 0; - virtual float phase() const = 0; - virtual float decision_threshold() const = 0; - }; - - } /* namespace analog */ +namespace analog { + +/*! + * \brief Detect the peak of a signal + * \ingroup peak_detectors_blk + * + * \details + * If a peak is detected, this block outputs a 1, + * or it outputs 0's. + */ +class ANALOG_API dpll_bb : virtual public sync_block +{ +public: + // gr::analog::dpll_bb::sptr + typedef boost::shared_ptr<dpll_bb> sptr; + + static sptr make(float period, float gain); + + virtual void set_gain(float gain) = 0; + virtual void set_decision_threshold(float thresh) = 0; + + virtual float gain() const = 0; + virtual float freq() const = 0; + virtual float phase() const = 0; + virtual float decision_threshold() const = 0; +}; + +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_DPLL_BB_H */ diff --git a/gr-analog/include/gnuradio/analog/fastnoise_source.h b/gr-analog/include/gnuradio/analog/fastnoise_source.h index 28cb21b4ca..35a4fb1351 100644 --- a/gr-analog/include/gnuradio/analog/fastnoise_source.h +++ b/gr-analog/include/gnuradio/analog/fastnoise_source.h @@ -31,63 +31,63 @@ #include <cstdint> namespace gr { - namespace analog { +namespace analog { - /*! - * \brief Random number source - * \ingroup source_blk - * - * \details - * Generate random values from different distributions. - * Currently, only Gaussian and uniform are enabled. - */ -template<class T> - class ANALOG_API fastnoise_source : virtual public sync_block - { - public: - // gr::analog::fastnoise_source::sptr - typedef boost::shared_ptr< fastnoise_source<T> > sptr; +/*! + * \brief Random number source + * \ingroup source_blk + * + * \details + * Generate random values from different distributions. + * Currently, only Gaussian and uniform are enabled. + */ +template <class T> +class ANALOG_API fastnoise_source : virtual public sync_block +{ +public: + // gr::analog::fastnoise_source::sptr + typedef boost::shared_ptr<fastnoise_source<T>> sptr; - /*! \brief Make a fast noise source - * \param type the random distribution to use (see - * gnuradio/analog/noise_type.h) - * \param ampl the standard deviation of a 1-d noise process. If - * this is the complex source, this parameter is split - * among the real and imaginary parts: - * <pre>(ampl/sqrt(2))x + j(ampl/sqrt(2))y</pre> - * \param seed seed for random generators. Note that for uniform - * and Gaussian distributions, this should be a negative - * number. - * \param samples Number of samples to pre-generate - */ - static sptr make(noise_type_t type, float ampl, - long seed = 0, long samples=1024*16); - virtual T sample() = 0; - virtual T sample_unbiased() = 0; - virtual const std::vector<T>& samples() const = 0; + /*! \brief Make a fast noise source + * \param type the random distribution to use (see + * gnuradio/analog/noise_type.h) + * \param ampl the standard deviation of a 1-d noise process. If + * this is the complex source, this parameter is split + * among the real and imaginary parts: + * <pre>(ampl/sqrt(2))x + j(ampl/sqrt(2))y</pre> + * \param seed seed for random generators. Note that for uniform + * and Gaussian distributions, this should be a negative + * number. + * \param samples Number of samples to pre-generate + */ + static sptr + make(noise_type_t type, float ampl, long seed = 0, long samples = 1024 * 16); + virtual T sample() = 0; + virtual T sample_unbiased() = 0; + virtual const std::vector<T>& samples() const = 0; - /*! - * Set the noise type. Nominally from the - * gr::analog::noise_type_t selections, but only GR_GAUSSIAN and - * GR_UNIFORM are currently available. - */ - virtual void set_type(noise_type_t type) = 0; + /*! + * Set the noise type. Nominally from the + * gr::analog::noise_type_t selections, but only GR_GAUSSIAN and + * GR_UNIFORM are currently available. + */ + virtual void set_type(noise_type_t type) = 0; - /*! - * Set the standard deviation (amplitude) of the 1-d noise - * process. - */ - virtual void set_amplitude(float ampl) = 0; + /*! + * Set the standard deviation (amplitude) of the 1-d noise + * process. + */ + virtual void set_amplitude(float ampl) = 0; - virtual noise_type_t type() const = 0; - virtual float amplitude() const = 0; - }; + virtual noise_type_t type() const = 0; + virtual float amplitude() const = 0; +}; - typedef fastnoise_source<float> fastnoise_source_f; - typedef fastnoise_source<std::int32_t> fastnoise_source_i; - typedef fastnoise_source<std::int16_t> fastnoise_source_s; - typedef fastnoise_source<gr_complex> fastnoise_source_c; - } /* namespace analog */ +typedef fastnoise_source<float> fastnoise_source_f; +typedef fastnoise_source<std::int32_t> fastnoise_source_i; +typedef fastnoise_source<std::int16_t> fastnoise_source_s; +typedef fastnoise_source<gr_complex> fastnoise_source_c; +} /* namespace analog */ } /* namespace gr */ diff --git a/gr-analog/include/gnuradio/analog/feedforward_agc_cc.h b/gr-analog/include/gnuradio/analog/feedforward_agc_cc.h index 647cdf675f..96b71109ca 100644 --- a/gr-analog/include/gnuradio/analog/feedforward_agc_cc.h +++ b/gr-analog/include/gnuradio/analog/feedforward_agc_cc.h @@ -27,29 +27,29 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief Non-causal AGC which computes required gain based on max + * absolute value over nsamples + * \ingroup level_controllers_blk + */ +class ANALOG_API feedforward_agc_cc : virtual public sync_block +{ +public: + // gr::analog::feedforward_agc_cc::sptr + typedef boost::shared_ptr<feedforward_agc_cc> sptr; /*! - * \brief Non-causal AGC which computes required gain based on max - * absolute value over nsamples - * \ingroup level_controllers_blk + * Build a complex valued feed-forward AGC loop block. + * + * \param nsamples number of samples to look ahead. + * \param reference reference value to adjust signal power to. */ - class ANALOG_API feedforward_agc_cc : virtual public sync_block - { - public: - // gr::analog::feedforward_agc_cc::sptr - typedef boost::shared_ptr<feedforward_agc_cc> sptr; - - /*! - * Build a complex valued feed-forward AGC loop block. - * - * \param nsamples number of samples to look ahead. - * \param reference reference value to adjust signal power to. - */ - static sptr make(int nsamples, float reference); - }; + static sptr make(int nsamples, float reference); +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_GR_FEEDFORWARD_AGC_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/fmdet_cf.h b/gr-analog/include/gnuradio/analog/fmdet_cf.h index 72437a875d..0e89d755fb 100644 --- a/gr-analog/include/gnuradio/analog/fmdet_cf.h +++ b/gr-analog/include/gnuradio/analog/fmdet_cf.h @@ -27,46 +27,45 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief Implements an IQ slope detector + * \ingroup modulators_blk + * + * \details + * input: stream of complex; output: stream of floats + * + * This implements a limiting slope detector. The limiter is in + * the normalization by the magnitude of the sample + */ +class ANALOG_API fmdet_cf : virtual public sync_block +{ +public: + // gr::analog::fmdet_cf::sptr + typedef boost::shared_ptr<fmdet_cf> sptr; /*! - * \brief Implements an IQ slope detector - * \ingroup modulators_blk - * - * \details - * input: stream of complex; output: stream of floats + * \brief Make FM detector block. * - * This implements a limiting slope detector. The limiter is in - * the normalization by the magnitude of the sample + * \param samplerate sample rate of signal (is not used; to be removed) + * \param freq_low lowest frequency of signal (Hz) + * \param freq_high highest frequency of signal (Hz) + * \param scl scale factor */ - class ANALOG_API fmdet_cf : virtual public sync_block - { - public: - // gr::analog::fmdet_cf::sptr - typedef boost::shared_ptr<fmdet_cf> sptr; - - /*! - * \brief Make FM detector block. - * - * \param samplerate sample rate of signal (is not used; to be removed) - * \param freq_low lowest frequency of signal (Hz) - * \param freq_high highest frequency of signal (Hz) - * \param scl scale factor - */ - static sptr make(float samplerate, float freq_low, - float freq_high, float scl); + static sptr make(float samplerate, float freq_low, float freq_high, float scl); - virtual void set_scale(float scl) = 0; - virtual void set_freq_range(float freq_low, float freq_high) = 0; + virtual void set_scale(float scl) = 0; + virtual void set_freq_range(float freq_low, float freq_high) = 0; - virtual float freq() const = 0; - virtual float freq_high() const = 0; - virtual float freq_low() const = 0; - virtual float scale() const = 0; - virtual float bias() const = 0; - }; + virtual float freq() const = 0; + virtual float freq_high() const = 0; + virtual float freq_low() const = 0; + virtual float scale() const = 0; + virtual float bias() const = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_FMDET_CF_H */ diff --git a/gr-analog/include/gnuradio/analog/frequency_modulator_fc.h b/gr-analog/include/gnuradio/analog/frequency_modulator_fc.h index 75f4fccb99..3ce44e1200 100644 --- a/gr-analog/include/gnuradio/analog/frequency_modulator_fc.h +++ b/gr-analog/include/gnuradio/analog/frequency_modulator_fc.h @@ -27,56 +27,56 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief Frequency modulator block + * \ingroup modulators_blk + * + * \details + * float input; complex baseband output + * + * Takes a real, baseband signal (x_m[n]) and output a frequency + * modulated signal (y[n]) according to: + * + * \f[ + * y[n] = exp (j 2 \pi \frac{f_{\Delta}}{f_s} \sum{x[n]}) + * \f] + * + * Where x[n] is the input sample at time n and \f$ f_{\Delta} \f$ + * is the frequency deviation. Common values for \f$ f_{\Delta} + * \f$ are 5 kHz for narrowband FM channels such as for voice + * systems and 75 KHz for wideband FM, like audio broadcast FM + * stations. + * + * In this block, the input argument is \p sensitivity, not the + * frequency deviation. The sensitivity specifies how much the + * phase changes based on the new input sample. Given a maximum + * deviation, \f$ f_{\Delta} \f$, and sample rate \f$f_s\f$, the + * sensitivity is defined as: + * + * \f[ + * k = 2 \pi \frac{f_{\Delta}}{f_s} + * \f] + */ +class ANALOG_API frequency_modulator_fc : virtual public sync_block +{ +public: + // gr::analog::frequency_modulator_fc::sptr + typedef boost::shared_ptr<frequency_modulator_fc> sptr; /*! - * \brief Frequency modulator block - * \ingroup modulators_blk - * - * \details - * float input; complex baseband output - * - * Takes a real, baseband signal (x_m[n]) and output a frequency - * modulated signal (y[n]) according to: - * - * \f[ - * y[n] = exp (j 2 \pi \frac{f_{\Delta}}{f_s} \sum{x[n]}) - * \f] + * Build a frequency modulator block. * - * Where x[n] is the input sample at time n and \f$ f_{\Delta} \f$ - * is the frequency deviation. Common values for \f$ f_{\Delta} - * \f$ are 5 kHz for narrowband FM channels such as for voice - * systems and 75 KHz for wideband FM, like audio broadcast FM - * stations. - * - * In this block, the input argument is \p sensitivity, not the - * frequency deviation. The sensitivity specifies how much the - * phase changes based on the new input sample. Given a maximum - * deviation, \f$ f_{\Delta} \f$, and sample rate \f$f_s\f$, the - * sensitivity is defined as: - * - * \f[ - * k = 2 \pi \frac{f_{\Delta}}{f_s} - * \f] + * \param sensitivity radians/sample = amplitude * sensitivity */ - class ANALOG_API frequency_modulator_fc : virtual public sync_block - { - public: - // gr::analog::frequency_modulator_fc::sptr - typedef boost::shared_ptr<frequency_modulator_fc> sptr; - - /*! - * Build a frequency modulator block. - * - * \param sensitivity radians/sample = amplitude * sensitivity - */ - static sptr make(float sensitivity); + static sptr make(float sensitivity); - virtual void set_sensitivity(float sens) = 0; - virtual float sensitivity() const = 0; - }; + virtual void set_sensitivity(float sens) = 0; + virtual float sensitivity() const = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_FREQUENCY_MODULATOR_FC_H */ diff --git a/gr-analog/include/gnuradio/analog/noise_source.h b/gr-analog/include/gnuradio/analog/noise_source.h index 4653074cb8..1ab2e49bfd 100644 --- a/gr-analog/include/gnuradio/analog/noise_source.h +++ b/gr-analog/include/gnuradio/analog/noise_source.h @@ -29,59 +29,59 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { - /*! - * \brief Random number source - * \ingroup waveform_generators_blk - * - * \details - * Generate random values from different distributions. - * Currently, only Gaussian and uniform are enabled. - */ -template<class T> - class ANALOG_API noise_source : virtual public sync_block - { - public: - // gr::analog::noise_source::sptr - typedef boost::shared_ptr< noise_source<T> > sptr; +/*! + * \brief Random number source + * \ingroup waveform_generators_blk + * + * \details + * Generate random values from different distributions. + * Currently, only Gaussian and uniform are enabled. + */ +template <class T> +class ANALOG_API noise_source : virtual public sync_block +{ +public: + // gr::analog::noise_source::sptr + typedef boost::shared_ptr<noise_source<T>> sptr; - /*! Build a noise source - * \param type the random distribution to use (see - * gnuradio/analog/noise_type.h) - * \param ampl the standard deviation of a 1-d noise process. If - * this is the complex source, this parameter is split - * among the real and imaginary parts: - * <pre>(ampl/sqrt(2))x + j(ampl/sqrt(2))y</pre> - * \param seed seed for random generators. Note that for uniform - * and Gaussian distributions, this should be a negative - * number. - */ - static sptr make(noise_type_t type, float ampl, long seed=0); + /*! Build a noise source + * \param type the random distribution to use (see + * gnuradio/analog/noise_type.h) + * \param ampl the standard deviation of a 1-d noise process. If + * this is the complex source, this parameter is split + * among the real and imaginary parts: + * <pre>(ampl/sqrt(2))x + j(ampl/sqrt(2))y</pre> + * \param seed seed for random generators. Note that for uniform + * and Gaussian distributions, this should be a negative + * number. + */ + static sptr make(noise_type_t type, float ampl, long seed = 0); - /*! - * Set the noise type. Nominally from the - * gr::analog::noise_type_t selections, but only GR_GAUSSIAN and - * GR_UNIFORM are currently available. - */ - virtual void set_type(noise_type_t type) = 0; + /*! + * Set the noise type. Nominally from the + * gr::analog::noise_type_t selections, but only GR_GAUSSIAN and + * GR_UNIFORM are currently available. + */ + virtual void set_type(noise_type_t type) = 0; - /*! - * Set the standard deviation (amplitude) of the 1-d noise - * process. - */ - virtual void set_amplitude(float ampl) = 0; + /*! + * Set the standard deviation (amplitude) of the 1-d noise + * process. + */ + virtual void set_amplitude(float ampl) = 0; - virtual noise_type_t type() const = 0; - virtual float amplitude() const = 0; - }; + virtual noise_type_t type() const = 0; + virtual float amplitude() const = 0; +}; - typedef noise_source<std::int16_t> noise_source_s; - typedef noise_source<std::int32_t> noise_source_i; - typedef noise_source<float> noise_source_f; - typedef noise_source<gr_complex> noise_source_c; +typedef noise_source<std::int16_t> noise_source_s; +typedef noise_source<std::int32_t> noise_source_i; +typedef noise_source<float> noise_source_f; +typedef noise_source<gr_complex> noise_source_c; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* NOISE_SOURCE_H */ diff --git a/gr-analog/include/gnuradio/analog/noise_type.h b/gr-analog/include/gnuradio/analog/noise_type.h index f1efa4573b..c72d132c28 100644 --- a/gr-analog/include/gnuradio/analog/noise_type.h +++ b/gr-analog/include/gnuradio/analog/noise_type.h @@ -24,13 +24,11 @@ #define INCLUDED_ANALOG_NOISE_TYPE_H namespace gr { - namespace analog { +namespace analog { - typedef enum { - GR_UNIFORM = 200, GR_GAUSSIAN, GR_LAPLACIAN, GR_IMPULSE - } noise_type_t; +typedef enum { GR_UNIFORM = 200, GR_GAUSSIAN, GR_LAPLACIAN, GR_IMPULSE } noise_type_t; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_NOISE_TYPE_H */ diff --git a/gr-analog/include/gnuradio/analog/phase_modulator_fc.h b/gr-analog/include/gnuradio/analog/phase_modulator_fc.h index a1d47fd38b..61f2714d5a 100644 --- a/gr-analog/include/gnuradio/analog/phase_modulator_fc.h +++ b/gr-analog/include/gnuradio/analog/phase_modulator_fc.h @@ -27,38 +27,38 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { - /*! - * \brief Phase modulator block - * \ingroup modulators_blk - * - * \details - * output = complex(cos(in*sensitivity), sin(in*sensitivity)) +/*! + * \brief Phase modulator block + * \ingroup modulators_blk + * + * \details + * output = complex(cos(in*sensitivity), sin(in*sensitivity)) + * + * Input stream 0: floats + * Output stream 0: complex + */ +class ANALOG_API phase_modulator_fc : virtual public sync_block +{ +public: + // gr::analog::phase_modulator_fc::sptr + typedef boost::shared_ptr<phase_modulator_fc> sptr; + + /* \brief Make a phase modulator block. * - * Input stream 0: floats - * Output stream 0: complex + * \param sensitivity Phase change sensitivity of input amplitude. */ - class ANALOG_API phase_modulator_fc : virtual public sync_block - { - public: - // gr::analog::phase_modulator_fc::sptr - typedef boost::shared_ptr<phase_modulator_fc> sptr; - - /* \brief Make a phase modulator block. - * - * \param sensitivity Phase change sensitivity of input amplitude. - */ - static sptr make(double sensitivity); + static sptr make(double sensitivity); - virtual double sensitivity() const = 0; - virtual double phase() const = 0; + virtual double sensitivity() const = 0; + virtual double phase() const = 0; - virtual void set_sensitivity(double s) = 0; - virtual void set_phase(double p) = 0; - }; + virtual void set_sensitivity(double s) = 0; + virtual void set_phase(double p) = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_PHASE_MODULATOR_FC_H */ diff --git a/gr-analog/include/gnuradio/analog/pll_carriertracking_cc.h b/gr-analog/include/gnuradio/analog/pll_carriertracking_cc.h index dceb3a618f..37a2dddc45 100644 --- a/gr-analog/include/gnuradio/analog/pll_carriertracking_cc.h +++ b/gr-analog/include/gnuradio/analog/pll_carriertracking_cc.h @@ -28,65 +28,64 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { - /*! - * \brief Implements a PLL which locks to the input frequency and outputs the - * input signal mixed with that carrier. - * \ingroup synchronizers_blk - * - * \details - * Input stream 0: complex - * Output stream 0: complex - * - * This PLL locks onto a [possibly noisy] reference carrier on the - * input and outputs that signal, downconverted to DC +/*! + * \brief Implements a PLL which locks to the input frequency and outputs the + * input signal mixed with that carrier. + * \ingroup synchronizers_blk + * + * \details + * Input stream 0: complex + * Output stream 0: complex + * + * This PLL locks onto a [possibly noisy] reference carrier on the + * input and outputs that signal, downconverted to DC + * + * All settings max_freq and min_freq are in terms of radians per + * sample, NOT HERTZ. The loop bandwidth determines the lock range + * and should be set around pi/200 -- 2pi/100. \sa + * pll_freqdet_cf, pll_carriertracking_cc + */ +class ANALOG_API pll_carriertracking_cc : virtual public sync_block, + virtual public blocks::control_loop +{ +public: + // gr::analog::pll_carriertracking_cc::sptr + typedef boost::shared_ptr<pll_carriertracking_cc> sptr; + + /* \brief Make a carrier tracking PLL block. * - * All settings max_freq and min_freq are in terms of radians per - * sample, NOT HERTZ. The loop bandwidth determines the lock range - * and should be set around pi/200 -- 2pi/100. \sa - * pll_freqdet_cf, pll_carriertracking_cc + * \param loop_bw: control loop's bandwidth parameter. + * \param max_freq: maximum (normalized) frequency PLL will lock to. + * \param min_freq: minimum (normalized) frequency PLL will lock to. */ - class ANALOG_API pll_carriertracking_cc - : virtual public sync_block, - virtual public blocks::control_loop - { - public: - // gr::analog::pll_carriertracking_cc::sptr - typedef boost::shared_ptr<pll_carriertracking_cc> sptr; - - /* \brief Make a carrier tracking PLL block. - * - * \param loop_bw: control loop's bandwidth parameter. - * \param max_freq: maximum (normalized) frequency PLL will lock to. - * \param min_freq: minimum (normalized) frequency PLL will lock to. - */ - static sptr make(float loop_bw, float max_freq, float min_freq); + static sptr make(float loop_bw, float max_freq, float min_freq); - virtual bool lock_detector(void) = 0; - virtual bool squelch_enable(bool) = 0; - virtual float set_lock_threshold(float) = 0; + virtual bool lock_detector(void) = 0; + virtual bool squelch_enable(bool) = 0; + virtual float set_lock_threshold(float) = 0; - virtual void set_loop_bandwidth(float bw) = 0; - virtual void set_damping_factor(float df) = 0; - virtual void set_alpha(float alpha) = 0; - virtual void set_beta(float beta) = 0; - virtual void set_frequency(float freq) = 0; - virtual void set_phase(float phase) = 0; - virtual void set_min_freq(float freq) = 0; - virtual void set_max_freq(float freq) = 0; + virtual void set_loop_bandwidth(float bw) = 0; + virtual void set_damping_factor(float df) = 0; + virtual void set_alpha(float alpha) = 0; + virtual void set_beta(float beta) = 0; + virtual void set_frequency(float freq) = 0; + virtual void set_phase(float phase) = 0; + virtual void set_min_freq(float freq) = 0; + virtual void set_max_freq(float freq) = 0; - virtual float get_loop_bandwidth() const = 0; - virtual float get_damping_factor() const = 0; - virtual float get_alpha() const = 0; - virtual float get_beta() const = 0; - virtual float get_frequency() const = 0; - virtual float get_phase() const = 0; - virtual float get_min_freq() const = 0; - virtual float get_max_freq() const = 0; - }; + virtual float get_loop_bandwidth() const = 0; + virtual float get_damping_factor() const = 0; + virtual float get_alpha() const = 0; + virtual float get_beta() const = 0; + virtual float get_frequency() const = 0; + virtual float get_phase() const = 0; + virtual float get_min_freq() const = 0; + virtual float get_max_freq() const = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_PLL_CARRIERTRACKING_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/pll_freqdet_cf.h b/gr-analog/include/gnuradio/analog/pll_freqdet_cf.h index a7bd654c99..df866cee66 100644 --- a/gr-analog/include/gnuradio/analog/pll_freqdet_cf.h +++ b/gr-analog/include/gnuradio/analog/pll_freqdet_cf.h @@ -28,60 +28,59 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { - /*! - * \brief Implements a PLL which locks to the input frequency and outputs - * an estimate of that frequency. Useful for FM Demod. - * \ingroup synchronizers_blk - * - * \details - * Input stream 0: complex - * Output stream 0: float +/*! + * \brief Implements a PLL which locks to the input frequency and outputs + * an estimate of that frequency. Useful for FM Demod. + * \ingroup synchronizers_blk + * + * \details + * Input stream 0: complex + * Output stream 0: float + * + * This PLL locks onto a [possibly noisy] reference carrier on + * the input and outputs an estimate of that frequency in radians per sample. + * All settings max_freq and min_freq are in terms of radians per sample, + * NOT HERTZ. The loop bandwidth determines the lock range and should be set + * around pi/200 -- 2pi/100. + * \sa pll_refout_cc, pll_carriertracking_cc + */ +class ANALOG_API pll_freqdet_cf : virtual public sync_block, + virtual public blocks::control_loop +{ +public: + // gr::analog::pll_freqdet_cf::sptr + typedef boost::shared_ptr<pll_freqdet_cf> sptr; + + /* \brief Make PLL block that outputs the tracked signal's frequency. * - * This PLL locks onto a [possibly noisy] reference carrier on - * the input and outputs an estimate of that frequency in radians per sample. - * All settings max_freq and min_freq are in terms of radians per sample, - * NOT HERTZ. The loop bandwidth determines the lock range and should be set - * around pi/200 -- 2pi/100. - * \sa pll_refout_cc, pll_carriertracking_cc + * \param loop_bw: control loop's bandwidth parameter. + * \param max_freq: maximum (normalized) frequency PLL will lock to. + * \param min_freq: minimum (normalized) frequency PLL will lock to. */ - class ANALOG_API pll_freqdet_cf - : virtual public sync_block, - virtual public blocks::control_loop - { - public: - // gr::analog::pll_freqdet_cf::sptr - typedef boost::shared_ptr<pll_freqdet_cf> sptr; - - /* \brief Make PLL block that outputs the tracked signal's frequency. - * - * \param loop_bw: control loop's bandwidth parameter. - * \param max_freq: maximum (normalized) frequency PLL will lock to. - * \param min_freq: minimum (normalized) frequency PLL will lock to. - */ - static sptr make(float loop_bw, float max_freq, float min_freq); + static sptr make(float loop_bw, float max_freq, float min_freq); - virtual void set_loop_bandwidth(float bw) = 0; - virtual void set_damping_factor(float df) = 0; - virtual void set_alpha(float alpha) = 0; - virtual void set_beta(float beta) = 0; - virtual void set_frequency(float freq) = 0; - virtual void set_phase(float phase) = 0; - virtual void set_min_freq(float freq) = 0; - virtual void set_max_freq(float freq) = 0; + virtual void set_loop_bandwidth(float bw) = 0; + virtual void set_damping_factor(float df) = 0; + virtual void set_alpha(float alpha) = 0; + virtual void set_beta(float beta) = 0; + virtual void set_frequency(float freq) = 0; + virtual void set_phase(float phase) = 0; + virtual void set_min_freq(float freq) = 0; + virtual void set_max_freq(float freq) = 0; - virtual float get_loop_bandwidth() const = 0; - virtual float get_damping_factor() const = 0; - virtual float get_alpha() const = 0; - virtual float get_beta() const = 0; - virtual float get_frequency() const = 0; - virtual float get_phase() const = 0; - virtual float get_min_freq() const = 0; - virtual float get_max_freq() const = 0; - }; + virtual float get_loop_bandwidth() const = 0; + virtual float get_damping_factor() const = 0; + virtual float get_alpha() const = 0; + virtual float get_beta() const = 0; + virtual float get_frequency() const = 0; + virtual float get_phase() const = 0; + virtual float get_min_freq() const = 0; + virtual float get_max_freq() const = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_PLL_FREQDET_CF_H */ diff --git a/gr-analog/include/gnuradio/analog/pll_refout_cc.h b/gr-analog/include/gnuradio/analog/pll_refout_cc.h index c73be94309..ad5b5961d8 100644 --- a/gr-analog/include/gnuradio/analog/pll_refout_cc.h +++ b/gr-analog/include/gnuradio/analog/pll_refout_cc.h @@ -28,43 +28,42 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { - /*! - * \brief Implements a PLL which locks to the input frequency and outputs a carrier - * \ingroup synchronizers_blk - * - * \details - * Input stream 0: complex - * Output stream 0: complex - * - * This PLL locks onto a [possibly noisy] reference carrier on the - * input and outputs a clean version which is phase and frequency - * aligned to it. +/*! + * \brief Implements a PLL which locks to the input frequency and outputs a carrier + * \ingroup synchronizers_blk + * + * \details + * Input stream 0: complex + * Output stream 0: complex + * + * This PLL locks onto a [possibly noisy] reference carrier on the + * input and outputs a clean version which is phase and frequency + * aligned to it. + * + * All settings max_freq and min_freq are in terms of radians per + * sample, NOT HERTZ. The loop bandwidth determines the lock range + * and should be set around pi/200 -- 2pi/100. \sa + * pll_freqdet_cf, pll_carriertracking_cc + */ +class ANALOG_API pll_refout_cc : virtual public sync_block, + virtual public blocks::control_loop +{ +public: + // gr::analog::pll_refout_cc::sptr + typedef boost::shared_ptr<pll_refout_cc> sptr; + + /* \brief Make PLL block that outputs the tracked carrier signal. * - * All settings max_freq and min_freq are in terms of radians per - * sample, NOT HERTZ. The loop bandwidth determines the lock range - * and should be set around pi/200 -- 2pi/100. \sa - * pll_freqdet_cf, pll_carriertracking_cc + * \param loop_bw: control loop's bandwidth parameter. + * \param max_freq: maximum (normalized) frequency PLL will lock to. + * \param min_freq: minimum (normalized) frequency PLL will lock to. */ - class ANALOG_API pll_refout_cc - : virtual public sync_block, - virtual public blocks::control_loop - { - public: - // gr::analog::pll_refout_cc::sptr - typedef boost::shared_ptr<pll_refout_cc> sptr; - - /* \brief Make PLL block that outputs the tracked carrier signal. - * - * \param loop_bw: control loop's bandwidth parameter. - * \param max_freq: maximum (normalized) frequency PLL will lock to. - * \param min_freq: minimum (normalized) frequency PLL will lock to. - */ - static sptr make(float loop_bw, float max_freq, float min_freq); - }; + static sptr make(float loop_bw, float max_freq, float min_freq); +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_PLL_REFOUT_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_c.h b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_c.h index e6816f7fb6..72abde9c4a 100644 --- a/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_c.h +++ b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_c.h @@ -26,44 +26,44 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief compute avg magnitude squared. + * \ingroup measurement_tools_blk + * + * \details + * Input stream 0: complex + * + * Compute a running average of the magnitude squared of the the + * input. The level and indication as to whether the level exceeds + * threshold can be retrieved with the level and unmuted + * accessors. + */ +class ANALOG_API probe_avg_mag_sqrd_c : virtual public sync_block +{ +public: + // gr::analog::probe_avg_mag_sqrd_c::sptr + typedef boost::shared_ptr<probe_avg_mag_sqrd_c> sptr; /*! - * \brief compute avg magnitude squared. - * \ingroup measurement_tools_blk - * - * \details - * Input stream 0: complex + * \brief Make a complex sink that computes avg magnitude squared. * - * Compute a running average of the magnitude squared of the the - * input. The level and indication as to whether the level exceeds - * threshold can be retrieved with the level and unmuted - * accessors. + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. */ - class ANALOG_API probe_avg_mag_sqrd_c : virtual public sync_block - { - public: - // gr::analog::probe_avg_mag_sqrd_c::sptr - typedef boost::shared_ptr<probe_avg_mag_sqrd_c> sptr; - - /*! - * \brief Make a complex sink that computes avg magnitude squared. - * - * \param threshold_db Threshold for muting. - * \param alpha Gain parameter for the running average filter. - */ - static sptr make(double threshold_db, double alpha = 0.0001); + static sptr make(double threshold_db, double alpha = 0.0001); - virtual bool unmuted() const = 0; - virtual double level() const = 0; - virtual double threshold() const = 0; + virtual bool unmuted() const = 0; + virtual double level() const = 0; + virtual double threshold() const = 0; - virtual void set_alpha(double alpha) = 0; - virtual void set_threshold(double decibels) = 0; - virtual void reset() = 0; - }; + virtual void set_alpha(double alpha) = 0; + virtual void set_threshold(double decibels) = 0; + virtual void reset() = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_C_H */ diff --git a/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_cf.h b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_cf.h index 9aeb8761be..03e4138824 100644 --- a/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_cf.h +++ b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_cf.h @@ -27,45 +27,45 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief compute avg magnitude squared. + * \ingroup measurement_tools_blk + * + * \details + * Input stream 0: complex + * Output stream 0: float + * + * Compute a running average of the magnitude squared of the the + * input. The level and indication as to whether the level exceeds + * threshold can be retrieved with the level and unmuted + * accessors. + */ +class ANALOG_API probe_avg_mag_sqrd_cf : virtual public sync_block +{ +public: + // gr::analog::probe_avg_mag_sqrd_cf::sptr + typedef boost::shared_ptr<probe_avg_mag_sqrd_cf> sptr; /*! - * \brief compute avg magnitude squared. - * \ingroup measurement_tools_blk - * - * \details - * Input stream 0: complex - * Output stream 0: float + * \brief Make a block that computes avg magnitude squared. * - * Compute a running average of the magnitude squared of the the - * input. The level and indication as to whether the level exceeds - * threshold can be retrieved with the level and unmuted - * accessors. + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. */ - class ANALOG_API probe_avg_mag_sqrd_cf : virtual public sync_block - { - public: - // gr::analog::probe_avg_mag_sqrd_cf::sptr - typedef boost::shared_ptr<probe_avg_mag_sqrd_cf> sptr; - - /*! - * \brief Make a block that computes avg magnitude squared. - * - * \param threshold_db Threshold for muting. - * \param alpha Gain parameter for the running average filter. - */ - static sptr make(double threshold_db, double alpha = 0.0001); + static sptr make(double threshold_db, double alpha = 0.0001); - virtual bool unmuted() const = 0; - virtual double level() const = 0; - virtual double threshold() const = 0; + virtual bool unmuted() const = 0; + virtual double level() const = 0; + virtual double threshold() const = 0; - virtual void set_alpha(double alpha) = 0; - virtual void set_threshold(double decibels) = 0; - virtual void reset() = 0; - }; + virtual void set_alpha(double alpha) = 0; + virtual void set_threshold(double decibels) = 0; + virtual void reset() = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_CF_H */ diff --git a/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_f.h b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_f.h index 66095c3709..eaef1d0da2 100644 --- a/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_f.h +++ b/gr-analog/include/gnuradio/analog/probe_avg_mag_sqrd_f.h @@ -27,45 +27,45 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief compute avg magnitude squared. + * \ingroup measurement_tools_blk + * + * \details + * input stream 0: float + * + * Compute a running average of the magnitude squared of the the + * input. The level and indication as to whether the level exceeds + * threshold can be retrieved with the level and unmuted + * accessors. + */ +class ANALOG_API probe_avg_mag_sqrd_f : virtual public sync_block +{ +public: + // gr::analog::probe_avg_mag_sqrd_f::sptr + typedef boost::shared_ptr<probe_avg_mag_sqrd_f> sptr; /*! - * \brief compute avg magnitude squared. - * \ingroup measurement_tools_blk - * - * \details - * input stream 0: float + * \brief Make a float sink that computes avg magnitude squared. * - * Compute a running average of the magnitude squared of the the - * input. The level and indication as to whether the level exceeds - * threshold can be retrieved with the level and unmuted - * accessors. + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. */ - class ANALOG_API probe_avg_mag_sqrd_f : virtual public sync_block - { - public: - // gr::analog::probe_avg_mag_sqrd_f::sptr - typedef boost::shared_ptr<probe_avg_mag_sqrd_f> sptr; - - /*! - * \brief Make a float sink that computes avg magnitude squared. - * - * \param threshold_db Threshold for muting. - * \param alpha Gain parameter for the running average filter. - */ - static sptr make(double threshold_db, double alpha = 0.0001); + static sptr make(double threshold_db, double alpha = 0.0001); - virtual bool unmuted() const = 0; - virtual double level() const = 0; + virtual bool unmuted() const = 0; + virtual double level() const = 0; - virtual double threshold() const = 0; + virtual double threshold() const = 0; - virtual void set_alpha (double alpha) = 0; - virtual void set_threshold (double decibels) = 0; - virtual void reset() = 0; - }; + virtual void set_alpha(double alpha) = 0; + virtual void set_threshold(double decibels) = 0; + virtual void reset() = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_PROBE_AVG_MAG_SQRD_F_H */ diff --git a/gr-analog/include/gnuradio/analog/pwr_squelch_cc.h b/gr-analog/include/gnuradio/analog/pwr_squelch_cc.h index 324743d965..9100904c70 100644 --- a/gr-analog/include/gnuradio/analog/pwr_squelch_cc.h +++ b/gr-analog/include/gnuradio/analog/pwr_squelch_cc.h @@ -28,53 +28,51 @@ #include <cmath> namespace gr { - namespace analog { +namespace analog { - /*! - * \brief gate or zero output when input power below threshold - * \ingroup level_controllers_blk - */ - class ANALOG_API pwr_squelch_cc : - public squelch_base_cc, virtual public block - { - protected: - virtual void update_state(const gr_complex &in) = 0; - virtual bool mute() const = 0; +/*! + * \brief gate or zero output when input power below threshold + * \ingroup level_controllers_blk + */ +class ANALOG_API pwr_squelch_cc : public squelch_base_cc, virtual public block +{ +protected: + virtual void update_state(const gr_complex& in) = 0; + virtual bool mute() const = 0; - public: - // gr::analog::pwr_squelch_cc::sptr - typedef boost::shared_ptr<pwr_squelch_cc> sptr; +public: + // gr::analog::pwr_squelch_cc::sptr + typedef boost::shared_ptr<pwr_squelch_cc> sptr; - /*! - * \brief Make power-based squelch block. - * - * \param db threshold (in dB) for power squelch - * \param alpha Gain of averaging filter. Defaults to 0.0001. - * \param ramp sets response characteristic. Defaults to 0. - * \param gate if true, no output if no squelch tone. - * if false, output 0's if no squelch tone (default). - * - * The block will emit a tag with the key pmt::intern("squelch_sob") - * with the value of pmt::PMT_NIL on the first item it passes, and with - * the key pmt::intern("squelch:eob") on the last item it passes. - */ - static sptr make(double db, double alpha=0.0001, - int ramp=0, bool gate=false); + /*! + * \brief Make power-based squelch block. + * + * \param db threshold (in dB) for power squelch + * \param alpha Gain of averaging filter. Defaults to 0.0001. + * \param ramp sets response characteristic. Defaults to 0. + * \param gate if true, no output if no squelch tone. + * if false, output 0's if no squelch tone (default). + * + * The block will emit a tag with the key pmt::intern("squelch_sob") + * with the value of pmt::PMT_NIL on the first item it passes, and with + * the key pmt::intern("squelch:eob") on the last item it passes. + */ + static sptr make(double db, double alpha = 0.0001, int ramp = 0, bool gate = false); - virtual std::vector<float> squelch_range() const = 0; + virtual std::vector<float> squelch_range() const = 0; - virtual double threshold() const = 0; - virtual void set_threshold(double db) = 0; - virtual void set_alpha(double alpha) = 0; + virtual double threshold() const = 0; + virtual void set_threshold(double db) = 0; + virtual void set_alpha(double alpha) = 0; - virtual int ramp() const = 0; - virtual void set_ramp(int ramp) = 0; - virtual bool gate() const = 0; - virtual void set_gate(bool gate) = 0; - virtual bool unmuted() const = 0; - }; + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_PWR_SQUELCH_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/pwr_squelch_ff.h b/gr-analog/include/gnuradio/analog/pwr_squelch_ff.h index a65cedaa57..ebdb049861 100644 --- a/gr-analog/include/gnuradio/analog/pwr_squelch_ff.h +++ b/gr-analog/include/gnuradio/analog/pwr_squelch_ff.h @@ -28,53 +28,51 @@ #include <cmath> namespace gr { - namespace analog { +namespace analog { - /*! - * \brief gate or zero output when input power below threshold - * \ingroup level_controllers_blk - */ - class ANALOG_API pwr_squelch_ff : - public squelch_base_ff, virtual public block - { - protected: - virtual void update_state(const float &in) = 0; - virtual bool mute() const = 0; +/*! + * \brief gate or zero output when input power below threshold + * \ingroup level_controllers_blk + */ +class ANALOG_API pwr_squelch_ff : public squelch_base_ff, virtual public block +{ +protected: + virtual void update_state(const float& in) = 0; + virtual bool mute() const = 0; - public: - // gr::analog::pwr_squelch_ff::sptr - typedef boost::shared_ptr<pwr_squelch_ff> sptr; +public: + // gr::analog::pwr_squelch_ff::sptr + typedef boost::shared_ptr<pwr_squelch_ff> sptr; - /*! - * \brief Make power-based squelch block. - * - * \param db threshold (in dB) for power squelch - * \param alpha Gain of averaging filter. Defaults to 0.0001. - * \param ramp sets response characteristic. Defaults to 0. - * \param gate if true, no output if no squelch tone. - * if false, output 0's if no squelch tone (default). - * - * The block will emit a tag with the key pmt::intern("squelch_sob") - * with the value of pmt::PMT_NIL on the first item it passes, and with - * the key pmt::intern("squelch:eob") on the last item it passes. - */ - static sptr make(double db, double alpha=0.0001, - int ramp=0, bool gate=false); + /*! + * \brief Make power-based squelch block. + * + * \param db threshold (in dB) for power squelch + * \param alpha Gain of averaging filter. Defaults to 0.0001. + * \param ramp sets response characteristic. Defaults to 0. + * \param gate if true, no output if no squelch tone. + * if false, output 0's if no squelch tone (default). + * + * The block will emit a tag with the key pmt::intern("squelch_sob") + * with the value of pmt::PMT_NIL on the first item it passes, and with + * the key pmt::intern("squelch:eob") on the last item it passes. + */ + static sptr make(double db, double alpha = 0.0001, int ramp = 0, bool gate = false); - virtual std::vector<float> squelch_range() const = 0; + virtual std::vector<float> squelch_range() const = 0; - virtual double threshold() const = 0; - virtual void set_threshold(double db) = 0; - virtual void set_alpha(double alpha) = 0; + virtual double threshold() const = 0; + virtual void set_threshold(double db) = 0; + virtual void set_alpha(double alpha) = 0; - virtual int ramp() const = 0; - virtual void set_ramp(int ramp) = 0; - virtual bool gate() const = 0; - virtual void set_gate(bool gate) = 0; - virtual bool unmuted() const = 0; - }; + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_PWR_SQUELCH_FF_H */ diff --git a/gr-analog/include/gnuradio/analog/quadrature_demod_cf.h b/gr-analog/include/gnuradio/analog/quadrature_demod_cf.h index b872bc2e5a..e018b68b48 100644 --- a/gr-analog/include/gnuradio/analog/quadrature_demod_cf.h +++ b/gr-analog/include/gnuradio/analog/quadrature_demod_cf.h @@ -27,60 +27,67 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { - /*! - * \brief quadrature demodulator: complex in, float out - * \ingroup modulators_blk - * - * \details - * This can be used to demod FM, FSK, GMSK, etc. The input is complex - * baseband, output is the signal frequency in relation to the sample - * rate, multiplied with the gain. - * - * Mathematically, this block calculates the product of the one-sample - * delayed input and the conjugate undelayed signal, and then calculates - * the argument of the resulting complex number: - * - * \f$y[n] = \mathrm{arg}\left(x[n] \, \bar x [n-1]\right)\f$. - * - * Let \f$x\f$ be a complex sinusoid with amplitude \f$A>0\f$, (absolute) - * frequency \f$f\in\mathbb R\f$ and phase \f$\phi_0\in[0;2\pi]\f$ sampled at - * \f$f_s>0\f$ so, without loss of generality, - * - * \f$x[n]= A e^{j2\pi( \frac f{f_s} n + \phi_0)}\f$ - * - * then +/*! + * \brief quadrature demodulator: complex in, float out + * \ingroup modulators_blk + * + * \details + * This can be used to demod FM, FSK, GMSK, etc. The input is complex + * baseband, output is the signal frequency in relation to the sample + * rate, multiplied with the gain. + * + * Mathematically, this block calculates the product of the one-sample + * delayed input and the conjugate undelayed signal, and then calculates + * the argument of the resulting complex number: + * + * \f$y[n] = \mathrm{arg}\left(x[n] \, \bar x [n-1]\right)\f$. + * + * Let \f$x\f$ be a complex sinusoid with amplitude \f$A>0\f$, (absolute) + * frequency \f$f\in\mathbb R\f$ and phase \f$\phi_0\in[0;2\pi]\f$ sampled at + * \f$f_s>0\f$ so, without loss of generality, + * + * \f$x[n]= A e^{j2\pi( \frac f{f_s} n + \phi_0)}\f$ + * + * then + * + * \f{align*}{ y[n] &= \mathrm{arg}\left(A e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} + * \overline{A e^{j2\pi( \frac f{f_s} (n-1) + \phi_0)}}\right)\\ + * & = \mathrm{arg}\left(A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} e^{-j2\pi( + * \frac f{f_s} (n-1) + \phi_0)}\right)\\ + * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0 - \frac f{f_s} (n-1) + * - \phi_0\right)}\right)\\ + * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n - \frac f{f_s} + * (n-1)\right)}\right)\\ + * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} + * \left(n-(n-1)\right)\right)}\right)\\ + * & = \mathrm{arg}\left( A^2 e^{j2\pi \frac f{f_s}}\right) \intertext{$A$ is real, so is + * $A^2$ and hence only \textit{scales}, therefore $\mathrm{arg}(\cdot)$ is invariant:} &= + * \mathrm{arg}\left(e^{j2\pi \frac f{f_s}}\right)\\ + * &= \frac f{f_s}\\ + * &&\blacksquare + * \f} + */ +class ANALOG_API quadrature_demod_cf : virtual public sync_block +{ +public: + // gr::analog::quadrature_demod_cf::sptr + typedef boost::shared_ptr<quadrature_demod_cf> sptr; + + /* \brief Make a quadrature demodulator block. * - * \f{align*}{ y[n] &= \mathrm{arg}\left(A e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} \overline{A e^{j2\pi( \frac f{f_s} (n-1) + \phi_0)}}\right)\\ - * & = \mathrm{arg}\left(A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} e^{-j2\pi( \frac f{f_s} (n-1) + \phi_0)}\right)\\ - * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0 - \frac f{f_s} (n-1) - \phi_0\right)}\right)\\ - * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n - \frac f{f_s} (n-1)\right)}\right)\\ - * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} \left(n-(n-1)\right)\right)}\right)\\ - * & = \mathrm{arg}\left( A^2 e^{j2\pi \frac f{f_s}}\right) \intertext{$A$ is real, so is $A^2$ and hence only \textit{scales}, therefore $\mathrm{arg}(\cdot)$ is invariant:} &= \mathrm{arg}\left(e^{j2\pi \frac f{f_s}}\right)\\ - * &= \frac f{f_s}\\ - * &&\blacksquare - * \f} + * \param gain Gain setting to adjust the output amplitude. Set + * based on converting the phase difference between + * samples to a nominal output value. */ - class ANALOG_API quadrature_demod_cf : virtual public sync_block - { - public: - // gr::analog::quadrature_demod_cf::sptr - typedef boost::shared_ptr<quadrature_demod_cf> sptr; - - /* \brief Make a quadrature demodulator block. - * - * \param gain Gain setting to adjust the output amplitude. Set - * based on converting the phase difference between - * samples to a nominal output value. - */ - static sptr make(float gain); + static sptr make(float gain); - virtual void set_gain(float gain) = 0; - virtual float gain() const = 0; - }; + virtual void set_gain(float gain) = 0; + virtual float gain() const = 0; +}; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H */ diff --git a/gr-analog/include/gnuradio/analog/rail_ff.h b/gr-analog/include/gnuradio/analog/rail_ff.h index c28c1746f6..f41720c600 100644 --- a/gr-analog/include/gnuradio/analog/rail_ff.h +++ b/gr-analog/include/gnuradio/analog/rail_ff.h @@ -27,34 +27,34 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief clips input values to min, max + * \ingroup level_controllers_blk + */ +class ANALOG_API rail_ff : virtual public sync_block +{ +public: + // gr::analog::rail_ff::sptr + typedef boost::shared_ptr<rail_ff> sptr; /*! - * \brief clips input values to min, max - * \ingroup level_controllers_blk + * Build a rail block. + * + * \param lo the low value to clip to. + * \param hi the high value to clip to. */ - class ANALOG_API rail_ff : virtual public sync_block - { - public: - // gr::analog::rail_ff::sptr - typedef boost::shared_ptr<rail_ff> sptr; - - /*! - * Build a rail block. - * - * \param lo the low value to clip to. - * \param hi the high value to clip to. - */ - static sptr make(float lo, float hi); - - virtual float lo() const = 0; - virtual float hi() const = 0; - - virtual void set_lo(float lo) = 0; - virtual void set_hi(float hi) = 0; - }; - - } /* namespace analog */ + static sptr make(float lo, float hi); + + virtual float lo() const = 0; + virtual float hi() const = 0; + + virtual void set_lo(float lo) = 0; + virtual void set_hi(float hi) = 0; +}; + +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_RAIL_FF_H */ diff --git a/gr-analog/include/gnuradio/analog/random_uniform_source.h b/gr-analog/include/gnuradio/analog/random_uniform_source.h index 1cd0f3016d..dbbd5557af 100644 --- a/gr-analog/include/gnuradio/analog/random_uniform_source.h +++ b/gr-analog/include/gnuradio/analog/random_uniform_source.h @@ -28,37 +28,38 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief Uniform Random Number Generator + * \ingroup waveform_generators_blk + */ +template <class T> +class ANALOG_API random_uniform_source : virtual public sync_block +{ +public: + // gr::analog::random_uniform_source::sptr + typedef boost::shared_ptr<random_uniform_source<T>> sptr; /*! - * \brief Uniform Random Number Generator - * \ingroup waveform_generators_blk + * \brief Return a shared_ptr to a new instance of analog::random_uniform_source_X. + * + * To avoid accidental use of raw pointers, analog::random_uniform_source_b's + * constructor is in a private implementation + * class. analog::random_uniform_source_b::make is the public interface for + * creating new instances. + * \param minimum defines minimal integer value output. + * \param maximum output values are below this value + * \param seed for Pseudo Random Number Generator. Defaults to 0. In this case current + * time is used. */ -template<class T> - class ANALOG_API random_uniform_source : virtual public sync_block - { - public: - // gr::analog::random_uniform_source::sptr - typedef boost::shared_ptr< random_uniform_source<T> > sptr; - - /*! - * \brief Return a shared_ptr to a new instance of analog::random_uniform_source_X. - * - * To avoid accidental use of raw pointers, analog::random_uniform_source_b's - * constructor is in a private implementation - * class. analog::random_uniform_source_b::make is the public interface for - * creating new instances. - * \param minimum defines minimal integer value output. - * \param maximum output values are below this value - * \param seed for Pseudo Random Number Generator. Defaults to 0. In this case current time is used. - */ - static sptr make(int minimum, int maximum, int seed); - }; + static sptr make(int minimum, int maximum, int seed); +}; - typedef random_uniform_source<std::uint8_t> random_uniform_source_b; - typedef random_uniform_source<std::int16_t> random_uniform_source_s; - typedef random_uniform_source<std::int32_t> random_uniform_source_i; - } /* namespace analog */ +typedef random_uniform_source<std::uint8_t> random_uniform_source_b; +typedef random_uniform_source<std::int16_t> random_uniform_source_s; +typedef random_uniform_source<std::int32_t> random_uniform_source_i; +} /* namespace analog */ } /* namespace gr */ #endif /* RANDOM_UNIFORM_SOURCE_H */ diff --git a/gr-analog/include/gnuradio/analog/sig_source.h b/gr-analog/include/gnuradio/analog/sig_source.h index ec8e4eee43..a1d124ec12 100644 --- a/gr-analog/include/gnuradio/analog/sig_source.h +++ b/gr-analog/include/gnuradio/analog/sig_source.h @@ -29,84 +29,86 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief signal generator with T output. + * \ingroup waveform_generators_blk + */ +template <class T> +class ANALOG_API sig_source : virtual public sync_block +{ +public: + // gr::analog::sig_source::sptr + typedef boost::shared_ptr<sig_source<T>> sptr; /*! - * \brief signal generator with T output. - * \ingroup waveform_generators_blk + * Build a signal source block. + * + * \param sampling_freq Sampling rate of signal. + * \param waveform wavetform type. + * \param wave_freq Frequency of waveform (relative to sampling_freq). + * \param ampl Signal amplitude. + * \param offset offset of signal. + * \param phase Initial phase of the signal */ -template<class T> - class ANALOG_API sig_source : virtual public sync_block - { - public: - // gr::analog::sig_source::sptr - typedef boost::shared_ptr< sig_source<T> > sptr; + static sptr make(double sampling_freq, + gr::analog::gr_waveform_t waveform, + double wave_freq, + double ampl, + T offset = 0, + float phase = 0); - /*! - * Build a signal source block. - * - * \param sampling_freq Sampling rate of signal. - * \param waveform wavetform type. - * \param wave_freq Frequency of waveform (relative to sampling_freq). - * \param ampl Signal amplitude. - * \param offset offset of signal. - * \param phase Initial phase of the signal - */ - static sptr make(double sampling_freq, - gr::analog::gr_waveform_t waveform, - double wave_freq, - double ampl, T offset = 0, float phase = 0); + virtual double sampling_freq() const = 0; + virtual gr::analog::gr_waveform_t waveform() const = 0; + virtual double frequency() const = 0; + virtual double amplitude() const = 0; + virtual T offset() const = 0; + virtual float phase() const = 0; - virtual double sampling_freq() const = 0; - virtual gr::analog::gr_waveform_t waveform() const = 0; - virtual double frequency() const = 0; - virtual double amplitude() const = 0; - virtual T offset() const = 0; - virtual float phase() const = 0; - - /*! - * Sets the sampling frequency of the signal. - * \param sampling_freq sampling frequency - */ - virtual void set_sampling_freq(double sampling_freq) = 0; + /*! + * Sets the sampling frequency of the signal. + * \param sampling_freq sampling frequency + */ + virtual void set_sampling_freq(double sampling_freq) = 0; - /*! - * Sets the waveform type of signal. - * \param waveform waveform type - */ - virtual void set_waveform(gr::analog::gr_waveform_t waveform) = 0; + /*! + * Sets the waveform type of signal. + * \param waveform waveform type + */ + virtual void set_waveform(gr::analog::gr_waveform_t waveform) = 0; - /*! - * Sets the frequency of a periodic signal. - * \param frequency frequency of the signal - */ - virtual void set_frequency(double frequency) = 0; + /*! + * Sets the frequency of a periodic signal. + * \param frequency frequency of the signal + */ + virtual void set_frequency(double frequency) = 0; - /*! - * Sets the amplitude of a signal. - * \param ampl amplitude of the signal - */ - virtual void set_amplitude(double ampl) = 0; + /*! + * Sets the amplitude of a signal. + * \param ampl amplitude of the signal + */ + virtual void set_amplitude(double ampl) = 0; - /*! - * Sets the DC offset of a signal. - * \param offset DC offset of the signal - */ - virtual void set_offset(T offset) = 0; + /*! + * Sets the DC offset of a signal. + * \param offset DC offset of the signal + */ + virtual void set_offset(T offset) = 0; - /*! - * Sets the phase of a periodic signal. - * \param phase phase of the signal - */ - virtual void set_phase(float phase) = 0; - }; + /*! + * Sets the phase of a periodic signal. + * \param phase phase of the signal + */ + virtual void set_phase(float phase) = 0; +}; - typedef sig_source<std::int8_t> sig_source_b; - typedef sig_source<std::int16_t> sig_source_s; - typedef sig_source<std::int32_t> sig_source_i; - typedef sig_source<float> sig_source_f; - typedef sig_source<gr_complex> sig_source_c; - } /* namespace analog */ +typedef sig_source<std::int8_t> sig_source_b; +typedef sig_source<std::int16_t> sig_source_s; +typedef sig_source<std::int32_t> sig_source_i; +typedef sig_source<float> sig_source_f; +typedef sig_source<gr_complex> sig_source_c; +} /* namespace analog */ } /* namespace gr */ #endif /* SIG_SOURCE_H */ diff --git a/gr-analog/include/gnuradio/analog/sig_source_waveform.h b/gr-analog/include/gnuradio/analog/sig_source_waveform.h index e3efeb1fbb..09ea53d661 100644 --- a/gr-analog/include/gnuradio/analog/sig_source_waveform.h +++ b/gr-analog/include/gnuradio/analog/sig_source_waveform.h @@ -24,22 +24,22 @@ #define INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H namespace gr { - namespace analog { +namespace analog { - /*! - * \brief Types of signal generator waveforms. - * \ingroup waveform_generators_blk - */ - typedef enum { - GR_CONST_WAVE = 100, - GR_SIN_WAVE, - GR_COS_WAVE, - GR_SQR_WAVE, - GR_TRI_WAVE, - GR_SAW_WAVE - } gr_waveform_t; +/*! + * \brief Types of signal generator waveforms. + * \ingroup waveform_generators_blk + */ +typedef enum { + GR_CONST_WAVE = 100, + GR_SIN_WAVE, + GR_COS_WAVE, + GR_SQR_WAVE, + GR_TRI_WAVE, + GR_SAW_WAVE +} gr_waveform_t; - } /* namespace analog */ +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_SIG_SOURCE_WAVEFORM_H */ diff --git a/gr-analog/include/gnuradio/analog/simple_squelch_cc.h b/gr-analog/include/gnuradio/analog/simple_squelch_cc.h index 53d2835ff3..56950e91de 100644 --- a/gr-analog/include/gnuradio/analog/simple_squelch_cc.h +++ b/gr-analog/include/gnuradio/analog/simple_squelch_cc.h @@ -27,36 +27,36 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace analog { +namespace analog { + +/*! + * \brief simple squelch block based on average signal power and threshold in dB. + * \ingroup level_controllers_blk + */ +class ANALOG_API simple_squelch_cc : virtual public sync_block +{ +public: + // gr::analog::simple_squelch_cc::sptr + typedef boost::shared_ptr<simple_squelch_cc> sptr; /*! - * \brief simple squelch block based on average signal power and threshold in dB. - * \ingroup level_controllers_blk + * \brief Make a simple squelch block. + * + * \param threshold_db Threshold for muting. + * \param alpha Gain parameter for the running average filter. */ - class ANALOG_API simple_squelch_cc : virtual public sync_block - { - public: - // gr::analog::simple_squelch_cc::sptr - typedef boost::shared_ptr<simple_squelch_cc> sptr; - - /*! - * \brief Make a simple squelch block. - * - * \param threshold_db Threshold for muting. - * \param alpha Gain parameter for the running average filter. - */ - static sptr make(double threshold_db, double alpha); - - virtual bool unmuted() const = 0; - - virtual void set_alpha(double alpha) = 0; - virtual void set_threshold(double decibels) = 0; - - virtual double threshold() const = 0; - virtual std::vector<float> squelch_range() const = 0; - }; - - } /* namespace analog */ + static sptr make(double threshold_db, double alpha); + + virtual bool unmuted() const = 0; + + virtual void set_alpha(double alpha) = 0; + virtual void set_threshold(double decibels) = 0; + + virtual double threshold() const = 0; + virtual std::vector<float> squelch_range() const = 0; +}; + +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_SIMPLE_SQUELCH_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/squelch_base_cc.h b/gr-analog/include/gnuradio/analog/squelch_base_cc.h index 63f84cb374..deecbdebac 100644 --- a/gr-analog/include/gnuradio/analog/squelch_base_cc.h +++ b/gr-analog/include/gnuradio/analog/squelch_base_cc.h @@ -27,30 +27,30 @@ #include <gnuradio/block.h> namespace gr { - namespace analog { - - /*! - * \brief basic squelch block; to be subclassed for other squelches. - * \ingroup level_blk - */ - class ANALOG_API squelch_base_cc : virtual public block - { - protected: - virtual void update_state(const gr_complex &sample) = 0; - virtual bool mute() const = 0; - - public: - squelch_base_cc() {}; - virtual int ramp() const = 0; - virtual void set_ramp(int ramp) = 0; - virtual bool gate() const = 0; - virtual void set_gate(bool gate) = 0; - virtual bool unmuted() const = 0; - - virtual std::vector<float> squelch_range() const = 0; - }; - - } /* namespace analog */ +namespace analog { + +/*! + * \brief basic squelch block; to be subclassed for other squelches. + * \ingroup level_blk + */ +class ANALOG_API squelch_base_cc : virtual public block +{ +protected: + virtual void update_state(const gr_complex& sample) = 0; + virtual bool mute() const = 0; + +public: + squelch_base_cc(){}; + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + + virtual std::vector<float> squelch_range() const = 0; +}; + +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_SQUELCH_BASE_CC_H */ diff --git a/gr-analog/include/gnuradio/analog/squelch_base_ff.h b/gr-analog/include/gnuradio/analog/squelch_base_ff.h index f68262f015..fcf81d5b8b 100644 --- a/gr-analog/include/gnuradio/analog/squelch_base_ff.h +++ b/gr-analog/include/gnuradio/analog/squelch_base_ff.h @@ -27,30 +27,30 @@ #include <gnuradio/block.h> namespace gr { - namespace analog { - - /*! - * \brief basic squelch block; to be subclassed for other squelches. - * \ingroup level_blk - */ - class ANALOG_API squelch_base_ff : virtual public block - { - protected: - virtual void update_state(const float &sample) = 0; - virtual bool mute() const = 0; - - public: - squelch_base_ff() {}; - virtual int ramp() const = 0; - virtual void set_ramp(int ramp) = 0; - virtual bool gate() const = 0; - virtual void set_gate(bool gate) = 0; - virtual bool unmuted() const = 0; - - virtual std::vector<float> squelch_range() const = 0; - }; - - } /* namespace analog */ +namespace analog { + +/*! + * \brief basic squelch block; to be subclassed for other squelches. + * \ingroup level_blk + */ +class ANALOG_API squelch_base_ff : virtual public block +{ +protected: + virtual void update_state(const float& sample) = 0; + virtual bool mute() const = 0; + +public: + squelch_base_ff(){}; + virtual int ramp() const = 0; + virtual void set_ramp(int ramp) = 0; + virtual bool gate() const = 0; + virtual void set_gate(bool gate) = 0; + virtual bool unmuted() const = 0; + + virtual std::vector<float> squelch_range() const = 0; +}; + +} /* namespace analog */ } /* namespace gr */ #endif /* INCLUDED_ANALOG_SQUELCH_BASE_FF_H */ |