Overview
Triggered playback of OggVorbis encoded files
Discussion
This module outputs OggVorbis data triggered via an input pin. The input .trigger is a Boolean value which starts the playback upon rising edge. Playback continues until the end of the file and does not repeat before the next trigger. Retrigger while being in the middle of the playback has no effect and will be ignored. Changing the filename while being in the middle of the playback will stop the playback.
...
If the modules arguments samplerate does not match the samplerate of the OggVorbis file it will be handled as an error.
Type Definition
Code Block |
---|
typedef struct _ModuleOggVorbisOneShotPlayerRAM { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure 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 triggerPrev; // State trigger signal to determine rising edge INT32 triggerLatched; // State trigger denoting player is active 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 } ModuleOggVorbisOneShotPlayerRAMClass; |
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
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 | |
triggerPrev | int | state | 0 | 0 | Unrestricted | |
triggerLatched | int | state | 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 | 1 | 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: trigger
Description: boolean trigger signal
...
Sample rate range: Unrestricted
Complex support: Real
Output Pins
Name: audio
Description: output data
...
Description: playing state
Data type: int
Scratch Pins
Channel count: 1
Block size: 256
Sample rate: 48000
MATLAB Usage
File Name: ogg_vorbis_oneshot_player_ram_module.m