Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The module constructor function is typically called by the framework in response to a message received from the PC over the tuning interface or from a message stored in a file system.  After a module constructor function is called, the framework checks if the module has an associated Set function.  If so, the Set function is called immediately with a mask of 0xFFFFFFFF. 

...

The second argument to the Set function is a bit mask that specifies which module variable(s) have changed.  The bit mask is set by the Server when module variables are updated while tuning.  The bit mask may also be set by control code running on the target.  Use of the bit mask is optional and is only really necessary when the module writer needs to distinguish between heavy duty changes requiring significant amounts of computation and lightweight changes.

A bit mask of 0xFFFFFFFF is used to force all variables in the Set function to update. This value of the bit mask is used in a call to the Set function after the module is constructed but before it is pumped for the first time. This ensures that all module variables are updated before they are used.

A special case of the bit mask is when it is equal to 0. When the module is constructed, after calling the module’s constructor function, set function is called immediately by the framework with a bit mask of 0xFFFFFFFF. User can use this in the Set function, if needed, to trigger action immediately after memory is allocated. Note that the module's array variables have not been set at this point. After the module constructor is called, each array variable is separately written and
the module's set function is called with the mask set based on the array written. Mask value of each variable/array in a module’s instance can be found in module header file (for example in ModPeakHoldExample.h).

When the destroy tuning command is processed by the AWECore, the Set function of every module is called with a mask of 0. This allows the module to do any necessary clean up operations. For example, if your module does file I/O you could close the file at this time. Or you might free memory that is dynamically allocated outside of the Audio Weaver heaps.

In the bit mask, bit N is set when the Nth module variable is set.  The bit counting includes the 8 word module instance header and thus the first tunable module variable is numbered 8.  The module header file contains a set of #define's indicating the bit value for each variable.  For example, ModPeakHoldModPeakHoldExample.h contains:

Code Block
#define MASK_PeakHold_Reset 0x00000100
#define MASK_PeakHold_attackTime 0x00000200
#define MASK_PeakHold_decayTime 0x00000400
#define MASK_PeakHold_decayCoef 0x00000800
#define MASK_PeakHold_attackCoef 0x00001000
#define MASK_PeakHold_peakHold 0x00002000
#define MASK_PeakHold_peakDecay 0x00004000

...