GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
noise_source.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2012,2018 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 
12 #ifndef NOISE_SOURCE_H
13 #define NOISE_SOURCE_H
14 
15 #include <gnuradio/analog/api.h>
17 #include <gnuradio/sync_block.h>
18 
19 namespace gr {
20 namespace analog {
21 
22 /*!
23  * \brief Random number source
24  * \ingroup waveform_generators_blk
25  *
26  * \details
27  * Generate random values from different distributions.
28  * Currently, only Gaussian and uniform are enabled.
29  */
30 template <class T>
31 class ANALOG_API noise_source : virtual public sync_block
32 {
33 public:
34  // gr::analog::noise_source::sptr
35  typedef std::shared_ptr<noise_source<T>> sptr;
36 
37  /*! Build a noise source
38  * \param type the random distribution to use (see
39  * gnuradio/analog/noise_type.h)
40  * \param ampl the standard deviation of a 1-d noise process. If
41  * this is the complex source, this parameter is split
42  * among the real and imaginary parts:
43  * <pre>(ampl/sqrt(2))x + j(ampl/sqrt(2))y</pre>
44  * \param seed seed for random generators. seed = 0 initializes
45  * the random number generator with the system time.
46  */
47  static sptr make(noise_type_t type, float ampl, long seed = 0);
48 
49  /*!
50  * Set the noise type. Nominally from the
51  * gr::analog::noise_type_t selections, but only GR_GAUSSIAN and
52  * GR_UNIFORM are currently available.
53  */
54  virtual void set_type(noise_type_t type) = 0;
55 
56  /*!
57  * Set the standard deviation (amplitude) of the 1-d noise
58  * process.
59  */
60  virtual void set_amplitude(float ampl) = 0;
61 
62  virtual noise_type_t type() const = 0;
63  virtual float amplitude() const = 0;
64 };
65 
70 
71 } /* namespace analog */
72 } /* namespace gr */
73 
74 #endif /* NOISE_SOURCE_H */
Random number source.
Definition: noise_source.h:32
static sptr make(noise_type_t type, float ampl, long seed=0)
std::shared_ptr< noise_source< T > > sptr
Definition: noise_source.h:35
virtual void set_type(noise_type_t type)=0
virtual noise_type_t type() const =0
virtual float amplitude() const =0
virtual void set_amplitude(float ampl)=0
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define ANALOG_API
Definition: gr-analog/include/gnuradio/analog/api.h:18
noise_type_t
Definition: noise_type.h:17
noise_source< float > noise_source_f
Definition: noise_source.h:68
noise_source< gr_complex > noise_source_c
Definition: noise_source.h:69
noise_source< std::int32_t > noise_source_i
Definition: noise_source.h:67
noise_source< std::int16_t > noise_source_s
Definition: noise_source.h:66
GNU Radio logging wrapper.
Definition: basic_block.h:29