You may have noticed the weird construction I used in the SSB/CW receiver V0.7 implemented in the GNU Radio companion. It was using three AGC2 blocks with different decay rates, running in parallel and selecting one of them using a selector. The reason why I didn’t just use one block and set the decay rate of the block using an option menu or a slider was that this method didn’t work! Today I decided to dig deeper into the code and see how to fix this.
I realized that there was a simple reason for this misbehaviour. The AGC2 block is implemented in C++ (located in gnuradio-core/src/lib/general/gr_agc2_{cc,ff}.cc and gri_agc2_{cc,ff}.cc) and it does have public methods for setting and getting the AGC levels and rates; however, only very few of these interfaces are exported to Python and none of them are available in the GRC block (grc/blocks/gr_agc2_xx.xml).
Fixing this was very simple, all I had to do was to list the missing interfaces in the gri_agc2_{cc,ff}.i files and define them as callbacks in the gr_agc2_xx.xml GRC block definition file.The patch is applied to git master rev f7a2b8b0 of 22 July 2010 and later. If you want to patch earlier revisions it is available from here. There is also a simple GRC file for testing the callbacks.
With the fixed AGC2 interfaces it was time to update the SSB/CW receiver to use a single AGC2 block where the decay rate is controlled by an option menu.
The updated receiver is available from http://files.oz9aec.net/gnuradio/grc/. Next update might include adjustable level and rate controls.