OggVorbisLoopPlayerFFS
Overview
Periodic playback of OggVorbis encoded files
Discussion
This module outputs OggVorbis data in loop mode. It extracts compressed audio data from AWE Flash File System container on control input pin "fsInstance" dependent on "fileName" argument. User can also change the file name directly inside "fileName" array as 32-bit packed data (char) 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 ogg file has less channels than output pin channels, then the remaining output channels will be muted. If the ogg file has more channels than the output pin channels it will be handled as an error.
If the modules arguments samplerate does not match the samplerate of the OggVorbis file it will be handled as an error.
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 _ModuleOggVorbisLoopPlayerFFS
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 enable; // En/Disable playback. Resets sample position to 0
INT32 playCtrl; // Play/Pause control. 1 for play (default), 0 for pause
INT32 seekPosTime; // Seek position in seconds
INT32 seekPosSamples; // Seek position in samples
INT32 oggLength; // Number of samples in currently loaded file
INT32 totalDuration; // Total duration of the stream in seconds
INT32 totalSamples; // Total number of samples
INT32 samplesRemaining; // Samples remaining in the stream
INT32 timeRemaining; // Remaining time for playback in milliseconds
INT32 prevSeekPosTime; // Seek position in seconds
INT32 prevSeekPosSamples; // Seek position in samples
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
INT32 sampleRate; // Sample rate
UINT32 pinID; // Specifies which control pins are available.
INT32 oggSR; // Actual sample rate of the ogg file.
INT32 oggNumChannels; // Number of channels in the ogg file.
INT32 decoderLock; // Flag for synchronization between the set and process function
INT32 syncLock; // Flag for synchronization between the set and process function
INT32 memPoolHeapSize; // Size of memory pool heap
INT32 memPoolScratchSize; // Size of memory pool scratch
INT32 usedMemPoolHeapSize; // Used size memory pool heap
INT32 usedMemPoolScratchSize; // Used size memory pool scratch
INT32* fileName; // Name of wave file to playback
INT32* fileNamePrev; // Previous wave file name
INT32* oggHandle; // OggVorbis library instance
INT32* oggBufferPos; // Structure variable holding the buffer management variables
INT32* memPoolHeap; // Memory pool heap for ogg decoder
INT32* memPoolScratch; // Memory pool scratch for ogg decoder
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 * oggBuffer; // State variable holds the start address of the wave file in filesystem.
} ModuleOggVorbisLoopPlayerFFSClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
enable | int | state | 0 | 1 | 0:1 | |
playCtrl | int | parameter | 0 | 1 | Unrestricted | |
seekPosTime | int | parameter | 0 | 0 | Unrestricted | Seconds |
seekPosSamples | int | parameter | 0 | 0 | Unrestricted | Samples |
oggLength | int | derived | 0 | 0 | Unrestricted | |
totalDuration | int | state | 0 | 0 | Unrestricted | Seconds |
totalSamples | int | state | 0 | 0 | Unrestricted | |
samplesRemaining | int | state | 0 | 0 | Unrestricted | |
timeRemaining | int | state | 0 | 0 | Unrestricted | ms |
prevSeekPosTime | int | state | 0 | 0 | Unrestricted | Seconds |
prevSeekPosSamples | int | state | 0 | 0 | Unrestricted | samples |
fsInstance | int | state | 0 | 0 | Unrestricted | |
errorCode | int | state | 0 | 0 | Unrestricted | |
isReady | int | state | 0 | 0 | Unrestricted | |
waitForMuteDone | int | state | 0 | 0 | Unrestricted | |
sampleRate | int | const | 1 | 48000 | Unrestricted | |
pinID | uint | const | 1 | 3 | Unrestricted | |
oggSR | int | derived | 1 | 0 | Unrestricted | |
oggNumChannels | int | derived | 1 | 0 | Unrestricted | |
decoderLock | int | state | 1 | 0 | Unrestricted | |
syncLock | int | state | 1 | 0 | Unrestricted | |
memPoolHeapSize | int | state | 1 | 192000 | Unrestricted | |
memPoolScratchSize | int | state | 1 | 12800 | Unrestricted | |
usedMemPoolHeapSize | int | state | 1 | 0 | Unrestricted | bytes |
usedMemPoolScratchSize | int | state | 1 | 0 | Unrestricted | bytes |
fileName | int* | parameter | 0 | [14 x 1] | Unrestricted | |
fileNamePrev | int* | state | 1 | [14 x 1] | Unrestricted | |
oggHandle | int* | state | 1 | [182 x 1] | Unrestricted | |
oggBufferPos | int* | state | 1 | [8 x 1] | Unrestricted | |
memPoolHeap | int* | state | 1 | [192000 x 1] | Unrestricted | |
memPoolScratch | int* | state | 1 | [12800 x 1] | Unrestricted | |
muteModPtr | void * | state | 1 | 0 | Unrestricted | |
unMuteModPtr | void * | state | 1 | 0 | Unrestricted | |
fsInstancePtr | UINT32 * | state | 1 | Unrestricted | ||
oggBuffer | 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
Output Pins
Name: audio
Description: output data
Data type: fract32
Name: isPlaying
Description: playing state
Data type: int
Scratch Pins
Channel count: 1
Block size: 256
Sample rate: 48000