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

Audio::SubLoopingAudioStream Class Reference

A looping audio stream, which features looping of a nested part of the stream. More...

#include <audiostream.h>

Inheritance diagram for Audio::SubLoopingAudioStream:
Collaboration diagram for Audio::SubLoopingAudioStream:

List of all members.

Public Member Functions

 SubLoopingAudioStream (SeekableAudioStream *stream, uint loops, const Timestamp loopStart, const Timestamp loopEnd, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES)
 Constructor for a SubLoopingAudioStream.
int readBuffer (int16 *buffer, 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.
bool isStereo () const
 Is this a stereo stream?
int getRate () const
 Sample rate of the stream.

Private Attributes

Common::DisposablePtr
< SeekableAudioStream
_parent
uint _loops
Timestamp _pos
Timestamp _loopStart
Timestamp _loopEnd
bool _done

Detailed Description

A looping audio stream, which features looping of a nested part of the stream.

NOTE: Currently this implementation stops after the nested loop finished playback.

IMPORTANT: This might be merged with SubSeekableAudioStream for playback purposes. (After extending it to accept a start time).

Definition at line 232 of file audiostream.h.


Constructor & Destructor Documentation

Audio::SubLoopingAudioStream::SubLoopingAudioStream ( SeekableAudioStream stream,
uint  loops,
const Timestamp  loopStart,
const Timestamp  loopEnd,
DisposeAfterUse::Flag  disposeAfterUse = DisposeAfterUse::YES 
)

Constructor for a SubLoopingAudioStream.

Note that on creation of the SubLoopingAudioStream object the underlying stream will be rewound.

Parameters:
stream Stream to loop
loops How often the stream should be looped (0 means infinite)
loopStart Start of the loop (this must be smaller than loopEnd)
loopEnd End of the loop (thus must be greater than loopStart)
disposeAfterUse Whether the stream should be disposed, when the SubLoopingAudioStream is destroyed.

Definition at line 173 of file audiostream.cpp.


Member Function Documentation

bool Audio::SubLoopingAudioStream::endOfData (  )  const [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 224 of file audiostream.cpp.

bool Audio::SubLoopingAudioStream::endOfStream (  )  const [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 230 of file audiostream.cpp.

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

Sample rate of the stream.

Implements Audio::AudioStream.

Definition at line 257 of file audiostream.h.

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

Is this a stereo stream?

Implements Audio::AudioStream.

Definition at line 256 of file audiostream.h.

int Audio::SubLoopingAudioStream::readBuffer ( int16 buffer,
const int  numSamples 
) [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 189 of file audiostream.cpp.


Member Data Documentation

Definition at line 265 of file audiostream.h.

Definition at line 263 of file audiostream.h.

Definition at line 261 of file audiostream.h.

Definition at line 262 of file audiostream.h.


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


Generated on Sat Mar 23 2019 05:06:37 for ResidualVM by doxygen 1.7.1
curved edge   curved edge