[Discuss-gnuradio] Souce Block

2010-08-25 Thread John Li
Hi!

I have many source blocks with different kinds of signal generator and I
want to create a configurable unique block.

Can I make a source block with multiple outputs each one with a different
rate?


Thank you,

John
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


Re: [Discuss-gnuradio] Souce Block

2010-08-25 Thread Eric Blossom
On Wed, Aug 25, 2010 at 10:08:22AM -0300, John Li wrote:
 Hi!
 
 I have many source blocks with different kinds of signal generator and I
 want to create a configurable unique block.
 
 Can I make a source block with multiple outputs each one with a different
 rate?
 
 Thank you,
 John

Yes you can in 3.3.*

Your block will need to derive from gr_block, and in general_work you
must call produce for each output streams, and general_work must
return WORK_CALLED_PRODUCE as it's value.

From gr_block.h:

  //! Magic return values from general_work
  enum {
WORK_CALLED_PRODUCE = -2,
WORK_DONE = -1
  };

  ...

  /*!
   * \brief Tell the scheduler \p how_many_items were produced on output stream 
\p which_output.
   *
   * If the block's general_work method calls produce, \p general_work must 
return WORK_CALLED_PRODUCE.
   */
  void produce (int which_output, int how_many_items);


Eric

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio