ScummVM API documentation
Audio streams

Description

API for managing audio input streams.

Classes

class  Audio::AudioStream
 
class  Audio::RewindableAudioStream
 
class  Audio::LoopableAudioStream
 
class  Audio::LoopingAudioStream
 
class  Audio::SeekableAudioStream
 
class  Audio::SubLoopingAudioStream
 
class  Audio::SubSeekableAudioStream
 
class  Audio::QueuingAudioStream
 
class  Audio::PacketizedAudioStream
 
class  Audio::StatelessPacketizedAudioStream
 

Functions

AudioStreamAudio::makeLoopingAudioStream (RewindableAudioStream *stream, uint loops)
 
AudioStreamAudio::makeLoopingAudioStream (SeekableAudioStream *stream, Timestamp start, Timestamp end, uint loops)
 
QueuingAudioStreamAudio::makeQueuingAudioStream (int rate, bool stereo)
 
Timestamp Audio::convertTimeToStreamPos (const Timestamp &where, int rate, bool isStereo)
 
AudioStreamAudio::makeLimitingAudioStream (AudioStream *parentStream, const Timestamp &length, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES)
 
AudioStreamAudio::makeNullAudioStream ()
 
AudioStreamAudio::makeSilentAudioStream (int rate, bool stereo)
 

Function Documentation

◆ makeLoopingAudioStream() [1/2]

AudioStream* Audio::makeLoopingAudioStream ( RewindableAudioStream stream,
uint  loops 
)

Wrapper functionality to efficiently create a stream that might be looped.

This function does not return a LoopingAudioStream, because it does not create one when the loop count is "1". This allows to keep the runtime overhead down when the code does not require any functionality that is only offered by LoopingAudioStream.

Parameters
streamThe stream to loop (will be automatically destroyed, when the looping is done).
loopsHow often to loop (0 = infinite).
Returns
A new AudioStream that offers the desired functionality.

◆ makeLoopingAudioStream() [2/2]

AudioStream* Audio::makeLoopingAudioStream ( SeekableAudioStream stream,
Timestamp  start,
Timestamp  end,
uint  loops 
)

Wrapper functionality to efficiently create a stream that might be looped in a certain interval.

This automatically starts the stream at time "start"!

This function does not return a LoopingAudioStream, because it does not create one when the loop count is "1". This allows to keep the runtime overhead down when the code does not require any functionality that is only offered by LoopingAudioStream.

Parameters
streamThe stream to loop (will be automatically destroyed when the looping is done).
startStart time of the stream interval to be looped.
endEnd of the stream interval to be looped (a zero time means till the end).
loopsHow often to loop (0 = infinite).
Returns
A new AudioStream that offers the desired functionality.

◆ makeQueuingAudioStream()

QueuingAudioStream* Audio::makeQueuingAudioStream ( int  rate,
bool  stereo 
)

Factory function for a QueuingAudioStream.

◆ convertTimeToStreamPos()

Timestamp Audio::convertTimeToStreamPos ( const Timestamp where,
int  rate,
bool  isStereo 
)

Convert a point in time to a precise sample offset with the given parameters.

Parameters
wherePoint in time.
rateRate of the stream.
isStereoWhether the stream is a stereo stream.

◆ makeLimitingAudioStream()

AudioStream* Audio::makeLimitingAudioStream ( AudioStream parentStream,
const Timestamp length,
DisposeAfterUse::Flag  disposeAfterUse = DisposeAfterUse::YES 
)

Factory function for an AudioStream wrapper that cuts off the amount of samples read after a given time length is reached.

Parameters
parentStreamThe stream to limit.
lengthThe time length to limit the stream to.
disposeAfterUseWhether the parent stream object should be destroyed on destruction of the returned stream.

◆ makeNullAudioStream()

AudioStream* Audio::makeNullAudioStream ( )

Create an AudioStream that plays nothing and immediately returns that endOfStream() has been reached.

◆ makeSilentAudioStream()

AudioStream* Audio::makeSilentAudioStream ( int  rate,
bool  stereo 
)

Create an AudioStream that just returns silent samples and runs infinitely.