xoreos  0.0.5
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Sound::Xbox_ADPCMStream Class Reference
Inheritance diagram for Sound::Xbox_ADPCMStream:
Inheritance graph
[legend]
Collaboration diagram for Sound::Xbox_ADPCMStream:
Collaboration graph
[legend]

Classes

struct  ADPCMChannelStatus
 

Public Member Functions

 Xbox_ADPCMStream (Common::SeekableReadStream *stream, bool disposeAfterUse, uint32 size, int rate, int channels, uint32 blockAlign)
 
virtual size_t readBuffer (int16 *buffer, const size_t numSamples)
 Fill the given buffer with up to numSamples samples. More...
 
- Public Member Functions inherited from Sound::ADPCMStream
 ADPCMStream (Common::SeekableReadStream *stream, bool disposeAfterUse, size_t size, int rate, int channels, uint32 blockAlign)
 
 ~ADPCMStream ()
 
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. More...
 
virtual int getChannels () const
 Return the number channels in this stream. More...
 
virtual int getRate () const
 Sample rate of the stream. More...
 
virtual uint64 getLength () const
 Estimate the total number of samples per channel in this stream. More...
 
virtual bool rewind ()
 Rewinds the stream to its start. More...
 
- Public Member Functions inherited from Sound::RewindableAudioStream
virtual uint64 getDuration () const
 Estimate the total duration of the stream in milliseconds. More...
 
- Public Member Functions inherited from Sound::AudioStream
virtual ~AudioStream ()
 
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. More...
 

Protected Member Functions

void reset ()
 
- Protected Member Functions inherited from Sound::ADPCMStream
int16 stepAdjust (byte)
 

Private Member Functions

int16 decodeXbox (int code, ADPCMChannelStatus &status)
 

Private Attributes

struct {
   ADPCMChannelStatus   ch [2]
 
_status
 

Additional Inherited Members

- Static Public Attributes inherited from Sound::RewindableAudioStream
static const uint64 kInvalidLength = UINT64_C(0xFFFFFFFFFFFFFFFF)
 
- Static Public Attributes inherited from Sound::AudioStream
static const size_t kSizeInvalid = SIZE_MAX
 
- Protected Attributes inherited from Sound::ADPCMStream
Common::DisposablePtr< Common::SeekableReadStream_stream
 
const size_t _size
 
const size_t _startpos
 
const size_t _endpos
 
const int _channels
 
const uint32 _blockAlign
 
uint32 _blockPos [2]
 
const int _rate
 
uint64 _length
 
struct {
   struct {
      int32   last
 
      int32   stepIndex
 
   }   ima_ch [2]
 
_status
 

Detailed Description

Definition at line 505 of file adpcm.cpp.

Constructor & Destructor Documentation

◆ Xbox_ADPCMStream()

Sound::Xbox_ADPCMStream::Xbox_ADPCMStream ( Common::SeekableReadStream stream,
bool  disposeAfterUse,
uint32  size,
int  rate,
int  channels,
uint32  blockAlign 
)
inline

Definition at line 507 of file adpcm.cpp.

References Sound::ADPCMStream::_blockAlign, Sound::ADPCMStream::_length, Sound::ADPCMStream::_size, _status, and reset().

Here is the call graph for this function:

Member Function Documentation

◆ decodeXbox()

int16 Sound::Xbox_ADPCMStream::decodeXbox ( int  code,
ADPCMChannelStatus status 
)
private

Definition at line 575 of file adpcm.cpp.

References Sound::imaStepTable, Sound::kXboxIndexTable, and status().

Referenced by readBuffer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readBuffer()

size_t Sound::Xbox_ADPCMStream::readBuffer ( int16 buffer,
const size_t  numSamples 
)
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:

  • 5.1: front left, front right, front center, low frequency rear left, rear right

Implements Sound::AudioStream.

Definition at line 596 of file adpcm.cpp.

References Sound::ADPCMStream::_blockAlign, Sound::ADPCMStream::_blockPos, Sound::ADPCMStream::_channels, Sound::ADPCMStream::_endpos, _status, Sound::ADPCMStream::_stream, decodeXbox(), and Sound::imaStepTable.

Here is the call graph for this function:

◆ reset()

void Sound::Xbox_ADPCMStream::reset ( )
inlineprotectedvirtual

Reimplemented from Sound::ADPCMStream.

Definition at line 546 of file adpcm.cpp.

References Sound::ADPCMStream::_blockAlign, Sound::ADPCMStream::_blockPos, _status, and Sound::ADPCMStream::reset().

Referenced by Xbox_ADPCMStream().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _status

struct { ... } Sound::Xbox_ADPCMStream::_status

Referenced by readBuffer(), reset(), and Xbox_ADPCMStream().

◆ ch

ADPCMChannelStatus Sound::Xbox_ADPCMStream::ch[2]

Definition at line 564 of file adpcm.cpp.


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