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

#include <audiocd-stream.h>

Inheritance diagram for AudioCDStream:
Collaboration diagram for AudioCDStream:

List of all members.

Public Member Functions

 AudioCDStream ()
 ~AudioCDStream ()
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 seek (const Audio::Timestamp &where)
 Seeks to a given offset in the stream.
Audio::Timestamp getLength () const
 Returns the length of the stream.

Protected Types

enum  { kBytesPerFrame = 2352, kSamplesPerFrame = kBytesPerFrame / 2 }
enum  { kSecondsPerMinute = 60, kFramesPerSecond = 75 }
enum  { kBufferThreshold = kFramesPerSecond }

Protected Member Functions

virtual uint getStartFrame () const =0
virtual uint getEndFrame () const =0
virtual bool readFrame (int frame, int16 *buffer)=0
void startTimer (bool fillBuffer=false)
void stopTimer ()

Private Member Functions

bool shouldForceStop () const
void forceStop ()
bool readNextFrame ()
void onTimer ()
void emptyQueue ()

Static Private Member Functions

static void timerProc (void *refCon)

Private Attributes

int16 _buffer [kSamplesPerFrame]
int _frame
uint _bufferPos
Common::Queue< int16 * > _bufferQueue
int _bufferFrame
Common::Mutex _mutex
bool _forceStop
Common::Mutex _forceStopMutex

Detailed Description

Definition at line 53 of file audiocd-stream.h.


Member Enumeration Documentation

anonymous enum [protected]
Enumerator:
kBytesPerFrame 
kSamplesPerFrame 

Definition at line 73 of file audiocd-stream.h.

anonymous enum [protected]
Enumerator:
kSecondsPerMinute 
kFramesPerSecond 

Definition at line 78 of file audiocd-stream.h.

anonymous enum [protected]
Enumerator:
kBufferThreshold 

Definition at line 83 of file audiocd-stream.h.


Constructor & Destructor Documentation

AudioCDStream::AudioCDStream (  ) 

Definition at line 48 of file audiocd-stream.cpp.

AudioCDStream::~AudioCDStream (  ) 

Definition at line 51 of file audiocd-stream.cpp.


Member Function Documentation

void AudioCDStream::emptyQueue (  )  [private]

Definition at line 186 of file audiocd-stream.cpp.

bool AudioCDStream::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 103 of file audiocd-stream.cpp.

void AudioCDStream::forceStop (  )  [private]

Definition at line 196 of file audiocd-stream.cpp.

virtual uint AudioCDStream::getEndFrame (  )  const [protected, pure virtual]
Audio::Timestamp AudioCDStream::getLength (  )  const [virtual]

Returns the length of the stream.

Returns:
length as Timestamp.

Implements Audio::SeekableAudioStream.

Definition at line 125 of file audiocd-stream.cpp.

int AudioCDStream::getRate (  )  const [inline, virtual]

Sample rate of the stream.

Implements Audio::AudioStream.

Definition at line 60 of file audiocd-stream.h.

virtual uint AudioCDStream::getStartFrame (  )  const [protected, pure virtual]
bool AudioCDStream::isStereo (  )  const [inline, virtual]

Is this a stereo stream?

Implements Audio::AudioStream.

Definition at line 59 of file audiocd-stream.h.

void AudioCDStream::onTimer (  )  [private]

Definition at line 133 of file audiocd-stream.cpp.

int AudioCDStream::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 60 of file audiocd-stream.cpp.

virtual bool AudioCDStream::readFrame ( int  frame,
int16 buffer 
) [protected, pure virtual]
bool AudioCDStream::readNextFrame (  )  [private]

Definition at line 83 of file audiocd-stream.cpp.

bool AudioCDStream::seek ( const Audio::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 107 of file audiocd-stream.cpp.

bool AudioCDStream::shouldForceStop (  )  const [private]

Definition at line 191 of file audiocd-stream.cpp.

void AudioCDStream::startTimer ( bool  fillBuffer = false  )  [protected]

Definition at line 173 of file audiocd-stream.cpp.

void AudioCDStream::stopTimer (  )  [protected]

Definition at line 181 of file audiocd-stream.cpp.

void AudioCDStream::timerProc ( void *  refCon  )  [static, private]

Definition at line 129 of file audiocd-stream.cpp.


Member Data Documentation

int16 AudioCDStream::_buffer[kSamplesPerFrame] [private]

Definition at line 89 of file audiocd-stream.h.

Definition at line 94 of file audiocd-stream.h.

Definition at line 91 of file audiocd-stream.h.

Definition at line 93 of file audiocd-stream.h.

bool AudioCDStream::_forceStop [private]

Definition at line 97 of file audiocd-stream.h.

Definition at line 100 of file audiocd-stream.h.

int AudioCDStream::_frame [private]

Definition at line 90 of file audiocd-stream.h.

Definition at line 95 of file audiocd-stream.h.


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


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