diff options
author | Tom Rondeau <tom@trondeau.com> | 2013-11-01 17:57:39 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2013-11-01 17:57:39 -0400 |
commit | 9c1e8f1c6579d22e17f9f194dcff5d2af32192be (patch) | |
tree | 32bae065aba21f6563caff29fc86f87a1d8412d0 | |
parent | c3f9b78534477a292a3bd5887fbd282c76a38430 (diff) |
runtime: changed name from set_group_delay to declare_sample_delay.
-rw-r--r-- | gnuradio-runtime/include/gnuradio/block.h | 44 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/buffer.h | 20 | ||||
-rw-r--r-- | gnuradio-runtime/lib/block.cc | 18 | ||||
-rw-r--r-- | gnuradio-runtime/lib/buffer.cc | 20 | ||||
-rw-r--r-- | gnuradio-runtime/lib/flat_flowgraph.cc | 2 | ||||
-rw-r--r-- | gnuradio-runtime/swig/block.i | 6 | ||||
-rw-r--r-- | gr-blocks/lib/delay_impl.cc | 2 | ||||
-rw-r--r-- | gr-filter/grc/filter_fft_filter_xxx.xml | 7 | ||||
-rw-r--r-- | gr-filter/grc/filter_fir_filter_xxx.xml | 7 | ||||
-rw-r--r-- | gr-filter/grc/filter_interp_fir_filter_xxx.xml | 7 |
10 files changed, 67 insertions, 66 deletions
diff --git a/gnuradio-runtime/include/gnuradio/block.h b/gnuradio-runtime/include/gnuradio/block.h index 026e4476ef..112d251587 100644 --- a/gnuradio-runtime/include/gnuradio/block.h +++ b/gnuradio-runtime/include/gnuradio/block.h @@ -86,37 +86,41 @@ namespace gr { void set_history(unsigned history); /*! - * Sets the group delay of the block. Since group delay of blocks - * like filters is derived from the taps and not the block itself, - * we cannot automatically calculate this value and so leave it as - * a user-defined property. It defaults to 0 is not set. + * Declares the block's delay in samples. Since the delay of + * blocks like filters is derived from the taps and not the block + * itself, we cannot automatically calculate this value and so + * leave it as a user-defined property. It defaults to 0 is not + * set. * - * The group delay is mostly used to adjust the placement of the - * tags and is not currently used for any signal processing. When - * a tag is passed through a block with internal delay, its - * location should be moved based on the group delay of the - * block. This interface allows us to set this. + * This does not actively set the delay; it just tells the + * scheduler what the delay is. + * + * This delay is mostly used to adjust the placement of the tags + * and is not currently used for any signal processing. When a tag + * is passed through a block with internal delay, its location + * should be moved based on the delay of the block. This interface + * allows us to tell the scheduler this value. * * \param which The buffer on which to set the delay. - * \param delay The group delay of the data stream. + * \param delay The sample delay of the data stream. */ - void set_group_delay(int which, unsigned delay); + void declare_sample_delay(int which, unsigned delay); /*! - * Convenience wrapper to gr::block::set_group_delay(int which, unsigned delay) + * Convenience wrapper to gr::block::declare_delay(int which, unsigned delay) * to set all ports to the same delay. */ - void set_group_delay(unsigned delay); + void declare_sample_delay(unsigned delay); /*! - * Gets the group delay of the block. Since group delay of blocks - * like filters is derived from the taps and not the block itself, - * we cannot automatically calculate this value and so leave it as - * a user-defined property. It defaults to 0 is not set. + * Gets the delay of the block. Since the delay of blocks like + * filters is derived from the taps and not the block itself, we + * cannot automatically calculate this value and so leave it as a + * user-defined property. It defaults to 0 is not set. * - * \param which Which port from which to get the group delay. + * \param which Which port from which to get the sample delay. */ - unsigned group_delay(int which) const; + unsigned sample_delay(int which) const; /*! * \brief Return true if this block has a fixed input to output rate. @@ -569,7 +573,7 @@ namespace gr { double d_relative_rate; // approx output_rate / input_rate block_detail_sptr d_detail; // implementation details unsigned d_history; - unsigned d_group_delay; + unsigned d_attr_delay; // the block's sample delay bool d_fixed_rate; bool d_max_noutput_items_set; // if d_max_noutput_items is valid int d_max_noutput_items; // value of max_noutput_items for this block diff --git a/gnuradio-runtime/include/gnuradio/buffer.h b/gnuradio-runtime/include/gnuradio/buffer.h index e8e142028a..4e95783733 100644 --- a/gnuradio-runtime/include/gnuradio/buffer.h +++ b/gnuradio-runtime/include/gnuradio/buffer.h @@ -140,7 +140,7 @@ namespace gr { char *d_base; // base address of buffer unsigned int d_bufsize; // in items - // Keep track of maximum group delay of any reader; Only prune tags past this. + // Keep track of maximum sample delay of any reader; Only prune tags past this. unsigned d_max_reader_delay; private: @@ -210,7 +210,7 @@ namespace gr { * \param buf is the buffer the \p gr::buffer_reader reads from. * \param nzero_preload -- number of zero items to "preload" into buffer. * \param link is the block that reads from the buffer using this gr::buffer_reader. - * \param delay Optional setting for the buffer's group delay. + * \param delay Optional setting to declare the buffer's sample delay. */ GR_RUNTIME_API buffer_reader_sptr buffer_add_reader(buffer_sptr buf, int nzero_preload, block_sptr link=block_sptr(), int delay=0); @@ -231,20 +231,20 @@ namespace gr { ~buffer_reader(); /*! - * Set group delay for this reader. + * Declares the sample delay for this reader. * - * See gr::block::set_group_delay for details. + * See gr::block::declare_sample_delay for details. * - * \param delay The new group delay + * \param delay The new sample delay */ - void set_group_delay(unsigned delay); + void declare_sample_delay(unsigned delay); /*! - * Gets the group delay for this reader. + * Gets the sample delay for this reader. * - * See gr::block::group_delay for details. + * See gr::block::sample_delay for details. */ - unsigned group_delay() const; + unsigned sample_delay() const; /*! * \brief Return number of items available for reading. @@ -318,7 +318,7 @@ namespace gr { unsigned int d_read_index; // in items [0,d->buffer.d_bufsize) uint64_t d_abs_read_offset; // num items seen since the start boost::weak_ptr<block> d_link; // block that reads via this buffer reader - unsigned d_group_delay; // group delay for tag propagation + unsigned d_attr_delay; // sample delay attribute for tag propagation //! constructor is private. Use gr::buffer::add_reader to create instances buffer_reader(buffer_sptr buffer, unsigned int read_index, diff --git a/gnuradio-runtime/lib/block.cc b/gnuradio-runtime/lib/block.cc index af963c9977..442f8dde77 100644 --- a/gnuradio-runtime/lib/block.cc +++ b/gnuradio-runtime/lib/block.cc @@ -44,7 +44,7 @@ namespace gr { d_is_unaligned(false), d_relative_rate (1.0), d_history(1), - d_group_delay(0), + d_attr_delay(0), d_fixed_rate(false), d_max_noutput_items_set(false), d_max_noutput_items(0), @@ -123,30 +123,30 @@ namespace gr { } void - block::set_group_delay(unsigned delay) + block::declare_sample_delay(unsigned delay) { - d_group_delay = delay; + d_attr_delay = delay; if(d_detail) { unsigned int nins = static_cast<unsigned int>(d_detail->ninputs()); for(unsigned int n = 0; n < nins; n++) { - d_detail->input(n)->set_group_delay(d_group_delay); + d_detail->input(n)->declare_sample_delay(d_attr_delay); } } } void - block::set_group_delay(int which, unsigned delay) + block::declare_sample_delay(int which, unsigned delay) { - d_group_delay = delay; + d_attr_delay = delay; if(d_detail) { - d_detail->input(which)->set_group_delay(d_group_delay); + d_detail->input(which)->declare_sample_delay(d_attr_delay); } } unsigned - block::group_delay(int which) const + block::sample_delay(int which) const { - return d_group_delay; + return d_attr_delay; } // stub implementation: 1:1 diff --git a/gnuradio-runtime/lib/buffer.cc b/gnuradio-runtime/lib/buffer.cc index b5cc19c35b..afa3efac34 100644 --- a/gnuradio-runtime/lib/buffer.cc +++ b/gnuradio-runtime/lib/buffer.cc @@ -203,7 +203,7 @@ namespace gr { buf->index_sub(buf->d_write_index, nzero_preload), link)); - r->set_group_delay(delay); + r->declare_sample_delay(delay); buf->d_readers.push_back(r.get ()); return r; @@ -262,7 +262,7 @@ namespace gr { // therefore lose little time this way. while(itr != d_item_tags.end()) { item_time = (*itr).offset; - if(item_time+d_max_reader_delay < max_time) { + if(item_time+d_max_reader_delay + bufsize() < max_time) { d_item_tags.erase(itr); itr = d_item_tags.begin(); } @@ -282,7 +282,7 @@ namespace gr { buffer_reader::buffer_reader(buffer_sptr buffer, unsigned int read_index, block_sptr link) : d_buffer(buffer), d_read_index(read_index), d_abs_read_offset(0), d_link(link), - d_group_delay(0) + d_attr_delay(0) { s_buffer_reader_count++; @@ -296,17 +296,17 @@ namespace gr { } void - buffer_reader::set_group_delay(unsigned delay) + buffer_reader::declare_sample_delay(unsigned delay) { - d_group_delay = delay; - d_buffer->d_max_reader_delay = std::max(d_group_delay, + d_attr_delay = delay; + d_buffer->d_max_reader_delay = std::max(d_attr_delay, d_buffer->d_max_reader_delay); } unsigned - buffer_reader::group_delay() const + buffer_reader::sample_delay() const { - return d_group_delay; + return d_attr_delay; } int @@ -342,7 +342,7 @@ namespace gr { uint64_t item_time; while(itr != d_buffer->get_tags_end()) { - item_time = (*itr).offset + d_group_delay; + item_time = (*itr).offset + d_attr_delay; if((item_time >= abs_start) && (item_time < abs_end)) { std::vector<long>::iterator id_itr; @@ -351,7 +351,7 @@ namespace gr { // If id is not in the vector of marked blocks if(id_itr == itr->marked_deleted.end()) { tag_t t = *itr; - t.offset += d_group_delay; + t.offset += d_attr_delay; v.push_back(t); v.back().marked_deleted.clear(); } diff --git a/gnuradio-runtime/lib/flat_flowgraph.cc b/gnuradio-runtime/lib/flat_flowgraph.cc index 52fdfba621..9e5964cb7d 100644 --- a/gnuradio-runtime/lib/flat_flowgraph.cc +++ b/gnuradio-runtime/lib/flat_flowgraph.cc @@ -200,7 +200,7 @@ namespace gr { std::cout << "Setting input " << dst_port << " from edge " << (*e) << std::endl; detail->set_input(dst_port, buffer_add_reader(src_buffer, grblock->history()-1, grblock, - grblock->group_delay(src_port))); + grblock->sample_delay(src_port))); } } diff --git a/gnuradio-runtime/swig/block.i b/gnuradio-runtime/swig/block.i index 746161ff62..37038d4323 100644 --- a/gnuradio-runtime/swig/block.i +++ b/gnuradio-runtime/swig/block.i @@ -44,9 +44,9 @@ class gr::block : public gr::basic_block unsigned history () const; - void set_group_delay(int which, unsigned delay); - void set_group_delay(unsigned delay); - unsigned group_delay(int which) const; + void declare_sample_delay(int which, int delay); + void declare_sample_delay(unsigned int delay); + unsigned sample_delay(int which) const; int output_multiple () const; double relative_rate () const; diff --git a/gr-blocks/lib/delay_impl.cc b/gr-blocks/lib/delay_impl.cc index 342beab707..7ae4037780 100644 --- a/gr-blocks/lib/delay_impl.cc +++ b/gr-blocks/lib/delay_impl.cc @@ -72,7 +72,7 @@ namespace gr { gr::thread::scoped_lock l(d_mutex_delay); int old = dly(); set_history(d+1); - set_group_delay(history()); + declare_sample_delay(history()-1); d_delta += dly() - old; } } diff --git a/gr-filter/grc/filter_fft_filter_xxx.xml b/gr-filter/grc/filter_fft_filter_xxx.xml index cb6926dde3..99b02cbab8 100644 --- a/gr-filter/grc/filter_fft_filter_xxx.xml +++ b/gr-filter/grc/filter_fft_filter_xxx.xml @@ -10,11 +10,10 @@ <import>from gnuradio import filter</import> <import>from gnuradio.filter import firdes</import> <make>filter.fft_filter_$(type)($decim, $taps, $nthreads) -self.$(id).set_group_delay($grp_delay) +self.$(id).declare_sample_delay($samp_delay) </make> <callback>set_taps($taps)</callback> <callback>set_nthreads($nthreads)</callback> - <callback>set_group_delay($grp_delay)</callback> <param> <name>Type</name> <key>type</key> @@ -46,8 +45,8 @@ self.$(id).set_group_delay($grp_delay) <type>$type.taps</type> </param> <param> - <name>Group Delay</name> - <key>grp_delay</key> + <name>Sample Delay</name> + <key>samp_delay</key> <value>0</value> <type>int</type> <hide>part</hide> diff --git a/gr-filter/grc/filter_fir_filter_xxx.xml b/gr-filter/grc/filter_fir_filter_xxx.xml index 4fe81ea994..edfd4b30c8 100644 --- a/gr-filter/grc/filter_fir_filter_xxx.xml +++ b/gr-filter/grc/filter_fir_filter_xxx.xml @@ -10,10 +10,9 @@ <import>from gnuradio import filter</import> <import>from gnuradio.filter import firdes</import> <make>filter.fir_filter_$(type)($decim, $taps) -self.$(id).set_group_delay($grp_delay) +self.$(id).declare_sample_delay($samp_delay) </make> <callback>set_taps($taps)</callback> - <callback>set_group_delay($grp_delay)</callback> <param> <name>Type</name> <key>type</key> @@ -73,8 +72,8 @@ self.$(id).set_group_delay($grp_delay) <type>$type.taps</type> </param> <param> - <name>Group Delay</name> - <key>grp_delay</key> + <name>Sample Delay</name> + <key>samp_delay</key> <value>0</value> <type>int</type> <hide>part</hide> diff --git a/gr-filter/grc/filter_interp_fir_filter_xxx.xml b/gr-filter/grc/filter_interp_fir_filter_xxx.xml index 64dbd1be03..0b82330f8c 100644 --- a/gr-filter/grc/filter_interp_fir_filter_xxx.xml +++ b/gr-filter/grc/filter_interp_fir_filter_xxx.xml @@ -10,10 +10,9 @@ <import>from gnuradio import filter</import> <import>from gnuradio.filter import firdes</import> <make>filter.interp_fir_filter_$(type)($interp, $taps) -self.$(id).set_group_delay($grp_delay) +self.$(id).declare_sample_delay($samp_delay) </make> <callback>set_taps($taps)</callback> - <callback>set_group_delay($grp_delay)</callback> <param> <name>Type</name> <key>type</key> @@ -73,8 +72,8 @@ self.$(id).set_group_delay($grp_delay) <type>$type.taps</type> </param> <param> - <name>Group Delay</name> - <key>grp_delay</key> + <name>Sample Delay</name> + <key>samp_delay</key> <value>0</value> <type>int</type> <hide>part</hide> |