# On the fly set\_output\_multiple()

**URL:** <https://www.ruby-forum.com/t/on-the-fly-set-output-multiple/239283>\
**Category:** GNU Radio\
**Created:** [February 20, 2014, 1:48pm UTC](https://www.ruby-forum.com/t/on-the-fly-set-output-multiple/239283 "2014-02-20T13:48:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [February 20, 2014, 1:48pm UTC](https://www.ruby-forum.com/t/on-the-fly-set-output-multiple/239283/1 "2014-02-20T13:48:14Z")

</div>

Dear Sir,

I need to create a interpolator block which has a callback function to  
change its interpolation factor on the fly.

If this block is inherited from gr::sync\_interpolator, its interpolation  
factor cannot be changed on the fly because the interpolation factor is  
an  
argument of its constructor.

The alternative is to inherit from gr::block instead. If the  
set\_output\_multiple() could be called on the fly, then the problem is  
solved.

The problem is, the set\_output\_multiple() could not be changed on the  
fly !  
[http://lists.gnu.org/archive/html/discuss-gnuradio/2010-11/msg00504.html](http://lists.gnu.org/archive/html/discuss-gnuradio/2010-11/msg00504.html)

Any solution to this?  
The objective is to create an interpolator block that its interpolation  
factor could be changed on the fly.

Thanks in advance.

Regards,  
Activecat

---

<div class="post-metadata">

**Author:** ![activecat\_k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@activecat\_k](https://www.ruby-forum.com/u/activecat_k)\
**Post date:** [February 20, 2014, 8:33pm UTC](https://www.ruby-forum.com/t/on-the-fly-set-output-multiple/239283/2 "2014-02-20T20:33:10Z")

</div>

On 02/20/2014 01:46 PM, Activecat wrote:

> The problem is, the set\_output\_multiple() could not be changed on the fly !  
> [Re: [Discuss-gnuradio] call set\_output\_multiple() on the fly](http://lists.gnu.org/archive/html/discuss-gnuradio/2010-11/msg00504.html)
> 
> Any solution to this?  
> The objective is to create an interpolator block that its interpolation  
> factor could be changed on the fly.

Well, in a ::block you can do whatever you like with your in- and output  
buffers. Also, forecast() is called all the time, and its behaviour can  
by dynamic. So, between those you should be able to figure something  
out.

1. Edit forecast()
2. in general\_work(), check if buffer sizes work
3. produce() and consume() as required

MB

---

<div class="post-metadata">

**Author:** ![activecat\_k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@activecat\_k](https://www.ruby-forum.com/u/activecat_k)\
**Post date:** [February 21, 2014, 12:40am UTC](https://www.ruby-forum.com/t/on-the-fly-set-output-multiple/239283/3 "2014-02-21T00:40:54Z")

</div>

Dear Martin,

Thanks for the hints.  
I think this function helps: set\_min\_noutput\_items()

Problem:  
Says, the instantaneous interpolation\_factor is 3.  
As inherited from gr::block, the scheduler may call the general\_work()  
with  
noutput\_items=2 (any number is possible).  
When this happen, there is nothing to be done except to consume\_each(0)  
and  
return 0 in the general\_work().  
But then the scheduler will repeat calling general\_work() many times  
with  
noutput\_items=2. This is fatal.

Solution:  
On the fly, set\_min\_noutput\_items(3)  
Then the scheduler will not call general\_work() with noutput\_items  
equals a  
value less than 3.  
This solves the problems !

Question:  
Does this function work on the fly? set\_min\_noutput\_items()

Thank you very much.

Regards,  
Activecat

---

<div class="post-metadata">

**Author:** ![activecat\_k](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c57346/32.png) [@activecat\_k](https://www.ruby-forum.com/u/activecat_k)\
**Post date:** [February 21, 2014, 4:38pm UTC](https://www.ruby-forum.com/t/on-the-fly-set-output-multiple/239283/4 "2014-02-21T16:38:10Z")

</div>

On 02/21/2014 12:38 AM, Activecat wrote:

> Problem:  
> Says, the instantaneous interpolation\_factor is 3.  
> As inherited from gr::block, the scheduler may call the general\_work()  
> with noutput\_items=2 (any number is possible).  
> When this happen, there is nothing to be done except to consume\_each(0)  
> and return 0 in the general\_work().

You could tweak forecast() to require more input.

> Does this function work on the fly? set\_min\_noutput\_items()  
> It should, that’s what it was made for.

MB
