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

Audio::SubSeekableAudioStream Class Reference

A SubSeekableAudioStream provides access to a SeekableAudioStream just in the range [start, end). More...

#include <audiostream.h>

Inheritance diagram for Audio::SubSeekableAudioStream:
Collaboration diagram for Audio::SubSeekableAudioStream:

List of all members.

Public Member Functions

 SubSeekableAudioStream (SeekableAudioStream *parent, const Timestamp start, const Timestamp end, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES)
 Creates a new SubSeekableAudioStream.
int readBuffer (int16 *buffer, const int numSamples)
 Fill the given buffer with up to numSamples samples.
bool isStereo () const
 Is this a stereo stream?
int getRate () const
 Sample rate of the stream.
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 seek (const Timestamp &where)
 Seeks to a given offset in the stream.
Timestamp getLength () const
 Returns the length of the stream.

Private Attributes

Common::DisposablePtr
< SeekableAudioStream
_parent
const Timestamp _start
const Timestamp _length
Timestamp _pos

Detailed Description

A SubSeekableAudioStream provides access to a SeekableAudioStream just in the range [start, end).

The same caveats apply to SubSeekableAudioStream as do to SeekableAudioStream.

Manipulating the parent stream directly /will/ mess up a substream.

Definition at line 276 of file audiostream.h.


Constructor & Destructor Documentation

Audio::SubSeekableAudioStream::SubSeekableAudioStream ( SeekableAudioStream parent,
const Timestamp  start,
const Timestamp  end,
DisposeAfterUse::Flag  disposeAfterUse = DisposeAfterUse::YES 
)

Creates a new SubSeekableAudioStream.

Parameters:
parent parent stream object.
start Start time.
end End time.
disposeAfterUse Whether the parent stream object should be destroyed on destruction of the SubSeekableAudioStream.

Definition at line 240 of file audiostream.cpp.


Member Function Documentation

bool Audio::SubSeekableAudioStream::endOfData (  )  const [inline, 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 294 of file audiostream.h.

bool Audio::SubSeekableAudioStream::endOfStream (  )  const [inline, 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 295 of file audiostream.h.

Timestamp Audio::SubSeekableAudioStream::getLength (  )  const [inline, virtual]

Returns the length of the stream.

Returns:
length as Timestamp.

Implements Audio::SeekableAudioStream.

Definition at line 299 of file audiostream.h.

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

Sample rate of the stream.

Implements Audio::AudioStream.

Definition at line 292 of file audiostream.h.

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

Is this a stereo stream?

Implements Audio::AudioStream.

Definition at line 290 of file audiostream.h.

int Audio::SubSeekableAudioStream::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 250 of file audiostream.cpp.

bool Audio::SubSeekableAudioStream::seek ( const Timestamp where  )  [virtual]

Seeks to a given offset in the stream.

Parameters:
where offset as timestamp
Returns:
true on success, false on failure.

Implements Audio::SeekableAudioStream.

Definition at line 257 of file audiostream.cpp.


Member Data Documentation

Definition at line 304 of file audiostream.h.

Definition at line 305 of file audiostream.h.

Definition at line 303 of file audiostream.h.


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


Generated on Sat Jan 12 2019 05:03:52 for ResidualVM by doxygen 1.7.1
curved edge   curved edge