GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
sig_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  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 
24 #ifndef SIG_SOURCE_H
25 #define SIG_SOURCE_H
26 
27 #include <gnuradio/analog/api.h>
29 #include <gnuradio/sync_block.h>
30 
31 namespace gr {
32 namespace analog {
33 
34 /*!
35  * \brief signal generator with T output.
36  * \ingroup waveform_generators_blk
37  */
38 template <class T>
39 class ANALOG_API sig_source : virtual public sync_block
40 {
41 public:
42  // gr::analog::sig_source::sptr
43  typedef boost::shared_ptr<sig_source<T>> sptr;
44 
45  /*!
46  * Build a signal source block.
47  *
48  * \param sampling_freq Sampling rate of signal.
49  * \param waveform wavetform type.
50  * \param wave_freq Frequency of waveform (relative to sampling_freq).
51  * \param ampl Signal amplitude.
52  * \param offset offset of signal.
53  * \param phase Initial phase of the signal
54  */
55  static sptr make(double sampling_freq,
57  double wave_freq,
58  double ampl,
59  T offset = 0,
60  float phase = 0);
61 
62  virtual double sampling_freq() const = 0;
63  virtual gr::analog::gr_waveform_t waveform() const = 0;
64  virtual double frequency() const = 0;
65  virtual double amplitude() const = 0;
66  virtual T offset() const = 0;
67  virtual float phase() const = 0;
68 
69  /*!
70  * Sets the sampling frequency of the signal.
71  * \param sampling_freq sampling frequency
72  */
73  virtual void set_sampling_freq(double sampling_freq) = 0;
74 
75  /*!
76  * Sets the waveform type of signal.
77  * \param waveform waveform type
78  */
79  virtual void set_waveform(gr::analog::gr_waveform_t waveform) = 0;
80 
81  /*!
82  * Sets the frequency of a periodic signal.
83  * \param frequency frequency of the signal
84  */
85  virtual void set_frequency(double frequency) = 0;
86 
87  /*!
88  * Sets the amplitude of a signal.
89  * \param ampl amplitude of the signal
90  */
91  virtual void set_amplitude(double ampl) = 0;
92 
93  /*!
94  * Sets the DC offset of a signal.
95  * \param offset DC offset of the signal
96  */
97  virtual void set_offset(T offset) = 0;
98 
99  /*!
100  * Sets the phase of a periodic signal.
101  * \param phase phase of the signal
102  */
103  virtual void set_phase(float phase) = 0;
104 };
105 
111 } /* namespace analog */
112 } /* namespace gr */
113 
114 #endif /* SIG_SOURCE_H */
sig_source< float > sig_source_f
Definition: sig_source.h:109
gr_waveform_t
Types of signal generator waveforms.
Definition: sig_source_waveform.h:33
sig_source< gr_complex > sig_source_c
Definition: sig_source.h:110
signal generator with T output.
Definition: sig_source.h:39
sig_source< std::int32_t > sig_source_i
Definition: sig_source.h:108
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
boost::shared_ptr< sig_source< T > > sptr
Definition: sig_source.h:43
#define ANALOG_API
Definition: gr-analog/include/gnuradio/analog/api.h:30
sig_source< std::int8_t > sig_source_b
Definition: sig_source.h:106
sig_source< std::int16_t > sig_source_s
Definition: sig_source.h:107