OggVorbisLoopPlayerRAM
Overview
Periodic playback of OggVorbis encoded files
Discussion
This module outputs OggVorbis data in loop mode. User has to specify the file name as an argument. 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.
Type Definition
typedef struct _ModuleOggVorbisLoopPlayerRAM
{
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 isReady; // Boolean that indicates the module is not ready to output data
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 oggBufferSize; // Size of the buffer containing the Ogg Vorbis stream
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
UINT32* oggBuffer; // OggFile transferred from PC to target DSP via this buffer.
INT32* memPoolHeap; // Memory pool heap for ogg decoder
INT32* memPoolScratch; // Memory pool scratch for ogg decoder
INT32* oggHandle; // OggVorbis library instance
INT32* oggBufferPos; // Structure variable holding the buffer management variables
} ModuleOggVorbisLoopPlayerRAMClass;
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 |
isReady | 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 | |
oggBufferSize | 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 |
oggBuffer | uint* | parameter | 1 | [0 x 0] | Unrestricted | |
memPoolHeap | int* | state | 1 | [192000 x 1] | Unrestricted | |
memPoolScratch | int* | state | 1 | [12800 x 1] | Unrestricted | |
oggHandle | INT32* | state | 1 | Unrestricted | ||
oggBufferPos | INT32* | 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
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
MATLAB Usage
File Name: ogg_vorbis_loop_player_ram_module.m