diff options
Diffstat (limited to 'gr-blocks/lib/repeat_impl.cc')
-rw-r--r-- | gr-blocks/lib/repeat_impl.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gr-blocks/lib/repeat_impl.cc b/gr-blocks/lib/repeat_impl.cc index b32efef4bf..fb62265134 100644 --- a/gr-blocks/lib/repeat_impl.cc +++ b/gr-blocks/lib/repeat_impl.cc @@ -43,13 +43,26 @@ namespace gr { d_itemsize(itemsize), d_interp(interp) { + message_port_register_in(pmt::mp("interpolation")); + set_msg_handler(pmt::mp("interpolation"), + boost::bind(&repeat_impl::msg_set_interpolation, this, _1)); } void + repeat_impl::msg_set_interpolation(pmt::pmt_t msg) + { + // Dynamization by Kevin McQuiggin: + d_interp = pmt::to_long(pmt::cdr(msg)); + sync_interpolator::set_interpolation(d_interp); + } + void repeat_impl::set_interpolation(int interp) { - d_interp = interp; - sync_interpolator::set_interpolation(d_interp); + // This ensures that interpolation is only changed between calls to work + // (and not in the middle of an ongoing work) + _post( pmt::mp("interpolation"), /* port */ + pmt::cons(pmt::mp("interpolation"), pmt::from_long(interp)) /* pair */ + ); } int |