86 throw Common::Exception(
"FMODSampleBank::getSampleName(): Index out of range (%s >= %s)",
122 throw Common::Exception(
"FMODSampleBank::getSampleName(): Index out of range (%s >= %s)",
130 std::map<Common::UString, const Sample *>::const_iterator s =
_sampleMap.find(name);
142 static const uint32 kFSBID =
MKTAG(
'F',
'S',
'B',
'4');
158 const size_t offsetInfo = 48;
159 size_t offsetData = offsetInfo + sampleInfoSize;
161 fsb.
seek(offsetInfo);
164 for (std::vector<Sample>::iterator s =
_samples.begin(); s !=
_samples.end(); ++s) {
206 fsb.
skip(infoSize - 80);
209 s->offset = offsetData;
210 offsetData += s->size;
212 if (!s->name.empty())
213 _sampleMap.insert(std::make_pair(s->name, &*s));
#define ResMan
Shortcut for accessing the sound manager.
#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...
FMODSampleBank(Common::SeekableReadStream *fsb)
uint32 readUint32LE()
Read an unsigned 32-bit word stored in little endian (LSB first) order from the stream and return it...
A class holding an UTF-8 string.
virtual size_t seek(ptrdiff_t offset, Origin whence=kOriginBegin)=0
Sets the stream position indicator for the stream.
bool hasSample(const Common::UString &name) const
Does a sample with this name exist in the sample bank?
void reset(PointerType o=0)
Resets the pointer with the new value.
UString composeString(T value)
Convert any POD integer, float/double or bool type into a string.
size_t offset
Offset to the sample within the FSB.
std::vector< Sample > _samples
void load(Common::SeekableReadStream &fsb)
Utility templates and functions for working with strings and streams.
Exception that provides a stack of explanations.
FORCEINLINE int32 readSint32LE()
Read a signed 32-bit word stored in little endian (LSB first) order from the stream and return it...
An FMOD SampleBank, found in Dragon Age: Origins as FSB files.
size_t size
Size of the sample in bytes.
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.
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...
Utility functions for working with differing string encodings.
FORCEINLINE int16 readSint16LE()
Read a signed 16-bit word stored in little endian (LSB first) order from the stream and return it...
size_t getSampleCount() const
Return the number of sample files.
void warning(const char *s,...)
uint32 readUint32BE()
Read an unsigned 32-bit word stored in big endian (MSB first) order from the stream and return it...
FORCEINLINE float readIEEEFloatLE()
Read a 32-bit IEEE float stored in little endian (LSB first) order from the stream and return it...
Plain, unextended ASCII (7bit clean).
Common::ScopedPtr< Common::SeekableReadStream > _fsb
UString debugTag(uint32 tag, bool trim)
Create an elaborate string from an integer tag, for debugging purposes.
UString readStringFixed(SeekableReadStream &stream, Encoding encoding, size_t length)
Read length bytes as a string with the given encoding out of a stream.
Decoding MP3 (MPEG-1 Audio Layer 3).
RewindableAudioStream * makeMP3Stream(Common::SeekableReadStream *stream, bool disposeAfterUse)
Create a new SeekableAudioStream from the MP3 data in the given stream.
RewindableAudioStream * getSample(size_t index) const
Return the audio stream of a sample, by index.
const Common::UString & getSampleName(size_t index) const
Return the name of a sample.
std::map< Common::UString, const Sample * > _sampleMap
Interface for a seekable & readable data stream.
The global resource manager for Aurora resources.