class ParameterListener

A listener for changes in named parameters.

The ParameterListener listens for changes to the value of a named Max parameter. When a change occurs, a user-specified callback function will be called. The object also provides methods for getting and setting the value of the observed parameter.

For convenience, the ParameterListener object is a property of the ParameterListenerData argument passed to the callback function. To access the ParameterListener from within its function, use ParameterListenerData.listener.

ParameterListener is not yet supported in the v8 engine.

Example

function valuechanged(data) {
    post("parameter value changed: " + data.name + "\n");
    post("new value: " + data.value + "\n");
}

var l = new ParameterListener("myParameter", valuechanged);

Constructors

new ParameterListener(paramName: string, fn: Function);

Constructs a new instance of the ParameterListener class

ParameterTypeDescription
paramNamestringthe parameter name
fnFunctionthe callback function which takes a ParameterListenerData as an argument

Properties

name string read-only

The name of the parameter to observe

silent number

Whether to execute the callback function in response to calling ParameterListener.setvalue() from this ParameterListener

Methods

getvalue

Get the value of a parameter

getvalue(): number | number[] | string;
NameTypeDescription
Return Valuenumber | number[] | string

setvalue_silent

Set the value of a parameter, but don't execute the callback function

setvalue_silent(value: number): void;
NameTypeDescription
valuenumberthe new parameter value

setvalue

Set the value of a parameter

setvalue(value: any): void;
NameTypeDescription
valueanythe new parameter value