Skip to main content
Skip table of contents

OggVorbisOneShotPlayerFFS

Overview

Triggered playback of OggVorbis encoded files

Discussion

This module outputs OggVorbis data triggered via an input pin. 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.

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.

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

CODE
typedef struct _ModuleOggVorbisOneShotPlayerFFS
{
    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 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.
} ModuleOggVorbisOneShotPlayerFFSClass;

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

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

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

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: trigger

Description: boolean trigger signal

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

MATLAB Usage

File Name: ogg_vorbis_oneshot_player_ffs_module.m

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.