diff options
Diffstat (limited to 'engines')
39 files changed, 99 insertions, 102 deletions
diff --git a/engines/cine/sound_driver.h b/engines/cine/sound_driver.h index cf1ec68411..183af12360 100644 --- a/engines/cine/sound_driver.h +++ b/engines/cine/sound_driver.h @@ -79,7 +79,7 @@ struct AdlibSoundInstrument { byte amDepth; }; -class AdlibSoundDriver : public SoundDriver, AudioStream { +class AdlibSoundDriver : public SoundDriver, Audio::AudioStream { public: AdlibSoundDriver(Audio::Mixer *mixer); virtual ~AdlibSoundDriver(); diff --git a/engines/gob/music.h b/engines/gob/music.h index e6421ea32c..16aa839cdc 100644 --- a/engines/gob/music.h +++ b/engines/gob/music.h @@ -33,7 +33,7 @@ namespace Gob { class GobEngine; -class Music : public AudioStream { +class Music : public Audio::AudioStream { public: Music(GobEngine *vm); ~Music(); diff --git a/engines/gob/sound.h b/engines/gob/sound.h index 4433cde305..d755e9898c 100644 --- a/engines/gob/sound.h +++ b/engines/gob/sound.h @@ -66,7 +66,7 @@ public: protected: // TODO: This is a very primitive square wave generator. The only thing is // has in common with the PC speaker is that it sounds terrible. - class SquareWaveStream : public AudioStream { + class SquareWaveStream : public Audio::AudioStream { private: uint _rate; bool _beepForever; diff --git a/engines/kyra/kyra.h b/engines/kyra/kyra.h index bea64cef4c..5859c92f18 100644 --- a/engines/kyra/kyra.h +++ b/engines/kyra/kyra.h @@ -26,8 +26,6 @@ #include "base/engine.h" #include "common/rect.h" -class AudioStream; - namespace Kyra { class Movie; diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index 7874a02d6a..d1891a501a 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -71,7 +71,7 @@ void Sound::voicePlay(const char *file) { Common::MemoryReadStream vocStream(fileData, fileSize); _mixer->stopHandle(_vocHandle); - _currentVocFile = makeVOCStream(vocStream); + _currentVocFile = Audio::makeVOCStream(vocStream); } if (_currentVocFile) @@ -476,13 +476,13 @@ void KyraEngine::snd_voiceWaitForFinish(bool ingame) { const Sound::SpeechCodecs Sound::_supportedCodes[] = { #ifdef USE_MAD - { ".VO3", makeMP3Stream }, + { ".VO3", Audio::makeMP3Stream }, #endif // USE_MAD #ifdef USE_VORBIS - { ".VOG", makeVorbisStream }, + { ".VOG", Audio::makeVorbisStream }, #endif // USE_VORBIS #ifdef USE_FLAC - { ".VOF", makeFlacStream }, + { ".VOF", Audio::makeFlacStream }, #endif // USE_FLAC { 0, 0 } }; diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index 9d0c131c5c..28444033f5 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -30,9 +30,8 @@ #include "sound/mixer.h" #include "kyra/kyra.h" -class AudioStream; - namespace Audio { +class AudioStream; class Mixer; class SoundHandle; } // end of namespace Audio @@ -68,13 +67,13 @@ protected: Audio::Mixer *_mixer; private: - AudioStream *_currentVocFile; + Audio::AudioStream *_currentVocFile; Audio::SoundHandle _vocHandle; Common::File _compressHandle; struct SpeechCodecs { const char *fileext; - AudioStream *(*streamFunc)(Common::File*, uint32); + Audio::AudioStream *(*streamFunc)(Common::File*, uint32); }; static const SpeechCodecs _supportedCodes[]; diff --git a/engines/kyra/sound_adlib.cpp b/engines/kyra/sound_adlib.cpp index aef67e19ef..f870c668b8 100644 --- a/engines/kyra/sound_adlib.cpp +++ b/engines/kyra/sound_adlib.cpp @@ -38,7 +38,7 @@ namespace Kyra { -class AdlibDriver : public AudioStream { +class AdlibDriver : public Audio::AudioStream { public: AdlibDriver(Audio::Mixer *mixer); ~AdlibDriver(); diff --git a/engines/queen/sound.cpp b/engines/queen/sound.cpp index 6d68d6ac91..2e28d5a87e 100644 --- a/engines/queen/sound.cpp +++ b/engines/queen/sound.cpp @@ -207,7 +207,7 @@ bool MP3Sound::sfxPlay(const char *name, Audio::SoundHandle *soundHandle) { uint32 size; Common::File *f = _vm->resource()->giveCompressedSound(name, &size); if (f) { - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, makeMP3Stream(f, size)); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(f, size)); return true; } return false; @@ -219,7 +219,7 @@ bool OGGSound::sfxPlay(const char *name, Audio::SoundHandle *soundHandle) { uint32 size; Common::File *f = _vm->resource()->giveCompressedSound(name, &size); if (f) { - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, makeVorbisStream(f, size)); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(f, size)); return true; } return false; @@ -231,7 +231,7 @@ bool FLACSound::sfxPlay(const char *name, Audio::SoundHandle *soundHandle) { uint32 size; Common::File *f = _vm->resource()->giveCompressedSound(name, &size); if (f) { - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, makeFlacStream(f, size)); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(f, size)); return true; } return false; diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp index 52ebc51440..453ef05d4c 100644 --- a/engines/saga/music.cpp +++ b/engines/saga/music.cpp @@ -41,18 +41,18 @@ namespace Saga { #define BUFFER_SIZE 4096 struct TrackFormat { - DigitalTrackInfo* (*openTrackFunction)(int); + Audio::DigitalTrackInfo* (*openTrackFunction)(int); }; static const TrackFormat TRACK_FORMATS[] = { #ifdef USE_FLAC - { getFlacTrack }, + { Audio::getFlacTrack }, #endif #ifdef USE_VORBIS - { getVorbisTrack }, + { Audio::getVorbisTrack }, #endif #ifdef USE_MAD - { getMP3Track }, + { Audio::getMP3Track }, #endif { NULL } // Terminator @@ -63,7 +63,7 @@ static const TrackFormat TRACK_FORMATS[] = { // Sword 2, to make it easier to add support for compressed music... but I'll // worry about that later. -class RAWInputStream : public AudioStream { +class RAWInputStream : public Audio::AudioStream { private: ResourceContext *_context; Common::File *_file; @@ -374,7 +374,7 @@ bool Music::isPlaying() { } void Music::play(uint32 resourceId, MusicFlags flags) { - AudioStream *audioStream = NULL; + Audio::AudioStream *audioStream = NULL; MidiParser *parser; ResourceContext *context; byte *resourceData; diff --git a/engines/saga/music.h b/engines/saga/music.h index a276896dac..691deeea5e 100644 --- a/engines/saga/music.h +++ b/engines/saga/music.h @@ -137,7 +137,7 @@ private: MidiParser *xmidiParser; MidiParser *smfParser; - DigitalTrackInfo *_track; + Audio::DigitalTrackInfo *_track; byte *_midiMusicData; diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp index 40c6bd86a6..7849ddecd0 100644 --- a/engines/saga/sndres.cpp +++ b/engines/saga/sndres.cpp @@ -137,7 +137,7 @@ void SndRes::playVoice(uint32 resourceId) { bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buffer, bool onlyHeader) { byte *soundResource; - AudioStream *voxStream; + Audio::AudioStream *voxStream; size_t soundResourceLength; bool result = false; GameSoundTypes resourceType; @@ -217,7 +217,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff buffer.buffer = NULL; free(soundResource); } else { - voxStream = makeADPCMStream(&readS, soundResourceLength, kADPCMOki); + voxStream = Audio::makeADPCMStream(&readS, soundResourceLength, Audio::kADPCMOki); buffer.buffer = (byte *)malloc(buffer.size); voxSize = voxStream->readBuffer((int16*)buffer.buffer, soundResourceLength * 2); if (voxSize != soundResourceLength * 2) { @@ -228,7 +228,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff result = true; break; case kSoundVOC: - data = loadVOCFromStream(readS, size, rate); + data = Audio::loadVOCFromStream(readS, size, rate); if (data) { buffer.frequency = rate; buffer.sampleBits = 8; @@ -246,7 +246,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff free(soundResource); break; case kSoundWAV: - if (loadWAVFromStream(readS, size, rate, flags)) { + if (Audio::loadWAVFromStream(readS, size, rate, flags)) { buffer.frequency = rate; buffer.sampleBits = 16; buffer.stereo = ((flags & Audio::Mixer::FLAG_STEREO) != 0); diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 4e3dd59c9c..dadc6ea7b7 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -1777,7 +1777,7 @@ int ScummEngine_v72he::getSoundResourceSize(int id) { size = READ_BE_UINT32(ptr + 4); Common::MemoryReadStream stream(ptr, size); - if (!loadWAVFromStream(stream, size, rate, flags)) { + if (!Audio::loadWAVFromStream(stream, size, rate, flags)) { error("getSoundResourceSize: Not a valid WAV file"); } } else { diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index 9519087efe..23224354c0 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -538,12 +538,12 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags) size = READ_LE_UINT32(ptr + 4); Common::MemoryReadStream stream(ptr, size); - if (!loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) { + if (!Audio::loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) { error("playHESound: Not a valid WAV file (%d)", soundID); } if (compType == 17) { - AudioStream *voxStream = makeADPCMStream(&stream, size, kADPCMMSIma, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign); + Audio::AudioStream *voxStream = Audio::makeADPCMStream(&stream, size, Audio::kADPCMMSIma, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign); sound = (char *)malloc(size * 4); size = voxStream->readBuffer((int16*)sound, size * 2); diff --git a/engines/scumm/imuse_digi/dimuse.h b/engines/scumm/imuse_digi/dimuse.h index fed2e48457..2a254958b6 100644 --- a/engines/scumm/imuse_digi/dimuse.h +++ b/engines/scumm/imuse_digi/dimuse.h @@ -80,7 +80,7 @@ private: ImuseDigiSndMgr::soundStruct *soundHandle; Audio::SoundHandle handle; AppendableAudioStream *stream; - AudioStream *stream2; + Audio::AudioStream *stream2; Track(); }; @@ -106,7 +106,7 @@ private: void callback(); void switchToNextRegion(Track *track); int allocSlot(int priority); - void startSound(int soundId, const char *soundName, int soundType, int volGroupId, AudioStream *input, int hookId, int volume, int priority); + void startSound(int soundId, const char *soundName, int soundType, int volGroupId, Audio::AudioStream *input, int hookId, int volume, int priority); void selectVolumeGroup(int soundId, int volGroupId); int32 getPosInMs(int soundId); @@ -135,7 +135,7 @@ public: void setAudioNames(int32 num, char *names); - void startVoice(int soundId, AudioStream *input); + void startVoice(int soundId, Audio::AudioStream *input); void startVoice(int soundId, const char *soundName); void startMusic(int soundId, int volume); void startMusic(const char *soundName, int soundId, int hookId, int volume); diff --git a/engines/scumm/imuse_digi/dimuse_script.cpp b/engines/scumm/imuse_digi/dimuse_script.cpp index 0feecd122f..69bbac57c5 100644 --- a/engines/scumm/imuse_digi/dimuse_script.cpp +++ b/engines/scumm/imuse_digi/dimuse_script.cpp @@ -208,7 +208,7 @@ void IMuseDigital::refreshScripts() { } } -void IMuseDigital::startVoice(int soundId, AudioStream *input) { +void IMuseDigital::startVoice(int soundId, Audio::AudioStream *input) { debug(5, "startVoiceStream(%d)", soundId); startSound(soundId, "", 0, IMUSE_VOLGRP_VOICE, input, 0, 127, 127); } diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 29b70a4763..19d34eabc9 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -163,7 +163,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, soundStruct *sound) { int time_constant = ptr[offset]; offset += 2; len -= 2; - sound->freq = getSampleRateFromVOCRate(time_constant); + sound->freq = Audio::getSampleRateFromVOCRate(time_constant); sound->region[sound->numRegions].offset = offset; sound->region[sound->numRegions].length = len; sound->numRegions++; @@ -614,11 +614,11 @@ int32 ImuseDigiSndMgr::getDataFromRegion(soundStruct *soundHandle, int region, b if (!soundHandle->compressedStream) { #ifdef USE_VORBIS if (oggMode) - soundHandle->compressedStream = makeVorbisStream(cmpFile, len); + soundHandle->compressedStream = Audio::makeVorbisStream(cmpFile, len); #endif #ifdef USE_MAD if (!oggMode) - soundHandle->compressedStream = makeMP3Stream(cmpFile, len); + soundHandle->compressedStream = Audio::makeMP3Stream(cmpFile, len); #endif assert(soundHandle->compressedStream); } diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.h b/engines/scumm/imuse_digi/dimuse_sndmgr.h index 5844fa0c1b..efae717d60 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.h +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.h @@ -85,7 +85,7 @@ public: int type; int volGroupId; int disk; - AudioStream *compressedStream; + Audio::AudioStream *compressedStream; bool compressed; char lastFileName[24]; }; diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp index d1bd5b8923..a203ee878a 100644 --- a/engines/scumm/imuse_digi/dimuse_track.cpp +++ b/engines/scumm/imuse_digi/dimuse_track.cpp @@ -67,7 +67,7 @@ int IMuseDigital::allocSlot(int priority) { return trackId; } -void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int volGroupId, AudioStream *input, int hookId, int volume, int priority) { +void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int volGroupId, Audio::AudioStream *input, int hookId, int volume, int priority) { debug(5, "IMuseDigital::startSound(%d)", soundId); int l = allocSlot(priority); diff --git a/engines/scumm/player_mod.cpp b/engines/scumm/player_mod.cpp index 773d34732d..9a22aaa1e0 100644 --- a/engines/scumm/player_mod.cpp +++ b/engines/scumm/player_mod.cpp @@ -92,7 +92,7 @@ void Player_MOD::startChannel(int id, void *data, int size, int rate, uint8 vol, _channels[i].vol = vol; _channels[i].pan = pan; _channels[i].freq = rate; - _channels[i].input = makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | (loopStart != loopEnd ? Audio::Mixer::FLAG_LOOP : 0), (const byte*)data, size, loopStart, loopEnd - loopStart); + _channels[i].input = Audio::makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | (loopStart != loopEnd ? Audio::Mixer::FLAG_LOOP : 0), (const byte*)data, size, loopStart, loopEnd - loopStart); _channels[i].converter = Audio::makeRateConverter(rate, _mixer->getOutputRate(), false, false); } diff --git a/engines/scumm/player_mod.h b/engines/scumm/player_mod.h index 317bf7fd6e..5caa27e23a 100644 --- a/engines/scumm/player_mod.h +++ b/engines/scumm/player_mod.h @@ -36,7 +36,7 @@ namespace Scumm { /** * Generic Amiga MOD mixer - provides a 60Hz 'update' routine. */ -class Player_MOD : public AudioStream { +class Player_MOD : public Audio::AudioStream { public: Player_MOD(ScummEngine *scumm); virtual ~Player_MOD(); @@ -73,7 +73,7 @@ private: int8 pan; uint16 freq; Audio::RateConverter *converter; - AudioStream *input; + Audio::AudioStream *input; }; Audio::Mixer *_mixer; diff --git a/engines/scumm/player_nes.h b/engines/scumm/player_nes.h index 17a11b2fe3..c7788bb6b1 100644 --- a/engines/scumm/player_nes.h +++ b/engines/scumm/player_nes.h @@ -43,7 +43,7 @@ static const int NUMCHANS = 4; /** * Scumm NES sound/music driver. */ -class Player_NES : public AudioStream, public MusicEngine { +class Player_NES : public Audio::AudioStream, public MusicEngine { public: Player_NES(ScummEngine *scumm); virtual ~Player_NES(); diff --git a/engines/scumm/player_v2.h b/engines/scumm/player_v2.h index 160400e06a..02a74e7bc0 100644 --- a/engines/scumm/player_v2.h +++ b/engines/scumm/player_v2.h @@ -76,7 +76,7 @@ struct channel_data { * This simulates the pc speaker sound, which is driven by the 8253 (square * wave generator) and a low-band filter. */ -class Player_V2 : public AudioStream, public MusicEngine { +class Player_V2 : public Audio::AudioStream, public MusicEngine { public: Player_V2(ScummEngine *scumm, bool pcjr); virtual ~Player_V2(); diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index d6594f1a55..dc13319c2b 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -871,7 +871,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { // as AudioCDManager::Status::playing, and MSVC6 has // a fit with that. This typedef simplifies the notation // to something MSVC6 can grasp. - typedef AudioCDManager::Status AudioCDManager_Status; + typedef Audio::AudioCDManager::Status AudioCDManager_Status; const SaveLoadEntry audioCDEntries[] = { MKLINE(AudioCDManager_Status, playing, sleUint32, VER(24)), MKLINE(AudioCDManager_Status, track, sleInt32, VER(24)), @@ -1140,7 +1140,7 @@ void ScummEngine::saveOrLoad(Serializer *s) { // Save/load the Audio CD status // if (s->getVersion() >= VER(24)) { - AudioCDManager::Status info; + Audio::AudioCDManager::Status info; if (s->isSaving()) info = AudioCD.getStatus(); s->saveLoadArrayOf(&info, 1, sizeof(info), audioCDEntries); diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index 7e846f4b12..9edf776989 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -1270,7 +1270,7 @@ void SmushPlayer::tryCmpFile(const char *filename) { if (_compressedFile.isOpen()) { int size = _compressedFile.size(); _compressedFileMode = true; - _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, makeMP3Stream(&_compressedFile, size)); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(&_compressedFile, size)); return; } #endif @@ -1281,7 +1281,7 @@ void SmushPlayer::tryCmpFile(const char *filename) { if (_compressedFile.isOpen()) { int size = _compressedFile.size(); _compressedFileMode = true; - _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size)); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(&_compressedFile, size)); return; } #endif diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index bdb4e658a1..b32686a215 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -272,10 +272,10 @@ void Sound::playSound(int soundID) { // We'd have to add the 'Creative Voice File' header for this, though, // or make readVOCFromMemory() less strict. - VocBlockHeader &voc_block_hdr = *(VocBlockHeader *)ptr; + Audio::VocBlockHeader &voc_block_hdr = *(Audio::VocBlockHeader *)ptr; assert(voc_block_hdr.blocktype == 1); size = voc_block_hdr.size[0] + (voc_block_hdr.size[1] << 8) + (voc_block_hdr.size[2] << 16) - 2; - rate = getSampleRateFromVOCRate(voc_block_hdr.sr); + rate = Audio::getSampleRateFromVOCRate(voc_block_hdr.sr); assert(voc_block_hdr.pack == 0); // Allocate a sound buffer, copy the data into it, and play @@ -600,29 +600,29 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle } if (!_soundsPaused && _vm->_mixer->isReady()) { - AudioStream *input = NULL; + Audio::AudioStream *input = NULL; switch (_soundMode) { case kMP3Mode: #ifdef USE_MAD assert(size > 0); - input = makeMP3Stream(_sfxFile, size); + input = Audio::makeMP3Stream(_sfxFile, size); #endif break; case kVorbisMode: #ifdef USE_VORBIS assert(size > 0); - input = makeVorbisStream(_sfxFile, size); + input = Audio::makeVorbisStream(_sfxFile, size); #endif break; case kFlacMode: #ifdef USE_FLAC assert(size > 0); - input = makeFlacStream(_sfxFile, size); + input = Audio::makeFlacStream(_sfxFile, size); #endif break; default: - input = makeVOCStream(*_sfxFile); + input = Audio::makeVOCStream(*_sfxFile); } if (!input) { diff --git a/engines/scumm/sound.h b/engines/scumm/sound.h index bf28cc9f3a..8d09d4a7b4 100644 --- a/engines/scumm/sound.h +++ b/engines/scumm/sound.h @@ -136,7 +136,7 @@ protected: * An audio stream to which additional data can be appended on-the-fly. * Used by SMUSH and iMuseDigital. */ -class AppendableAudioStream : public AudioStream { +class AppendableAudioStream : public Audio::AudioStream { public: virtual void append(const byte *data, uint32 len) = 0; virtual void finish() = 0; diff --git a/engines/simon/animation.cpp b/engines/simon/animation.cpp index adf433691e..329827b7fa 100644 --- a/engines/simon/animation.cpp +++ b/engines/simon/animation.cpp @@ -187,7 +187,7 @@ void MoviePlayer::startSound() { _fd.read(buffer, size); Common::MemoryReadStream stream(buffer, size); - _bgSoundStream = makeWAVStream(stream); + _bgSoundStream = Audio::makeWAVStream(stream); _mixer->stopHandle(_bgSound); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream); free(buffer); diff --git a/engines/simon/animation.h b/engines/simon/animation.h index b3b31c1c32..ba7cd5eaa1 100644 --- a/engines/simon/animation.h +++ b/engines/simon/animation.h @@ -38,7 +38,7 @@ class MoviePlayer { Audio::Mixer *_mixer; Audio::SoundHandle _bgSound; - AudioStream *_bgSoundStream; + Audio::AudioStream *_bgSoundStream; bool _omniTV; bool _playing; diff --git a/engines/simon/sound.cpp b/engines/simon/sound.cpp index f00ff4456c..4a0124002e 100644 --- a/engines/simon/sound.cpp +++ b/engines/simon/sound.cpp @@ -133,7 +133,7 @@ void WavSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) { byte wavFlags; int size, rate; - if (!loadWAVFromStream(*_file, size, rate, wavFlags)) { + if (!Audio::loadWAVFromStream(*_file, size, rate, wavFlags)) { error("playSound: Not a valid WAV file"); } @@ -151,7 +151,7 @@ void VocSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) { _file->seek(_offsets[sound], SEEK_SET); int size, rate; - byte *buffer = loadVOCFromStream(*_file, size, rate); + byte *buffer = Audio::loadVOCFromStream(*_file, size, rate); _mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE); } @@ -187,7 +187,7 @@ void MP3Sound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) uint32 size = _offsets[sound + i] - _offsets[sound]; - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeMP3Stream(_file, size)); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, Audio::makeMP3Stream(_file, size)); } #endif @@ -211,7 +211,7 @@ void VorbisSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) uint32 size = _offsets[sound + i] - _offsets[sound]; - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeVorbisStream(_file, size)); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, Audio::makeVorbisStream(_file, size)); } #endif @@ -235,7 +235,7 @@ void FlacSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) uint32 size = _offsets[sound + i] - _offsets[sound]; - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeFlacStream(_file, size)); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, Audio::makeFlacStream(_file, size)); } #endif @@ -588,7 +588,7 @@ void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint soun int size = READ_LE_UINT32(soundData + 4); Common::MemoryReadStream stream(soundData, size); - if (!loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) { + if (!Audio::loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) { error("playSoundData: Not a valid WAV data"); } @@ -628,7 +628,7 @@ void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint soun flags |= Audio::Mixer::FLAG_LOOP; if (compType == 2) { - AudioStream *sndStream = makeADPCMStream(&stream, size, kADPCMMS, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign); + Audio::AudioStream *sndStream = Audio::makeADPCMStream(&stream, size, Audio::kADPCMMS, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign); buffer = (byte *)malloc(size * 4); size = sndStream->readBuffer((int16*)buffer, size * 2); size *= 2; // 16bits. diff --git a/engines/sky/music/adlibmusic.h b/engines/sky/music/adlibmusic.h index effa19dc51..6b27e0625a 100644 --- a/engines/sky/music/adlibmusic.h +++ b/engines/sky/music/adlibmusic.h @@ -33,7 +33,7 @@ namespace Audio { namespace Sky { -class AdlibMusic : public AudioStream, public MusicBase { +class AdlibMusic : public Audio::AudioStream, public MusicBase { public: AdlibMusic(Audio::Mixer *pMixer, Disk *pDisk); ~AdlibMusic(void); diff --git a/engines/sword1/animation.cpp b/engines/sword1/animation.cpp index f6865cc5e2..ff21d99de4 100644 --- a/engines/sword1/animation.cpp +++ b/engines/sword1/animation.cpp @@ -74,11 +74,11 @@ bool AnimationState::soundFinished(void) { return !_snd->isSoundHandleActive(_bgSound); } -AudioStream *AnimationState::createAudioStream(const char *name, void *arg) { +Audio::AudioStream *AnimationState::createAudioStream(const char *name, void *arg) { if (arg) - return (AudioStream*)arg; + return (Audio::AudioStream*)arg; else - return AudioStream::openStreamFile(name); + return Audio::AudioStream::openStreamFile(name); } MoviePlayer::MoviePlayer(Screen *scr, Audio::Mixer *snd, OSystem *sys) @@ -103,7 +103,7 @@ MoviePlayer::~MoviePlayer(void) { void MoviePlayer::play(uint32 id) { #if defined(USE_MPEG2) && defined(USE_VORBIS) AnimationState *anim = new AnimationState(_scr, _snd, _sys); - AudioStream *stream = NULL; + Audio::AudioStream *stream = NULL; if (SwordEngine::_systemVars.cutscenePackVersion == 1) { if ((id == SEQ_INTRO) || (id == SEQ_FINALE) || (id == SEQ_HISTORY) || (id == SEQ_FERRARI)) { // these sequences are language specific @@ -120,7 +120,7 @@ void MoviePlayer::play(uint32 id) { for (uint32 segCnt = 0; segCnt < numSegs; segCnt++) { oggSource->seek( header[SwordEngine::_systemVars.language * 2 + 0 + segCnt * 14]); uint32 segSize = header[SwordEngine::_systemVars.language * 2 + 1 + segCnt * 14]; - AudioStream *apStream = makeVorbisStream(oggSource, segSize); + Audio::AudioStream *apStream = Audio::makeVorbisStream(oggSource, segSize); if (!apStream) error("Can't create Vorbis Stream from file %s", sndName); sStream->appendStream(apStream); @@ -240,7 +240,7 @@ int SplittedAudioStream::getRate(void) const { return 22050; } -void SplittedAudioStream::appendStream(AudioStream *stream) { +void SplittedAudioStream::appendStream(Audio::AudioStream *stream) { FileQueue **que = &_queue; while (*que) que = &((*que)->next); diff --git a/engines/sword1/animation.h b/engines/sword1/animation.h index 2200212384..378116fe6a 100644 --- a/engines/sword1/animation.h +++ b/engines/sword1/animation.h @@ -76,7 +76,7 @@ private: #endif protected: - virtual AudioStream *createAudioStream(const char *name, void *arg); + virtual Audio::AudioStream *createAudioStream(const char *name, void *arg); }; class MoviePlayer { @@ -98,15 +98,15 @@ private: }; struct FileQueue { - AudioStream *stream; + Audio::AudioStream *stream; FileQueue *next; }; -class SplittedAudioStream : public AudioStream { +class SplittedAudioStream : public Audio::AudioStream { public: SplittedAudioStream(void); ~SplittedAudioStream(void); - void appendStream(AudioStream *stream); + void appendStream(Audio::AudioStream *stream); virtual int readBuffer(int16 *buffer, const int numSamples); virtual bool isStereo(void) const; virtual bool endOfData(void) const; diff --git a/engines/sword1/credits.cpp b/engines/sword1/credits.cpp index 7a3b6f077b..a8a4446d56 100644 --- a/engines/sword1/credits.cpp +++ b/engines/sword1/credits.cpp @@ -86,7 +86,7 @@ bool spaceInBuf(uint16 blitSta, uint16 blitEnd, uint16 renderDest) { } void CreditsPlayer::play(void) { - AudioStream *bgSoundStream = AudioStream::openStreamFile("credits"); + Audio::AudioStream *bgSoundStream = Audio::AudioStream::openStreamFile("credits"); if (bgSoundStream == NULL) { warning("\"credits.ogg\" not found, skipping credits sequence"); return; diff --git a/engines/sword1/music.cpp b/engines/sword1/music.cpp index 6ea75da4c7..fe3b90c052 100644 --- a/engines/sword1/music.cpp +++ b/engines/sword1/music.cpp @@ -47,7 +47,7 @@ WaveAudioStream::WaveAudioStream(Common::File *source, uint32 pSize) { _sourceFile = source; _sampleBuf = (uint8*)malloc(SMP_BUFSIZE); _sourceFile->incRef(); - if (_sourceFile->isOpen() && loadWAVFromStream(*_sourceFile, size, rate, flags)) { + if (_sourceFile->isOpen() && Audio::loadWAVFromStream(*_sourceFile, size, rate, flags)) { _isStereo = (flags & Audio::Mixer::FLAG_STEREO) != 0; _rate = rate; if (pSize && (int)pSize < size) @@ -107,16 +107,16 @@ bool WaveAudioStream::endOfData(void) const { // These functions are only called from Music, so I'm just going to // assume that if locking is needed it has already been taken care of. -AudioStream *MusicHandle::createAudioSource(void) { +Audio::AudioStream *MusicHandle::createAudioSource(void) { _file.seek(0); switch (_musicMode) { #ifdef USE_MAD case MusicMp3: - return makeMP3Stream(&_file, _file.size()); + return Audio::makeMP3Stream(&_file, _file.size()); #endif #ifdef USE_VORBIS case MusicVorbis: - return makeVorbisStream(&_file, _file.size()); + return Audio::makeVorbisStream(&_file, _file.size()); #endif case MusicWave: return makeWaveStream(&_file, 0); diff --git a/engines/sword1/music.h b/engines/sword1/music.h index 4f355d3931..28ca933326 100644 --- a/engines/sword1/music.h +++ b/engines/sword1/music.h @@ -44,7 +44,7 @@ enum MusicMode { MusicVorbis }; -class WaveAudioStream : public AudioStream { +class WaveAudioStream : public Audio::AudioStream { public: WaveAudioStream(Common::File *source, uint32 pSize); virtual ~WaveAudioStream(); @@ -61,15 +61,15 @@ private: uint16 _bitsPerSample; }; -class MusicHandle : public AudioStream { +class MusicHandle : public Audio::AudioStream { private: Common::File _file; bool _looping; int32 _fading; int32 _fadeSamples; MusicMode _musicMode; - AudioStream *_audioSource; - AudioStream *createAudioSource(void); + Audio::AudioStream *_audioSource; + Audio::AudioStream *createAudioSource(void); public: MusicHandle() : _looping(false), _fading(0), _audioSource(NULL) {} virtual int readBuffer(int16 *buffer, const int numSamples); @@ -85,7 +85,7 @@ public: int getRate() const; }; -class Music : public AudioStream { +class Music : public Audio::AudioStream { public: Music(Audio::Mixer *pMixer); ~Music(); diff --git a/engines/sword1/sound.cpp b/engines/sword1/sound.cpp index 8529f11f54..c2576ee7d4 100644 --- a/engines/sword1/sound.cpp +++ b/engines/sword1/sound.cpp @@ -201,7 +201,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_MAD else if (_cowMode == CowMp3) { _cowFile.seek(index); - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speechHandle, makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speechHandle, Audio::makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan); // with compressed audio, we can't calculate the wave volume. // so default to talking. for (int cnt = 0; cnt < 480; cnt++) @@ -212,7 +212,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_VORBIS else if (_cowMode == CowVorbis) { _cowFile.seek(index); - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speechHandle, makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speechHandle, Audio::makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan); for (int cnt = 0; cnt < 480; cnt++) _waveVolume[cnt] = true; _waveVolPos = 0; diff --git a/engines/sword2/music.cpp b/engines/sword2/music.cpp index 276b0f0f6a..4b5f1e935d 100644 --- a/engines/sword2/music.cpp +++ b/engines/sword2/music.cpp @@ -43,9 +43,9 @@ namespace Sword2 { -static AudioStream *makeCLUStream(Common::File *fp, int size); +static Audio::AudioStream *makeCLUStream(Common::File *fp, int size); -static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd, uint32 id, uint32 *numSamples) { +static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd, uint32 id, uint32 *numSamples) { debug(3, "Playing %s from CD %d", base, cd); if (!fh->file.isOpen()) { @@ -139,15 +139,15 @@ static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd return makeCLUStream(&fh->file, enc_len); #ifdef USE_MAD case kMP3Mode: - return makeMP3Stream(&fh->file, enc_len); + return Audio::makeMP3Stream(&fh->file, enc_len); #endif #ifdef USE_VORBIS case kVorbisMode: - return makeVorbisStream(&fh->file, enc_len); + return Audio::makeVorbisStream(&fh->file, enc_len); #endif #ifdef USE_FLAC case kFlacMode: - return makeFlacStream(&fh->file, enc_len); + return Audio::makeFlacStream(&fh->file, enc_len); #endif default: return NULL; @@ -232,7 +232,7 @@ void CLUInputStream::refill() { _bufferEnd = out; } -AudioStream *makeCLUStream(Common::File *file, int size) { +Audio::AudioStream *makeCLUStream(Common::File *file, int size) { return new CLUInputStream(file, size); } @@ -718,7 +718,7 @@ uint32 Sound::preFetchCompSpeech(uint32 speechId, uint16 **buf) { SoundFileHandle *fh = (cd == 1) ? &_speechFile[0] : &_speechFile[1]; - AudioStream *input = getAudioStream(fh, "speech", cd, speechId, &numSamples); + Audio::AudioStream *input = getAudioStream(fh, "speech", cd, speechId, &numSamples); if (!input) return 0; @@ -762,7 +762,7 @@ int32 Sound::playCompSpeech(uint32 speechId, uint8 vol, int8 pan) { int cd = _vm->_resman->getCD(); SoundFileHandle *fh = (cd == 1) ? &_speechFile[0] : &_speechFile[1]; - AudioStream *input = getAudioStream(fh, "speech", cd, speechId, NULL); + Audio::AudioStream *input = getAudioStream(fh, "speech", cd, speechId, NULL); if (!input) return RDERR_INVALIDID; diff --git a/engines/sword2/sound.cpp b/engines/sword2/sound.cpp index 202a563fbb..575cd7b849 100644 --- a/engines/sword2/sound.cpp +++ b/engines/sword2/sound.cpp @@ -265,7 +265,7 @@ int32 Sound::playFx(Audio::SoundHandle *handle, byte *data, uint32 len, uint8 vo int rate, size; byte flags; - if (!loadWAVFromStream(stream, size, rate, flags)) { + if (!Audio::loadWAVFromStream(stream, size, rate, flags)) { warning("playFX: Not a valid WAV file"); return RDERR_INVALIDWAV; } diff --git a/engines/sword2/sound.h b/engines/sword2/sound.h index 1e8629b062..32299c38bb 100644 --- a/engines/sword2/sound.h +++ b/engines/sword2/sound.h @@ -79,7 +79,7 @@ enum { RDSE_SPEAKING = 0 }; -class CLUInputStream : public AudioStream { +class CLUInputStream : public Audio::AudioStream { private: Common::File *_file; bool _firstTime; @@ -118,12 +118,12 @@ struct SoundFileHandle { volatile bool inUse; }; -class MusicInputStream : public AudioStream { +class MusicInputStream : public Audio::AudioStream { private: int _cd; SoundFileHandle *_fh; uint32 _musicId; - AudioStream *_decoder; + Audio::AudioStream *_decoder; int16 _buffer[BUFFER_SIZE]; const int16 *_bufferEnd; const int16 *_pos; @@ -165,7 +165,7 @@ public: int32 getTimeRemaining(); }; -class Sound : public AudioStream { +class Sound : public Audio::AudioStream { private: Sword2Engine *_vm; |