Question in source code of gr_sig_source_f

Hi,

I was browsing the GNU radio C++ API. Here I have a couple of questions
about the class reference of gr_sig_source_f. (Signal generator)

  1. For the type of public member function waveform(), i.e. gr_waveform_t
    waveform () const. Where can I refer to the definition of
    “gr_waveform_t”?
    Is there any description of how waveforms(sine wave) are generated?

  2. I am going to generate a set of sine waves at different frequencies.
    If
    these sine waves are obtained from the iteration equations of harmonious
    oscillators: v(t+dt)=v(t) - omega^2 * x(t)dt ; x(t+dt)=x(t) + v(t)dt,
    is
    that different from the way of sine wave generation in gnu radio. Do I
    need
    to create a new sine wave generation block instead of the defaut one?
    (x(t)

  • displacement, v(t) - velocity)

Thank you,

Milo

On Thu, Aug 06, 2009 at 12:39:15PM -0700, Milo W. wrote:

Hi,

I was browsing the GNU radio C++ API. Here I have a couple of questions
about the class reference of gr_sig_source_f. (Signal generator)

  1. For the type of public member function waveform(), i.e. gr_waveform_t
    waveform () const. Where can I refer to the definition of “gr_waveform_t”?

Hi Milo,

You can find it in gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h

(Given that there were only 3 includes in gr_sig_source_f, it didn’t
take long to find it… grep would have worked too)

http://gnuradio.org/doc/doxygen/gr__sig__source__f_8h-source.html
http://gnuradio.org/doc/doxygen/gr__sig__source__waveform_8h.html

Is there any description of how waveforms(sine wave) are generated?

Use the source Luke!

gnuradio-core/src/lib/gengen/gr_sig_source_f.cc

  1. I am going to generate a set of sine waves at different frequencies. If
    these sine waves are obtained from the iteration equations of harmonious
    oscillators: v(t+dt)=v(t) - omega^2 * x(t)dt ; x(t+dt)=x(t) + v(t)dt, is
    that different from the way of sine wave generation in gnu radio. Do I need
    to create a new sine wave generation block instead of the defaut one? (x(t)
  • displacement, v(t) - velocity)

Thank you,
Milo

No, there’s no reason to reimplement the sine generator unless
you enjoy that kind of thing. First thing to remember is that the
block does what it says: it generates a sine wave of the specified
frequency and amplitude.

We also have blocks to generate sinusoids with frequency a function
of its input stream. See e.g, gr_frequency_modulator_fc or gr_vco_f

Eric