98 if (index >=
_waves.size())
99 throw Common::Exception(
"XACTWaveBank_Binary::getWave(): Index out of range (%s >= %s)",
108 switch (wave.
codec) {
123 static_cast<uint>(wave.
codec));
143 static const uint32 kXWBID =
MKTAG(
'W',
'B',
'N',
'D');
171 if (waveMetaSize < 24)
172 throw Common::Exception(
"XACTWaveBank_Binary::load(): Wave meta data size too small (%s)",
182 dataOffset = indexOffset + waveCount * waveMetaSize;
185 for (std::vector<Wave>::iterator w =
_waves.begin(); w !=
_waves.end(); ++w) {
186 xwb.
seek(indexOffset);
198 w->codec =
static_cast<Codec>(((formatCode ) & ((1 << 2) - 1)));
199 w->channels = (formatCode >> 2) & ((1 << 3) - 1);
200 w->samplingRate = (formatCode >> 5) & ((1 << 18) - 1);
201 w->blockAlign = (formatCode >> 23) & ((1 << 8) - 1);
202 w->bitRate = ((formatCode >> 31) & ((1 << 1) - 1)) ? 16 : 8;
212 static_cast<uint>(w->codec));
215 indexOffset += waveMetaSize;
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
uint32 readUint32LE()
Read an unsigned 32-bit word stored in little endian (LSB first) order from the stream and return it...
Containerless PCM stream.
virtual size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)=0
Sets the stream position indicator for the stream.
ASF container with a WMA stream.
A binary XACT WaveBank, found in the Xbox version of Jade Empire as XWB files.
UString composeString(T value)
Convert any POD integer, float/double or bool type into a string.
RewindableAudioStream * getWave(size_t index) const
Return the audio stream of a wave.
Don't loop this sound.
Implementing the reading stream interfaces for plain memory blocks.
std::vector< Wave > _waves
uint8 bitRate
Number of bits per sample.
unsigned samples (default: signed)
RewindableAudioStream * makePCMStream(Common::SeekableReadStream *stream, int rate, byte flags, int channels, bool disposeAfterUse)
Creates an audio stream, which plays from the given stream.
Common::UString _name
The internal name of this wavebank. */.
Codec codec
The codec the wave is in.
Decoding PCM (Pulse Code Modulation).
uint8 channels
Number of channels.
RewindableAudioStream * makeASFStream(Common::SeekableReadStream *stream, bool disposeAfterUse)
Try to load a ASF from the given seekable stream and create a RewindableAudioStream from that data...
Utility templates and functions for working with strings and streams.
uint32 samplingRate
Sampling frequency in Hz.
Exception that provides a stack of explanations.
Common::ScopedPtr< Common::SeekableReadStream > _xwb
Basic exceptions to throw.
Decoding ADPCM (Adaptive Differential Pulse Code Modulation).
A rewindable audio stream.
const char * c_str() const
Return the (utf8 encoded) string data.
Utility templates and functions.
Codec
The codec of a wave within the wavebank.
XACTWaveBank_Binary(Common::SeekableReadStream *xwb)
A wave within the wavebank.
RewindableAudioStream * makeADPCMStream(Common::SeekableReadStream *stream, bool disposeAfterUse, uint32 size, ADPCMTypes type, int rate, int channels, uint32 blockAlign)
Takes an input stream containing ADPCM compressed sound data and creates an RewindableAudioStream fro...
Ignore the data after the looping section.
virtual size_t skip(ptrdiff_t offset)
Skip the specified number of bytes, adding that offset to the current position in the stream...
Utility functions for working with differing string encodings.
void load(Common::SeekableReadStream &xwb)
uint32 readUint32BE()
Read an unsigned 32-bit word stored in big endian (MSB first) order from the stream and return it...
sound is 16 bits wide (default: 8bit)
Plain, unextended ASCII (7bit clean).
UString debugTag(uint32 tag, bool trim)
Create an elaborate string from an integer tag, for debugging purposes.
Audio file is used by at least one looping sound.
samples are little endian (default: big endian)
UString readStringFixed(SeekableReadStream &stream, Encoding encoding, size_t length)
Read length bytes as a string with the given encoding out of a stream.
Containerless Xbox ADPCM stream.
bool isStreaming() const
Is this WaveBank rating for streaming, or in-memory play?
Decoding Microsoft's Advanced Streaming Format.
Interface for a seekable & readable data stream.
size_t offset
The offset of the wave within the wavebank. */.
Performance hint: read ahead while streaming.
size_t getWaveCount() const
Return the number of wave files.
size_t size
The size of the wave in bytes. */.