Skip to content

CoeffAllocator

Overview

Allocates a source buffer and provides a reference for access

Discussion

This module has an internal buffer holding floating point data. It outputs a "reference" frame, which includes the heap and offset of the buffer. The module is used in conjunction with downstream "user" modules which can interpret the frame to access the data.

The output frame has 5 words with the following zero-based indices and data:
[0] - buffer-offset relative to the start of the heap
[1] - whether the data is complex (1) or not (0)
[2] - number of channels (does not change if data is complex)
[3] - samples per channel (does not change if data is complex)
[4] - heap number where buffer is allocated (can differ from user argument in single-heap targets)

The argument NUMCHANNELS defines the number of coefficient channels. Channel (or column) data is stored non-interleaved, so samples in the same column of the table are sequential in memory. If interleaved channels are desired, store channel data along the rows instead of along the columns.

The argument CHANNELSAMPS defines the samples per channel. Internally, the number of stored samples per channel is exactly this value. This is also the value sent on the output frame. Complex values count as a single sample, so channelSamps must be doubled to get the total number of words per channel (and hence the offset of the next channel). On the target, complex data is stored in interleaved fashion: real, imag, real, etc.

The argument SAMPLERATE defines the sample rate of the output wire.

The argument ISCOMPLEX defines whether to store complex data or not.

The argument MEMHEAP defines which heap should host the buffer.

See also: FIRUser StateAllocator FeNLMSUser

See usage examples in the AllocatorUser_*.awd layouts found in the audioweaver/Examples/Module_Usage folder

Module Pack

Advanced

ClassID

classID = 1459

Type Definition

typedef struct _ModuleCoeffAllocator
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
INT32 channelSamps;                           // Samples per channel
INT32 numChannels;                            // Number of Channels
INT32 sampleRate;                             // Sample Rate
INT32 isComplex;                              // Is Complex
INT32 arrayHeapAlloc;                         // True heap in which array was allocated.
INT32 arrayHeap;                              // Heap in which to allocate memory.
UINT32 arrayOffset;                           // Heap offset where array is allocated.
FLOAT32* value;                               // Array of floating point data
void * pOwnerPtr;                             // Pointer to hold owner AWEInstance pointer
} ModuleCoeffAllocatorClass;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
channelSamps int const 0 48 Unrestricted
numChannels int const 0 1 Unrestricted
sampleRate int const 0 48000 Unrestricted
isComplex int const 0 0 Unrestricted
arrayHeapAlloc int derived 0 1 Unrestricted
arrayHeap int const 1 1 Unrestricted
arrayOffset uint derived 1 0 Unrestricted
value float* parameter 0 [48 x 1] Unrestricted
pOwnerPtr void * state 1 Unrestricted

Pins

Output Pins

Name C
Description coeff buffer reference
Data Type int

Matlab Usage

File Name: coeff_allocator_module.m 
 M = coeff_allocator_module(NAME, NUMCHANNELS, CHANNELSAMPS, SAMPLERATE, ISCOMPLEX, MEMHEAP) 
 Creates a buffer source module and provides a reference to access the buffer. It 
 is used in combination with other "allocator" and "user" modules, such as 
 the fir_user_module.m 
 Arguments: 
    NAME - name of the module. 
    NUMCHANNELS - number of interleaved channels. 
         By default, NUMCHANNELS = 1; 
    CHANNELSAMPS - number of samples per channel. 
        If this is empty then we use the blockSize from the system 
        input.  By default, CHANNELSAMPS = []. 
    SAMPLERATE - sample rate of the output pin, in Hz. 
        If this is empty then we use the sample rate of the first input  
        pin of the containing system.  By default, SAMPLERATE = []. 
    ISCOMPLEX - Boolean indicating whether the source module holds complex 
         data.  By default ISCOMPLEX = 0 (real). 
    MEMHEAP - specifies the memory heap to use to allocate the main 
         coeff 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 (default). 
            'AWE_HEAP_FASTB' - always use internal PM memory. 
            'AWE_HEAP_SLOW' - always use external memory. 
            'AWE_HEAP_SHARED' - always use shared memory. 

Copyright (c) 2026 DSP Concepts, Inc.