xoreos
0.0.5
|
Generic audio input stream. More...
#include <audiostream.h>
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 |
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.
|
inlinevirtual |
Definition at line 74 of file audiostream.h.
|
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().
|
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().
|
pure virtual |
Return the number channels in this stream.
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 Sound::SoundManager::fillBuffer(), and Sound::QueuingAudioStreamImpl::queueAudioStream().
|
pure virtual |
Sample rate of the stream.
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 Sound::SoundManager::fillBuffer(), Sound::RewindableAudioStream::getDuration(), and Sound::QueuingAudioStreamImpl::queueAudioStream().
|
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:
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().
|
static |
Definition at line 72 of file audiostream.h.
Referenced by Sound::SoundManager::fillBuffer(), Sound::Interleaver::readBuffer(), Sound::ASFStream::readBuffer(), Sound::LoopingAudioStream::readBuffer(), and Sound::QueuingAudioStreamImpl::readBuffer().