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

Audio::QueuingAudioStreamImpl Class Reference

Inheritance diagram for Audio::QueuingAudioStreamImpl:
Collaboration diagram for Audio::QueuingAudioStreamImpl:

List of all members.

Classes

struct  StreamHolder
 We queue a number of (pointers to) audio stream objects. More...

Public Member Functions

 QueuingAudioStreamImpl (int rate, bool stereo)
 ~QueuingAudioStreamImpl ()
virtual int readBuffer (int16 *buffer, const int numSamples)
 Fill the given buffer with up to numSamples samples.
virtual bool isStereo () const
 Is this a stereo stream?
virtual int getRate () const
 Sample rate of the stream.
virtual 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.
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.
virtual void queueAudioStream (AudioStream *stream, DisposeAfterUse::Flag disposeAfterUse)
 Queue an audio stream for playback.
virtual void finish ()
 Mark this stream as finished.
uint32 numQueuedStreams () const
 Return the number of streams still queued for playback (including the currently playing stream).

Private Attributes

const int _rate
 The sampling rate of this audio stream.
const int _stereo
 Whether this audio stream is mono (=false) or stereo (=true).
bool _finished
 This flag is set by the finish() method only.
Common::Mutex _mutex
 A mutex to avoid access problems (causing e.g.
Common::Queue< StreamHolder_queue
 The queue of audio streams.

Detailed Description

Definition at line 283 of file audiostream.cpp.


Constructor & Destructor Documentation

Audio::QueuingAudioStreamImpl::QueuingAudioStreamImpl ( int  rate,
bool  stereo 
) [inline]

Definition at line 327 of file audiostream.cpp.

Audio::QueuingAudioStreamImpl::~QueuingAudioStreamImpl (  ) 

Definition at line 360 of file audiostream.cpp.


Member Function Documentation

virtual bool Audio::QueuingAudioStreamImpl::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 336 of file audiostream.cpp.

virtual bool Audio::QueuingAudioStreamImpl::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 341 of file audiostream.cpp.

virtual void Audio::QueuingAudioStreamImpl::finish (  )  [inline, virtual]

Mark this stream as finished.

That is, signal that no further data will be queued to it. Only after this has been done can this stream ever 'end'.

Implements Audio::QueuingAudioStream.

Definition at line 349 of file audiostream.cpp.

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

Sample rate of the stream.

Implements Audio::AudioStream.

Definition at line 334 of file audiostream.cpp.

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

Is this a stereo stream?

Implements Audio::AudioStream.

Definition at line 333 of file audiostream.cpp.

uint32 Audio::QueuingAudioStreamImpl::numQueuedStreams (  )  const [inline, virtual]

Return the number of streams still queued for playback (including the currently playing stream).

Implements Audio::QueuingAudioStream.

Definition at line 354 of file audiostream.cpp.

void Audio::QueuingAudioStreamImpl::queueAudioStream ( AudioStream audStream,
DisposeAfterUse::Flag  disposeAfterUse 
) [virtual]

Queue an audio stream for playback.

This stream plays all queued streams, in the order they were queued. If disposeAfterUse is set to DisposeAfterUse::YES, then the queued stream is deleted after all data contained in it has been played.

Implements Audio::QueuingAudioStream.

Definition at line 368 of file audiostream.cpp.

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


Member Data Documentation

This flag is set by the finish() method only.

See there for more details.

Definition at line 313 of file audiostream.cpp.

A mutex to avoid access problems (causing e.g.

corruption of the linked list) in thread aware environments.

Definition at line 319 of file audiostream.cpp.

The queue of audio streams.

Definition at line 324 of file audiostream.cpp.

The sampling rate of this audio stream.

Definition at line 303 of file audiostream.cpp.

Whether this audio stream is mono (=false) or stereo (=true).

Definition at line 308 of file audiostream.cpp.


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


Generated on Sat Nov 16 2019 05:02:32 for ResidualVM by doxygen 1.7.1
curved edge   curved edge