xoreos  0.0.5
Public Member Functions | Static Public Attributes | List of all members
Sound::AudioStream Class Referenceabstract

Generic audio input stream. More...

#include <audiostream.h>

Inheritance diagram for Sound::AudioStream:
Inheritance graph
[legend]
Collaboration diagram for Sound::AudioStream:
Collaboration graph
[legend]

Public Member Functions

virtual ~AudioStream ()
 
virtual size_t readBuffer (int16 *buffer, const size_t numSamples)=0
 Fill the given buffer with up to numSamples samples. More...
 
virtual int getChannels () const =0
 Return the number channels in this stream. More...
 
virtual int getRate () const =0
 Sample rate of the stream. More...
 
virtual bool endOfData () const =0
 End of data reached? If this returns true, it means that at this time there is no data available in the stream. More...
 
virtual 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. More...
 

Static Public Attributes

static const size_t kSizeInvalid = SIZE_MAX
 

Detailed Description

Generic audio input stream.

Subclasses of this are used to feed arbitrary sampled audio data into xoreos' SoundManager.

Definition at line 70 of file audiostream.h.

Constructor & Destructor Documentation

◆ ~AudioStream()

virtual Sound::AudioStream::~AudioStream ( )
inlinevirtual

Definition at line 74 of file audiostream.h.

Member Function Documentation

◆ endOfData()

virtual bool Sound::AudioStream::endOfData ( ) const
pure 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.

Implemented in Sound::WwRIFFVorbisStream, Sound::StatelessPacketizedAudioStream, Sound::PacketizedVorbisStream, Video::QuickTimeDecoder::QuickTimeAudioTrack, Sound::QueuingAudioStreamImpl, Sound::LoopingAudioStream, Sound::EmptyAudioStream, Sound::VorbisStream, Sound::ASFStream, Sound::WMACodec, Sound::MP3Stream, Sound::PCMStream< is16Bit, isUnsigned, isLE >, Sound::ADPCMStream, Sound::AACDecoder, and Sound::Interleaver.

Referenced by endOfStream(), Sound::SoundManager::fillBuffer(), and Sound::QueuingAudioStreamImpl::readBuffer().

Here is the caller graph for this function:

◆ endOfStream()

virtual bool Sound::AudioStream::endOfStream ( ) const
inlinevirtual

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 in Sound::StatelessPacketizedAudioStream, Sound::PacketizedVorbisStream, Video::QuickTimeDecoder::QuickTimeAudioTrack, Sound::QueuingAudioStreamImpl, Sound::WMACodec, Sound::AACDecoder, and Sound::Interleaver.

Definition at line 117 of file audiostream.h.

References endOfData().

Here is the call graph for this function:

◆ getChannels()

virtual int Sound::AudioStream::getChannels ( ) const
pure virtual

◆ getRate()

virtual int Sound::AudioStream::getRate ( ) const
pure virtual

◆ readBuffer()

virtual size_t Sound::AudioStream::readBuffer ( int16 buffer,
const size_t  numSamples 
)
pure virtual

Fill the given buffer with up to numSamples samples.

Returns the actual number of samples read, or kSizeInvalid 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 endianness, 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.

The same holds true for more channels. Channel configurations recognized:

  • 5.1: front left, front right, front center, low frequency rear left, rear right

Implemented in Sound::Xbox_ADPCMStream, Sound::MS_ADPCMStream, Sound::WwRIFFVorbisStream, Sound::StatelessPacketizedAudioStream, Sound::MSIma_ADPCMStream, Sound::PacketizedVorbisStream, Video::QuickTimeDecoder::QuickTimeAudioTrack, Sound::QueuingAudioStreamImpl, Sound::LoopingAudioStream, Sound::Apple_ADPCMStream, Sound::EmptyAudioStream, Sound::Ima_ADPCMStream, Sound::VorbisStream, Sound::WMACodec, Sound::ASFStream, Sound::MP3Stream, Sound::PCMStream< is16Bit, isUnsigned, isLE >, Sound::AACDecoder, and Sound::Interleaver.

Referenced by Sound::SoundManager::fillBuffer(), and Sound::QueuingAudioStreamImpl::readBuffer().

Here is the caller graph for this function:

Member Data Documentation

◆ kSizeInvalid

const size_t Sound::AudioStream::kSizeInvalid = SIZE_MAX
static

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