OggVorbisOneShotPlayerRAM
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.
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 _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
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_oneshot_player_ram_module.m