Torque3D Documentation / _generateds / SFXInternal::SFXAsyncStream

SFXInternal::SFXAsyncStream

Engine/source/sfx/sfxInternal.h

Asynchronous sound data stream that delivers sound data in discrete packets.

More...

Public Types

enum
_Anonymous_ {  DEFAULT_STREAM_PACKET_LENGTH = 8
}

Protected Attributes

bool

If true, the stream reads one packet of silence beyond the sound streams actual sound data.

Protected Functions

_newPacket(U32 packetSize)

Create a new stream packet of the given size.

_newReadItem(PacketReadItemRef & outRef, SFXStreamPacket * packet, U32 numElements)

Request the next packet from the underlying stream.

Public Functions

SFXAsyncStream(const SFXStreamRef & stream, bool isIncremental, U32 streamPacketLength, U32 numReadAhead, bool isLooping)

Construct a new async sound stream reading data from "stream".

Return the playback time of a single sound packet in milliseconds.

Returns true if the stream will read a packet of silence after the actual sound data.

setReadSilenceAtEnd(bool value)

Set whether the stream should read one packet of silence past the actual sound data.

Detailed Description

Asynchronous sound data stream that delivers sound data in discrete packets.

Public Types

@169

Enumerator

DEFAULT_STREAM_PACKET_LENGTH = 8

The number of seconds of sample data to load per streaming packet by default.

Set this reasonably high to ensure the system is able to cope with latencies in the buffer update chain.

typedef AsyncPacketBufferedInputStream< SFXStreamRef, SFXStreamPacket > Parent 

Protected Attributes

bool mReadSilenceAtEnd 

If true, the stream reads one packet of silence beyond the sound streams actual sound data.

This is to avoid wrap-around playback queues running into old data when there is a delay in playback being stopped.

note:

The silence packet is not counting towards stream playback time.

Protected Functions

_newPacket(U32 packetSize)

Reimplemented from: AsyncPacketBufferedInputStream

_newReadItem(PacketReadItemRef & outRef, SFXStreamPacket * packet, U32 numElements)

_onArrival(SFXStreamPacket *const & packet)

_requestNext()

Reimplemented from: AsyncPacketBufferedInputStream

Public Functions

SFXAsyncStream(const SFXStreamRef & stream, bool isIncremental, U32 streamPacketLength, U32 numReadAhead, bool isLooping)

Construct a new async sound stream reading data from "stream".

Parameters:

stream

The sound data source stream.

isIncremental

If true, "stream" is read in packets of "streamPacketLength" size each; otherwise the stream is read in a single packet containing the entire stream.

streamPacketLength

Seconds of sample data to read per streaming packet. Only relevant if "isIncremental" is true.

numReadAhead

Number of stream packets to read and buffer in advance.

isLooping

If true, the packet stream infinitely loops over "stream".

getPacketDuration()

Return the playback time of a single sound packet in milliseconds.

For non-incremental streams, this will be the duration of the entire stream.

getReadSilenceAtEnd()

Returns true if the stream will read a packet of silence after the actual sound data.

setReadSilenceAtEnd(bool value)

Set whether the stream should read one packet of silence past the actual sound data.

This is useful for situations where continued playback may run into old data.