Document toolboxDocument toolbox

(8.D.2.2 ) DelayStateWriter

Overview

Writes data into an internal circular state buffer

Discussion

This module writes data to an internal circular state buffer and outputs a pointer to its instance structure. The module is used inconjunction with downstream "reader" modules which pull data out of the circular state buffer. For example, you can use it with the fir_sparse_reader_module.m to create tapped delay lines which share a common state buffer.

The module outputs a pointer to its instance structure. Upstream module then use this pointer to read out data from the state buffer. The upstream modules should treat the DelayStateWriter instance structure as read-only and not modify any values.

The construct argument MAXDELAY specifies the number of samples of delay, per channel. The size of the internal state buffer is (MAXDELAY + inBlockSize) * numInChannels samples where inBlockSize is the blockSize of the input pin. The internal state buffer size is doubled if the input is complex. This buffer is large enough so that a new block of data can first be written into the buffer and then data as old as MAXDELAY samples can be read out.

Type Definition

typedef struct _ModuleDelayStateWriter { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 maxDelay; // Maximum delay, per channel. INT32 stateLen; // Size of the internal state buffer. INT32 stateIndex; // Index of the oldest state variable in the array of state variables. INT32 stateHeap; // Heap in which to allocate memory. FLOAT32* state; // State variable array. } ModuleDelayStateWriterClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

maxDelay

int

const

0

100

Unrestricted

samples

stateLen

int

derived

0

132

Unrestricted

samples

stateIndex

int

state

1

0

Unrestricted

 

stateHeap

int

const

1

561

Unrestricted

 

state

float*

state

1

[132 x 1]

Unrestricted

 

Pins

Input Pins

Name: in

Description: audio input

Data type: {float, int, fract32}

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real and Complex

Output Pins

Name: ID

Description: Module objectID

Data type: int

MATLAB Usage

File Name: delay_state_writer_module.m

M = delay_state_writer_module(NAME, MAXDELAY, MEMHEAP) This module holds a circular delay buffer and is used in combination with other "writer" modules, such as the fir_sparse_reader_module.m Arguments: NAME - name of the module. MAXDELAY - maximum delay, in samples, per channel. This also partially specifies the size of the delay buffer. MEMHEAP - specifies the memory heap to use to allocate the main state buffer. This is a string and follows the memory allocation enumeration in Framework.h. Allowable values are: 'AWE_HEAP_FAST' - always use internal DM memory. 'AWE_HEAP_FASTB' - always use internal PM memory. 'AWE_HEAP_SLOW' - always use external memory (the default). 'AWE_HEAP_FAST2SLOW' - use internal memory. If this fails then use external memory (the default).

Â