diff options
Diffstat (limited to 'gnuradio-core')
17 files changed, 24 insertions, 549 deletions
diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc index 15452e5399..f19c7303d2 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test-qt.grc @@ -613,10 +613,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -749,7 +749,7 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_psk_mod_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -798,7 +798,7 @@ </connection> <connection> <source_block_id>blocks_packed_to_unpacked_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc index 36238e5c18..20e8e7f7db 100644 --- a/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc +++ b/gnuradio-core/src/examples/ctrlport/pfb_sync_test.grc @@ -558,10 +558,10 @@ </param> </block> <block> - <key>gr_throttle</key> + <key>blocks_throttle</key> <param> <key>id</key> - <value>gr_throttle_0</value> + <value>blocks_throttle_0</value> </param> <param> <key>_enabled</key> @@ -624,7 +624,7 @@ </param> </block> <connection> - <source_block_id>gr_throttle_0</source_block_id> + <source_block_id>blocks_throttle_0</source_block_id> <sink_block_id>digital_psk_mod_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> @@ -661,7 +661,7 @@ </connection> <connection> <source_block_id>blocks_packed_to_unpacked_xx_0</source_block_id> - <sink_block_id>gr_throttle_0</sink_block_id> + <sink_block_id>blocks_throttle_0</sink_block_id> <source_key>0</source_key> <sink_key>0</sink_key> </connection> diff --git a/gnuradio-core/src/examples/mp-sched/affinity_set.py b/gnuradio-core/src/examples/mp-sched/affinity_set.py index 6db632e0fa..c1c1a33932 100755 --- a/gnuradio-core/src/examples/mp-sched/affinity_set.py +++ b/gnuradio-core/src/examples/mp-sched/affinity_set.py @@ -6,6 +6,7 @@ from gnuradio import eng_notation from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from optparse import OptionParser @@ -25,7 +26,7 @@ class affinity_set(gr.top_block): # Blocks ################################################## vec_len = 1 - self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*vec_len, samp_rate) + self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*vec_len, samp_rate) self.gr_null_source_0 = gr.null_source(gr.sizeof_gr_complex*vec_len) self.gr_null_sink_0 = gr.null_sink(gr.sizeof_gr_complex*vec_len) self.gr_filt_0 = gr.fir_filter_ccc(1, 40000*[0.2+0.3j,]) @@ -37,8 +38,8 @@ class affinity_set(gr.top_block): ################################################## # Connections ################################################## - self.connect((self.gr_null_source_0, 0), (self.gr_throttle_0, 0)) - self.connect((self.gr_throttle_0, 0), (self.gr_filt_0, 0)) + self.connect((self.gr_null_source_0, 0), (self.blocks_throttle_0, 0)) + self.connect((self.blocks_throttle_0, 0), (self.gr_filt_0, 0)) self.connect((self.gr_filt_0, 0), (self.gr_filt_1, 0)) self.connect((self.gr_filt_1, 0), (self.gr_null_sink_0, 0)) diff --git a/gnuradio-core/src/examples/network/dial_tone_source.py b/gnuradio-core/src/examples/network/dial_tone_source.py index a8d85c4c57..d0d3cc7a8d 100755 --- a/gnuradio-core/src/examples/network/dial_tone_source.py +++ b/gnuradio-core/src/examples/network/dial_tone_source.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from optparse import OptionParser import sys @@ -45,7 +46,7 @@ class dial_tone_source(gr.top_block): add = blocks.add_ff() # Throttle needed here to account for the other side's audio card sampling rate - thr = gr.throttle(gr.sizeof_float, sample_rate) + thr = blocks.throttle(gr.sizeof_float, sample_rate) sink = gr.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof) self.connect(src0, (add, 0)) self.connect(src1, (add, 1)) diff --git a/gnuradio-core/src/examples/tags/test_file_tags.py b/gnuradio-core/src/examples/tags/test_file_tags.py index 135626d2c6..1dfc9e46cd 100755 --- a/gnuradio-core/src/examples/tags/test_file_tags.py +++ b/gnuradio-core/src/examples/tags/test_file_tags.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import sys try: @@ -36,7 +37,7 @@ def main(): src = gr.vector_source_s(data, True) trigger = gr.vector_source_s(trig, True) - thr = gr.throttle(gr.sizeof_short, 10e3) + thr = blocks.throttle(gr.sizeof_short, 10e3) ann = gr.annotator_alltoall(1000000, gr.sizeof_short) tagger = gr.burst_tagger(gr.sizeof_short) diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 581d57f8d8..d4287685d9 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -167,10 +167,7 @@ set(gr_core_general_triple_threats gr_random_pdu gr_remez gr_skiphead - gr_stretch_ff gr_test - gr_threshold_ff - gr_throttle gr_transcendental gr_vco_f gr_vector_map diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 64b2816327..36ae0de6f3 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -40,10 +40,8 @@ #include <gr_firdes.h> #include <gr_random_pdu.h> #include <gr_fake_channel_coder_pp.h> -#include <gr_throttle.h> #include <gr_transcendental.h> #include <gr_vco_f.h> -#include <gr_threshold_ff.h> #include <gr_pa_2x2_phase_combiner.h> #include <gr_kludge_copy.h> #include <gr_prefs.h> @@ -54,7 +52,6 @@ #include <gr_pack_k_bits_bb.h> #include <gr_feval.h> #include <gr_bin_statistics_f.h> -#include <gr_stretch_ff.h> #include <gr_copy.h> #include <complex_vec_test.h> #include <gr_annotator_alltoall.h> @@ -84,10 +81,8 @@ %include "gr_firdes.i" %include "gr_random_pdu.i" %include "gr_fake_channel_coder_pp.i" -%include "gr_throttle.i" %include "gr_transcendental.i" %include "gr_vco_f.i" -%include "gr_threshold_ff.i" %include "gr_pa_2x2_phase_combiner.i" %include "gr_kludge_copy.i" %include "gr_prefs.i" @@ -98,7 +93,6 @@ %include "gr_pack_k_bits_bb.i" %include "gr_feval.i" %include "gr_bin_statistics_f.i" -%include "gr_stretch_ff.i" %include "gr_copy.i" %include "complex_vec_test.i" %include "gr_annotator_alltoall.i" diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.cc b/gnuradio-core/src/lib/general/gr_stretch_ff.cc deleted file mode 100644 index e89eadf8b1..0000000000 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_stretch_ff.h> -#include <gr_io_signature.h> - -gr_stretch_ff_sptr -gr_make_stretch_ff(float lo, size_t vlen) -{ - return gnuradio::get_initial_sptr(new gr_stretch_ff(lo, vlen)); -} - -gr_stretch_ff::gr_stretch_ff(float lo, size_t vlen) - : gr_sync_block("stretch_ff", - gr_make_io_signature(1, 1, vlen * sizeof(float)), - gr_make_io_signature(1, 1, vlen * sizeof(float))), - d_lo(lo), d_vlen(vlen) -{ -} - -int -gr_stretch_ff::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - for (int count = 0; count < noutput_items; count++) { - float vmax = in[0] - d_lo; - - for (unsigned int i = 1; i < d_vlen; i++) { - float vtmp = in[i] - d_lo; - if (vtmp > vmax) - vmax = vtmp; - } - - if (vmax != 0.0) - for (unsigned int i = 0; i < d_vlen; i++) - out[i] = d_lo * (1.0 - (in[i] - d_lo) / vmax); - else - for (unsigned int i = 0; i < d_vlen; i++) - out[i] = in[i]; - - in += d_vlen; - out += d_vlen; - } - - return noutput_items; -} - diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.h b/gnuradio-core/src/lib/general/gr_stretch_ff.h deleted file mode 100644 index f592c94a78..0000000000 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_STRETCH_FF_H_ -# define INCLUDED_GR_STRETCH_FF_H_ - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -/*! - * \brief adjust y-range of an input vector by mapping to range - * (max-of-input, stipulated-min). Primarily for spectral signature - * matching by normalizing spectrum dynamic ranges. - * \ingroup misc_blk - */ - - -class gr_stretch_ff; -typedef boost::shared_ptr<gr_stretch_ff> gr_stretch_ff_sptr; - -GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); - -class GR_CORE_API gr_stretch_ff : public gr_sync_block -{ - friend GR_CORE_API gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); - - float d_lo; // the constant - size_t d_vlen; - gr_stretch_ff(float lo, size_t vlen); - - public: - float lo() const { return d_lo; } - void set_lo(float lo) { d_lo = lo; } - size_t vlen() const { return d_vlen; } - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_stretch_ff.i b/gnuradio-core/src/lib/general/gr_stretch_ff.i deleted file mode 100644 index 81366655eb..0000000000 --- a/gnuradio-core/src/lib/general/gr_stretch_ff.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,stretch_ff); - -gr_stretch_ff_sptr gr_make_stretch_ff(float lo, size_t vlen); - -class gr_stretch_ff : public gr_sync_block -{ -private: - gr_stretch_ff(float lo, size_t vlen); -}; - diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.cc b/gnuradio-core/src/lib/general/gr_threshold_ff.cc deleted file mode 100644 index 952613151f..0000000000 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -// WARNING: this file is machine generated. Edits will be over written - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_threshold_ff.h> -#include <gr_io_signature.h> - -gr_threshold_ff_sptr -gr_make_threshold_ff (float lo, float hi, float initial_state) -{ - return gnuradio::get_initial_sptr(new gr_threshold_ff (lo, hi, initial_state)); -} - -gr_threshold_ff::gr_threshold_ff (float lo, float hi, float initial_state) - : gr_sync_block ("threshold_ff", - gr_make_io_signature (1, 1, sizeof (float)), - gr_make_io_signature (1, 1, sizeof (float))), - d_lo (lo), d_hi (hi), d_last_state (initial_state) -{ -} - -int -gr_threshold_ff::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const float *in = (const float *) input_items[0]; - float *out = (float *) output_items[0]; - - - for(int i=0; i<noutput_items; i++) { - if (in[i] > d_hi) { - out[i] = 1.0; - d_last_state = 1.0; - } else if (in[i] < d_lo) { - out[i] = 0.0; - d_last_state = 0.0; - } else - out[i] = d_last_state; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.h b/gnuradio-core/src/lib/general/gr_threshold_ff.h deleted file mode 100644 index 678f8b1d2d..0000000000 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_THRESHOLD_FF_H -#define INCLUDED_GR_THRESHOLD_FF_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_threshold_ff; -typedef boost::shared_ptr<gr_threshold_ff> gr_threshold_ff_sptr; - -GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0); - -/*! - * \brief Please fix my documentation - * \ingroup misc_blk - */ -class GR_CORE_API gr_threshold_ff : public gr_sync_block -{ - friend GR_CORE_API gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state); - - float d_lo,d_hi; // the constant - float d_last_state; - gr_threshold_ff (float lo, float hi, float initial_state); - - public: - float lo () const { return d_lo; } - void set_lo (float lo) { d_lo = lo; } - float hi () const { return d_hi; } - void set_hi (float hi) { d_hi = hi; } - float last_state () const { return d_last_state; } - void set_last_state (float last_state) { d_last_state = last_state; } - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_threshold_ff.i b/gnuradio-core/src/lib/general/gr_threshold_ff.i deleted file mode 100644 index 7584feea8a..0000000000 --- a/gnuradio-core/src/lib/general/gr_threshold_ff.i +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -GR_SWIG_BLOCK_MAGIC(gr,threshold_ff); - -gr_threshold_ff_sptr gr_make_threshold_ff (float lo, float hi, float initial_state=0); - -class gr_threshold_ff : public gr_sync_block -{ - private: - gr_threshold_ff (float lo, float hi, float initial_state); - - public: - float lo () const { return d_lo; } - void set_lo (float lo) { d_lo = lo; } - float hi () const { return d_hi; } - void set_hi (float hi) { d_hi = hi; } - float last_state () const { return d_last_state; } - void set_last_state (float last_state) { d_last_state = last_state; } -}; diff --git a/gnuradio-core/src/lib/general/gr_throttle.cc b/gnuradio-core/src/lib/general/gr_throttle.cc deleted file mode 100644 index 1c6c8cf893..0000000000 --- a/gnuradio-core/src/lib/general/gr_throttle.cc +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_throttle.h> -#include <gr_io_signature.h> -#include <cstring> -#include <boost/thread/thread.hpp> - -class gr_throttle_impl : public gr_throttle{ -public: - gr_throttle_impl(size_t itemsize): - gr_sync_block("throttle", - gr_make_io_signature(1, 1, itemsize), - gr_make_io_signature(1, 1, itemsize)), - d_itemsize(itemsize) - { - /* NOP */ - } - - double sample_rate(){ - return d_samps_per_us*1e6; - } - - void set_sample_rate(double rate){ - //changing the sample rate performs a reset of state params - d_start = boost::get_system_time(); - d_total_samples = 0; - d_samps_per_tick = rate/boost::posix_time::time_duration::ticks_per_second(); - d_samps_per_us = rate/1e6; - } - - int work ( - int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items - ){ - //calculate the expected number of samples to have passed through - boost::system_time now = boost::get_system_time(); - boost::int64_t ticks = (now - d_start).ticks(); - uint64_t expected_samps = uint64_t(d_samps_per_tick*ticks); - - //if the expected samples was less, we need to throttle back - if (d_total_samples > expected_samps){ - boost::this_thread::sleep(boost::posix_time::microseconds( - long((d_total_samples - expected_samps)/d_samps_per_us) - )); - } - - //copy all samples output[i] <= input[i] - const char *in = (const char *) input_items[0]; - char *out = (char *) output_items[0]; - std::memcpy(out, in, noutput_items * d_itemsize); - d_total_samples += noutput_items; - return noutput_items; - } - -private: - boost::system_time d_start; - size_t d_itemsize; - uint64_t d_total_samples; - double d_samps_per_tick, d_samps_per_us; - - void setup_rpc(){ -#ifdef GR_CTRLPORT - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_get<gr_throttle_impl, double>( - alias(), "sample_rate", &gr_throttle_impl::sample_rate, - pmt::mp(0.0), pmt::mp(100.0e6), pmt::mp(0.0), - "Hz", "Sample Rate", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); - d_rpc_vars.push_back( - rpcbasic_sptr(new rpcbasic_register_set<gr_throttle_impl, double>( - alias(), "sample_rate", &gr_throttle_impl::set_sample_rate, - pmt::mp(0.0), pmt::mp(100.0e6), pmt::mp(0.0), - "Hz", "Sample Rate", RPC_PRIVLVL_MIN, - DISPTIME | DISPOPTSTRIP))); -#endif - } -}; - -gr_throttle::sptr -gr_make_throttle(size_t itemsize, double samples_per_sec) -{ - gr_throttle::sptr throttle(new gr_throttle_impl(itemsize)); - throttle->set_sample_rate(samples_per_sec); - return throttle; -} diff --git a/gnuradio-core/src/lib/general/gr_throttle.h b/gnuradio-core/src/lib/general/gr_throttle.h deleted file mode 100644 index 2235ffacf1..0000000000 --- a/gnuradio-core/src/lib/general/gr_throttle.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_THROTTLE_H -#define INCLUDED_GR_THROTTLE_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -/*! - * \brief throttle flow of samples such that the average rate does not exceed samples_per_sec. - * \ingroup misc_blk - * - * input: one stream of itemsize; output: one stream of itemsize - * - * N.B. this should only be used in GUI apps where there is no other - * rate limiting block. It is not intended nor effective at precisely - * controlling the rate of samples. That should be controlled by a - * source or sink tied to sample clock. E.g., a USRP or audio card. - */ -class GR_CORE_API gr_throttle : virtual public gr_sync_block -{ -public: - typedef boost::shared_ptr<gr_throttle> sptr; - - //! Sets the sample rate in samples per second - virtual double sample_rate() = 0; - virtual void set_sample_rate(double rate) = 0; -}; - -GR_CORE_API gr_throttle::sptr gr_make_throttle(size_t itemsize, double samples_per_sec); - -#endif /* INCLUDED_GR_THROTTLE_H */ diff --git a/gnuradio-core/src/lib/general/gr_throttle.i b/gnuradio-core/src/lib/general/gr_throttle.i deleted file mode 100644 index 5ba32de6ed..0000000000 --- a/gnuradio-core/src/lib/general/gr_throttle.i +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005-2011 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -%{ -#include <gr_throttle.h> -%} - -GR_SWIG_BLOCK_MAGIC(gr,throttle); - -%include <gr_throttle.h> diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py index 27858b575b..091f0642c6 100644 --- a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py +++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py @@ -21,6 +21,7 @@ # from gnuradio import gr +from gnuradio import blocks import sys, time try: @@ -44,7 +45,7 @@ class GrDataPlotterC(gr.top_block): self._data_len = 0 self.src = gr.vector_source_c([]) - self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) self.snk = qtgui.time_sink_c(self._npts, samp_rate, self._name, 1) self.snk.enable_autoscale(True) @@ -129,7 +130,7 @@ class GrDataPlotterF(gr.top_block): self._data_len = 0 self.src = gr.vector_source_f([]) - self.thr = gr.throttle(gr.sizeof_float, rate) + self.thr = blocks.throttle(gr.sizeof_float, rate) self.snk = qtgui.time_sink_f(self._npts, samp_rate, self._name, 1) self.snk.enable_autoscale(True) @@ -207,7 +208,7 @@ class GrDataPlotterConst(gr.top_block): self._data_len = 0 self.src = gr.vector_source_c([]) - self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) self.snk = qtgui.const_sink_c(self._npts, self._name, 1) self.snk.enable_autoscale(True) @@ -286,7 +287,7 @@ class GrDataPlotterPsdC(gr.top_block): self._data_len = 0 self.src = gr.vector_source_c([]) - self.thr = gr.throttle(gr.sizeof_gr_complex, rate) + self.thr = blocks.throttle(gr.sizeof_gr_complex, rate) self.snk = qtgui.freq_sink_c(self._fftsize, self._wintype, self._fc, self._samp_rate, self._name, 1) @@ -359,7 +360,7 @@ class GrDataPlotterPsdF(gr.top_block): self._data_len = 0 self.src = gr.vector_source_f([]) - self.thr = gr.throttle(gr.sizeof_float, rate) + self.thr = blocks.throttle(gr.sizeof_float, rate) self.snk = qtgui.freq_sink_f(self._fftsize, self._wintype, self._fc, self._samp_rate, self._name, 1) @@ -432,7 +433,7 @@ class GrTimeRasterF(gr.top_block): self._data_len = 0 self.src = gr.vector_source_f([]) - self.thr = gr.throttle(gr.sizeof_float, rate) + self.thr = blocks.throttle(gr.sizeof_float, rate) self.snk = qtgui.time_raster_sink_f(samp_rate, self._npts, self._rows, [], [], self._name, 1) @@ -499,7 +500,7 @@ class GrTimeRasterB(gr.top_block): self._data_len = 0 self.src = gr.vector_source_b([]) - self.thr = gr.throttle(gr.sizeof_char, rate) + self.thr = blocks.throttle(gr.sizeof_char, rate) self.snk = qtgui.time_raster_sink_b(samp_rate, self._npts, self._rows, [], [], self._name, 1) |