Typedefs | |
typedef byte *(* | LoadSoundFxInstrumentCallback) (const char *name, uint32 *size) |
typedef int16 | st_sample_t |
typedef uint16 | st_volume_t |
typedef uint32 | st_size_t |
typedef uint32 | st_rate_t |
Enumerations | |
enum | ADPCMType { kADPCMOki, kADPCMMSIma, kADPCMMS, kADPCMDVI, kADPCMApple, kADPCMDK3, kADPCMXA } |
enum | RawFlags { FLAG_UNSIGNED = 1 << 0, FLAG_16BITS = 1 << 1, FLAG_24BITS = 1 << 2, FLAG_LITTLE_ENDIAN = 1 << 3, FLAG_STEREO = 1 << 4 } |
enum | WaveCompressionType { kWaveFormatNone = 0x0000, kWaveFormatPCM = 0x0001, kWaveFormatMSADPCM = 0x0002, kWaveFormatALawPCM = 0x0006, kWaveFormatMuLawPCM = 0x0007, kWaveFormatMSIMAADPCM = 0x0011, kWaveFormatMP3 = 0x0055, kWaveFormatDK3 = 0x0062, kWaveFormatMSIMAADPCM2 = 0x0069, kWaveFormatWMAv2 = 0x0161, kWaveFormatXanDPCM = 0x594a } |
enum | MilesVersion { MILES_VERSION_2 = 2, MILES_VERSION_3 } |
enum | { ST_SAMPLE_MAX = 0x7fffL, ST_SAMPLE_MIN = (-ST_SAMPLE_MAX - 1L) } |
Functions | |
AudioStream * | makeLoopingAudioStream (RewindableAudioStream *stream, uint loops) |
AudioStream * | makeLoopingAudioStream (SeekableAudioStream *stream, Timestamp start, Timestamp end, uint loops) |
QueuingAudioStream * | makeQueuingAudioStream (int rate, bool stereo) |
Timestamp | convertTimeToStreamPos (const Timestamp &where, int rate, bool isStereo) |
AudioStream * | makeLimitingAudioStream (AudioStream *parentStream, const Timestamp &length, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES) |
AudioStream * | makeNullAudioStream () |
AudioStream * | makeSilentAudioStream (int rate, bool stereo) |
RewindableAudioStream * | make3DO_ADP4AudioStream (Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, uint32 *audioLengthMSecsPtr=NULL, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES, audio_3DO_ADP4_PersistentSpace *persistentSpacePtr=NULL) |
RewindableAudioStream * | make3DO_SDX2AudioStream (Common::SeekableReadStream *stream, uint16 sampleRate, bool stereo, uint32 *audioLengthMSecsPtr=NULL, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES, audio_3DO_SDX2_PersistentSpace *persistentSpacePtr=NULL) |
SeekableAudioStream * | makeADPCMStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, ADPCMType type, int rate, int channels, uint32 blockAlign=0) |
PacketizedAudioStream * | makePacketizedADPCMStream (ADPCMType type, int rate, int channels, uint32 blockAlign=0) |
RewindableAudioStream * | makeAIFFStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) |
PacketizedAudioStream * | makeAPCStream (Common::SeekableReadStream &header) |
APCStream * | makeAPCStream (uint sampleRate, bool stereo) |
SeekableAudioStream * | makeASFStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) |
SeekableAudioStream * | makeALawStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, int rate, int channels) |
SeekableAudioStream * | makeMuLawStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, int rate, int channels) |
AudioStream * | make8SVXStream (Common::ReadStream &stream, bool loop) |
SeekableAudioStream * | makeMacSndStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) |
SeekableAudioStream * | makeQuickTimeStream (const Common::Path &filename) |
SeekableAudioStream * | makeQuickTimeStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES) |
SeekableAudioStream * | makeRawStream (const byte *buffer, uint32 size, int rate, byte flags, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES) |
SeekableAudioStream * | makeRawStream (Common::SeekableReadStream *stream, int rate, byte flags, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES) |
PacketizedAudioStream * | makePacketizedRawStream (int rate, byte flags) |
int | getSampleRateFromVOCRate (int vocSR) |
SeekableAudioStream * | makeVOCStream (Common::SeekableReadStream *stream, byte flags, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::NO) |
bool | loadWAVFromStream (Common::SeekableReadStream &stream, int &size, int &rate, byte &flags, uint16 *wavType=0, int *blockAlign=0, int *samplesPerBlock=0) |
SeekableAudioStream * | makeWAVStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) |
RewindableAudioStream * | makeXAStream (Common::SeekableReadStream *stream, int rate, DisposeAfterUse::Flag disposeAfterUse=DisposeAfterUse::YES) |
MidiDriver_Multisource * | MidiDriver_Miles_AdLib_create (const Common::Path &filenameAdLib, const Common::Path &filenameOPL3, Common::SeekableReadStream *streamAdLib=nullptr, Common::SeekableReadStream *streamOPL3=nullptr) |
MidiDriver_Miles_Midi * | MidiDriver_Miles_MT32_create (const Common::Path &instrumentDataFilename) |
MidiDriver_Miles_Midi * | MidiDriver_Miles_MIDI_create (MusicType midiType, const Common::Path &instrumentDataFilename) |
RewindableAudioStream * | makeModXmS3mStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, int initialPos=0, int rate=48000, int interpolation=0) |
bool | probeModXmS3m (Common::SeekableReadStream *stream) |
AudioStream * | makeProtrackerStream (Common::SeekableReadStream *stream, int offs=0, int rate=44100, bool stereo=true, Modules::Module **module=0) |
AudioStream * | makeRjp1Stream (Common::SeekableReadStream *songData, Common::SeekableReadStream *instrumentsData, int num, int rate=44100, bool stereo=true) |
AudioStream * | makeSoundFxStream (Common::SeekableReadStream *data, LoadSoundFxInstrumentCallback loadCb, int rate=44100, bool stereo=true, bool repeat=true, int periodScaleDivisor=1) |
RewindableAudioStream * | makeUniversalTrackerStream (Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, int rate=48000) |
RateConverter * | makeRateConverter (st_rate_t inRate, st_rate_t outRate, bool inStereo, bool outStereo, bool reverseStereo) |
Variables | |
struct Audio::VocFileHeader | PACKED_STRUCT |
const uint16 | wmaCriticalFreqs [25] |
const uint32 | hgainHuffCodes [37] |
const uint8 | hgainHuffBits [37] |
const uint32 | scaleHuffCodes [121] |
const uint8 | scaleHuffBits [121] |
const float | lspCodebook [kLSPCoefCount][16] |
Internal interfaces to the ADPCM decoders.
These can be used to make custom ADPCM decoder subclasses, or to at least share some common data tables between various ADPCM decoder implementations.
This file and all files in this directory were imported from the SCI engine and lightly modified to match DGDS, removing:
The original games also used lightly modified SCI midi drivers.
enum Audio::RawFlags |
Various flags which can be bit-ORed and then passed to makeRawStream and some other AudioStream factories to control their behavior.
Engine authors are advised not to rely on a certain value or order of these flags (in particular, do not store them verbatim in savestates).
RewindableAudioStream* Audio::make3DO_ADP4AudioStream | ( | Common::SeekableReadStream * | stream, |
uint16 | sampleRate, | ||
bool | stereo, | ||
uint32 * | audioLengthMSecsPtr = NULL , |
||
DisposeAfterUse::Flag | disposeAfterUse = DisposeAfterUse::YES , |
||
audio_3DO_ADP4_PersistentSpace * | persistentSpacePtr = NULL |
||
) |
Try to decode 3DO ADP4 data from the given seekable stream and create a SeekableAudioStream from that data.
stream | the SeekableReadStream from which to read the 3DO SDX2 data sample rate if it's stereo or mono pointer to a uint32 variable, that is supposed to get the length of the audio in milliseconds disposeAfterUse whether to delete the stream after use pointer to the persistent space structure |
RewindableAudioStream* Audio::make3DO_SDX2AudioStream | ( | Common::SeekableReadStream * | stream, |
uint16 | sampleRate, | ||
bool | stereo, | ||
uint32 * | audioLengthMSecsPtr = NULL , |
||
DisposeAfterUse::Flag | disposeAfterUse = DisposeAfterUse::YES , |
||
audio_3DO_SDX2_PersistentSpace * | persistentSpacePtr = NULL |
||
) |
Try to decode 3DO SDX2 data from the given seekable stream and create a SeekableAudioStream from that data.
stream | the SeekableReadStream from which to read the 3DO SDX2 data sample rate if it's stereo or mono pointer to a uint32 variable, that is supposed to get the length of the audio in milliseconds disposeAfterUse whether to delete the stream after use pointer to the persistent space structure |
SeekableAudioStream* Audio::makeADPCMStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse, | ||
uint32 | size, | ||
ADPCMType | type, | ||
int | rate, | ||
int | channels, | ||
uint32 | blockAlign = 0 |
||
) |
Takes an input stream containing ADPCM compressed sound data and creates a RewindableAudioStream from that.
stream | the SeekableReadStream from which to read the ADPCM data |
disposeAfterUse | whether to delete the stream after use |
size | how many bytes to read from the stream (0 = all) |
type | the compression type used |
rate | the sampling rate |
channels | the number of channels |
blockAlign | block alignment ??? |
PacketizedAudioStream* Audio::makePacketizedADPCMStream | ( | ADPCMType | type, |
int | rate, | ||
int | channels, | ||
uint32 | blockAlign = 0 |
||
) |
Creates a PacketizedAudioStream that will automatically queue packets as individual AudioStreams like returned by makeADPCMStream.
Due to the ADPCM types not necessarily supporting stateless streaming, OKI, XA and DVI are not supported by this function and will return NULL.
type | the compression type used |
rate | the sampling rate |
channels | the number of channels |
blockAlign | block alignment ??? |
RewindableAudioStream* Audio::makeAIFFStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse | ||
) |
Try to load an AIFF from the given seekable stream and create an AudioStream from that data.
stream | the SeekableReadStream from which to read the AIFF data |
disposeAfterUse | whether to delete the stream after use |
PacketizedAudioStream* Audio::makeAPCStream | ( | Common::SeekableReadStream & | header | ) |
Create a PacketizedAudioStream that decodes Cryo APC sound from stream
header | The stream containing the header queuePacket must be called after |
APCStream* Audio::makeAPCStream | ( | uint | sampleRate, |
bool | stereo | ||
) |
Create a PacketizedAudioStream that decodes Cryo APC sound using predefined settings This is used by HNM6 video decoder and shouldn't be called elsewhere.
sampleRate | The sample rate of the stream |
stereo | Whether the stream will be stereo |
SeekableAudioStream* Audio::makeASFStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse | ||
) |
Try to load a ASF from the given seekable stream and create a RewindableAudioStream from that data.
stream | The SeekableReadStream from which to read the ASF data. |
disposeAfterUse | Whether to delete the stream after use. |
SeekableAudioStream* Audio::makeALawStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse, | ||
int | rate, | ||
int | channels | ||
) |
Takes an input stream containing G711 A-law compressed sound data and creates a SeekableAudioStream from that.
stream | the SeekableReadStream from which to read the PCM data |
disposeAfterUse | whether to delete the stream after use |
rate | the sampling rate |
channels | the number of channels |
SeekableAudioStream* Audio::makeMuLawStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse, | ||
int | rate, | ||
int | channels | ||
) |
Takes an input stream containing G711 μ-law compressed sound data and creates a SeekableAudioStream from that.
stream | the SeekableReadStream from which to read the PCM data |
disposeAfterUse | whether to delete the stream after use |
rate | the sampling rate |
channels | the number of channels |
SeekableAudioStream* Audio::makeMacSndStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse | ||
) |
Try to load a Mac snd resource from the given seekable stream and create a SeekableAudioStream from that data.
stream | the SeekableReadStream from which to read the snd data |
disposeAfterUse | whether to delete the stream after use |
SeekableAudioStream* Audio::makeQuickTimeStream | ( | const Common::Path & | filename | ) |
Try to load a QuickTime sound file from the given file name and create a SeekableAudioStream from that data.
filename | the filename of the file from which to read the data |
SeekableAudioStream* Audio::makeQuickTimeStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse = DisposeAfterUse::YES |
||
) |
Try to load a QuickTime sound file from the given seekable stream and create a SeekableAudioStream from that data.
stream | the SeekableReadStream from which to read the data |
disposeAfterUse | whether to delete the stream after use |
SeekableAudioStream* Audio::makeRawStream | ( | const byte * | buffer, |
uint32 | size, | ||
int | rate, | ||
byte | flags, | ||
DisposeAfterUse::Flag | disposeAfterUse = DisposeAfterUse::YES |
||
) |
Creates an audio stream, which plays from the given buffer.
buffer | Buffer to play from. |
size | Size of the buffer in bytes. |
rate | Rate of the sound data. |
flags | Audio flags combination. |
disposeAfterUse | Whether to free the buffer after use (with free!). |
SeekableAudioStream* Audio::makeRawStream | ( | Common::SeekableReadStream * | stream, |
int | rate, | ||
byte | flags, | ||
DisposeAfterUse::Flag | disposeAfterUse = DisposeAfterUse::YES |
||
) |
Creates an audio stream, which plays from the given stream.
stream | Stream object to play from. |
rate | Rate of the sound data. |
flags | Audio flags combination. |
disposeAfterUse | Whether to delete the stream after use. |
PacketizedAudioStream* Audio::makePacketizedRawStream | ( | int | rate, |
byte | flags | ||
) |
Creates a PacketizedAudioStream that will automatically queue packets as individual AudioStreams like returned by makeRawStream.
rate | Rate of the sound data. |
flags | Audio flags combination. |
int Audio::getSampleRateFromVOCRate | ( | int | vocSR | ) |
Take a sample rate parameter as it occurs in a VOC sound header, and return the corresponding sample frequency.
This method has special cases for the standard rates of 11025 and 22050 kHz, which due to limitations of the format, cannot be encoded exactly in a VOC file. As a consequence, many game files have sound data sampled with those rates, but the VOC marks them incorrectly as 11111 or 22222 kHz. This code works around that and "unrounds" the sampling rates.
SeekableAudioStream* Audio::makeVOCStream | ( | Common::SeekableReadStream * | stream, |
byte | flags, | ||
DisposeAfterUse::Flag | disposeAfterUse = DisposeAfterUse::NO |
||
) |
Try to load a VOC from the given seekable stream and create an AudioStream from that data. Currently this function only supports uncompressed raw PCM data.
This does not use any of the looping features of VOC files!
bool Audio::loadWAVFromStream | ( | Common::SeekableReadStream & | stream, |
int & | size, | ||
int & | rate, | ||
byte & | flags, | ||
uint16 * | wavType = 0 , |
||
int * | blockAlign = 0 , |
||
int * | samplesPerBlock = 0 |
||
) |
Try to load a WAVE from the given seekable stream. Returns true if successful. In that case, the stream's seek position will be set to the start of the audio data, and size, rate and flags contain information necessary for playback. Currently this function supports uncompressed raw PCM data, MS IMA ADPCM and MS ADPCM (uses makeADPCMStream internally).
SeekableAudioStream* Audio::makeWAVStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse | ||
) |
Try to load a WAVE from the given seekable stream and create an AudioStream from that data. Currently this function supports uncompressed raw PCM data, MS IMA ADPCM and MS ADPCM (uses makeADPCMStream internally).
This function uses loadWAVFromStream() internally.
stream | the SeekableReadStream from which to read the WAVE data |
disposeAfterUse | whether to delete the stream after use |
RewindableAudioStream* Audio::makeXAStream | ( | Common::SeekableReadStream * | stream, |
int | rate, | ||
DisposeAfterUse::Flag | disposeAfterUse = DisposeAfterUse::YES |
||
) |
Takes an input stream containing XA ADPCM sound data and creates a RewindableAudioStream from that.
stream | the SeekableReadStream from which to read the XA ADPCM data |
rate | the sampling rate |
disposeAfterUse | whether to delete the stream after use. |
RewindableAudioStream* Audio::makeModXmS3mStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse, | ||
int | initialPos = 0 , |
||
int | rate = 48000 , |
||
int | interpolation = 0 |
||
) |
Factory function for ModXmS3mStream streams. Reads all data from the given ReadStream and creates an AudioStream from this. No reference to the 'stream' object is kept, so you can safely delete it after invoking this factory.
This stream may be infinitely long if the mod contains a loop.
stream | the ReadStream from which to read the tracker sound data |
disposeAfterUse | whether to delete the stream after use |
initialPos | initial track to start playback from |
rate | sample rate |
interpolation | interpolation effect level |
bool Audio::probeModXmS3m | ( | Common::SeekableReadStream * | stream | ) |
Check if the stream is one of the supported formats
RewindableAudioStream* Audio::makeUniversalTrackerStream | ( | Common::SeekableReadStream * | stream, |
DisposeAfterUse::Flag | disposeAfterUse, | ||
int | rate = 48000 |
||
) |
Create a new AudioStream from the Impulse Tracker data in the given stream.
stream | the SeekableReadStream from which to read the Ogg Vorbis data |
disposeAfterUse | whether to delete the stream after use |
const uint16 Audio::wmaCriticalFreqs[25] |
const uint32 Audio::hgainHuffCodes[37] |
const uint8 Audio::hgainHuffBits[37] |
const uint32 Audio::scaleHuffCodes[121] |
const uint8 Audio::scaleHuffBits[121] |
const float Audio::lspCodebook[kLSPCoefCount][16] |