diff options
author | Tom Rondeau <trondeau@vt.edu> | 2012-11-06 14:28:22 -0500 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2012-11-06 14:40:43 -0500 |
commit | fd110bdbbe8bc40781c34f33c70deec5b7931109 (patch) | |
tree | ef18e813add19b09c57cc21cb672ea602701405b /gr-audio/examples | |
parent | 0c9c16fb008b02a5af39fb22e18acfff2dbd933a (diff) |
analog: Removing reference to gr.sig_source_X and gr.noise_source_X where possible.
Passing make and make test. Examples and apps need testing.
gr-filter relies on sig_source and noise_source, so can't remove them from core.
Diffstat (limited to 'gr-audio/examples')
-rw-r--r-- | gr-audio/examples/c++/CMakeLists.txt | 3 | ||||
-rw-r--r-- | gr-audio/examples/c++/dial_tone.cc | 8 | ||||
-rwxr-xr-x | gr-audio/examples/python/dial_tone.py | 16 | ||||
-rwxr-xr-x | gr-audio/examples/python/dial_tone_daemon.py | 16 | ||||
-rwxr-xr-x | gr-audio/examples/python/dial_tone_wav.py | 7 | ||||
-rwxr-xr-x | gr-audio/examples/python/mono_tone.py | 11 | ||||
-rwxr-xr-x | gr-audio/examples/python/multi_tone.py | 18 | ||||
-rwxr-xr-x | gr-audio/examples/python/test_resampler.py | 12 |
8 files changed, 48 insertions, 43 deletions
diff --git a/gr-audio/examples/c++/CMakeLists.txt b/gr-audio/examples/c++/CMakeLists.txt index f0d45817cb..6f3eda2730 100644 --- a/gr-audio/examples/c++/CMakeLists.txt +++ b/gr-audio/examples/c++/CMakeLists.txt @@ -19,8 +19,9 @@ include_directories(${GR_AUDIO_INCLUDE_DIRS}) include_directories(${GNURADIO_CORE_INCLUDE_DIRS}) +include_directories(${GR_ANALOG_INCLUDE_DIRS}) add_executable(dial_tone dial_tone.cc) -target_link_libraries(dial_tone gnuradio-audio) +target_link_libraries(dial_tone gnuradio-audio gnuradio-analog) INSTALL(TARGETS dial_tone diff --git a/gr-audio/examples/c++/dial_tone.cc b/gr-audio/examples/c++/dial_tone.cc index 4cd0ff59cf..801ff35f2e 100644 --- a/gr-audio/examples/c++/dial_tone.cc +++ b/gr-audio/examples/c++/dial_tone.cc @@ -38,9 +38,11 @@ // Include header files for each block used in flowgraph #include <gr_top_block.h> -#include <gr_sig_source_f.h> +#include <analog/sig_source_f.h> #include <gr_audio_sink.h> +using namespace gr; + int main(int argc, char **argv) { int rate = 48000; // Audio card sample rate @@ -52,8 +54,8 @@ int main(int argc, char **argv) gr_top_block_sptr tb = gr_make_top_block("dial_tone"); // Construct a real-valued signal source for each tone, at given sample rate - gr_sig_source_f_sptr src0 = gr_make_sig_source_f(rate, GR_SIN_WAVE, 350, ampl); - gr_sig_source_f_sptr src1 = gr_make_sig_source_f(rate, GR_SIN_WAVE, 440, ampl); + analog::sig_source_f::sptr src0 = analog::sig_source_f::make(rate, analog::GR_SIN_WAVE, 350, ampl); + analog::sig_source_f::sptr src1 = analog::sig_source_f::make(rate, analog::GR_SIN_WAVE, 440, ampl); // Construct an audio sink to accept audio tones audio_sink::sptr sink = audio_make_sink(rate); diff --git a/gr-audio/examples/python/dial_tone.py b/gr-audio/examples/python/dial_tone.py index 5661d13d48..9c8e8d460d 100755 --- a/gr-audio/examples/python/dial_tone.py +++ b/gr-audio/examples/python/dial_tone.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr from gnuradio import audio +from gnuradio import analog from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -35,7 +36,7 @@ class my_top_block(gr.top_block): help="pcm output device name. E.g., hw:0,0 or /dev/dsp") parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, help="set sample rate to RATE (48000)") - (options, args) = parser.parse_args () + (options, args) = parser.parse_args() if len(args) != 0: parser.print_help() raise SystemExit, 1 @@ -43,12 +44,11 @@ class my_top_block(gr.top_block): sample_rate = int(options.sample_rate) ampl = 0.1 - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl) - dst = audio.sink (sample_rate, options.audio_output) - self.connect (src0, (dst, 0)) - self.connect (src1, (dst, 1)) - + src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 350, ampl) + src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, ampl) + dst = audio.sink(sample_rate, options.audio_output) + self.connect(src0, (dst, 0)) + self.connect(src1, (dst, 1)) if __name__ == '__main__': try: diff --git a/gr-audio/examples/python/dial_tone_daemon.py b/gr-audio/examples/python/dial_tone_daemon.py index b25baebee2..2d40ac9714 100755 --- a/gr-audio/examples/python/dial_tone_daemon.py +++ b/gr-audio/examples/python/dial_tone_daemon.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gru from gnuradio import audio +from gnuradio import analog from gnuradio.eng_option import eng_option from optparse import OptionParser import os @@ -36,7 +37,7 @@ class my_top_block(gr.top_block): help="pcm output device name. E.g., hw:0,0 or /dev/dsp") parser.add_option("-r", "--sample-rate", type="eng_float", default=48000, help="set sample rate to RATE (48000)") - (options, args) = parser.parse_args () + (options, args) = parser.parse_args() if len(args) != 0: parser.print_help() raise SystemExit, 1 @@ -44,12 +45,11 @@ class my_top_block(gr.top_block): sample_rate = int(options.sample_rate) ampl = 0.1 - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl) - dst = audio.sink (sample_rate, options.audio_output) - self.connect (src0, (dst, 0)) - self.connect (src1, (dst, 1)) - + src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 350, ampl) + src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, ampl) + dst = audio.sink(sample_rate, options.audio_output) + self.connect(src0, (dst, 0)) + self.connect(src1, (dst, 1)) if __name__ == '__main__': pid = gru.daemonize() diff --git a/gr-audio/examples/python/dial_tone_wav.py b/gr-audio/examples/python/dial_tone_wav.py index c06af55b70..e044a83f14 100755 --- a/gr-audio/examples/python/dial_tone_wav.py +++ b/gr-audio/examples/python/dial_tone_wav.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,6 +23,7 @@ # GNU Radio example program to record a dial tone to a WAV file from gnuradio import gr +from gnuradio import analog from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -45,8 +46,8 @@ class my_top_block(gr.top_block): sample_rate = int(options.sample_rate) ampl = 0.1 - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 350, ampl) - src1 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 440, ampl) + src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 350, ampl) + src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, ampl) head0 = gr.head(gr.sizeof_float, int(options.samples)) head1 = gr.head(gr.sizeof_float, int(options.samples)) dst = gr.wavfile_sink(args[0], 2, int(options.sample_rate), 16) diff --git a/gr-audio/examples/python/mono_tone.py b/gr-audio/examples/python/mono_tone.py index bce486e4ab..376ed4fee6 100755 --- a/gr-audio/examples/python/mono_tone.py +++ b/gr-audio/examples/python/mono_tone.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import analog from gnuradio import audio from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -50,11 +51,11 @@ class my_top_block(gr.top_block): sample_rate = int(options.sample_rate) ampl = 0.1 - src0 = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, 650, ampl) + src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 650, ampl) - dst = audio.sink (sample_rate, - options.audio_output, - options.ok_to_block) + dst = audio.sink(sample_rate, + options.audio_output, + options.ok_to_block) self.connect (src0, (dst, 0)) diff --git a/gr-audio/examples/python/multi_tone.py b/gr-audio/examples/python/multi_tone.py index 00c213b634..d311247520 100755 --- a/gr-audio/examples/python/multi_tone.py +++ b/gr-audio/examples/python/multi_tone.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2006,2007 Free Software Foundation, Inc. +# Copyright 2004,2006,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -43,7 +43,7 @@ class my_top_block(gr.top_block): help="set maximum channels to use") parser.add_option("-D", "--dont-block", action="store_false", default=True, dest="ok_to_block") - (options, args) = parser.parse_args () + (options, args) = parser.parse_args() if len(args) != 0: parser.print_help() raise SystemExit, 1 @@ -69,19 +69,19 @@ class my_top_block(gr.top_block): # progression = (7, 11, 1, 5) progression = (7, 11, 1, 5, 9) - dst = audio.sink (sample_rate, - options.audio_output, - options.ok_to_block) + dst = audio.sink(sample_rate, + options.audio_output, + options.ok_to_block) max_chan = dst.input_signature().max_streams() if (max_chan == -1) or (max_chan > limit_channels): max_chan = limit_channels - for i in range (max_chan): - quo, rem = divmod (i, len (progression)) + for i in range(max_chan): + quo, rem = divmod(i, len (progression)) freq = base * ratios[progression[rem]] * (quo + 1) - src = gr.sig_source_f (sample_rate, gr.GR_SIN_WAVE, freq, ampl) - self.connect (src, (dst, i)) + src = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, freq, ampl) + self.connect(src, (dst, i)) if __name__ == '__main__': try: diff --git a/gr-audio/examples/python/test_resampler.py b/gr-audio/examples/python/test_resampler.py index db7f79fba0..9775754e39 100755 --- a/gr-audio/examples/python/test_resampler.py +++ b/gr-audio/examples/python/test_resampler.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,6 +22,7 @@ from gnuradio import gr, gru, blks2 from gnuradio import audio +from gnuradio import analog from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -38,7 +39,7 @@ class my_top_block(gr.top_block): help="set input sample rate to RATE (%default)") parser.add_option("-o", "--output-rate", type="eng_float", default=48000, help="set output sample rate to RATE (%default)") - (options, args) = parser.parse_args () + (options, args) = parser.parse_args() if len(args) != 0: parser.print_help() raise SystemExit, 1 @@ -53,11 +54,10 @@ class my_top_block(gr.top_block): print "decim =", decim ampl = 0.1 - src0 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 650, ampl) + src0 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 650, ampl) rr = blks2.rational_resampler_fff(interp, decim) - dst = audio.sink (output_rate, options.audio_output) - self.connect (src0, rr, (dst, 0)) - + dst = audio.sink(output_rate, options.audio_output) + self.connect(src0, rr, (dst, 0)) if __name__ == '__main__': try: |