40 if (riffTag !=
MKTAG(
'R',
'I',
'F',
'F'))
46 if (waveTag !=
MKTAG(
'W',
'A',
'V',
'E'))
50 if (fmtTag !=
MKTAG(
'f',
'm',
't',
' '))
55 throw Common::Exception(
"makeWAVStream(): Invalid wave format size %d", fmtLength);
66 stream->
skip(fmtLength - 16);
83 switch (compression) {
88 if (bitsPerSample == 8)
90 else if (bitsPerSample == 16)
93 throw Common::Exception(
"makeWAVStream(): Unsupported PCM bits per sample %d", bitsPerSample);
95 return makePCMStream(subStream, sampleRate, flags, channels,
true);
104 throw Common::Exception(
"makeWAVStream(): Unhandled wave type 0x%04x", compression);
#define MKTAG(a0, a1, a2, a3)
A wrapper macro used around four character constants, like 'DATA', to ensure portability.
uint16 readUint16LE()
Read an unsigned 16-bit word stored in little endian (LSB first) order from the stream and return it...
uint32 readUint32LE()
Read an unsigned 32-bit word stored in little endian (LSB first) order from the stream and return it...
Decoding RIFF WAVE (Resource Interchange File Format Waveform).
virtual bool eos() const =0
Returns true if a read failed because the stream has been reached.
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.
Decoding PCM (Pulse Code Modulation).
Compression types in Microsoft's WAVEFORMAT(EX).
Utility templates and functions for working with strings and streams.
Exception that provides a stack of explanations.
Basic exceptions to throw.
Decoding ADPCM (Adaptive Differential Pulse Code Modulation).
A rewindable audio stream.
Utility templates and functions.
RewindableAudioStream * makeWAVStream(Common::SeekableReadStream *stream, bool disposeAfterUse)
Try to load a WAVE from the given seekable stream and create an AudioStream from that data...
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...
virtual size_t skip(ptrdiff_t offset)
Skip the specified number of bytes, adding that offset to the current position in the stream...
Basic reading stream interfaces.
virtual size_t pos() const =0
Obtains the current value of the stream position indicator of the stream.
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)
UString debugTag(uint32 tag, bool trim)
Create an elaborate string from an integer tag, for debugging purposes.
samples are little endian (default: big endian)
SeekableSubReadStream provides access to a SeekableReadStream restricted to the range [begin...
Interface for a seekable & readable data stream.