ParamGetV2
Overview
Gets parameters in other modules
Discussion
The ParamGetV2 module gets the value of a parameter from another module. At instantiation time (or in Module Name and Arguments in Audio Weaver Designer), you specify the data type of the output pin and also the variable which will be fetched. The variable is specified as
Mod.Var
where Mod is the name of the module (in the same level of the hierarchy as the ParamGetV2 module) and Var is the variable name. You can also specify modules that are within subsystems using
Subsystem.Mod.Var
You can also go up in hierarchy and get parameters from modules that are in an upper system. Use a single backslash character to move up one level in the hierarchy. Use multiple backslash characters to traverse multiple levels of hierarchy. Suppose that the ParamGetV2 module is located in:
SYS.Subsystem.ParamGetV2
and you want to get the variable
SYS.Scaler1.gain
Then set the Mod.Var field to
\Scaler1.gain
And finally, you can also get individual values from arrays using the syntax
Mod.Var[index]
where index is the zero-based index of the element in the array Var to get.
Note that the get function is called through deferred processing, ParamGetV2 calls its own set function through deferred processing. Then, when the set function is called during the deferred processing, it will call the target modules get function immediately. This is done in order to allow the get function to be called with the target variable's mask so that the get function only processes what is required by the change in that variable. This is a change from the original ParamGet module which called the target module's get function through deferred processing, which always is called to execute as if all the variables have been changed leading to increased CPU usage.
Deferred processing means that it's called as a background task. It may take tens of milliseconds before the get function is actually called and the exact timing can depend upon the CPU loading of the system. If the system is lightly loaded, then there is more CPU power available for performing the deferred processing tasks.
The argument executionOrder determines when the param get will actually execute in relation to the target module:
Undefined = Let the build process decide
Before = Get the parameter before the target module executes
After = Get the parameter after the target module executes
This can be confirmed by generating a .AWS file and looking at the order which the modules are added to the layout, which set the execution order.
Please see the ParamGetV2 example for specific use cases.
Type Definition
typedef struct _ModuleParamGetV2
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
UINT32 mask; // MASK value when calling the controlled module's get function
void * modPtr; // Points to the module to get
void * varPtr; // Points to the variable to get within the module instance structure
} ModuleParamGetV2Class;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
mask | uint | parameter | 1 | 0 | Unrestricted | |
modPtr | void * | parameter | 1 | Unrestricted | ||
varPtr | void * | parameter | 1 | Unrestricted |
Pins
Output Pins
Name: out
Description: parameter value
Data type: float
MATLAB Usage
File Name: param_get_module.m
M = param_get_v2_module(NAME, DATATYPE, SAMPLERATE, MODVAR)
Parameter get module. This module can reach into the instance structure
of other modules and gets the parameter values. This is the "v2" version of
this module and it uses the correct mask value when calling the controlled
module's Set() function. Arguments:
NAME - name of the module.
DATATYPE - string specifying the data type of the variable and
also used for the data type of the input pin. Allowable
values are 'float', 'int', or 'fract32'. Implicit casts from
'int' to 'uint' variables allowed, but take caution to avoid
passing out of range values.
SAMPLERATE - sample rate of the output signal, in Hz.
MODVAR - specifies the module and variable name using the form:
'MOD.VAR' where MOD is the module name and VAR is the
variable name. You can also specify internal subsystems using
'SUBSYS.MOD.VAR'.
EXECUTIONORDER - Determines when the ParamGet module executes relative
to the module it is controlling. Allowable values are:
'undefined' - the default. The execution order is set
by the routing algorithm and can occur before
or after the module it is controlling.
'before' - forces ParamGet to execute before the module it
is controlling.
'after' - forces ParamGet to execute after the module it
is controlling.
When using 'before' and 'after' you could get a build error
indicating that no more modules can execute or there is a
circular dependency.