On Mon, Oct 02, 2006 at 09:08:00AM -0700, Johnathan Corgan wrote:
> Marcus Leech wrote:
> 
> > There was discussion on the list a few months ago about adding the
> > ability to hook a python function
> >  into the processing chain.   I don't remember what the conclusion of
> > that discussion was.
> > 
> > I have a need to be able to hook a user-defined Python code snippet into
> > the processing chain, near the end
> >  where the sample rate is very low (1Hz).   Is this easily done, and if
> > so, how?
> 
> Take a look at gr.feval_xx class:
> 
> http://gnuradio.org/trac/browser/gnuradio/trunk/gnuradio-core/src/lib/general/gr_feval.h
> 
> It defines a function 'eval' that can be called either from C++ or from
> Python.  In Python you can subclass this and override the eval function
> with whatever you want.  When the function is called from C++, control
> flow passes to the Python interpreter to evaluate the function and return.
> 
> I haven't used it myself, but you can get a good feel for what is
> possible by looking at the QA code for the block at:
> 
> http://gnuradio.org/trac/browser/gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/qa_feval.py
> 
> Johnathan Corgan, AE6HO
> [EMAIL PROTECTED]

This is all good info.

You could build a few classes derived from gr_sync_block that would
use the same techniques.

Eric


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

Reply via email to