Document toolboxDocument toolbox

(8.D.2.2 ) PeriodicStreaming

Overview

Repetitively outputs a block of data as pulled by a downstream module

Discussion

This module has an internal circular buffer containing audio data and works in conjunction with some of the other modules which "pull data" in real-time. The module has an internal circular buffer which is initialized with a block of audio data. The module is then ready to output data.

The variable, currentFillLevel indicates how many data samples are available in the circular buffer to the output. This always equals the size of the circular buffer and indicates to the downstream puller module that data is available to be ready out of the buffer. The variable, underflowCount indicates how many output samples could not be supplied due to lack of data. underflowCount is not incremented during the initial prefill operation. underflowCount remains for compatibility with other puller modules and will always equal zero.

The output of the module is a single integer which points to a data structure in memory. By manipulating the data structure, a downstream module can pull data out of the module's circular buffer. This module currently works with file-based decoders and also the raw_streaming_source_module.m.

Type Definition

typedef struct _ModulePeriodicStreaming { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 transferBufferSize; // NOT USED. Size of the transfer buffer, in 32-bit words. INT32 circularBufferSize; // Size of the circular buffer, in 32-bit words. INT32 prefillLevel; // NOT USED. Circular buffer fills to this number of words before data is output. INT32 underflowCount; // Number of output samples that could not be serviced. INT32 currentFillLevel; // Number of available data samples in the circular buffer. INT32 isReady; // Boolean that indicates whether the module is ready to output data. INT32 isPrefilling; // Boolean that indicates whether the module is waiting for prefill data. While waiting, the module does not output data. INT32 asyncStatus; // Used to pass asynchronous messages (pause/stop/play) from the PC to the target. INT32 playbackState; // Indicates the current state of the player: FIOS_Stopped, FIOS_Playing, FIOS_Paused. Starts out in FIOS_Stopped. INT32 isNewStream; // Boolean that indicates whether the player has just output the first block of a new file. INT32 fileExtension; // First 4 letters of the file extension each packed as a byte into the word (for commonality with the file_streaming_module.m). INT32 writeIndex; // Index at which to write data into the circular buffer. INT32 readIndex; // Index at which to read data out of the circular buffer. INT32* transferBuffer; // NOT USED. Data transferred from PC to target DSP via this buffer. INT32* circularBuffer; // Data transferred from PC to target DSP via this buffer. } ModulePeriodicStreamingClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

transferBufferSize

int

const

0

0

1:1000000

32-bit words

circularBufferSize

int

const

0

1024

1:1000000

32-bit words

prefillLevel

int

parameter

0

512

Unrestricted

32-bit words

underflowCount

int

state

0

0

Unrestricted

 

currentFillLevel

int

state

0

0

0:1024

32-bit words

isReady

int

state

0

1

0:1

 

isPrefilling

int

state

0

0

0:1

 

asyncStatus

int

state

0

0

Unrestricted

 

playbackState

int

state

0

7

Unrestricted

 

isNewStream

int

state

0

0

Unrestricted

 

fileExtension

int

state

0

0

Unrestricted

 

writeIndex

int

state

1

0

Unrestricted

 

readIndex

int

state

1

0

Unrestricted

 

transferBuffer

int*

parameter

0

[1 x 1]

Unrestricted

 

circularBuffer

int*

parameter

0

[1024 x 1]

Unrestricted

 

Pins

Output Pins

Name: ID

Description: Module objectID

Data type: int

MATLAB Usage

File Name: periodic_streaming_module.m

M=periodic_streaming_module(NAME, CIRCBUFSIZE) Creates a streaming source module that can be connected to one of the modules which "pulls" data, such as: raw_streaming_source_module.m or one of the audio decoders. The module has an internal buffer of audio data and continuously outputs the same block of data. Arguments: NAME - name of the module. CIRBUFSIZE - size of the internal circular buffer, in 32-bit words. The data is from the circular buffer to output.

Â