xoreos
0.0.5
|
Public Member Functions | |
Interleaver (int rate, const std::vector< AudioStream *> &streams, bool disposeAfterUse) | |
~Interleaver () | |
size_t | readBuffer (int16 *buffer, const size_t numSamples) |
Fill the given buffer with up to numSamples samples. More... | |
int | getChannels () const |
Return the number channels in this stream. More... | |
int | getRate () const |
Sample rate of the stream. More... | |
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. More... | |
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... | |
Public Member Functions inherited from Sound::AudioStream | |
virtual | ~AudioStream () |
Private Attributes | |
int | _rate |
int | _channels |
std::vector< AudioStream * > | _streams |
bool | _disposeAfterUse |
Additional Inherited Members | |
Static Public Attributes inherited from Sound::AudioStream | |
static const size_t | kSizeInvalid = SIZE_MAX |
Definition at line 35 of file interleaver.cpp.
Sound::Interleaver::Interleaver | ( | int | rate, |
const std::vector< AudioStream *> & | streams, | ||
bool | disposeAfterUse | ||
) |
Definition at line 57 of file interleaver.cpp.
Sound::Interleaver::~Interleaver | ( | ) |
Definition at line 72 of file interleaver.cpp.
References _disposeAfterUse, and _streams.
|
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 Sound::AudioStream.
Definition at line 114 of file interleaver.cpp.
References _streams.
Referenced by readBuffer().
|
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 Sound::AudioStream.
Definition at line 125 of file interleaver.cpp.
References _streams.
|
virtual |
Return the number channels in this stream.
Implements Sound::AudioStream.
Definition at line 106 of file interleaver.cpp.
References _channels.
|
virtual |
Sample rate of the stream.
Implements Sound::AudioStream.
Definition at line 110 of file interleaver.cpp.
References _rate.
|
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:
Implements Sound::AudioStream.
Definition at line 78 of file interleaver.cpp.
References _streams, endOfData(), and Sound::AudioStream::kSizeInvalid.
|
private |
Definition at line 50 of file interleaver.cpp.
Referenced by getChannels(), and Interleaver().
|
private |
Definition at line 53 of file interleaver.cpp.
Referenced by ~Interleaver().
|
private |
Definition at line 49 of file interleaver.cpp.
Referenced by getRate().
|
private |
Definition at line 52 of file interleaver.cpp.
Referenced by endOfData(), endOfStream(), Interleaver(), readBuffer(), and ~Interleaver().