FoaMatrixChain:
Filter:
Classes (extension) | Libraries > Ambisonic Toolkit > Utilities > FOA

FoaMatrixChain : Object
ExtensionExtension

Chain multiple FoaXformerMatrix transforms.

Description

A utility to chain multiple FoaXformerMatrix transforms. While it can be used as a standalone utility, it was primarily designed for internal use by FoaXformDisplay.

Transform Chain Structure

An FoaMatrixChain generates a node structure of transforms in both series and parallel. Parallel chains can tap "outputs" from nodes in other chains. The final output (retrieved with -curXformMatrix) is always the last transform node of the last chain. However the resultant matrix at each node in the chain is also stored.

An FoaMatrixChain may actually be composed of multiple "chains" of transforms in parallel. By default, each node in the chain reads in the matrix from the previous transform, or the last transform of the previous chain in the case of a new parallel chain. The first node in a chain can optionally read in any previous node in the tree, and some transforms can also read a previous node into its input. For example in the add transform takes a previous node as an argument to be added to its input matrix. This structure will become apparent when using the interface provided with FoaXformDisplay.

Many of the instance methods have arguments asking whichChain followed by an index. This refers to which parallel chain (a zero-based index), followed by the index of the node (transform) within that chain. For example if you have three parallel chains, and you want to specify the second node position in the last parallel chain, then whichChan: 2, index: 1.

NOTE: When modifying the matrix chain, you must call -chainXForms in order for the chain and its variables to update. At that point -curXformMatrix will return the resultant transform matrix.

Class Methods

FoaMatrixChain.new(verbose: false)

Arguments:

verbose

A Boolean specifying whether the transform chain is posted whenever a transform is changed, added or removed.

Inherited class methods

Instance Methods

.addTransform(xformName, whichChain, index ... params)

Insert a transform into the chain.

Arguments:

xformName

A Symbol corresponding to the transform's name, as listed by key in .xFormDict.keys.

whichChain

A chain index, zero-based.

index

A index in the chain specified by whichChain.

... params

Initial parameters to supply the transform, in the order they are listed in the controls, which can be viewed with, for example, .xFormDict['press'].controls. This param order and default values corresponds to the order defined in the FoaXformerMatrix.

.removeTransform(whichChain, index)

Remove a transform from the chain.

Arguments:

whichChain

Which chain index.

index

Index of the transform in the specified chain.

.replaceTransform(newXformName, whichChain, index ... params)

Similar to addTransform, but rather than inserting, it replaces the transform at the specified chain/index location.

.setParam(whichChain, index, ctlDex, value)

Set a parameter of one of the transforms in the chain(s).

Arguments:

whichChain

A chain index, zero-based.

index

A index in the chain specified by whichChain.

ctlDex

The index of the parameter in the .controls array corresponding to the transform being changed.

value

The new value for the transform parameter.

.addChain(index)

Add a parallel processing chain. The default head of the chain will be the tail of the preceeding chain.

Arguments:

index

Index at which to insert the new chain.

.removeChain(index)

Remove one of the parallel processing chains at index. Note that any transform inputs reading from nodes in this chain will be reset to 'A0', the orginal unaffected input soundfield.

.chainXForms

Perform the calculation of "chaining" all the transforms together. This should be called after any alteration to the transform chain, which will in turn update the -curXformMatrix variable.

.curXformMatrix

Get the resultant transform from the chain.

.chains

Returns:

A 2D Array of FoaMatrixChainLinks whose state can be queried to return it's transform name, control parameter values, and resultant matrix up to that point in the chain, by .name, .controlStates, and .mtx, repsectively.

.reset

Reset the processing chain, starting over from an unaffected input soundfield.

.clear

Same as reset.

.verbose

.verbose = value

A Boolean specifying whether the transform chain is posted whenever a transform is changed, added or removed.

.postChain

Post the current processing chains, with the transform names and parameters formatted to view easily.

.getLinkByKey(key)

Get a transform "link" in the chain by its alpha-numeric key.

Arguments:

key

An alpha-numeric key, e.g. 'B2' would return the third ('2') transform "link" in the second parallel chain ('B')

Returns:

A FoaMatrixChainLink whose state can be queried to return it's transform name, control parameter values, and resultant matrix up to that point in the chain, by .name, .controlStates, and .mtx, repsectively.

.xFormDict

Returns:

A Dictionary containing specifications for all of the valid transforms and their controls.

Inherited instance methods