(8.D.2.3) WaveIndexPlayerFFS
Overview
WAV playback using index vector as pitch factor input
Discussion
This module outputs wave data in loop mode and takes an input stream or vector as sample index input. It extracts wave data from AWE Flash File System container on control input pin fsInstance, based on WAVFILE argument. User has to specify the file name as an argument and can also change file name directly into fileName array as 32-bit packed data during run time. Along with the above parameters, the playback functionality can be enabled from the control input pin, 1 - Enable and 0 - Disable. The module supports multichannel such that, if the wave file has more channels than provided to the module argument then only channels up to output pin channels will be used. If the wave file has less channels than output pin channels, then the remaining output channels will be muted. Optional argument MUTMOD can be used to mute output before changing file in run time.
Optional argument UNMUTEMOD can be used to un-mute output after file is processed in run time.
If any errors occurs in the module, it is captured in the parameter .errorCodes. Please check in Errors.h for the meaning of error code returned.
Type Definition
typedef struct _ModuleWaveIndexPlayerFFS
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 enable; // En/Disable playback
INT32 interpMode; // Linear or cubic interpolation
FLOAT32 normRate; // Rate of data used to compute the ratio for normalized players
INT32 waveLength; // Number of samples in currently loaded file
INT32 fsInstance; // AWE flash file system instance pointer
INT32 errorCode; // Captures errors that could arise in the module C code. Appears on the inspector
INT32 isReady; // Boolean that indicates the module is not ready to output data
INT32 waitForMuteDone; // Internal flag to check if the smooth mute is done
FLOAT32 formatF; // Integer value of left-shift by NCOFracBits. Determines the precision of the linear interpolation.
INT32 waveSR; // Actual sample rate of the wave file.
INT32 waveNumChannels; // Number of channels in the wave file.
INT32 waveBit; // Wave data sample bit resolution.
FLOAT32 scaleFactor; // Scale factor for playback rate
UINT32 pinID; // Specifies which control pins are available.
INT32* fileName; // Name of wave file to playback
INT32* fileNamePrev; // Name of wave file to playback
void * muteModPtr; // Internal pointer to mute module to mute before reconfiguration
void * unMuteModPtr; // Internal pointer to mute module to unmute after reconfiguration
UINT32 * fsInstancePtr; // AWE flash file system instance pointer
UINT32 * waveBuffer; // State variable holds the start address of the wave file in filesystem.
} ModuleWaveIndexPlayerFFSClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
enable | int | state | 0 | 1 | 0:1 | Â |
interpMode | int | const | 0 | 2 | Unrestricted | Â |
normRate | float | const | 0 | 1 | Unrestricted | Â |
waveLength | int | derived | 0 | 0 | Unrestricted | Â |
fsInstance | int | state | 0 | 0 | Unrestricted | Â |
errorCode | int | state | 0 | 0 | Unrestricted | Â |
isReady | int | state | 0 | 0 | Unrestricted | Â |
waitForMuteDone | int | state | 0 | 0 | Unrestricted | Â |
formatF | float | const | 1 | 65540 | Unrestricted | Â |
waveSR | int | derived | 1 | 0 | Unrestricted | Â |
waveNumChannels | int | derived | 1 | 0 | Unrestricted | Â |
waveBit | int | derived | 1 | 0 | Unrestricted | Â |
scaleFactor | float | derived | 1 | 1 | Unrestricted | Â |
pinID | uint | const | 1 | 3 | Unrestricted | Â |
fileName | int* | parameter | 1 | [14 x 1] | Unrestricted | Â |
fileNamePrev | int* | state | 1 | [14 x 1] | Unrestricted | Â |
muteModPtr | void * | state | 1 | 0 | Unrestricted | Â |
unMuteModPtr | void * | state | 1 | 0 | Unrestricted | Â |
fsInstancePtr | UINT32 * | state | 1 | Â | Unrestricted | Â |
waveBuffer | UINT32 * | state | 1 | Â | Unrestricted | Â |
Pins
Input Pins
Name: enable
Description: flag to enable playback
Data type: int
Channel range: 1
Block size range: 1
Sample rate range: Unrestricted
Complex support: Real
Â
Name: fsInstance
Description: AWE file system instance pointer
Data type: int
Channel range: Unrestricted
Block size range: 1
Sample rate range: Unrestricted
Complex support: Real
Â
Name: index
Description: sample index vector input data
Data type: float
Channel range: 1
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: audio
Description: output data
Data type: float
Â
Name: isPlaying
Description: playing state
Data type: int
Scratch Pins
Channel count: 1
Block size: 256
Sample rate: 48000
MATLAB Usage
File Name: wave_index_player_ffs_module.m