Skip to content

SourceV2

Discussion

The source module has an internal buffer holding 1 output wire's worth of floating point data. The module continuously copies the data from the internal value buffer to the output wire. Since this is a source module, you must specify the number of channels, blockSize, and sample rate of the output pin. It has an additional module argument to decide whether the internal array is in interleaved or deinterleaved format.

The module also supports real and complex data. For complex data data, set the .value field to complex data in MATLAB. On the target, complex data is stored in interleaved fashion: real, imag, real, etc.

This module makes the wire information available as internal variables. Block size, channel number, sample rate and signal complexity can be accessed in MATLAB code, source code, or in a layout using the ParamGet module.

Module Pack

Standard

ClassID

classID = 245

Type Definition

typedef struct _ModuleSourceV2
{
ModuleInstanceDescriptor instance;            // Common Audio Weaver module instance structure
INT32 BlockSize;                              // Block Size
INT32 NumChannels;                            // Number of Channels
INT32 SampleRate;                             // Sample Rate
INT32 isComplex;                              // Is Complex
INT32 format;                                 // Is interleaved Or deinterleaved
INT32 arrayHeap;                              // Heap in which to allocate memory.
FLOAT32* value;                               // Array of floating point data
} ModuleSourceV2Class;

Variables

Properties

Name Type Usage isHidden Default Value Range Units
BlockSize int const 0 48 Unrestricted
NumChannels int const 0 2 Unrestricted
SampleRate int const 0 48000 Unrestricted
isComplex int const 0 0 Unrestricted
format int const 0 0 Unrestricted
arrayHeap int const 1 2 Unrestricted
value float* parameter 0 [48 x 2] Unrestricted

Pins

Output Pins

Name out
Description output data
Data Type float

Matlab Usage

File Name: source_v2_module.m 
 M=source_v2_module(NAME, NUMCHANNELS, BLOCKSIZE, SAMPLERATE, ISCOMPLEX, FORMAT, MEMHEAP) 
 Creates a source module that allows you to inject float data into 
 the audio processing layout.   

 Arguments: 
    NAME - name of the module. 
    NUMCHANNELS - number of interleaved channels in each output pin. 
         By default, NUMCHANNELS=1; 
    BLOCKSIZE - number of samples per output channel. By default, 
         BLOCKSIZE=32. 
    SAMPLERATE - sample rate of the output signal, in Hz.  By default, 
         SAMPLERATE=48000. 
    ISCOMPLEX - Boolean indicating whether the source module holds complex 
         data.  By default ISCOMPLEX = 0 (real). 
    FORMAT - Boolean indicating whether internal array is interleaved 
         or deinterleaved. By default = deinterleaved 
    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. 

Copyright (c) 2026 DSP Concepts, Inc.