ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Audio::StatelessPacketizedAudioStream Class Reference

A PacketizedAudioStream that works closer to a QueuingAudioStream. More...

#include <audiostream.h>

Inheritance diagram for Audio::StatelessPacketizedAudioStream:
Collaboration diagram for Audio::StatelessPacketizedAudioStream:

List of all members.

Public Member Functions

 StatelessPacketizedAudioStream (uint rate, uint channels)
virtual ~StatelessPacketizedAudioStream ()
bool isStereo () const
 Is this a stereo stream?
int getRate () const
 Sample rate of the stream.
int readBuffer (int16 *data, const int numSamples)
 Fill the given buffer with up to numSamples samples.
bool endOfData () const
 End of data reached? If this returns true, it means that at this time there is no data available in the stream.
bool endOfStream () const
 End of stream reached? If this returns true, it means that all data in this stream is used up and no additional data will appear in it in the future.
void queuePacket (Common::SeekableReadStream *data)
 Queue the next packet to be decoded.
void finish ()
 Mark this stream as finished.
uint getChannels () const

Protected Member Functions

virtual AudioStreammakeStream (Common::SeekableReadStream *data)=0
 Make the AudioStream for a given packet.

Private Attributes

uint _rate
uint _channels
Common::ScopedPtr
< QueuingAudioStream
_stream

Detailed Description

A PacketizedAudioStream that works closer to a QueuingAudioStream.

It queues individual packets as whole AudioStream to an internal QueuingAudioStream. This is used for writing quick wrappers against e.g. RawStream, which can be made into PacketizedAudioStreams with little effort.

Definition at line 405 of file audiostream.h.


Constructor & Destructor Documentation

Audio::StatelessPacketizedAudioStream::StatelessPacketizedAudioStream ( uint  rate,
uint  channels 
) [inline]

Definition at line 407 of file audiostream.h.

virtual Audio::StatelessPacketizedAudioStream::~StatelessPacketizedAudioStream (  )  [inline, virtual]

Definition at line 409 of file audiostream.h.


Member Function Documentation

bool Audio::StatelessPacketizedAudioStream::endOfData (  )  const [inline, virtual]

End of data reached? If this returns true, it means that at this time there is no data available in the stream.

However there may be more data in the future. This is used by e.g. a rate converter to decide whether to keep on converting data or stop.

Implements Audio::AudioStream.

Definition at line 415 of file audiostream.h.

bool Audio::StatelessPacketizedAudioStream::endOfStream (  )  const [inline, virtual]

End of stream reached? If this returns true, it means that all data in this stream is used up and no additional data will appear in it in the future.

This is used by the mixer to decide whether a given stream shall be removed from the list of active streams (and thus be destroyed). By default this maps to endOfData()

Reimplemented from Audio::AudioStream.

Definition at line 416 of file audiostream.h.

void Audio::StatelessPacketizedAudioStream::finish (  )  [inline, virtual]

Mark this stream as finished.

That is, signal that no further data will be queued to it. Only after this has been done can this stream ever 'end'.

Implements Audio::PacketizedAudioStream.

Definition at line 420 of file audiostream.h.

uint Audio::StatelessPacketizedAudioStream::getChannels (  )  const [inline]

Definition at line 422 of file audiostream.h.

int Audio::StatelessPacketizedAudioStream::getRate (  )  const [inline, virtual]

Sample rate of the stream.

Implements Audio::AudioStream.

Definition at line 413 of file audiostream.h.

bool Audio::StatelessPacketizedAudioStream::isStereo (  )  const [inline, virtual]

Is this a stereo stream?

Implements Audio::AudioStream.

Definition at line 412 of file audiostream.h.

virtual AudioStream* Audio::StatelessPacketizedAudioStream::makeStream ( Common::SeekableReadStream data  )  [protected, pure virtual]

Make the AudioStream for a given packet.

Implemented in Audio::PacketizedADPCMStream, and Audio::PacketizedRawStream.

void Audio::StatelessPacketizedAudioStream::queuePacket ( Common::SeekableReadStream data  )  [inline, virtual]

Queue the next packet to be decoded.

Implements Audio::PacketizedAudioStream.

Definition at line 419 of file audiostream.h.

int Audio::StatelessPacketizedAudioStream::readBuffer ( int16 buffer,
const int  numSamples 
) [inline, virtual]

Fill the given buffer with up to numSamples samples.

Returns the actual number of samples read, or -1 if a critical error occurred (note: you *must* check if this value is less than what you requested, this can happen when the stream is fully used up).

Data has to be in native endianess, 16 bit per sample, signed. For stereo stream, buffer will be filled with interleaved left and right channel samples, starting with a left sample. Furthermore, the samples in the left and right are summed up. So if you request 4 samples from a stereo stream, you will get a total of two left channel and two right channel samples.

Implements Audio::AudioStream.

Definition at line 414 of file audiostream.h.


Member Data Documentation

Definition at line 431 of file audiostream.h.


The documentation for this class was generated from the following file:


Generated on Sat Jan 12 2019 05:03:52 for ResidualVM by doxygen 1.7.1
curved edge   curved edge