aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cine/sound_driver.h2
-rw-r--r--engines/gob/music.h2
-rw-r--r--engines/gob/sound.h2
-rw-r--r--engines/kyra/kyra.h2
-rw-r--r--engines/kyra/sound.cpp8
-rw-r--r--engines/kyra/sound.h7
-rw-r--r--engines/kyra/sound_adlib.cpp2
-rw-r--r--engines/queen/sound.cpp6
-rw-r--r--engines/saga/music.cpp12
-rw-r--r--engines/saga/music.h2
-rw-r--r--engines/saga/sndres.cpp8
-rw-r--r--engines/scumm/he/resource_he.cpp2
-rw-r--r--engines/scumm/he/sound_he.cpp4
-rw-r--r--engines/scumm/imuse_digi/dimuse.h6
-rw-r--r--engines/scumm/imuse_digi/dimuse_script.cpp2
-rw-r--r--engines/scumm/imuse_digi/dimuse_sndmgr.cpp6
-rw-r--r--engines/scumm/imuse_digi/dimuse_sndmgr.h2
-rw-r--r--engines/scumm/imuse_digi/dimuse_track.cpp2
-rw-r--r--engines/scumm/player_mod.cpp2
-rw-r--r--engines/scumm/player_mod.h4
-rw-r--r--engines/scumm/player_nes.h2
-rw-r--r--engines/scumm/player_v2.h2
-rw-r--r--engines/scumm/saveload.cpp4
-rw-r--r--engines/scumm/smush/smush_player.cpp4
-rw-r--r--engines/scumm/sound.cpp14
-rw-r--r--engines/scumm/sound.h2
-rw-r--r--engines/simon/animation.cpp2
-rw-r--r--engines/simon/animation.h2
-rw-r--r--engines/simon/sound.cpp14
-rw-r--r--engines/sky/music/adlibmusic.h2
-rw-r--r--engines/sword1/animation.cpp12
-rw-r--r--engines/sword1/animation.h8
-rw-r--r--engines/sword1/credits.cpp2
-rw-r--r--engines/sword1/music.cpp8
-rw-r--r--engines/sword1/music.h10
-rw-r--r--engines/sword1/sound.cpp4
-rw-r--r--engines/sword2/music.cpp16
-rw-r--r--engines/sword2/sound.cpp2
-rw-r--r--engines/sword2/sound.h8
-rw-r--r--graphics/animation.cpp4
-rw-r--r--graphics/animation.h8
-rw-r--r--sound/adpcm.cpp4
-rw-r--r--sound/adpcm.h4
-rw-r--r--sound/audiocd.cpp4
-rw-r--r--sound/audiocd.h7
-rw-r--r--sound/audiostream.cpp6
-rw-r--r--sound/audiostream.h7
-rw-r--r--sound/flac.cpp4
-rw-r--r--sound/flac.h9
-rw-r--r--sound/mixer.h2
-rw-r--r--sound/mp3.cpp6
-rw-r--r--sound/mp3.h12
-rw-r--r--sound/softsynth/emumidi.h2
-rw-r--r--sound/voc.cpp4
-rw-r--r--sound/voc.h8
-rw-r--r--sound/vorbis.cpp22
-rw-r--r--sound/vorbis.h12
-rw-r--r--sound/wave.cpp4
-rw-r--r--sound/wave.h7
59 files changed, 203 insertions, 134 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;
diff --git a/graphics/animation.cpp b/graphics/animation.cpp
index 3c0d0bab83..c1fb87f5b9 100644
--- a/graphics/animation.cpp
+++ b/graphics/animation.cpp
@@ -155,8 +155,8 @@ bool BaseAnimationState::init(const char *name, void *audioArg) {
#endif
}
-AudioStream *BaseAnimationState::createAudioStream(const char *name, void *arg) {
- return AudioStream::openStreamFile(name);
+Audio::AudioStream *BaseAnimationState::createAudioStream(const char *name, void *arg) {
+ return Audio::AudioStream::openStreamFile(name);
}
bool BaseAnimationState::decodeFrame() {
diff --git a/graphics/animation.h b/graphics/animation.h
index 24b6f7e560..9b7f49352c 100644
--- a/graphics/animation.h
+++ b/graphics/animation.h
@@ -26,7 +26,9 @@
#include "common/scummsys.h"
#include "sound/mixer.h"
-class AudioStream;
+namespace Audio {
+ class AudioStream;
+}
// Uncomment this if you are using libmpeg2 0.3.1.
// #define USE_MPEG2_0_3_1
@@ -91,7 +93,7 @@ protected:
Common::File *_mpegFile;
Audio::SoundHandle _bgSound;
- AudioStream *_bgSoundStream;
+ Audio::AudioStream *_bgSoundStream;
#ifdef BACKEND_8BIT
int _palNum;
@@ -132,7 +134,7 @@ public:
protected:
bool checkPaletteSwitch();
virtual void drawYUV(int width, int height, byte *const *dat) = 0;
- virtual AudioStream *createAudioStream(const char *name, void *arg);
+ virtual Audio::AudioStream *createAudioStream(const char *name, void *arg);
#ifdef BACKEND_8BIT
void buildLookup(int p, int lines);
diff --git a/sound/adpcm.cpp b/sound/adpcm.cpp
index 5d213842e6..2b447d6b0f 100644
--- a/sound/adpcm.cpp
+++ b/sound/adpcm.cpp
@@ -28,6 +28,8 @@
#include "sound/audiostream.h"
+namespace Audio {
+
// TODO: Switch from a SeekableReadStream to a plain ReadStream. This requires
// some internal refactoring but is definitely possible and will increase the
// flexibility of this code.
@@ -353,3 +355,5 @@ int16 ADPCMInputStream::decodeMS(ADPCMChannelStatus *c, byte code) {
AudioStream *makeADPCMStream(Common::SeekableReadStream *stream, uint32 size, typesADPCM type, int rate, int channels, uint32 blockAlign) {
return new ADPCMInputStream(stream, size, type, rate, channels, blockAlign);
}
+
+} // End of namespace Audio
diff --git a/sound/adpcm.h b/sound/adpcm.h
index 6db3acae00..deab1f8e1c 100644
--- a/sound/adpcm.h
+++ b/sound/adpcm.h
@@ -27,6 +27,9 @@
#include "common/scummsys.h"
#include "common/stream.h"
+
+namespace Audio {
+
class AudioStream;
enum typesADPCM {
@@ -37,5 +40,6 @@ enum typesADPCM {
AudioStream *makeADPCMStream(Common::SeekableReadStream *stream, uint32 size, typesADPCM type, int rate = 22050, int channels = 2, uint32 blockAlign = 0);
+} // End of namespace Audio
#endif
diff --git a/sound/audiocd.cpp b/sound/audiocd.cpp
index c204ff4fd4..1487f4491a 100644
--- a/sound/audiocd.cpp
+++ b/sound/audiocd.cpp
@@ -31,6 +31,8 @@
#include "common/util.h"
#include "common/system.h"
+namespace Audio {
+
struct TrackFormat {
/** Decodername */
const char* decoderName;
@@ -165,3 +167,5 @@ int AudioCDManager::getCachedTrack(int track) {
debug(2, "Track %d not available in compressed format", track);
return -1;
}
+
+} // End of namespace Audio
diff --git a/sound/audiocd.h b/sound/audiocd.h
index c829daafaa..c7d5fd15e0 100644
--- a/sound/audiocd.h
+++ b/sound/audiocd.h
@@ -28,6 +28,9 @@
#include "common/singleton.h"
#include "sound/mixer.h"
+
+namespace Audio {
+
class DigitalTrackInfo {
public:
virtual bool error() = 0;
@@ -82,6 +85,8 @@ private:
};
/** Shortcut for accessing the audio CD manager. */
-#define AudioCD AudioCDManager::instance()
+#define AudioCD Audio::AudioCDManager::instance()
+
+} // End of namespace Audio
#endif
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp
index 2af01f66e6..07115390e8 100644
--- a/sound/audiostream.cpp
+++ b/sound/audiostream.cpp
@@ -31,6 +31,9 @@
#include "sound/vorbis.h"
#include "sound/flac.h"
+
+namespace Audio {
+
struct StreamFileFormat {
/** Decodername */
const char* decoderName;
@@ -209,3 +212,6 @@ AudioStream *makeLinearInputStream(int rate, byte flags, const byte *ptr, uint32
}
}
}
+
+
+} // End of namespace Audio
diff --git a/sound/audiostream.h b/sound/audiostream.h
index 88d5339f5a..078c8506c5 100644
--- a/sound/audiostream.h
+++ b/sound/audiostream.h
@@ -28,6 +28,8 @@
#include "common/scummsys.h"
+namespace Audio {
+
/**
* Generic input stream for the resampling code.
*/
@@ -116,11 +118,10 @@ AudioStream *makeLinearInputStream(int rate, byte flags, const byte *ptr, uint32
// us to go with the macro approach. So far this is
// the only template function that MSVC6 seemed to
// compile incorrectly. Knock on wood.
-#define READSAMPLE(is16Bit, isUnsigned, ptr) \
- ((is16Bit ? READ_BE_UINT16(ptr) : (*ptr << 8)) ^ (isUnsigned ? 0x8000 : 0))
-
#define READ_ENDIAN_SAMPLE(is16Bit, isUnsigned, ptr, isLE) \
((is16Bit ? (isLE ? READ_LE_UINT16(ptr) : READ_BE_UINT16(ptr)) : (*ptr << 8)) ^ (isUnsigned ? 0x8000 : 0))
+} // End of namespace Audio
+
#endif
diff --git a/sound/flac.cpp b/sound/flac.cpp
index 5380e85faf..7f206ae562 100644
--- a/sound/flac.cpp
+++ b/sound/flac.cpp
@@ -37,6 +37,8 @@
using Common::File;
+namespace Audio {
+
#pragma mark -
#pragma mark --- Flac stream ---
#pragma mark -
@@ -849,4 +851,6 @@ AudioStream *makeFlacStream(File *file, uint32 length)
}
+} // End of namespace Audio
+
#endif // #ifdef USE_FLAC
diff --git a/sound/flac.h b/sound/flac.h
index fa2eaa077f..a916db9df0 100644
--- a/sound/flac.h
+++ b/sound/flac.h
@@ -28,12 +28,15 @@
#ifdef USE_FLAC
-class AudioStream;
-class DigitalTrackInfo;
namespace Common {
class File;
}
+namespace Audio {
+
+class AudioStream;
+class DigitalTrackInfo;
+
DigitalTrackInfo *getFlacTrack(int track);
/**
@@ -44,5 +47,7 @@ DigitalTrackInfo *getFlacTrack(int track);
*/
AudioStream *makeFlacStream(Common::File *file, uint32 size);
+} // End of namespace Audio
+
#endif // #ifdef USE_FLAC
#endif // #ifndef SOUND_FLAC_H
diff --git a/sound/mixer.h b/sound/mixer.h
index 347f0c409b..f1cbc0586c 100644
--- a/sound/mixer.h
+++ b/sound/mixer.h
@@ -29,12 +29,12 @@
#include "common/mutex.h"
-class AudioStream;
class OSystem;
namespace Audio {
+class AudioStream;
class Channel;
class Mixer;
diff --git a/sound/mp3.cpp b/sound/mp3.cpp
index 855d2c25a3..f2ba7e9b26 100644
--- a/sound/mp3.cpp
+++ b/sound/mp3.cpp
@@ -36,6 +36,8 @@
using Common::File;
+namespace Audio {
+
#pragma mark -
#pragma mark --- MP3 (MAD) stream ---
#pragma mark -
@@ -487,4 +489,6 @@ DigitalTrackInfo *getMP3Track(int track) {
}
-#endif
+} // End of namespace Audio
+
+#endif // #ifdef USE_MAD
diff --git a/sound/mp3.h b/sound/mp3.h
index db4f0cec6d..4f31337fcf 100644
--- a/sound/mp3.h
+++ b/sound/mp3.h
@@ -28,12 +28,15 @@
#ifdef USE_MAD
-class AudioStream;
-class DigitalTrackInfo;
namespace Common {
class File;
}
+namespace Audio {
+
+class AudioStream;
+class DigitalTrackInfo;
+
DigitalTrackInfo *getMP3Track(int track);
/**
@@ -44,6 +47,7 @@ DigitalTrackInfo *getMP3Track(int track);
*/
AudioStream *makeMP3Stream(Common::File *file, uint32 size);
-#endif
+} // End of namespace Audio
-#endif
+#endif // #ifdef USE_MAD
+#endif // #ifndef SOUND_MP3_H
diff --git a/sound/softsynth/emumidi.h b/sound/softsynth/emumidi.h
index b77d55dc6e..89124b8024 100644
--- a/sound/softsynth/emumidi.h
+++ b/sound/softsynth/emumidi.h
@@ -26,7 +26,7 @@
#define FIXP_SHIFT 16
-class MidiDriver_Emulated : public AudioStream, public MidiDriver {
+class MidiDriver_Emulated : public Audio::AudioStream, public MidiDriver {
protected:
bool _isOpen;
Audio::Mixer *_mixer;
diff --git a/sound/voc.cpp b/sound/voc.cpp
index 86abca3ce2..0fc224521e 100644
--- a/sound/voc.cpp
+++ b/sound/voc.cpp
@@ -31,6 +31,8 @@
#include "sound/voc.h"
+namespace Audio {
+
int getSampleRateFromVOCRate(int vocSR) {
if (vocSR == 0xa5 || vocSR == 0xa6) {
return 11025;
@@ -140,3 +142,5 @@ AudioStream *makeVOCStream(Common::ReadStream &stream) {
return makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, data, size, 0, 0);
}
+
+} // End of namespace Audio
diff --git a/sound/voc.h b/sound/voc.h
index 59ddc305ec..d53fcedcdf 100644
--- a/sound/voc.h
+++ b/sound/voc.h
@@ -27,9 +27,13 @@
#include "common/stdafx.h"
#include "common/scummsys.h"
-class AudioStream;
namespace Common { class ReadStream; }
+namespace Audio {
+
+class AudioStream;
+
+
#if !defined(__GNUC__)
#pragma START_PACK_STRUCTS
#endif
@@ -81,4 +85,6 @@ extern byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate)
*/
AudioStream *makeVOCStream(Common::ReadStream &stream);
+} // End of namespace Audio
+
#endif
diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp
index 7a8748b28b..002d75c170 100644
--- a/sound/vorbis.cpp
+++ b/sound/vorbis.cpp
@@ -44,6 +44,8 @@
using Common::File;
+namespace Audio {
+
static AudioStream *makeVorbisStream(OggVorbis_File *file, int duration);
#pragma mark -
@@ -134,7 +136,7 @@ static int seek_wrap(void *datasource, ogg_int64_t offset, int whence) {
f->curr_pos = f->file->pos() - f->start;
#ifdef __SYMBIAN32__
- // For symbian we now store the last read position and then close the file
+ // For symbian we now store the last read position and then close the file
if (f->file) {
f->file->close();
}
@@ -208,7 +210,7 @@ bool VorbisTrackInfo::openTrack() {
#ifndef __SYMBIAN32__
_file->incRef();
#endif
- }
+ }
return err;
}
@@ -233,7 +235,7 @@ void VorbisTrackInfo::play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int
ov_time_seek(&_ov_file, (ogg_int64_t)(startFrame / 75.0 * 1000));
#endif
#else
- ov_time_seek(&_ov_file, startFrame / 75.0);
+ ov_time_seek(&_ov_file, startFrame / 75.0);
#endif
AudioStream *input = makeVorbisStream(&_ov_file, duration * ov_info(&_ov_file, -1)->rate / 75);
@@ -392,7 +394,7 @@ AudioStream *makeVorbisStream(File *file, uint32 size) {
#else
f->file = file;
#endif
- f->start = file->pos();
+ f->start = file->pos();
f->len = size;
f->curr_pos = 0;
@@ -400,12 +402,16 @@ AudioStream *makeVorbisStream(File *file, uint32 size) {
warning("Invalid file format");
delete ov_file;
delete f;
- return 0;
- } else {
+ return 0;
+ } else {
#ifndef __SYMBIAN32__
file->incRef();
#endif
return new VorbisInputStream(ov_file, 0, true);
- }
}
-#endif
+}
+
+
+} // End of namespace Audio
+
+#endif // #ifdef USE_VORBIS
diff --git a/sound/vorbis.h b/sound/vorbis.h
index ee8943cdde..205f578e34 100644
--- a/sound/vorbis.h
+++ b/sound/vorbis.h
@@ -28,12 +28,15 @@
#ifdef USE_VORBIS
-class AudioStream;
-class DigitalTrackInfo;
namespace Common {
class File;
}
+namespace Audio {
+
+class AudioStream;
+class DigitalTrackInfo;
+
DigitalTrackInfo *getVorbisTrack(int track);
/**
@@ -44,6 +47,7 @@ DigitalTrackInfo *getVorbisTrack(int track);
*/
AudioStream *makeVorbisStream(Common::File *file, uint32 size);
-#endif
+} // End of namespace Audio
-#endif
+#endif // #ifdef USE_VORBIS
+#endif // #ifndef SOUND_VORBIS_H
diff --git a/sound/wave.cpp b/sound/wave.cpp
index dbee606a39..0256d23226 100644
--- a/sound/wave.cpp
+++ b/sound/wave.cpp
@@ -29,6 +29,8 @@
#include "sound/wave.h"
#include "sound/adpcm.h"
+namespace Audio {
+
bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, byte &flags, uint16 *wavType, int *blockAlign_) {
const uint32 initialPos = stream.pos();
byte buf[4+1];
@@ -181,3 +183,5 @@ AudioStream *makeWAVStream(Common::SeekableReadStream &stream) {
return makeLinearInputStream(rate, flags, data, size, 0, 0);
}
+
+} // End of namespace Audio
diff --git a/sound/wave.h b/sound/wave.h
index f0aca0c9fc..4c4c4ce644 100644
--- a/sound/wave.h
+++ b/sound/wave.h
@@ -26,9 +26,12 @@
#include "common/stdafx.h"
#include "common/scummsys.h"
-class AudioStream;
namespace Common { class SeekableReadStream; }
+namespace Audio {
+
+class AudioStream;
+
/**
* 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
@@ -47,4 +50,6 @@ extern bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int
*/
AudioStream *makeWAVStream(Common::SeekableReadStream &stream);
+} // End of namespace Audio
+
#endif