GNU Radio Manual and C++ API Reference  3.10.9.1
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  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 
12 #ifndef SIG_SOURCE_H
13 #define SIG_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 signal generator with T output.
24  * \ingroup waveform_generators_blk
25  */
26 template <class T>
27 class ANALOG_API sig_source : virtual public sync_block
28 {
29 public:
30  // gr::analog::sig_source::sptr
31  typedef std::shared_ptr<sig_source<T>> sptr;
32 
33  /*!
34  * Build a signal source block.
35  *
36  * \param sampling_freq Sampling rate of signal.
37  * \param waveform wavetform type.
38  * \param wave_freq Frequency of waveform (relative to sampling_freq).
39  * \param ampl Signal amplitude.
40  * \param offset offset of signal.
41  * \param phase Initial phase of the signal
42  */
43  static sptr make(double sampling_freq,
45  double wave_freq,
46  double ampl,
47  T offset = 0,
48  float phase = 0);
49 
50  virtual double sampling_freq() const = 0;
51  virtual gr::analog::gr_waveform_t waveform() const = 0;
52  virtual double frequency() const = 0;
53  virtual double amplitude() const = 0;
54  virtual T offset() const = 0;
55  virtual float phase() const = 0;
56 
57  /*!
58  * Sets the sampling frequency of the signal.
59  * \param sampling_freq sampling frequency
60  */
61  virtual void set_sampling_freq(double sampling_freq) = 0;
62 
63  /*!
64  * Sets the waveform type of signal.
65  * \param waveform waveform type
66  */
67  virtual void set_waveform(gr::analog::gr_waveform_t waveform) = 0;
68 
69  /*!
70  * Sets the frequency of a periodic signal.
71  * \param frequency frequency of the signal
72  */
73  virtual void set_frequency(double frequency) = 0;
74 
75  /*!
76  * Sets the amplitude of a signal.
77  * \param ampl amplitude of the signal
78  */
79  virtual void set_amplitude(double ampl) = 0;
80 
81  /*!
82  * Sets the DC offset of a signal.
83  * \param offset DC offset of the signal
84  */
85  virtual void set_offset(T offset) = 0;
86 
87  /*!
88  * Sets the phase of a periodic signal.
89  * \param phase phase of the signal
90  */
91  virtual void set_phase(float phase) = 0;
92 };
93 
99 } /* namespace analog */
100 } /* namespace gr */
101 
102 #endif /* SIG_SOURCE_H */
signal generator with T output.
Definition: sig_source.h:28
virtual float phase() const =0
virtual void set_frequency(double frequency)=0
virtual double amplitude() const =0
virtual void set_amplitude(double ampl)=0
virtual void set_sampling_freq(double sampling_freq)=0
virtual void set_waveform(gr::analog::gr_waveform_t waveform)=0
static sptr make(double sampling_freq, gr::analog::gr_waveform_t waveform, double wave_freq, double ampl, T offset=0, float phase=0)
std::shared_ptr< sig_source< T > > sptr
Definition: sig_source.h:31
virtual T offset() const =0
virtual void set_phase(float phase)=0
virtual double sampling_freq() const =0
virtual gr::analog::gr_waveform_t waveform() const =0
virtual void set_offset(T offset)=0
virtual double frequency() const =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
gr_waveform_t
Types of signal generator waveforms.
Definition: sig_source_waveform.h:21
sig_source< gr_complex > sig_source_c
Definition: sig_source.h:98
sig_source< std::int8_t > sig_source_b
Definition: sig_source.h:94
sig_source< std::int16_t > sig_source_s
Definition: sig_source.h:95
sig_source< float > sig_source_f
Definition: sig_source.h:97
sig_source< std::int32_t > sig_source_i
Definition: sig_source.h:96
GNU Radio logging wrapper.
Definition: basic_block.h:29