ScummVM API documentation
Audio::StatelessPacketizedAudioStream Class Referenceabstract

#include <audiostream.h>

Inheritance diagram for Audio::StatelessPacketizedAudioStream:
Audio::PacketizedAudioStream Audio::AudioStream Audio::XanDPCMStream

Public Member Functions

 StatelessPacketizedAudioStream (uint rate, uint channels)
 
bool isStereo () const
 
int getRate () const
 
int readBuffer (int16 *data, const int numSamples)
 
bool endOfData () const
 
bool endOfStream () const
 
void queuePacket (Common::SeekableReadStream *data)
 
void finish ()
 
uint getChannels () const
 

Protected Member Functions

virtual AudioStreammakeStream (Common::SeekableReadStream *data)=0
 

Detailed Description

A PacketizedAudioStream that works closer to a QueuingAudioStream.

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

Constructor & Destructor Documentation

◆ StatelessPacketizedAudioStream()

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

Create a StatelessPacketizedAudioStream with the specified sample rate and for the specified number of channels.

Member Function Documentation

◆ isStereo()

bool Audio::StatelessPacketizedAudioStream::isStereo ( ) const
inlinevirtual

Check whether this is a stereo stream.

Implements Audio::AudioStream.

◆ getRate()

int Audio::StatelessPacketizedAudioStream::getRate ( ) const
inlinevirtual

Sample rate of the stream.

Implements Audio::AudioStream.

◆ readBuffer()

int Audio::StatelessPacketizedAudioStream::readBuffer ( int16 *  buffer,
const int  numSamples 
)
inlinevirtual

Fill the given buffer with up to numSamples samples.

Data must be in native endianness, 16 bits per sample, signed. For stereo stream, the buffer will be filled with interleaved left and right channel samples, starting with the 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.

Returns
The actual number of samples read, or -1 if a critical error occurred.
Note
You must check whether the returned value is less than what you requested. This indicates that the stream is fully used up.

Implements Audio::AudioStream.

◆ endOfData()

bool Audio::StatelessPacketizedAudioStream::endOfData ( ) const
inlinevirtual

Check whether end of data has been reached.

If this returns true, it indicates that at this time there is no data available in the stream. However, there might be more data in the future.

This is used by e.g. a rate converter to decide whether to keep on converting data or to stop.

Implements Audio::AudioStream.

◆ endOfStream()

bool Audio::StatelessPacketizedAudioStream::endOfStream ( ) const
inlinevirtual

Check whether end of stream has been reached.

If this returns true, it indicates 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.

◆ queuePacket()

void Audio::StatelessPacketizedAudioStream::queuePacket ( Common::SeekableReadStream data)
inlinevirtual

Queue the next packet to be decoded.

Implements Audio::PacketizedAudioStream.

◆ finish()

void Audio::StatelessPacketizedAudioStream::finish ( )
inlinevirtual

Mark this stream as finished. That is, signal that no further data

This is used to signal that no further data will be queued to the stream. The stream is only considered as ended after this has been done.

Implements Audio::PacketizedAudioStream.

◆ getChannels()

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

Return how many channels this stream is using.

◆ makeStream()

virtual AudioStream* Audio::StatelessPacketizedAudioStream::makeStream ( Common::SeekableReadStream data)
protectedpure virtual

Create an AudioStream for a given packet.

Implemented in Audio::XanDPCMStream.


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