Skip to main content
Skip table of contents

DelayStateWriter16

Overview

Writes data into an internal 16-bit circular state buffer

Discussion

This module writes data from fract32 input to an internal 16-bit 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_fract16_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 DelayStateWriter16 instance structure as read-only and not modify any values.

The constructor 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. 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

CODE
typedef struct _ModuleDelayStateWriter16
{
    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.
} ModuleDelayStateWriter16Class;

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

1

Unrestricted

state

float*

state

1

[66 x 1]

Unrestricted

Pins

Input Pins

Name: in

Description: audio input

Data type: fract32

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: ID

Description: Module objectID

Data type: int

MATLAB Usage

File Name: delay_state_writer16_module.m

CODE
 M = delay_state_writer16_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_fract16_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).

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.