Moved class SoundMixer to Audio::Mixer (didn't call the namespace 'Sound' because we already have many classes with that name)

svn-id: r18039
This commit is contained in:
Max Horn 2005-05-10 23:48:48 +00:00
parent 72f4c03b0b
commit 1a615346ab
80 changed files with 360 additions and 330 deletions

View file

@ -26,7 +26,9 @@
class GameDetector; class GameDetector;
class OSystem; class OSystem;
class SoundMixer; namespace Audio {
class Mixer;
}
namespace Common { namespace Common {
class SaveFileManager; class SaveFileManager;
class Timer; class Timer;
@ -35,7 +37,7 @@ namespace Common {
class Engine { class Engine {
public: public:
OSystem *_system; OSystem *_system;
SoundMixer *_mixer; Audio::Mixer *_mixer;
Common::Timer * _timer; Common::Timer * _timer;
protected: protected:

View file

@ -633,6 +633,6 @@ Engine *GameDetector::createEngine(OSystem *sys) {
return _plugin->createInstance(this, sys); return _plugin->createInstance(this, sys);
} }
SoundMixer *GameDetector::createMixer() { Audio::Mixer *GameDetector::createMixer() {
return new SoundMixer(); return new Audio::Mixer();
} }

View file

@ -29,7 +29,9 @@ class Engine;
class GameDetector; class GameDetector;
class OSystem; class OSystem;
class Plugin; class Plugin;
class SoundMixer; namespace Audio {
class Mixer;
}
/** Global (shared) game feature flags. */ /** Global (shared) game feature flags. */
enum { enum {
@ -66,7 +68,7 @@ public:
public: public:
Engine *createEngine(OSystem *system); Engine *createEngine(OSystem *system);
static SoundMixer *createMixer(); static Audio::Mixer *createMixer();
static GameSettings findGame(const String &gameName, const Plugin **plugin = NULL); static GameSettings findGame(const String &gameName, const Plugin **plugin = NULL);

View file

@ -823,7 +823,7 @@ public:
* Determine the output sample rate. Audio data provided by the sound * Determine the output sample rate. Audio data provided by the sound
* callback will be played using this rate. * callback will be played using this rate.
* @note Client code other than the sound mixer should _not_ use this * @note Client code other than the sound mixer should _not_ use this
* method. Instead, call SoundMixer::getOutputRate()! * method. Instead, call Mixer::getOutputRate()!
* @return the output sample rate * @return the output sample rate
*/ */
virtual int getOutputSampleRate() const = 0; virtual int getOutputSampleRate() const = 0;

View file

@ -130,8 +130,8 @@ GobEngine::GobEngine(GameDetector *detector, OSystem * syst) : Engine(syst) {
warning("Sound initialization failed."); warning("Sound initialization failed.");
} }
_mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_vm = this; _vm = this;
} }

View file

@ -114,7 +114,7 @@ void snd_setBlasterPort(int16 port) {return;}
void snd_speakerOn(int16 frequency, int32 length) { void snd_speakerOn(int16 frequency, int32 length) {
speakerStream.playNote(frequency, length); speakerStream.playNote(frequency, length);
if (!_vm->_mixer->isSoundHandleActive(speakerHandle)) { if (!_vm->_mixer->isSoundHandleActive(speakerHandle)) {
_vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &speakerHandle, &speakerStream, -1, 255, 0, false); _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &speakerHandle, &speakerStream, -1, 255, 0, false);
} }
} }

View file

@ -30,7 +30,7 @@
namespace Graphics { namespace Graphics {
BaseAnimationState::BaseAnimationState(SoundMixer *snd, OSystem *sys, int width, int height) BaseAnimationState::BaseAnimationState(Audio::Mixer *snd, OSystem *sys, int width, int height)
: _movieWidth(width), _movieHeight(height), _snd(snd), _sys(sys) { : _movieWidth(width), _movieHeight(height), _snd(snd), _sys(sys) {
#ifndef BACKEND_8BIT #ifndef BACKEND_8BIT
_colorTab = NULL; _colorTab = NULL;
@ -143,7 +143,7 @@ bool BaseAnimationState::init(const char *name, void *audioArg) {
_bgSoundStream = createAudioStream(name, audioArg); _bgSoundStream = createAudioStream(name, audioArg);
if (_bgSoundStream != NULL) { if (_bgSoundStream != NULL) {
_snd->playInputStream(SoundMixer::kSFXSoundType, &_bgSound, _bgSoundStream, -1, 255, 0, false); _snd->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream, -1, 255, 0, false);
} else { } else {
warning("Cutscene: Could not open Audio Track for %s", name); warning("Cutscene: Could not open Audio Track for %s", name);
} }

View file

@ -74,7 +74,7 @@ protected:
const int _movieWidth; const int _movieWidth;
const int _movieHeight; const int _movieHeight;
SoundMixer *_snd; Audio::Mixer *_snd;
OSystem *_sys; OSystem *_sys;
uint _frameNum; uint _frameNum;
@ -117,7 +117,7 @@ protected:
#endif #endif
public: public:
BaseAnimationState(SoundMixer *snd, OSystem *sys, int width, int height); BaseAnimationState(Audio::Mixer *snd, OSystem *sys, int width, int height);
virtual ~BaseAnimationState(); virtual ~BaseAnimationState();
bool init(const char *name, void *audioArg = NULL); bool init(const char *name, void *audioArg = NULL);

View file

@ -408,19 +408,19 @@ int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset) {
// Volume controllers // Volume controllers
_musicVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Music volume: ", 100, kMusicVolumeChanged); _musicVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Music volume: ", 100, kMusicVolumeChanged);
_musicVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft); _musicVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft);
_musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(SoundMixer::kMaxMixerVolume); _musicVolumeSlider->setMinValue(0); _musicVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
_musicVolumeLabel->setFlags(WIDGET_CLEARBG); _musicVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16; yoffset += 16;
_sfxVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "SFX volume: ", 100, kSfxVolumeChanged); _sfxVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "SFX volume: ", 100, kSfxVolumeChanged);
_sfxVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft); _sfxVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft);
_sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(SoundMixer::kMaxMixerVolume); _sfxVolumeSlider->setMinValue(0); _sfxVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
_sfxVolumeLabel->setFlags(WIDGET_CLEARBG); _sfxVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16; yoffset += 16;
_speechVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Speech volume: ", 100, kSpeechVolumeChanged); _speechVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Speech volume: ", 100, kSpeechVolumeChanged);
_speechVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft); _speechVolumeLabel = new StaticTextWidget(boss, 200, yoffset + 2, 24, kLineHeight, "100%", kTextAlignLeft);
_speechVolumeSlider->setMinValue(0); _speechVolumeSlider->setMaxValue(SoundMixer::kMaxMixerVolume); _speechVolumeSlider->setMinValue(0); _speechVolumeSlider->setMaxValue(Audio::Mixer::kMaxMixerVolume);
_speechVolumeLabel->setFlags(WIDGET_CLEARBG); _speechVolumeLabel->setFlags(WIDGET_CLEARBG);
yoffset += 16; yoffset += 16;

View file

@ -106,8 +106,8 @@ KyraEngine::KyraEngine(GameDetector *detector, OSystem *syst)
warning("Sound initialization failed."); warning("Sound initialization failed.");
} }
_mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); _mixer->setVolumeForSoundType(Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); _mixer->setVolumeForSoundType(Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
// gets the game // gets the game
if (detector->_game.features & GF_KYRA1) { if (detector->_game.features & GF_KYRA1) {

View file

@ -419,9 +419,9 @@ int QueenEngine::init(GameDetector &detector) {
if (!_mixer->isReady()) if (!_mixer->isReady())
warning("Sound initialisation failed"); warning("Sound initialisation failed");
_mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
// Set mixer music volume to maximum, since music volume is regulated by MusicPlayer's MIDI messages // Set mixer music volume to maximum, since music volume is regulated by MusicPlayer's MIDI messages
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, SoundMixer::kMaxMixerVolume); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxMixerVolume);
int midiDriver = MidiDriver::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE); int midiDriver = MidiDriver::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE);
MidiDriver *driver = MidiDriver::createMidi(midiDriver); MidiDriver *driver = MidiDriver::createMidi(midiDriver);

View file

@ -36,14 +36,14 @@
namespace Queen { namespace Queen {
Sound::Sound(SoundMixer *mixer, QueenEngine *vm) : Sound::Sound(Audio::Mixer *mixer, QueenEngine *vm) :
_mixer(mixer), _vm(vm), _sfxToggle(true), _speechToggle(true), _musicToggle(true), _lastOverride(0) { _mixer(mixer), _vm(vm), _sfxToggle(true), _speechToggle(true), _musicToggle(true), _lastOverride(0) {
} }
Sound::~Sound() { Sound::~Sound() {
} }
Sound *Sound::giveSound(SoundMixer *mixer, QueenEngine *vm, uint8 compression) { Sound *Sound::giveSound(Audio::Mixer *mixer, QueenEngine *vm, uint8 compression) {
if (!mixer->isReady()) if (!mixer->isReady())
return new SilentSound(mixer, vm); return new SilentSound(mixer, vm);
@ -187,7 +187,7 @@ void Sound::loadState(uint32 ver, byte *&ptr) {
} }
void SBSound::playSound(byte *sound, uint32 size, bool isSpeech) { void SBSound::playSound(byte *sound, uint32 size, bool isSpeech) {
byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE; byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE;
_mixer->playRaw(isSpeech ? &_speechHandle : &_sfxHandle, sound, size, 11025, flags); _mixer->playRaw(isSpeech ? &_speechHandle : &_sfxHandle, sound, size, 11025, flags);
} }
@ -201,7 +201,7 @@ void SBSound::sfxPlay(const char *name, bool isSpeech) {
void MP3Sound::sfxPlay(const char *name, bool isSpeech) { void MP3Sound::sfxPlay(const char *name, bool isSpeech) {
uint32 size; uint32 size;
Common::File *f = _vm->resource()->giveCompressedSound(name, &size); Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
_mixer->playInputStream(SoundMixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeMP3Stream(f, size)); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeMP3Stream(f, size));
} }
#endif #endif
@ -209,7 +209,7 @@ void MP3Sound::sfxPlay(const char *name, bool isSpeech) {
void OGGSound::sfxPlay(const char *name, bool isSpeech) { void OGGSound::sfxPlay(const char *name, bool isSpeech) {
uint32 size; uint32 size;
Common::File *f = _vm->resource()->giveCompressedSound(name, &size); Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
_mixer->playInputStream(SoundMixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeVorbisStream(f, size)); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeVorbisStream(f, size));
} }
#endif #endif
@ -217,7 +217,7 @@ void OGGSound::sfxPlay(const char *name, bool isSpeech) {
void FLACSound::sfxPlay(const char *name, bool isSpeech) { void FLACSound::sfxPlay(const char *name, bool isSpeech) {
uint32 size; uint32 size;
Common::File *f = _vm->resource()->giveCompressedSound(name, &size); Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
_mixer->playInputStream(SoundMixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeFlacStream(f, size)); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, isSpeech ? &_speechHandle : &_sfxHandle, makeFlacStream(f, size));
} }
#endif #endif

View file

@ -51,10 +51,10 @@ class QueenEngine;
class Sound { class Sound {
public: public:
Sound(SoundMixer *mixer, QueenEngine *vm); Sound(Audio::Mixer *mixer, QueenEngine *vm);
virtual ~Sound(); virtual ~Sound();
virtual void sfxPlay(const char *name, bool isSpeech) = 0; virtual void sfxPlay(const char *name, bool isSpeech) = 0;
static Sound *giveSound(SoundMixer *mixer, QueenEngine *vm, uint8 compression); static Sound *giveSound(Audio::Mixer *mixer, QueenEngine *vm, uint8 compression);
void playSfx(uint16 sfx, bool isSpeech); void playSfx(uint16 sfx, bool isSpeech);
void playSfx(const char *base, bool isSpeech); void playSfx(const char *base, bool isSpeech);
void playSong(int16 songNum); void playSong(int16 songNum);
@ -103,7 +103,7 @@ public:
protected: protected:
void waitFinished(bool isSpeech); void waitFinished(bool isSpeech);
SoundMixer *_mixer; Audio::Mixer *_mixer;
QueenEngine *_vm; QueenEngine *_vm;
bool _sfxToggle; bool _sfxToggle;
@ -118,13 +118,13 @@ protected:
class SilentSound : public Sound { class SilentSound : public Sound {
public: public:
SilentSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {}; SilentSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
void sfxPlay(const char *name, bool isSpeech) { } void sfxPlay(const char *name, bool isSpeech) { }
}; };
class SBSound : public Sound { class SBSound : public Sound {
public: public:
SBSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {}; SBSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
void sfxPlay(const char *name, bool isSpeech); void sfxPlay(const char *name, bool isSpeech);
protected: protected:
void playSound(byte *sound, uint32 size, bool isSpeech); void playSound(byte *sound, uint32 size, bool isSpeech);
@ -133,7 +133,7 @@ protected:
#ifdef USE_MAD #ifdef USE_MAD
class MP3Sound : public Sound { class MP3Sound : public Sound {
public: public:
MP3Sound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {}; MP3Sound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
void sfxPlay(const char *name, bool isSpeech); void sfxPlay(const char *name, bool isSpeech);
}; };
#endif #endif
@ -141,7 +141,7 @@ public:
#ifdef USE_VORBIS #ifdef USE_VORBIS
class OGGSound : public Sound { class OGGSound : public Sound {
public: public:
OGGSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {}; OGGSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
void sfxPlay(const char *name, bool isSpeech); void sfxPlay(const char *name, bool isSpeech);
}; };
#endif #endif
@ -149,7 +149,7 @@ public:
#ifdef USE_FLAC #ifdef USE_FLAC
class FLACSound : public Sound { class FLACSound : public Sound {
public: public:
FLACSound(SoundMixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {}; FLACSound(Audio::Mixer *mixer, QueenEngine *vm) : Sound(mixer, vm) {};
void sfxPlay(const char *name, bool isSpeech); void sfxPlay(const char *name, bool isSpeech);
}; };
#endif // #ifdef USE_FLAC #endif // #ifdef USE_FLAC

View file

@ -279,10 +279,10 @@ void MusicPlayer::stopMusic() {
} }
} }
Music::Music(SoundMixer *mixer, MidiDriver *driver, int enabled) : _mixer(mixer), _enabled(enabled), _adlib(false) { Music::Music(Audio::Mixer *mixer, MidiDriver *driver, int enabled) : _mixer(mixer), _enabled(enabled), _adlib(false) {
_player = new MusicPlayer(driver); _player = new MusicPlayer(driver);
_musicInitialized = 1; _musicInitialized = 1;
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
if (_vm->getGameType() == GType_ITE) { if (_vm->getGameType() == GType_ITE) {
Common::File file; Common::File file;
@ -434,7 +434,7 @@ int Music::play(uint32 music_rn, uint16 flags) {
if (audioStream) { if (audioStream) {
debug(0, "Playing digitized music"); debug(0, "Playing digitized music");
_mixer->playInputStream(SoundMixer::kMusicSoundType, &_musicHandle, audioStream); _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, audioStream);
return SUCCESS; return SUCCESS;
} }

View file

@ -106,7 +106,7 @@ protected:
class Music { class Music {
public: public:
Music(SoundMixer *mixer, MidiDriver *driver, int enabled); Music(Audio::Mixer *mixer, MidiDriver *driver, int enabled);
~Music(void); ~Music(void);
void setNativeMT32(bool b) { _player->setNativeMT32(b); } void setNativeMT32(bool b) { _player->setNativeMT32(b); }
bool hasNativeMT32() { return _player->hasNativeMT32(); } bool hasNativeMT32() { return _player->hasNativeMT32(); }
@ -122,7 +122,7 @@ public:
private: private:
SoundMixer *_mixer; Audio::Mixer *_mixer;
MusicPlayer *_player; MusicPlayer *_player;
SoundHandle _musicHandle; SoundHandle _musicHandle;

View file

@ -158,8 +158,8 @@ SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst)
warning("Sound initialization failed."); warning("Sound initialization failed.");
} }
_mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_vm = this; _vm = this;
} }

View file

@ -207,7 +207,7 @@ int SndRes::loadWavSound(byte *snd_res, size_t snd_res_len, SOUNDBUFFER *snd_buf
return FAILURE; return FAILURE;
} }
snd_buf_i->s_stereo = ((flags & SoundMixer::FLAG_STEREO) != 0); snd_buf_i->s_stereo = ((flags & Audio::Mixer::FLAG_STEREO) != 0);
snd_buf_i->s_freq = rate; snd_buf_i->s_freq = rate;
snd_buf_i->s_samplebits = 16; snd_buf_i->s_samplebits = 16;
snd_buf_i->s_signed = 1; snd_buf_i->s_signed = 1;

View file

@ -30,7 +30,7 @@
namespace Saga { namespace Saga {
Sound::Sound(SagaEngine *vm, SoundMixer *mixer, int enabled) : Sound::Sound(SagaEngine *vm, Audio::Mixer *mixer, int enabled) :
_vm(vm), _mixer(mixer), _enabled(enabled), _voxStream(0) { _vm(vm), _mixer(mixer), _enabled(enabled), _voxStream(0) {
_soundInitialized = 1; _soundInitialized = 1;
@ -53,20 +53,20 @@ int Sound::playSoundBuffer(SoundHandle *handle, SOUNDBUFFER *buf, int volume, bo
return FAILURE; return FAILURE;
} }
flags = SoundMixer::FLAG_AUTOFREE; flags = Audio::Mixer::FLAG_AUTOFREE;
if (loop) if (loop)
flags |= SoundMixer::FLAG_LOOP; flags |= Audio::Mixer::FLAG_LOOP;
if (buf->s_samplebits == 16) { if (buf->s_samplebits == 16) {
flags |= SoundMixer::FLAG_16BITS; flags |= Audio::Mixer::FLAG_16BITS;
if (!(_vm->getFeatures() & GF_BIG_ENDIAN_DATA)) if (!(_vm->getFeatures() & GF_BIG_ENDIAN_DATA))
flags |= SoundMixer::FLAG_LITTLE_ENDIAN; flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
} }
if (buf->s_stereo) if (buf->s_stereo)
flags |= SoundMixer::FLAG_STEREO; flags |= Audio::Mixer::FLAG_STEREO;
if (!buf->s_signed) if (!buf->s_signed)
flags |= SoundMixer::FLAG_UNSIGNED; flags |= Audio::Mixer::FLAG_UNSIGNED;
_mixer->playRaw(handle, buf->s_buf, buf->s_buf_len, buf->s_freq, flags, -1, volume); _mixer->playRaw(handle, buf->s_buf, buf->s_buf_len, buf->s_freq, flags, -1, volume);
@ -120,7 +120,7 @@ int Sound::playVoxVoice(SOUNDBUFFER *buf) {
_voxStream = new Common::MemoryReadStream(buf->s_buf, buf->s_buf_len); _voxStream = new Common::MemoryReadStream(buf->s_buf, buf->s_buf_len);
audioStream = makeADPCMStream(*_voxStream, buf->s_buf_len, kADPCMOki); audioStream = makeADPCMStream(*_voxStream, buf->s_buf_len, kADPCMOki);
_mixer->playInputStream(SoundMixer::kSFXSoundType, &_voiceHandle, audioStream); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_voiceHandle, audioStream);
return SUCCESS; return SUCCESS;
} }

View file

@ -48,7 +48,7 @@ struct SOUNDBUFFER {
class Sound { class Sound {
public: public:
Sound(SagaEngine *vm, SoundMixer *mixer, int enabled); Sound(SagaEngine *vm, Audio::Mixer *mixer, int enabled);
~Sound(); ~Sound();
int playSound(SOUNDBUFFER *buf, int volume, bool loop); int playSound(SOUNDBUFFER *buf, int volume, bool loop);
@ -70,7 +70,7 @@ public:
int _enabled; int _enabled;
SagaEngine *_vm; SagaEngine *_vm;
SoundMixer *_mixer; Audio::Mixer *_mixer;
Common::MemoryReadStream *_voxStream; Common::MemoryReadStream *_voxStream;
SoundHandle _effectHandle; SoundHandle _effectHandle;

View file

@ -171,19 +171,19 @@ void IMuseDigital::saveOrLoad(Serializer *ser) {
track->iteration = freq * channels; track->iteration = freq * channels;
track->mixerFlags = 0; track->mixerFlags = 0;
if (channels == 2) if (channels == 2)
track->mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO; track->mixerFlags = Audio::Mixer::FLAG_STEREO | Audio::Mixer::FLAG_REVERSE_STEREO;
if ((bits == 12) || (bits == 16)) { if ((bits == 12) || (bits == 16)) {
track->mixerFlags |= SoundMixer::FLAG_16BITS; track->mixerFlags |= Audio::Mixer::FLAG_16BITS;
track->iteration *= 2; track->iteration *= 2;
} else if (bits == 8) { } else if (bits == 8) {
track->mixerFlags |= SoundMixer::FLAG_UNSIGNED; track->mixerFlags |= Audio::Mixer::FLAG_UNSIGNED;
} else } else
error("IMuseDigital::saveOrLoad(): Can't handle %d bit samples", bits); error("IMuseDigital::saveOrLoad(): Can't handle %d bit samples", bits);
#ifdef SCUMM_LITTLE_ENDIAN #ifdef SCUMM_LITTLE_ENDIAN
if (track->compressed) if (track->compressed)
track->mixerFlags |= SoundMixer::FLAG_LITTLE_ENDIAN; track->mixerFlags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
#endif #endif
int32 streamBufferSize = track->iteration; int32 streamBufferSize = track->iteration;
@ -192,14 +192,14 @@ void IMuseDigital::saveOrLoad(Serializer *ser) {
const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0; const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0;
const int vol = track->vol / 1000; const int vol = track->vol / 1000;
SoundMixer::SoundType type = SoundMixer::kPlainSoundType; Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType;
if (track->volGroupId == 1) if (track->volGroupId == 1)
type = SoundMixer::kSpeechSoundType; type = Audio::Mixer::kSpeechSoundType;
if (track->volGroupId == 2) if (track->volGroupId == 2)
type = SoundMixer::kSFXSoundType; type = Audio::Mixer::kSFXSoundType;
if (track->volGroupId == 3) if (track->volGroupId == 3)
type = SoundMixer::kMusicSoundType; type = Audio::Mixer::kMusicSoundType;
_vm->_mixer->playInputStream(type, &track->handle, track->stream, -1, vol, pan, false); _vm->_mixer->playInputStream(type, &track->handle, track->stream, -1, vol, pan, false);
} }
@ -246,14 +246,14 @@ void IMuseDigital::callback() {
const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0; const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0;
const int vol = track->vol / 1000; const int vol = track->vol / 1000;
SoundMixer::SoundType type = SoundMixer::kPlainSoundType; Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType;
if (track->volGroupId == 1) if (track->volGroupId == 1)
type = SoundMixer::kSpeechSoundType; type = Audio::Mixer::kSpeechSoundType;
if (track->volGroupId == 2) if (track->volGroupId == 2)
type = SoundMixer::kSFXSoundType; type = Audio::Mixer::kSFXSoundType;
if (track->volGroupId == 3) if (track->volGroupId == 3)
type = SoundMixer::kMusicSoundType; type = Audio::Mixer::kMusicSoundType;
if (track->stream) { if (track->stream) {
byte *data = NULL; byte *data = NULL;

View file

@ -170,7 +170,7 @@ void IMuseDigital::flushTracks() {
track->stream->finish(); track->stream->finish();
} }
if (track->stream->endOfStream() if (track->stream->endOfStream()
|| _vm->_mixer->isPaused() // hack for paused SoundMixer || _vm->_mixer->isPaused() // hack for paused Mixer
|| _vm->_insaneRunning) { // INSANE hack for sync timer mode || _vm->_insaneRunning) { // INSANE hack for sync timer mode
_vm->_mixer->stopHandle(track->handle); _vm->_mixer->stopHandle(track->handle);
delete track->stream; delete track->stream;

View file

@ -140,19 +140,19 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
track->iteration = freq * channels; track->iteration = freq * channels;
if (channels == 2) if (channels == 2)
track->mixerFlags = SoundMixer::FLAG_STEREO | SoundMixer::FLAG_REVERSE_STEREO; track->mixerFlags = Audio::Mixer::FLAG_STEREO | Audio::Mixer::FLAG_REVERSE_STEREO;
if ((bits == 12) || (bits == 16)) { if ((bits == 12) || (bits == 16)) {
track->mixerFlags |= SoundMixer::FLAG_16BITS; track->mixerFlags |= Audio::Mixer::FLAG_16BITS;
track->iteration *= 2; track->iteration *= 2;
} else if (bits == 8) { } else if (bits == 8) {
track->mixerFlags |= SoundMixer::FLAG_UNSIGNED; track->mixerFlags |= Audio::Mixer::FLAG_UNSIGNED;
} else } else
error("IMuseDigital::startSound(): Can't handle %d bit samples", bits); error("IMuseDigital::startSound(): Can't handle %d bit samples", bits);
#ifdef SCUMM_LITTLE_ENDIAN #ifdef SCUMM_LITTLE_ENDIAN
if (track->compressed) if (track->compressed)
track->mixerFlags |= SoundMixer::FLAG_LITTLE_ENDIAN; track->mixerFlags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
#endif #endif
} }
@ -163,14 +163,14 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
} else { } else {
const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0; const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0;
const int vol = track->vol / 1000; const int vol = track->vol / 1000;
SoundMixer::SoundType type = SoundMixer::kPlainSoundType; Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType;
if (track->volGroupId == 1) if (track->volGroupId == 1)
type = SoundMixer::kSpeechSoundType; type = Audio::Mixer::kSpeechSoundType;
if (track->volGroupId == 2) if (track->volGroupId == 2)
type = SoundMixer::kSFXSoundType; type = Audio::Mixer::kSFXSoundType;
if (track->volGroupId == 3) if (track->volGroupId == 3)
type = SoundMixer::kMusicSoundType; type = Audio::Mixer::kMusicSoundType;
// setup 1 second stream wrapped buffer // setup 1 second stream wrapped buffer
int32 streamBufferSize = track->iteration; int32 streamBufferSize = track->iteration;
@ -340,14 +340,14 @@ IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(Track *track, int fadeDel
fadeTrack->volFadeStep = (fadeTrack->volFadeDest - fadeTrack->vol) * 60 * (1000 / _callbackFps) / (1000 * fadeDelay); fadeTrack->volFadeStep = (fadeTrack->volFadeDest - fadeTrack->vol) * 60 * (1000 / _callbackFps) / (1000 * fadeDelay);
fadeTrack->volFadeUsed = true; fadeTrack->volFadeUsed = true;
SoundMixer::SoundType type = SoundMixer::kPlainSoundType; Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType;
if (fadeTrack->volGroupId == 1) if (fadeTrack->volGroupId == 1)
type = SoundMixer::kSpeechSoundType; type = Audio::Mixer::kSpeechSoundType;
if (fadeTrack->volGroupId == 2) if (fadeTrack->volGroupId == 2)
type = SoundMixer::kSFXSoundType; type = Audio::Mixer::kSFXSoundType;
if (fadeTrack->volGroupId == 3) if (fadeTrack->volGroupId == 3)
type = SoundMixer::kMusicSoundType; type = Audio::Mixer::kMusicSoundType;
// setup 1 second stream wrapped buffer // setup 1 second stream wrapped buffer
int32 streamBufferSize = fadeTrack->iteration; int32 streamBufferSize = fadeTrack->iteration;

View file

@ -448,8 +448,8 @@ void ScummEngine::processKbd(bool smushMode) {
vol = runDialog(dlg); vol = runDialog(dlg);
vol *= 16; vol *= 16;
if (vol > SoundMixer::kMaxMixerVolume) if (vol > Audio::Mixer::kMaxMixerVolume)
vol = SoundMixer::kMaxMixerVolume; vol = Audio::Mixer::kMaxMixerVolume;
ConfMan.set("music_volume", vol); ConfMan.set("music_volume", vol);
setupVolumes(); setupVolumes();

View file

@ -91,7 +91,7 @@ void Player_MOD::startChannel(int id, void *data, int size, int rate, uint8 vol,
_channels[i].vol = vol; _channels[i].vol = vol;
_channels[i].pan = pan; _channels[i].pan = pan;
_channels[i].freq = rate; _channels[i].freq = rate;
_channels[i].input = makeLinearInputStream(rate, SoundMixer::FLAG_AUTOFREE | (loopStart != loopEnd ? SoundMixer::FLAG_LOOP : 0), (const byte*)data, size, loopStart, loopEnd - loopStart); _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].converter = makeRateConverter(rate, _mixer->getOutputRate(), false, false); _channels[i].converter = makeRateConverter(rate, _mixer->getOutputRate(), false, false);
} }

View file

@ -26,7 +26,6 @@
#include "scumm/scumm.h" #include "scumm/scumm.h"
#include "sound/audiostream.h" #include "sound/audiostream.h"
class AudioStream;
class RateConverter; class RateConverter;
namespace Scumm { namespace Scumm {
@ -74,7 +73,7 @@ private:
AudioStream *input; AudioStream *input;
}; };
SoundMixer *_mixer; Audio::Mixer *_mixer;
uint32 _mixamt; uint32 _mixamt;
uint32 _mixpos; uint32 _mixpos;

View file

@ -27,7 +27,9 @@
#include "scumm/music.h" #include "scumm/music.h"
#include "sound/audiostream.h" #include "sound/audiostream.h"
class SoundMixer; namespace Audio {
class Mixer;
}
namespace Scumm { namespace Scumm {
@ -69,7 +71,7 @@ private:
void do_mix(int16 *buf, uint len); void do_mix(int16 *buf, uint len);
ScummEngine *_vm; ScummEngine *_vm;
SoundMixer *_mixer; Audio::Mixer *_mixer;
int _sample_rate; int _sample_rate;
int _samples_per_frame; int _samples_per_frame;
int _current_sample; int _current_sample;

View file

@ -28,7 +28,9 @@
#include "scumm/music.h" #include "scumm/music.h"
#include "sound/audiostream.h" #include "sound/audiostream.h"
class SoundMixer; namespace Audio {
class Mixer;
}
namespace Scumm { namespace Scumm {
@ -96,7 +98,7 @@ public:
protected: protected:
bool _isV3Game; bool _isV3Game;
SoundMixer *_mixer; Audio::Mixer *_mixer;
ScummEngine *_vm; ScummEngine *_vm;
bool _pcjr; bool _pcjr;

View file

@ -27,7 +27,7 @@
#include "scumm/music.h" #include "scumm/music.h"
#include "scumm/player_mod.h" #include "scumm/player_mod.h"
class SoundMixer; class Mixer;
namespace Scumm { namespace Scumm {

View file

@ -27,7 +27,7 @@
#include "scumm/music.h" #include "scumm/music.h"
#include "scumm/player_mod.h" #include "scumm/player_mod.h"
class SoundMixer; class Mixer;
namespace Scumm { namespace Scumm {

View file

@ -1384,13 +1384,13 @@ void ScummEngine_v8::o8_kernelGetFunctions() {
} }
break; break;
case 0xDD: // getGroupSfxVol case 0xDD: // getGroupSfxVol
push(_mixer->getVolumeForSoundType(SoundMixer::kSFXSoundType) / 2); push(_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 2);
break; break;
case 0xDE: // getGroupVoiceVol case 0xDE: // getGroupVoiceVol
push(_mixer->getVolumeForSoundType(SoundMixer::kSpeechSoundType) / 2); push(_mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType) / 2);
break; break;
case 0xDF: // getGroupMusicVol case 0xDF: // getGroupMusicVol
push(_mixer->getVolumeForSoundType(SoundMixer::kMusicSoundType) / 2); push(_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 2);
break; break;
case 0xE0: // readRegistryValue case 0xE0: // readRegistryValue
{ {

View file

@ -1879,9 +1879,9 @@ void ScummEngine::setupVolumes() {
_musicEngine->setMusicVolume(soundVolumeMusic); _musicEngine->setMusicVolume(soundVolumeMusic);
} }
_mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, soundVolumeSfx); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSfx);
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, soundVolumeMusic); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic);
_mixer->setVolumeForSoundType(SoundMixer::kSpeechSoundType, soundVolumeSpeech); _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech);
} }

View file

@ -33,7 +33,7 @@
namespace Scumm { namespace Scumm {
SmushMixer::SmushMixer(SoundMixer *m) : SmushMixer::SmushMixer(Audio::Mixer *m) :
_mixer(m), _mixer(m),
_soundFrequency(22050) { _soundFrequency(22050) {
for (int32 i = 0; i < NUM_CHANNELS; i++) { for (int32 i = 0; i < NUM_CHANNELS; i++) {
@ -109,27 +109,27 @@ bool SmushMixer::handleFrame() {
_channels[i].chan->getParameters(rate, stereo, is_16bit, vol, pan); _channels[i].chan->getParameters(rate, stereo, is_16bit, vol, pan);
int32 size = _channels[i].chan->availableSoundData(); int32 size = _channels[i].chan->availableSoundData();
byte flags = stereo ? SoundMixer::FLAG_STEREO : 0; byte flags = stereo ? Audio::Mixer::FLAG_STEREO : 0;
if (is_16bit) { if (is_16bit) {
data = malloc(size * (stereo ? 2 : 1) * 4); data = malloc(size * (stereo ? 2 : 1) * 4);
_channels[i].chan->getSoundData((int16 *)data, size); _channels[i].chan->getSoundData((int16 *)data, size);
size *= stereo ? 4 : 2; size *= stereo ? 4 : 2;
flags |= SoundMixer::FLAG_16BITS; flags |= Audio::Mixer::FLAG_16BITS;
} else { } else {
data = malloc(size * (stereo ? 2 : 1) * 2); data = malloc(size * (stereo ? 2 : 1) * 2);
_channels[i].chan->getSoundData((int8 *)data, size); _channels[i].chan->getSoundData((int8 *)data, size);
size *= stereo ? 2 : 1; size *= stereo ? 2 : 1;
flags |= SoundMixer::FLAG_UNSIGNED; flags |= Audio::Mixer::FLAG_UNSIGNED;
} }
if (_mixer->isReady()) { if (_mixer->isReady()) {
if (!_channels[i].stream) { if (!_channels[i].stream) {
_channels[i].stream = makeAppendableAudioStream(rate, flags, 500000); _channels[i].stream = makeAppendableAudioStream(rate, flags, 500000);
_mixer->playInputStream(SoundMixer::kSFXSoundType, &_channels[i].handle, _channels[i].stream); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_channels[i].handle, _channels[i].stream);
} }
_mixer->setChannelVolume(_channels[i].handle, vol); _mixer->setChannelVolume(_channels[i].handle, vol);
_mixer->setChannelBalance(_channels[i].handle, pan); _mixer->setChannelBalance(_channels[i].handle, pan);

View file

@ -35,7 +35,7 @@ class SmushMixer {
}; };
private: private:
SoundMixer *_mixer; Audio::Mixer *_mixer;
struct channels { struct channels {
int id; int id;
SmushChannel *chan; SmushChannel *chan;
@ -49,7 +49,7 @@ private:
public: public:
SmushMixer(SoundMixer *); SmushMixer(Audio::Mixer *);
virtual ~SmushMixer(); virtual ~SmushMixer();
SmushChannel *findChannel(int32 track); SmushChannel *findChannel(int32 track);
void addChannel(SmushChannel *c); void addChannel(SmushChannel *c);

View file

@ -511,8 +511,8 @@ void SmushPlayer::handleIACT(Chunk &b) {
} while (--count); } while (--count);
if (!_IACTstream) { if (!_IACTstream) {
_IACTstream = makeAppendableAudioStream(22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 400000); _IACTstream = makeAppendableAudioStream(22050, Audio::Mixer::FLAG_STEREO | Audio::Mixer::FLAG_16BITS, 400000);
_vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_IACTchannel, _IACTstream); _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_IACTchannel, _IACTstream);
} }
_IACTstream->append(output_data, 0x1000); _IACTstream->append(output_data, 0x1000);
@ -1187,7 +1187,7 @@ void SmushPlayer::tryCmpFile(const char *filename) {
if (_compressedFile.isOpen()) { if (_compressedFile.isOpen()) {
int size = _compressedFile.size(); int size = _compressedFile.size();
_compressedFileMode = true; _compressedFileMode = true;
_vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_compressedFileSoundHandle, makeMP3Stream(&_compressedFile, size)); _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, makeMP3Stream(&_compressedFile, size));
return; return;
} }
#endif #endif
@ -1198,7 +1198,7 @@ void SmushPlayer::tryCmpFile(const char *filename) {
if (_compressedFile.isOpen()) { if (_compressedFile.isOpen()) {
int size = _compressedFile.size(); int size = _compressedFile.size();
_compressedFileMode = true; _compressedFileMode = true;
_vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size)); _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size));
return; return;
} }
#endif #endif

View file

@ -223,7 +223,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
char *sound; char *sound;
int size = -1; int size = -1;
int rate; int rate;
byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE; byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE;
if (heChannel == -1) { if (heChannel == -1) {
heChannel = 1; heChannel = 1;
@ -337,7 +337,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
if (heFlags & 1) { if (heFlags & 1) {
// TODO // TODO
// flags |= SoundMixer::FLAG_LOOP; // flags |= Audio::Mixer::FLAG_LOOP;
} }
// Allocate a sound buffer, copy the data into it, and play // Allocate a sound buffer, copy the data into it, and play
@ -353,7 +353,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
size = READ_BE_UINT32(ptr+4) - 8; size = READ_BE_UINT32(ptr+4) - 8;
rate = 22050; rate = 22050;
flags = SoundMixer::FLAG_AUTOFREE; flags = Audio::Mixer::FLAG_AUTOFREE;
// Allocate a sound buffer, copy the data into it, and play // Allocate a sound buffer, copy the data into it, and play
sound = (char *)malloc(size); sound = (char *)malloc(size);
@ -482,7 +482,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
size -= waveSize; size -= waveSize;
if (loopEnd > 0) if (loopEnd > 0)
flags |= SoundMixer::FLAG_LOOP; flags |= Audio::Mixer::FLAG_LOOP;
_vm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd); _vm->_mixer->playRaw(NULL, sound, waveSize, rate, flags, soundID, 255, 0, loopStart, loopEnd);
} }
@ -546,7 +546,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) {
sound = (char *)malloc(size); sound = (char *)malloc(size);
int vol = ptr[24] * 4; int vol = ptr[24] * 4;
memcpy(sound, ptr + READ_BE_UINT16(ptr + 8), size); memcpy(sound, ptr + READ_BE_UINT16(ptr + 8), size);
_vm->_mixer->playRaw(NULL, sound, size, rate, SoundMixer::FLAG_AUTOFREE, soundID, vol, 0); _vm->_mixer->playRaw(NULL, sound, size, rate, Audio::Mixer::FLAG_AUTOFREE, soundID, vol, 0);
} }
else { else {
@ -806,7 +806,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, SoundHandle *handl
//_vm->_imuseDigital->stopSound(kTalkSoundID); //_vm->_imuseDigital->stopSound(kTalkSoundID);
_vm->_imuseDigital->startVoice(kTalkSoundID, input); _vm->_imuseDigital->startVoice(kTalkSoundID, input);
} else { } else {
_vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, handle, input, id); _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, input, id);
} }
} }
} }
@ -1189,7 +1189,7 @@ ScummFile *Sound::openSfxFile() {
} }
bool Sound::isSfxFinished() const { bool Sound::isSfxFinished() const {
return !_vm->_mixer->hasActiveChannelOfType(SoundMixer::kSFXSoundType); return !_vm->_mixer->hasActiveChannelOfType(Audio::Mixer::kSFXSoundType);
} }
// We use a real timer in an attempt to get better sync with CD tracks. This is // We use a real timer in an attempt to get better sync with CD tracks. This is
@ -2436,10 +2436,10 @@ void AppendableMemoryStream<stereo, is16Bit, isUnsigned, isLE>::append(const byt
return new AppendableMemoryStream<STEREO, false, UNSIGNED, false>(rate, len) return new AppendableMemoryStream<STEREO, false, UNSIGNED, false>(rate, len)
AppendableAudioStream *makeAppendableAudioStream(int rate, byte _flags, uint32 len) { AppendableAudioStream *makeAppendableAudioStream(int rate, byte _flags, uint32 len) {
const bool isStereo = (_flags & SoundMixer::FLAG_STEREO) != 0; const bool isStereo = (_flags & Audio::Mixer::FLAG_STEREO) != 0;
const bool is16Bit = (_flags & SoundMixer::FLAG_16BITS) != 0; const bool is16Bit = (_flags & Audio::Mixer::FLAG_16BITS) != 0;
const bool isUnsigned = (_flags & SoundMixer::FLAG_UNSIGNED) != 0; const bool isUnsigned = (_flags & Audio::Mixer::FLAG_UNSIGNED) != 0;
const bool isLE = (_flags & SoundMixer::FLAG_LITTLE_ENDIAN) != 0; const bool isLE = (_flags & Audio::Mixer::FLAG_LITTLE_ENDIAN) != 0;
if (isStereo) { if (isStereo) {
if (isUnsigned) { if (isUnsigned) {

View file

@ -673,7 +673,7 @@ int SimonEngine::init(GameDetector &detector) {
warning("Sound initialization failed. " warning("Sound initialization failed. "
"Features of the game that depend on sound synchronization will most likely break"); "Features of the game that depend on sound synchronization will most likely break");
set_volume(ConfMan.getInt("sfx_volume")); set_volume(ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_system->beginGFXTransaction(); _system->beginGFXTransaction();
initCommonGFX(detector); initCommonGFX(detector);
@ -4254,7 +4254,7 @@ void SimonEngine::dx_unlock_attached() {
} }
void SimonEngine::set_volume(int volume) { void SimonEngine::set_volume(int volume) {
_mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, volume); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume);
} }
byte SimonEngine::getByte() { byte SimonEngine::getByte() {

View file

@ -40,35 +40,35 @@ class BaseSound {
protected: protected:
File *_file; File *_file;
uint32 *_offsets; uint32 *_offsets;
SoundMixer *_mixer; Audio::Mixer *_mixer;
bool _freeOffsets; bool _freeOffsets;
public: public:
BaseSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false); BaseSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false);
BaseSound(SoundMixer *mixer, File *file, uint32 *offsets, bool bigendian = false); BaseSound(Audio::Mixer *mixer, File *file, uint32 *offsets, bool bigendian = false);
virtual ~BaseSound(); virtual ~BaseSound();
virtual void playSound(uint sound, SoundHandle *handle, byte flags) = 0; virtual void playSound(uint sound, SoundHandle *handle, byte flags) = 0;
}; };
class WavSound : public BaseSound { class WavSound : public BaseSound {
public: public:
WavSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {}; WavSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
WavSound(SoundMixer *mixer, File *file, uint32 *offsets) : BaseSound(mixer, file, offsets) {}; WavSound(Audio::Mixer *mixer, File *file, uint32 *offsets) : BaseSound(mixer, file, offsets) {};
void playSound(uint sound, SoundHandle *handle, byte flags); void playSound(uint sound, SoundHandle *handle, byte flags);
}; };
class VocSound : public BaseSound { class VocSound : public BaseSound {
public: public:
VocSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {}; VocSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
void playSound(uint sound, SoundHandle *handle, byte flags); void playSound(uint sound, SoundHandle *handle, byte flags);
}; };
class RawSound : public BaseSound { class RawSound : public BaseSound {
public: public:
RawSound(SoundMixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {}; RawSound(Audio::Mixer *mixer, File *file, uint32 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {};
void playSound(uint sound, SoundHandle *handle, byte flags); void playSound(uint sound, SoundHandle *handle, byte flags);
}; };
BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 base, bool bigendian) { BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 base, bool bigendian) {
_mixer = mixer; _mixer = mixer;
_file = file; _file = file;
@ -106,7 +106,7 @@ BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 base, bool bigendian)
_offsets[res] = _file->pos(); _offsets[res] = _file->pos();
} }
BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 *offsets, bool bigendian) { BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 *offsets, bool bigendian) {
_mixer = mixer; _mixer = mixer;
_file = file; _file = file;
_offsets = offsets; _offsets = offsets;
@ -131,7 +131,7 @@ void WavSound::playSound(uint sound, SoundHandle *handle, byte flags) {
error("playWav(%d): can't read WAVE header", sound); error("playWav(%d): can't read WAVE header", sound);
} }
_mixer->playInputStream(SoundMixer::kSFXSoundType, handle, stream); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream);
} }
void VocSound::playSound(uint sound, SoundHandle *handle, byte flags) { void VocSound::playSound(uint sound, SoundHandle *handle, byte flags) {
@ -143,7 +143,7 @@ void VocSound::playSound(uint sound, SoundHandle *handle, byte flags) {
int size, samples_per_sec; int size, samples_per_sec;
byte *buffer = loadVOCFromStream(*_file, size, samples_per_sec); byte *buffer = loadVOCFromStream(*_file, size, samples_per_sec);
_mixer->playRaw(handle, buffer, size, samples_per_sec, flags | SoundMixer::FLAG_AUTOFREE); _mixer->playRaw(handle, buffer, size, samples_per_sec, flags | Audio::Mixer::FLAG_AUTOFREE);
} }
void RawSound::playSound(uint sound, SoundHandle *handle, byte flags) { void RawSound::playSound(uint sound, SoundHandle *handle, byte flags) {
@ -156,13 +156,13 @@ void RawSound::playSound(uint sound, SoundHandle *handle, byte flags) {
byte *buffer = (byte *)malloc(size); byte *buffer = (byte *)malloc(size);
_file->read(buffer, size); _file->read(buffer, size);
_mixer->playRaw(handle, buffer, size, 22050, flags | SoundMixer::FLAG_AUTOFREE); _mixer->playRaw(handle, buffer, size, 22050, flags | Audio::Mixer::FLAG_AUTOFREE);
} }
#ifdef USE_MAD #ifdef USE_MAD
class MP3Sound : public BaseSound { class MP3Sound : public BaseSound {
public: public:
MP3Sound(SoundMixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {}; MP3Sound(Audio::Mixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
void playSound(uint sound, SoundHandle *handle, byte flags); void playSound(uint sound, SoundHandle *handle, byte flags);
}; };
@ -179,14 +179,14 @@ void MP3Sound::playSound(uint sound, SoundHandle *handle, byte flags)
uint32 size = _offsets[sound + i] - _offsets[sound]; uint32 size = _offsets[sound + i] - _offsets[sound];
_mixer->playInputStream(SoundMixer::kSFXSoundType, handle, makeMP3Stream(_file, size)); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeMP3Stream(_file, size));
} }
#endif #endif
#ifdef USE_VORBIS #ifdef USE_VORBIS
class VorbisSound : public BaseSound { class VorbisSound : public BaseSound {
public: public:
VorbisSound(SoundMixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {}; VorbisSound(Audio::Mixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
void playSound(uint sound, SoundHandle *handle, byte flags); void playSound(uint sound, SoundHandle *handle, byte flags);
}; };
@ -203,14 +203,14 @@ void VorbisSound::playSound(uint sound, SoundHandle *handle, byte flags)
uint32 size = _offsets[sound + i] - _offsets[sound]; uint32 size = _offsets[sound + i] - _offsets[sound];
_mixer->playInputStream(SoundMixer::kSFXSoundType, handle, makeVorbisStream(_file, size)); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeVorbisStream(_file, size));
} }
#endif #endif
#ifdef USE_FLAC #ifdef USE_FLAC
class FlacSound : public BaseSound { class FlacSound : public BaseSound {
public: public:
FlacSound(SoundMixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {}; FlacSound(Audio::Mixer *mixer, File *file, uint32 base = 0) : BaseSound(mixer, file, base) {};
void playSound(uint sound, SoundHandle *handle, byte flags); void playSound(uint sound, SoundHandle *handle, byte flags);
}; };
@ -227,11 +227,11 @@ void FlacSound::playSound(uint sound, SoundHandle *handle, byte flags)
uint32 size = _offsets[sound + i] - _offsets[sound]; uint32 size = _offsets[sound + i] - _offsets[sound];
_mixer->playInputStream(SoundMixer::kSFXSoundType, handle, makeFlacStream(_file, size)); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeFlacStream(_file, size));
} }
#endif #endif
Sound::Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer) Sound::Sound(const byte game, const GameSpecificSettings *gss, Audio::Mixer *mixer)
: _game(game), _mixer(mixer) { : _game(game), _mixer(mixer) {
_voice = 0; _voice = 0;
_effects = 0; _effects = 0;
@ -444,7 +444,7 @@ void Sound::playVoice(uint sound) {
return; return;
_mixer->stopHandle(_voiceHandle); _mixer->stopHandle(_voiceHandle);
_voice->playSound(sound, &_voiceHandle, (_game == GAME_SIMON1CD32) ? 0 : SoundMixer::FLAG_UNSIGNED); _voice->playSound(sound, &_voiceHandle, (_game == GAME_SIMON1CD32) ? 0 : Audio::Mixer::FLAG_UNSIGNED);
} }
void Sound::playEffects(uint sound) { void Sound::playEffects(uint sound) {
@ -454,7 +454,7 @@ void Sound::playEffects(uint sound) {
if (_effectsPaused) if (_effectsPaused)
return; return;
_effects->playSound(sound, &_effectsHandle, (_game == GAME_SIMON1CD32) ? 0 : SoundMixer::FLAG_UNSIGNED); _effects->playSound(sound, &_effectsHandle, (_game == GAME_SIMON1CD32) ? 0 : Audio::Mixer::FLAG_UNSIGNED);
} }
void Sound::playAmbient(uint sound) { void Sound::playAmbient(uint sound) {
@ -470,7 +470,7 @@ void Sound::playAmbient(uint sound) {
return; return;
_mixer->stopHandle(_ambientHandle); _mixer->stopHandle(_ambientHandle);
_effects->playSound(sound, &_ambientHandle, SoundMixer::FLAG_LOOP|SoundMixer::FLAG_UNSIGNED); _effects->playSound(sound, &_ambientHandle, Audio::Mixer::FLAG_LOOP|Audio::Mixer::FLAG_UNSIGNED);
} }
bool Sound::hasVoice() const { bool Sound::hasVoice() const {

View file

@ -32,7 +32,7 @@ class Sound {
private: private:
byte _game; byte _game;
SoundMixer *_mixer; Audio::Mixer *_mixer;
BaseSound *_voice; BaseSound *_voice;
BaseSound *_effects; BaseSound *_effects;
@ -53,7 +53,7 @@ private:
uint _ambientPlaying; uint _ambientPlaying;
public: public:
Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer); Sound(const byte game, const GameSpecificSettings *gss, Audio::Mixer *mixer);
~Sound(); ~Sound();
void readSfxFile(const char *filename); void readSfxFile(const char *filename);

View file

@ -618,7 +618,7 @@ uint16 Intro::_floppyIntroSeq[] = {
SEQEND SEQEND
}; };
Intro::Intro(Disk *disk, Screen *screen, MusicBase *music, Sound *sound, Text *text, SoundMixer *mixer, OSystem *system) { Intro::Intro(Disk *disk, Screen *screen, MusicBase *music, Sound *sound, Text *text, Audio::Mixer *mixer, OSystem *system) {
_skyDisk = disk; _skyDisk = disk;
_skyScreen = screen; _skyScreen = screen;
@ -739,7 +739,7 @@ bool Intro::nextPart(uint16 *&data) {
// directly, but this will have to do for now. // directly, but this will have to do for now.
memset(vData, 127, sizeof(struct dataFileHeader)); memset(vData, 127, sizeof(struct dataFileHeader));
_mixer->playRaw(&_voice, vData, _skyDisk->_lastLoadedFileSize, 11025, _mixer->playRaw(&_voice, vData, _skyDisk->_lastLoadedFileSize, 11025,
SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, SOUND_VOICE); Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, SOUND_VOICE);
return true; return true;
case WAITVOICE: case WAITVOICE:
while (_mixer->isSoundHandleActive(_voice)) while (_mixer->isSoundHandleActive(_voice))
@ -756,12 +756,12 @@ bool Intro::nextPart(uint16 *&data) {
case LOOPBG: case LOOPBG:
_mixer->stopID(SOUND_BG); _mixer->stopID(SOUND_BG);
_mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025, _mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025,
SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_LOOP, SOUND_BG); Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LOOP, SOUND_BG);
return true; return true;
case PLAYBG: case PLAYBG:
_mixer->stopID(SOUND_BG); _mixer->stopID(SOUND_BG);
_mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025, _mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025,
SoundMixer::FLAG_UNSIGNED, SOUND_BG); Audio::Mixer::FLAG_UNSIGNED, SOUND_BG);
return true; return true;
case STOPBG: case STOPBG:
_mixer->stopID(SOUND_BG); _mixer->stopID(SOUND_BG);

View file

@ -36,7 +36,7 @@ class Text;
class Intro { class Intro {
public: public:
Intro(Disk *disk, Screen *screen, MusicBase *music, Sound *sound, Text *text, SoundMixer *mixer, OSystem *system); Intro(Disk *disk, Screen *screen, MusicBase *music, Sound *sound, Text *text, Audio::Mixer *mixer, OSystem *system);
~Intro(void); ~Intro(void);
bool doIntro(bool floppyIntro); bool doIntro(bool floppyIntro);
bool _quitProg; bool _quitProg;
@ -51,7 +51,7 @@ private:
Sound *_skySound; Sound *_skySound;
Text *_skyText; Text *_skyText;
OSystem *_system; OSystem *_system;
SoundMixer *_mixer; Audio::Mixer *_mixer;
uint8 *_textBuf, *_saveBuf; uint8 *_textBuf, *_saveBuf;
uint8 *_bgBuf; uint8 *_bgBuf;

View file

@ -26,7 +26,7 @@
namespace Sky { namespace Sky {
AdlibMusic::AdlibMusic(SoundMixer *pMixer, Disk *pDisk) AdlibMusic::AdlibMusic(Audio::Mixer *pMixer, Disk *pDisk)
: MusicBase(pDisk) { : MusicBase(pDisk) {
_driverFileBase = 60202; _driverFileBase = 60202;

View file

@ -26,13 +26,15 @@
#include "sound/audiostream.h" #include "sound/audiostream.h"
#include "sound/fmopl.h" #include "sound/fmopl.h"
class SoundMixer; namespace Audio {
class Mixer;
}
namespace Sky { namespace Sky {
class AdlibMusic : public AudioStream, public MusicBase { class AdlibMusic : public AudioStream, public MusicBase {
public: public:
AdlibMusic(SoundMixer *pMixer, Disk *pDisk); AdlibMusic(Audio::Mixer *pMixer, Disk *pDisk);
~AdlibMusic(void); ~AdlibMusic(void);
virtual void setVolume(uint8 volume); virtual void setVolume(uint8 volume);
@ -47,7 +49,7 @@ public:
private: private:
FM_OPL *_opl; FM_OPL *_opl;
SoundMixer *_mixer; Audio::Mixer *_mixer;
uint8 *_initSequence; uint8 *_initSequence;
uint32 _sampleRate, _nextMusicPoll; uint32 _sampleRate, _nextMusicPoll;
virtual void setupPointers(void); virtual void setupPointers(void);

View file

@ -283,8 +283,8 @@ int SkyEngine::init(GameDetector &detector) {
if (!_mixer->isReady()) if (!_mixer->isReady())
warning("Sound initialisation failed"); warning("Sound initialisation failed");
_mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_floppyIntro = ConfMan.getBool("alt_intro"); _floppyIntro = ConfMan.getBool("alt_intro");
_skyDisk = new Disk(_gameDataPath); _skyDisk = new Disk(_gameDataPath);

View file

@ -1017,7 +1017,7 @@ SfxQueue Sound::_sfxQueue[MAX_QUEUED_FX] = {
{ 0, 0, 0, 0} { 0, 0, 0, 0}
}; };
Sound::Sound(SoundMixer *mixer, Disk *pDisk, uint8 pVolume) { Sound::Sound(Audio::Mixer *mixer, Disk *pDisk, uint8 pVolume) {
_skyDisk = pDisk; _skyDisk = pDisk;
_soundData = NULL; _soundData = NULL;
_mixer = mixer; _mixer = mixer;
@ -1034,7 +1034,7 @@ Sound::~Sound(void) {
void Sound::playSound(uint32 id, byte *sound, uint32 size, SoundHandle *handle) { void Sound::playSound(uint32 id, byte *sound, uint32 size, SoundHandle *handle) {
byte flags = 0; byte flags = 0;
flags |= SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE; flags |= Audio::Mixer::FLAG_UNSIGNED|Audio::Mixer::FLAG_AUTOFREE;
size -= sizeof(struct dataFileHeader); size -= sizeof(struct dataFileHeader);
byte *buffer = (byte *)malloc(size); byte *buffer = (byte *)malloc(size);
memcpy(buffer, sound+sizeof(struct dataFileHeader), size); memcpy(buffer, sound+sizeof(struct dataFileHeader), size);
@ -1105,13 +1105,13 @@ void Sound::playSound(uint16 sound, uint16 volume, uint8 channel) {
uint16 dataSize = (_sfxInfo[(sound << 3) | 2] << 8) | _sfxInfo[(sound << 3) | 3]; uint16 dataSize = (_sfxInfo[(sound << 3) | 2] << 8) | _sfxInfo[(sound << 3) | 3];
uint16 dataLoop = (_sfxInfo[(sound << 3) | 6] << 8) | _sfxInfo[(sound << 3) | 7]; uint16 dataLoop = (_sfxInfo[(sound << 3) | 6] << 8) | _sfxInfo[(sound << 3) | 7];
byte flags = SoundMixer::FLAG_UNSIGNED; byte flags = Audio::Mixer::FLAG_UNSIGNED;
uint32 loopSta = 0, loopEnd = 0; uint32 loopSta = 0, loopEnd = 0;
if (dataLoop) { if (dataLoop) {
loopSta = dataSize - dataLoop; loopSta = dataSize - dataLoop;
loopEnd = dataSize; loopEnd = dataSize;
flags |= SoundMixer::FLAG_LOOP; flags |= Audio::Mixer::FLAG_LOOP;
} }
if (channel == 0) if (channel == 0)
@ -1242,7 +1242,7 @@ bool Sound::startSpeech(uint16 textNum) {
rate = 11025; rate = 11025;
_mixer->stopID(SOUND_SPEECH); _mixer->stopID(SOUND_SPEECH);
_mixer->playRaw(&_ingameSpeech, playBuffer, speechSize, rate, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, SOUND_SPEECH); _mixer->playRaw(&_ingameSpeech, playBuffer, speechSize, rate, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE, SOUND_SPEECH);
return true; return true;
} }

View file

@ -49,7 +49,7 @@ protected:
public: public:
SoundMixer *_mixer; Audio::Mixer *_mixer;
SoundHandle _voiceHandle; SoundHandle _voiceHandle;
SoundHandle _effectHandle; SoundHandle _effectHandle;
SoundHandle _bgSoundHandle; SoundHandle _bgSoundHandle;
@ -62,7 +62,7 @@ protected:
void playSound(uint32 id, byte *sound, uint32 size, SoundHandle *handle); void playSound(uint32 id, byte *sound, uint32 size, SoundHandle *handle);
public: public:
Sound(SoundMixer *mixer, Disk *pDisk, uint8 pVolume); Sound(Audio::Mixer *mixer, Disk *pDisk, uint8 pVolume);
~Sound(void); ~Sound(void);
void loadSection(uint8 pSection); void loadSection(uint8 pSection);

View file

@ -30,7 +30,7 @@
class DigitalTrackInfo { class DigitalTrackInfo {
public: public:
virtual bool error() = 0; virtual bool error() = 0;
virtual void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) = 0; virtual void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) = 0;
virtual ~DigitalTrackInfo() { } virtual ~DigitalTrackInfo() { }
}; };

View file

@ -186,11 +186,11 @@ int LinearMemoryStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buf
return new LinearMemoryStream<STEREO, false, UNSIGNED, false>(rate, ptr, len, loopOffset, loopLen, autoFree) return new LinearMemoryStream<STEREO, false, UNSIGNED, false>(rate, ptr, len, loopOffset, loopLen, autoFree)
AudioStream *makeLinearInputStream(int rate, byte flags, const byte *ptr, uint32 len, uint loopOffset, uint loopLen) { AudioStream *makeLinearInputStream(int rate, byte flags, const byte *ptr, uint32 len, uint loopOffset, uint loopLen) {
const bool isStereo = (flags & SoundMixer::FLAG_STEREO) != 0; const bool isStereo = (flags & Audio::Mixer::FLAG_STEREO) != 0;
const bool is16Bit = (flags & SoundMixer::FLAG_16BITS) != 0; const bool is16Bit = (flags & Audio::Mixer::FLAG_16BITS) != 0;
const bool isUnsigned = (flags & SoundMixer::FLAG_UNSIGNED) != 0; const bool isUnsigned = (flags & Audio::Mixer::FLAG_UNSIGNED) != 0;
const bool isLE = (flags & SoundMixer::FLAG_LITTLE_ENDIAN) != 0; const bool isLE = (flags & Audio::Mixer::FLAG_LITTLE_ENDIAN) != 0;
const bool autoFree = (flags & SoundMixer::FLAG_AUTOFREE) != 0; const bool autoFree = (flags & Audio::Mixer::FLAG_AUTOFREE) != 0;
if (isStereo) { if (isStereo) {
if (isUnsigned) { if (isUnsigned) {

View file

@ -750,7 +750,7 @@ public:
FlacTrackInfo(File *file); FlacTrackInfo(File *file);
~FlacTrackInfo(); ~FlacTrackInfo();
bool error() { return _file == NULL; } bool error() { return _file == NULL; }
void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration); void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration);
}; };
FlacTrackInfo::FlacTrackInfo(File *file) : _file(NULL), _firstStream(NULL) FlacTrackInfo::FlacTrackInfo(File *file) : _file(NULL), _firstStream(NULL)
@ -764,7 +764,7 @@ FlacTrackInfo::FlacTrackInfo(File *file) : _file(NULL), _firstStream(NULL)
delete tempStream; delete tempStream;
} }
void FlacTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) { void FlacTrackInfo::play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) {
if (error()) { if (error()) {
debug(1, "FlacTrackInfo::play: invalid state, method should not been called"); debug(1, "FlacTrackInfo::play: invalid state, method should not been called");
} }
@ -787,7 +787,7 @@ void FlacTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame,
flac->setLastSample(0); flac->setLastSample(0);
if (flac->seekAbsolute(static_cast<FLAC__uint64>(startFrame) * (info.sample_rate / 75))) { if (flac->seekAbsolute(static_cast<FLAC__uint64>(startFrame) * (info.sample_rate / 75))) {
mixer->playInputStream(SoundMixer::kMusicSoundType, handle, flac); mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, flac);
return; return;
} }
// startSample is beyond the existing Samples // startSample is beyond the existing Samples

View file

@ -27,7 +27,9 @@
#include "common/timer.h" #include "common/timer.h"
class MidiChannel; class MidiChannel;
class SoundMixer; namespace Audio {
class Mixer;
}
namespace Common { class String; } namespace Common { class String; }
/** MIDI Driver Types */ /** MIDI Driver Types */
@ -190,19 +192,19 @@ public:
// Factory functions, for faster compile // Factory functions, for faster compile
extern MidiDriver *MidiDriver_NULL_create(); extern MidiDriver *MidiDriver_NULL_create();
extern MidiDriver *MidiDriver_ADLIB_create(SoundMixer *mixer); extern MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer);
extern MidiDriver *MidiDriver_WIN_create(); extern MidiDriver *MidiDriver_WIN_create();
extern MidiDriver *MidiDriver_SEQ_create(); extern MidiDriver *MidiDriver_SEQ_create();
extern MidiDriver *MidiDriver_QT_create(); extern MidiDriver *MidiDriver_QT_create();
extern MidiDriver *MidiDriver_CORE_create(); extern MidiDriver *MidiDriver_CORE_create();
extern MidiDriver *MidiDriver_ETUDE_create(); extern MidiDriver *MidiDriver_ETUDE_create();
extern MidiDriver *MidiDriver_ALSA_create(); extern MidiDriver *MidiDriver_ALSA_create();
extern MidiDriver *MidiDriver_YM2612_create(SoundMixer *mixer); extern MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer);
#ifdef USE_FLUIDSYNTH #ifdef USE_FLUIDSYNTH
extern MidiDriver *MidiDriver_FluidSynth_create(SoundMixer *mixer); extern MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer);
#endif #endif
#ifdef USE_MT32EMU #ifdef USE_MT32EMU
extern MidiDriver *MidiDriver_MT32_create(SoundMixer *mixer); extern MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer);
#endif #endif
extern MidiDriver *MidiDriver_YamahaPa1_create(); extern MidiDriver *MidiDriver_YamahaPa1_create();
extern MidiDriver *MidiDriver_Zodiac_create(); extern MidiDriver *MidiDriver_Zodiac_create();

View file

@ -34,6 +34,8 @@
#include "sound/vorbis.h" #include "sound/vorbis.h"
namespace Audio {
#pragma mark - #pragma mark -
#pragma mark --- Channel classes --- #pragma mark --- Channel classes ---
#pragma mark - #pragma mark -
@ -44,10 +46,10 @@
*/ */
class Channel { class Channel {
public: public:
const SoundMixer::SoundType _type; const Mixer::SoundType _type;
SoundHandle _handle; SoundHandle _handle;
private: private:
SoundMixer *_mixer; Mixer *_mixer;
bool _autofreeStream; bool _autofreeStream;
bool _permanent; bool _permanent;
byte _volume; byte _volume;
@ -64,8 +66,8 @@ protected:
public: public:
Channel(SoundMixer *mixer, SoundMixer::SoundType type, int id = -1); Channel(Mixer *mixer, Mixer::SoundType type, int id = -1);
Channel(SoundMixer *mixer, SoundMixer::SoundType type, AudioStream *input, bool autofreeStream, bool reverseStereo = false, int id = -1, bool permanent = false); Channel(Mixer *mixer, Mixer::SoundType type, AudioStream *input, bool autofreeStream, bool reverseStereo = false, int id = -1, bool permanent = false);
virtual ~Channel(); virtual ~Channel();
void mix(int16 *data, uint len); void mix(int16 *data, uint len);
@ -96,11 +98,11 @@ public:
#pragma mark - #pragma mark -
#pragma mark --- SoundMixer --- #pragma mark --- Mixer ---
#pragma mark - #pragma mark -
SoundMixer::SoundMixer() { Mixer::Mixer() {
_syst = &OSystem::instance(); _syst = &OSystem::instance();
_handleSeed = 0; _handleSeed = 0;
@ -125,7 +127,7 @@ SoundMixer::SoundMixer() {
debug(1, "Output sample rate: %d Hz", _outputRate); debug(1, "Output sample rate: %d Hz", _outputRate);
} }
SoundMixer::~SoundMixer() { Mixer::~Mixer() {
_syst->clearSoundCallback(); _syst->clearSoundCallback();
stopAll(true); stopAll(true);
@ -133,11 +135,11 @@ SoundMixer::~SoundMixer() {
_premixChannel = 0; _premixChannel = 0;
} }
bool SoundMixer::isPaused() { bool Mixer::isPaused() {
return _paused; return _paused;
} }
void SoundMixer::setupPremix(AudioStream *stream, SoundType type) { void Mixer::setupPremix(AudioStream *stream, SoundType type) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
delete _premixChannel; delete _premixChannel;
@ -150,7 +152,7 @@ void SoundMixer::setupPremix(AudioStream *stream, SoundType type) {
_premixChannel = new Channel(this, type, stream, false); _premixChannel = new Channel(this, type, stream, false);
} }
void SoundMixer::insertChannel(SoundHandle *handle, Channel *chan) { void Mixer::insertChannel(SoundHandle *handle, Channel *chan) {
int index = -1; int index = -1;
for (int i = 0; i != NUM_CHANNELS; i++) { for (int i = 0; i != NUM_CHANNELS; i++) {
@ -160,7 +162,7 @@ void SoundMixer::insertChannel(SoundHandle *handle, Channel *chan) {
} }
} }
if (index == -1) { if (index == -1) {
warning("SoundMixer::out of mixer slots"); warning("Mixer::out of mixer slots");
delete chan; delete chan;
return; return;
} }
@ -173,7 +175,7 @@ void SoundMixer::insertChannel(SoundHandle *handle, Channel *chan) {
} }
} }
void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, void Mixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rate, byte flags,
int id, byte volume, int8 balance, uint32 loopStart, uint32 loopEnd, SoundType type) { int id, byte volume, int8 balance, uint32 loopStart, uint32 loopEnd, SoundType type) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
@ -181,7 +183,7 @@ void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rat
if (id != -1) { if (id != -1) {
for (int i = 0; i != NUM_CHANNELS; i++) for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] != 0 && _channels[i]->getId() == id) { if (_channels[i] != 0 && _channels[i]->getId() == id) {
if ((flags & SoundMixer::FLAG_AUTOFREE) != 0) if ((flags & Mixer::FLAG_AUTOFREE) != 0)
free(sound); free(sound);
return; return;
} }
@ -189,7 +191,7 @@ void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rat
// Create the input stream // Create the input stream
AudioStream *input; AudioStream *input;
if (flags & SoundMixer::FLAG_LOOP) { if (flags & Mixer::FLAG_LOOP) {
if (loopEnd == 0) { if (loopEnd == 0) {
input = makeLinearInputStream(rate, flags, (byte *)sound, size, 0, size); input = makeLinearInputStream(rate, flags, (byte *)sound, size, 0, size);
} else { } else {
@ -201,13 +203,13 @@ void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rat
} }
// Create the channel // Create the channel
Channel *chan = new Channel(this, type, input, true, (flags & SoundMixer::FLAG_REVERSE_STEREO) != 0, id); Channel *chan = new Channel(this, type, input, true, (flags & Mixer::FLAG_REVERSE_STEREO) != 0, id);
chan->setVolume(volume); chan->setVolume(volume);
chan->setBalance(balance); chan->setBalance(balance);
insertChannel(handle, chan); insertChannel(handle, chan);
} }
void SoundMixer::playInputStream(SoundType type, SoundHandle *handle, AudioStream *input, void Mixer::playInputStream(SoundType type, SoundHandle *handle, AudioStream *input,
int id, byte volume, int8 balance, bool autofreeStream, bool permanent) { int id, byte volume, int8 balance, bool autofreeStream, bool permanent) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
@ -233,7 +235,7 @@ void SoundMixer::playInputStream(SoundType type, SoundHandle *handle, AudioStrea
insertChannel(handle, chan); insertChannel(handle, chan);
} }
void SoundMixer::mix(int16 *buf, uint len) { void Mixer::mix(int16 *buf, uint len) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
// zero the buf // zero the buf
@ -255,15 +257,15 @@ void SoundMixer::mix(int16 *buf, uint len) {
} }
} }
void SoundMixer::mixCallback(void *s, byte *samples, int len) { void Mixer::mixCallback(void *s, byte *samples, int len) {
assert(s); assert(s);
assert(samples); assert(samples);
// Len is the number of bytes in the buffer; we divide it by // Len is the number of bytes in the buffer; we divide it by
// four to get the number of samples (stereo 16 bit). // four to get the number of samples (stereo 16 bit).
((SoundMixer *)s)->mix((int16 *)samples, len >> 2); ((Mixer *)s)->mix((int16 *)samples, len >> 2);
} }
void SoundMixer::stopAll(bool force) { void Mixer::stopAll(bool force) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++) for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] != 0) { if (_channels[i] != 0) {
@ -274,7 +276,7 @@ void SoundMixer::stopAll(bool force) {
} }
} }
void SoundMixer::stopID(int id) { void Mixer::stopID(int id) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++) { for (int i = 0; i != NUM_CHANNELS; i++) {
if (_channels[i] != 0 && _channels[i]->getId() == id) { if (_channels[i] != 0 && _channels[i]->getId() == id) {
@ -284,7 +286,7 @@ void SoundMixer::stopID(int id) {
} }
} }
void SoundMixer::stopHandle(SoundHandle handle) { void Mixer::stopHandle(SoundHandle handle) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
// Simply ignore stop requests for handles of sounds that already terminated // Simply ignore stop requests for handles of sounds that already terminated
@ -296,7 +298,7 @@ void SoundMixer::stopHandle(SoundHandle handle) {
_channels[index] = 0; _channels[index] = 0;
} }
void SoundMixer::setChannelVolume(SoundHandle handle, byte volume) { void Mixer::setChannelVolume(SoundHandle handle, byte volume) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
const int index = handle._val % NUM_CHANNELS; const int index = handle._val % NUM_CHANNELS;
@ -306,7 +308,7 @@ void SoundMixer::setChannelVolume(SoundHandle handle, byte volume) {
_channels[index]->setVolume(volume); _channels[index]->setVolume(volume);
} }
void SoundMixer::setChannelBalance(SoundHandle handle, int8 balance) { void Mixer::setChannelBalance(SoundHandle handle, int8 balance) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
const int index = handle._val % NUM_CHANNELS; const int index = handle._val % NUM_CHANNELS;
@ -316,7 +318,7 @@ void SoundMixer::setChannelBalance(SoundHandle handle, int8 balance) {
_channels[index]->setBalance(balance); _channels[index]->setBalance(balance);
} }
uint32 SoundMixer::getSoundElapsedTimeOfSoundID(int id) { uint32 Mixer::getSoundElapsedTimeOfSoundID(int id) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++) for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] && _channels[i]->getId() == id) if (_channels[i] && _channels[i]->getId() == id)
@ -324,7 +326,7 @@ uint32 SoundMixer::getSoundElapsedTimeOfSoundID(int id) {
return 0; return 0;
} }
uint32 SoundMixer::getSoundElapsedTime(SoundHandle handle) { uint32 Mixer::getSoundElapsedTime(SoundHandle handle) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
const int index = handle._val % NUM_CHANNELS; const int index = handle._val % NUM_CHANNELS;
@ -334,11 +336,11 @@ uint32 SoundMixer::getSoundElapsedTime(SoundHandle handle) {
return _channels[index]->getElapsedTime(); return _channels[index]->getElapsedTime();
} }
void SoundMixer::pauseAll(bool paused) { void Mixer::pauseAll(bool paused) {
_paused = paused; _paused = paused;
} }
void SoundMixer::pauseID(int id, bool paused) { void Mixer::pauseID(int id, bool paused) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++) { for (int i = 0; i != NUM_CHANNELS; i++) {
if (_channels[i] != 0 && _channels[i]->getId() == id) { if (_channels[i] != 0 && _channels[i]->getId() == id) {
@ -348,7 +350,7 @@ void SoundMixer::pauseID(int id, bool paused) {
} }
} }
void SoundMixer::pauseHandle(SoundHandle handle, bool paused) { void Mixer::pauseHandle(SoundHandle handle, bool paused) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
// Simply ignore pause/unpause requests for handles of sound that alreayd terminated // Simply ignore pause/unpause requests for handles of sound that alreayd terminated
@ -359,7 +361,7 @@ void SoundMixer::pauseHandle(SoundHandle handle, bool paused) {
_channels[index]->pause(paused); _channels[index]->pause(paused);
} }
bool SoundMixer::isSoundIDActive(int id) { bool Mixer::isSoundIDActive(int id) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++) for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] && _channels[i]->getId() == id) if (_channels[i] && _channels[i]->getId() == id)
@ -367,7 +369,7 @@ bool SoundMixer::isSoundIDActive(int id) {
return false; return false;
} }
int SoundMixer::getSoundID(SoundHandle handle) { int Mixer::getSoundID(SoundHandle handle) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
const int index = handle._val % NUM_CHANNELS; const int index = handle._val % NUM_CHANNELS;
if (_channels[index] && _channels[index]->_handle._val == handle._val) if (_channels[index] && _channels[index]->_handle._val == handle._val)
@ -375,13 +377,13 @@ int SoundMixer::getSoundID(SoundHandle handle) {
return 0; return 0;
} }
bool SoundMixer::isSoundHandleActive(SoundHandle handle) { bool Mixer::isSoundHandleActive(SoundHandle handle) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
const int index = handle._val % NUM_CHANNELS; const int index = handle._val % NUM_CHANNELS;
return _channels[index] && _channels[index]->_handle._val == handle._val; return _channels[index] && _channels[index]->_handle._val == handle._val;
} }
bool SoundMixer::hasActiveChannelOfType(SoundType type) { bool Mixer::hasActiveChannelOfType(SoundType type) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++) for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] && _channels[i]->_type == type) if (_channels[i] && _channels[i]->_type == type)
@ -389,7 +391,7 @@ bool SoundMixer::hasActiveChannelOfType(SoundType type) {
return false; return false;
} }
void SoundMixer::setVolumeForSoundType(SoundType type, int volume) { void Mixer::setVolumeForSoundType(SoundType type, int volume) {
assert(0 <= type && type < ARRAYSIZE(_volumeForSoundType)); assert(0 <= type && type < ARRAYSIZE(_volumeForSoundType));
// Check range // Check range
@ -404,7 +406,7 @@ void SoundMixer::setVolumeForSoundType(SoundType type, int volume) {
_volumeForSoundType[type] = volume; _volumeForSoundType[type] = volume;
} }
int SoundMixer::getVolumeForSoundType(SoundType type) const { int Mixer::getVolumeForSoundType(SoundType type) const {
assert(0 <= type && type < ARRAYSIZE(_volumeForSoundType)); assert(0 <= type && type < ARRAYSIZE(_volumeForSoundType));
return _volumeForSoundType[type]; return _volumeForSoundType[type];
@ -416,17 +418,17 @@ int SoundMixer::getVolumeForSoundType(SoundType type) const {
#pragma mark - #pragma mark -
Channel::Channel(SoundMixer *mixer, SoundMixer::SoundType type, int id) Channel::Channel(Mixer *mixer, Mixer::SoundType type, int id)
: _type(type), _mixer(mixer), _autofreeStream(true), : _type(type), _mixer(mixer), _autofreeStream(true),
_volume(SoundMixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0), _volume(Mixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0),
_samplesDecoded(0), _mixerTimeStamp(0), _converter(0), _input(0) { _samplesDecoded(0), _mixerTimeStamp(0), _converter(0), _input(0) {
assert(mixer); assert(mixer);
} }
Channel::Channel(SoundMixer *mixer, SoundMixer::SoundType type, AudioStream *input, Channel::Channel(Mixer *mixer, Mixer::SoundType type, AudioStream *input,
bool autofreeStream, bool reverseStereo, int id, bool permanent) bool autofreeStream, bool reverseStereo, int id, bool permanent)
: _type(type), _mixer(mixer), _autofreeStream(autofreeStream), : _type(type), _mixer(mixer), _autofreeStream(autofreeStream),
_volume(SoundMixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0), _volume(Mixer::kMaxChannelVolume), _balance(0), _paused(false), _id(id), _samplesConsumed(0),
_samplesDecoded(0), _mixerTimeStamp(0), _converter(0), _input(input), _permanent(permanent) { _samplesDecoded(0), _mixerTimeStamp(0), _converter(0), _input(input), _permanent(permanent) {
assert(mixer); assert(mixer);
assert(input); assert(input);
@ -465,14 +467,14 @@ void Channel::mix(int16 *data, uint len) {
st_volume_t vol_l, vol_r; st_volume_t vol_l, vol_r;
if (_balance == 0) { if (_balance == 0) {
vol_l = vol / SoundMixer::kMaxChannelVolume; vol_l = vol / Mixer::kMaxChannelVolume;
vol_r = vol / SoundMixer::kMaxChannelVolume; vol_r = vol / Mixer::kMaxChannelVolume;
} else if (_balance < 0) { } else if (_balance < 0) {
vol_l = vol / SoundMixer::kMaxChannelVolume; vol_l = vol / Mixer::kMaxChannelVolume;
vol_r = ((127 + _balance) * vol) / (SoundMixer::kMaxChannelVolume * 127); vol_r = ((127 + _balance) * vol) / (Mixer::kMaxChannelVolume * 127);
} else { } else {
vol_l = ((127 - _balance) * vol) / (SoundMixer::kMaxChannelVolume * 127); vol_l = ((127 - _balance) * vol) / (Mixer::kMaxChannelVolume * 127);
vol_r = vol / SoundMixer::kMaxChannelVolume; vol_r = vol / Mixer::kMaxChannelVolume;
} }
_samplesConsumed = _samplesDecoded; _samplesConsumed = _samplesDecoded;
@ -507,3 +509,6 @@ uint32 Channel::getElapsedTime() {
// FIXME: This won't work very well if the sound is paused. // FIXME: This won't work very well if the sound is paused.
return 1000 * seconds + milliseconds + delta; return 1000 * seconds + milliseconds + delta;
} }
} // End of namespace Audio

View file

@ -29,19 +29,23 @@
class AudioStream; class AudioStream;
class Channel; namespace Audio {
class Channel;
class Mixer;
}
class OSystem; class OSystem;
class SoundHandle { class SoundHandle {
friend class Channel; friend class Audio::Channel;
friend class SoundMixer; friend class Audio::Mixer;
uint32 _val; uint32 _val;
public: public:
inline SoundHandle() : _val(0xFFFFFFFF) {} inline SoundHandle() : _val(0xFFFFFFFF) {}
}; };
namespace Audio {
class SoundMixer { class Mixer {
public: public:
enum { enum {
/** unsigned samples (default: signed) */ /** unsigned samples (default: signed) */
@ -101,8 +105,8 @@ private:
bool _mixerReady; bool _mixerReady;
public: public:
SoundMixer(); Mixer();
~SoundMixer(); ~Mixer();
@ -304,4 +308,7 @@ private:
static void mixCallback(void *s, byte *samples, int len); static void mixCallback(void *s, byte *samples, int len);
}; };
} // End of namespace Audio
#endif #endif

View file

@ -288,7 +288,7 @@ public:
MP3TrackInfo(File *file); MP3TrackInfo(File *file);
~MP3TrackInfo(); ~MP3TrackInfo();
bool error() { return _error_flag; } bool error() { return _error_flag; }
void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration); void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration);
}; };
@ -363,7 +363,7 @@ error:
delete file; delete file;
} }
void MP3TrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) { void MP3TrackInfo::play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) {
unsigned int offset; unsigned int offset;
mad_timer_t durationTime; mad_timer_t durationTime;
@ -383,7 +383,7 @@ void MP3TrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame,
// Play it // Play it
AudioStream *input = new MP3InputStream(_file, durationTime); AudioStream *input = new MP3InputStream(_file, durationTime);
mixer->playInputStream(SoundMixer::kMusicSoundType, handle, input); mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input);
} }
MP3TrackInfo::~MP3TrackInfo() { MP3TrackInfo::~MP3TrackInfo() {

View file

@ -168,10 +168,10 @@ int LinearRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_samp
} }
// output left channel // output left channel
clampedAdd(*obuf++, (out[0] * (int)vol_l) / SoundMixer::kMaxMixerVolume); clampedAdd(*obuf++, (out[0] * (int)vol_l) / Audio::Mixer::kMaxMixerVolume);
// output right channel // output right channel
clampedAdd(*obuf++, (out[1] * (int)vol_r) / SoundMixer::kMaxMixerVolume); clampedAdd(*obuf++, (out[1] * (int)vol_r) / Audio::Mixer::kMaxMixerVolume);
// Increment output position // Increment output position
unsigned long tmp = opos_frac + opos_inc_frac; unsigned long tmp = opos_frac + opos_inc_frac;
@ -238,10 +238,10 @@ public:
} }
// output left channel // output left channel
clampedAdd(*obuf++, (tmp0 * (int)vol_l) / SoundMixer::kMaxMixerVolume); clampedAdd(*obuf++, (tmp0 * (int)vol_l) / Audio::Mixer::kMaxMixerVolume);
// output right channel // output right channel
clampedAdd(*obuf++, (tmp1 * (int)vol_r) / SoundMixer::kMaxMixerVolume); clampedAdd(*obuf++, (tmp1 * (int)vol_r) / Audio::Mixer::kMaxMixerVolume);
} }
return (ST_SUCCESS); return (ST_SUCCESS);
} }

View file

@ -543,7 +543,7 @@ class MidiDriver_ADLIB : public MidiDriver_Emulated {
friend class AdlibPercussionChannel; friend class AdlibPercussionChannel;
public: public:
MidiDriver_ADLIB(SoundMixer *mixer); MidiDriver_ADLIB(Audio::Mixer *mixer);
int open(); int open();
void close(); void close();
@ -798,7 +798,7 @@ void AdlibPercussionChannel::noteOn(byte note, byte velocity) {
// MidiDriver method implementations // MidiDriver method implementations
MidiDriver_ADLIB::MidiDriver_ADLIB(SoundMixer *mixer) MidiDriver_ADLIB::MidiDriver_ADLIB(Audio::Mixer *mixer)
: MidiDriver_Emulated(mixer) { : MidiDriver_Emulated(mixer) {
uint i; uint i;
@ -962,7 +962,7 @@ MidiChannel *MidiDriver_ADLIB::allocateChannel() {
return NULL; return NULL;
} }
MidiDriver *MidiDriver_ADLIB_create(SoundMixer *mixer) { MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer) {
return new MidiDriver_ADLIB(mixer); return new MidiDriver_ADLIB(mixer);
} }

View file

@ -28,7 +28,7 @@
class MidiDriver_Emulated : public AudioStream, public MidiDriver { class MidiDriver_Emulated : public AudioStream, public MidiDriver {
protected: protected:
bool _isOpen; bool _isOpen;
SoundMixer *_mixer; Audio::Mixer *_mixer;
private: private:
Common::Timer::TimerProc _timerProc; Common::Timer::TimerProc _timerProc;
@ -44,7 +44,7 @@ protected:
int _baseFreq; int _baseFreq;
public: public:
MidiDriver_Emulated(SoundMixer *mixer) : _mixer(mixer) { MidiDriver_Emulated(Audio::Mixer *mixer) : _mixer(mixer) {
_isOpen = false; _isOpen = false;
_timerProc = 0; _timerProc = 0;

View file

@ -49,7 +49,7 @@ protected:
void generateSamples(int16 *buf, int len); void generateSamples(int16 *buf, int len);
public: public:
MidiDriver_FluidSynth(SoundMixer *mixer); MidiDriver_FluidSynth(Mixer *mixer);
int open(); int open();
void close(); void close();
@ -65,7 +65,7 @@ public:
// MidiDriver method implementations // MidiDriver method implementations
MidiDriver_FluidSynth::MidiDriver_FluidSynth(SoundMixer *mixer) MidiDriver_FluidSynth::MidiDriver_FluidSynth(Mixer *mixer)
: MidiDriver_Emulated(mixer) { : MidiDriver_Emulated(mixer) {
for (int i = 0; i < ARRAYSIZE(_midiChannels); i++) { for (int i = 0; i < ARRAYSIZE(_midiChannels); i++) {
@ -138,7 +138,7 @@ int MidiDriver_FluidSynth::open() {
MidiDriver_Emulated::open(); MidiDriver_Emulated::open();
// The MT-32 emulator uses kSFXSoundType here. I don't know why. // The MT-32 emulator uses kSFXSoundType here. I don't know why.
_mixer->playInputStream(SoundMixer::kMusicSoundType, &_handle, this, -1, 255, 0, false, true); _mixer->playInputStream(Mixer::kMusicSoundType, &_handle, this, -1, 255, 0, false, true);
return 0; return 0;
} }
@ -206,7 +206,7 @@ MidiChannel *MidiDriver_FluidSynth::getPercussionChannel() {
return &_midiChannels[9]; return &_midiChannels[9];
} }
MidiDriver *MidiDriver_FluidSynth_create(SoundMixer *mixer) { MidiDriver *MidiDriver_FluidSynth_create(Mixer *mixer) {
return new MidiDriver_FluidSynth(mixer); return new MidiDriver_FluidSynth(mixer);
} }

View file

@ -56,7 +56,7 @@ protected:
public: public:
bool _initialising; bool _initialising;
MidiDriver_MT32(SoundMixer *mixer); MidiDriver_MT32(Audio::Mixer *mixer);
virtual ~MidiDriver_MT32(); virtual ~MidiDriver_MT32();
int open(); int open();
@ -208,7 +208,7 @@ static int MT32_Report(void *userData, MT32Emu::ReportType type, const void *rep
// //
//////////////////////////////////////// ////////////////////////////////////////
MidiDriver_MT32::MidiDriver_MT32(SoundMixer *mixer) : MidiDriver_Emulated(mixer) { MidiDriver_MT32::MidiDriver_MT32(Audio::Mixer *mixer) : MidiDriver_Emulated(mixer) {
_channelMask = 0xFFFF; // Permit all 16 channels by default _channelMask = 0xFFFF; // Permit all 16 channels by default
uint i; uint i;
for (i = 0; i < ARRAYSIZE(_midiChannels); ++i) { for (i = 0; i < ARRAYSIZE(_midiChannels); ++i) {
@ -221,7 +221,7 @@ MidiDriver_MT32::MidiDriver_MT32(SoundMixer *mixer) : MidiDriver_Emulated(mixer)
_baseFreq = 10000; _baseFreq = 10000;
// Unfortunately bugs in the emulator cause inaccurate tuning // Unfortunately bugs in the emulator cause inaccurate tuning
// at rates other than 32KHz, thus we produce data at 32KHz and // at rates other than 32KHz, thus we produce data at 32KHz and
// rely on SoundMixer to convert. // rely on Mixer to convert.
_outputRate = 32000; //_mixer->getOutputRate(); _outputRate = 32000; //_mixer->getOutputRate();
_initialising = false; _initialising = false;
} }
@ -267,7 +267,7 @@ int MidiDriver_MT32::open() {
_initialising = false; _initialising = false;
g_system->clearScreen(); g_system->clearScreen();
g_system->updateScreen(); g_system->updateScreen();
_mixer->playInputStream(SoundMixer::kSFXSoundType, &_handle, this, -1, 255, 0, false, true); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_handle, this, -1, 255, 0, false, true);
return 0; return 0;
} }
@ -388,7 +388,7 @@ protected:
void sysEx(byte *msg, uint16 length); void sysEx(byte *msg, uint16 length);
public: public:
MidiDriver_ThreadedMT32(SoundMixer *mixer); MidiDriver_ThreadedMT32(Audio::Mixer *mixer);
void onTimer(); void onTimer();
void close(); void close();
@ -396,7 +396,7 @@ public:
}; };
MidiDriver_ThreadedMT32::MidiDriver_ThreadedMT32(SoundMixer *mixer) : MidiDriver_MT32(mixer) { MidiDriver_ThreadedMT32::MidiDriver_ThreadedMT32(Audio::Mixer *mixer) : MidiDriver_MT32(mixer) {
_events = NULL; _events = NULL;
_timer_proc = NULL; _timer_proc = NULL;
} }
@ -468,7 +468,7 @@ void MidiDriver_ThreadedMT32::onTimer() {
// //
//////////////////////////////////////// ////////////////////////////////////////
MidiDriver *MidiDriver_MT32_create(SoundMixer *mixer) { MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer) {
// HACK: It will stay here until engine plugin loader overhaul // HACK: It will stay here until engine plugin loader overhaul
if (ConfMan.hasKey("extrapath")) if (ConfMan.hasKey("extrapath"))
Common::File::addDefaultDirectory(ConfMan.get("extrapath")); Common::File::addDefaultDirectory(ConfMan.get("extrapath"));

View file

@ -168,7 +168,7 @@ protected:
void generateSamples(int16 *buf, int len); void generateSamples(int16 *buf, int len);
public: public:
MidiDriver_YM2612(SoundMixer *mixer); MidiDriver_YM2612(Audio::Mixer *mixer);
virtual ~MidiDriver_YM2612(); virtual ~MidiDriver_YM2612();
int open(); int open();
@ -710,7 +710,7 @@ void MidiChannel_YM2612::rate(uint16 r) {
// //
//////////////////////////////////////// ////////////////////////////////////////
MidiDriver_YM2612::MidiDriver_YM2612(SoundMixer *mixer) MidiDriver_YM2612::MidiDriver_YM2612(Audio::Mixer *mixer)
: MidiDriver_Emulated(mixer) { : MidiDriver_Emulated(mixer) {
_next_voice = 0; _next_voice = 0;
@ -903,6 +903,6 @@ void MidiDriver_YM2612::createLookupTables() {
// //
//////////////////////////////////////// ////////////////////////////////////////
MidiDriver *MidiDriver_YM2612_create(SoundMixer *mixer) { MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer) {
return new MidiDriver_YM2612(mixer); return new MidiDriver_YM2612(mixer);
} }

View file

@ -135,6 +135,6 @@ AudioStream *makeVOCStream(Common::ReadStream &stream) {
if (!data) if (!data)
return 0; return 0;
return makeLinearInputStream(rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, data, size, 0, 0); return makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, data, size, 0, 0);
} }

View file

@ -52,7 +52,7 @@ public:
~VorbisTrackInfo(); ~VorbisTrackInfo();
bool openTrack(); bool openTrack();
bool error() { return _error_flag; } bool error() { return _error_flag; }
void play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration); void play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration);
}; };
@ -168,7 +168,7 @@ VorbisTrackInfo::~VorbisTrackInfo() {
#define VORBIS_TREMOR #define VORBIS_TREMOR
#endif #endif
void VorbisTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame, int duration) { void VorbisTrackInfo::play(Audio::Mixer *mixer, SoundHandle *handle, int startFrame, int duration) {
bool err = openTrack(); bool err = openTrack();
assert(!err); assert(!err);
@ -180,7 +180,7 @@ void VorbisTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFram
#endif #endif
AudioStream *input = makeVorbisStream(&_ov_file, duration * ov_info(&_ov_file, -1)->rate / 75); AudioStream *input = makeVorbisStream(&_ov_file, duration * ov_info(&_ov_file, -1)->rate / 75);
mixer->playInputStream(SoundMixer::kMusicSoundType, handle, input); mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input);
} }
DigitalTrackInfo *getVorbisTrack(int track) { DigitalTrackInfo *getVorbisTrack(int track) {

View file

@ -109,18 +109,18 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate,
flags = 0; flags = 0;
if (bitsPerSample == 8) // 8 bit data is unsigned if (bitsPerSample == 8) // 8 bit data is unsigned
flags |= SoundMixer::FLAG_UNSIGNED; flags |= Audio::Mixer::FLAG_UNSIGNED;
else if (bitsPerSample == 16) // 16 bit data is signed little endian else if (bitsPerSample == 16) // 16 bit data is signed little endian
flags |= (SoundMixer::FLAG_16BITS | SoundMixer::FLAG_LITTLE_ENDIAN); flags |= (Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN);
else if (bitsPerSample == 4 && type == 17) // IMA ADPCM compressed. We decompress it else if (bitsPerSample == 4 && type == 17) // IMA ADPCM compressed. We decompress it
flags |= (SoundMixer::FLAG_16BITS | SoundMixer::FLAG_LITTLE_ENDIAN); flags |= (Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN);
else { else {
warning("getWavInfo: unsupported bitsPerSample %d", bitsPerSample); warning("getWavInfo: unsupported bitsPerSample %d", bitsPerSample);
return false; return false;
} }
if (numChannels == 2) if (numChannels == 2)
flags |= SoundMixer::FLAG_STEREO; flags |= Audio::Mixer::FLAG_STEREO;
else if (numChannels != 1) { else if (numChannels != 1) {
warning("getWavInfo: unsupported number of channels %d", numChannels); warning("getWavInfo: unsupported number of channels %d", numChannels);
return false; return false;
@ -166,7 +166,7 @@ AudioStream *makeWAVStream(Common::SeekableReadStream &stream) {
byte *data = (byte *)malloc(size); byte *data = (byte *)malloc(size);
assert(data); assert(data);
stream.read(data, size); stream.read(data, size);
flags |= SoundMixer::FLAG_AUTOFREE; flags |= Audio::Mixer::FLAG_AUTOFREE;
return makeLinearInputStream(rate, flags, data, size, 0, 0); return makeLinearInputStream(rate, flags, data, size, 0, 0);
} }

View file

@ -32,7 +32,7 @@
namespace Sword1 { namespace Sword1 {
AnimationState::AnimationState(Screen *scr, SoundMixer *snd, OSystem *sys) AnimationState::AnimationState(Screen *scr, Audio::Mixer *snd, OSystem *sys)
: BaseAnimationState(snd, sys, 640, 400), _scr(scr) { : BaseAnimationState(snd, sys, 640, 400), _scr(scr) {
} }
@ -80,7 +80,7 @@ AudioStream *AnimationState::createAudioStream(const char *name, void *arg) {
return AudioStream::openStreamFile(name); return AudioStream::openStreamFile(name);
} }
MoviePlayer::MoviePlayer(Screen *scr, SoundMixer *snd, OSystem *sys) MoviePlayer::MoviePlayer(Screen *scr, Audio::Mixer *snd, OSystem *sys)
: _scr(scr), _snd(snd), _sys(sys) { : _scr(scr), _snd(snd), _sys(sys) {
for (uint8 cnt = 0; cnt < INTRO_LOGO_OVLS; cnt++) for (uint8 cnt = 0; cnt < INTRO_LOGO_OVLS; cnt++)
_logoOvls[cnt] = NULL; _logoOvls[cnt] = NULL;

View file

@ -61,7 +61,7 @@ private:
Screen *_scr; Screen *_scr;
public: public:
AnimationState(Screen *scr, SoundMixer *snd, OSystem *sys); AnimationState(Screen *scr, Audio::Mixer *snd, OSystem *sys);
~AnimationState(); ~AnimationState();
void updateScreen(); void updateScreen();
OverlayColor *giveRgbBuffer(void); OverlayColor *giveRgbBuffer(void);
@ -80,7 +80,7 @@ protected:
class MoviePlayer { class MoviePlayer {
public: public:
MoviePlayer(Screen *scr, SoundMixer *snd, OSystem *sys); MoviePlayer(Screen *scr, Audio::Mixer *snd, OSystem *sys);
~MoviePlayer(void); ~MoviePlayer(void);
void play(uint32 id); void play(uint32 id);
private: private:
@ -88,7 +88,7 @@ private:
void processFrame(uint32 animId, AnimationState *anim, uint32 frameNo); void processFrame(uint32 animId, AnimationState *anim, uint32 frameNo);
bool initOverlays(uint32 id); bool initOverlays(uint32 id);
Screen *_scr; Screen *_scr;
SoundMixer *_snd; Audio::Mixer *_snd;
OSystem *_sys; OSystem *_sys;
static const char *_sequenceList[20]; static const char *_sequenceList[20];

View file

@ -66,7 +66,7 @@ enum {
}; };
CreditsPlayer::CreditsPlayer(OSystem *pSystem, SoundMixer *pMixer) { CreditsPlayer::CreditsPlayer(OSystem *pSystem, Audio::Mixer *pMixer) {
_system = pSystem; _system = pSystem;
_mixer = pMixer; _mixer = pMixer;
_smlFont = _bigFont = NULL; _smlFont = _bigFont = NULL;
@ -113,7 +113,7 @@ void CreditsPlayer::play(void) {
// everything's initialized, time to render and show the credits. // everything's initialized, time to render and show the credits.
SoundHandle bgSound; SoundHandle bgSound;
_mixer->playInputStream(SoundMixer::kMusicSoundType, &bgSound, bgSoundStream, 0); _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &bgSound, bgSoundStream, 0);
int relDelay = 0; int relDelay = 0;
uint16 scrollY = 0; uint16 scrollY = 0;

View file

@ -23,7 +23,10 @@
#define BS1CREDITS_H #define BS1CREDITS_H
#include "common/util.h" #include "common/util.h"
class SoundMixer;
namespace Audio {
class Mixer;
}
class OSystem; class OSystem;
namespace Sword1 { namespace Sword1 {
@ -44,7 +47,7 @@ private:
class CreditsPlayer { class CreditsPlayer {
public: public:
CreditsPlayer(OSystem *pSystem, SoundMixer *pMixer); CreditsPlayer(OSystem *pSystem, Audio::Mixer *pMixer);
void play(void); void play(void);
private: private:
void generateFonts(ArcFile *arcFile); void generateFonts(ArcFile *arcFile);
@ -58,7 +61,7 @@ private:
uint8 _numChars; uint8 _numChars;
OSystem *_system; OSystem *_system;
SoundMixer *_mixer; Audio::Mixer *_mixer;
uint8 *_smlFont, *_bigFont; uint8 *_smlFont, *_bigFont;
}; };

View file

@ -48,7 +48,7 @@ namespace Sword1 {
uint32 Logic::_scriptVars[NUM_SCRIPT_VARS]; uint32 Logic::_scriptVars[NUM_SCRIPT_VARS];
Logic::Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, SoundMixer *mixer) { Logic::Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, Audio::Mixer *mixer) {
_objMan = pObjMan; _objMan = pObjMan;
_resMan = resMan; _resMan = resMan;
_screen = pScreen; _screen = pScreen;

View file

@ -47,7 +47,7 @@ typedef int (Logic::*BSMcodeTable)(Object *, int32, int32, int32, int32, int32,
class Logic { class Logic {
public: public:
Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, SoundMixer *mixer); Logic(ObjectMan *pObjMan, ResMan *resMan, Screen *pScreen, Mouse *pMouse, Sound *pSound, Music *pMusic, Menu *pMenu, OSystem *system, Audio::Mixer *mixer);
~Logic(void); ~Logic(void);
void initialize(void); void initialize(void);
void newScreen(uint32 screen); void newScreen(uint32 screen);
@ -62,7 +62,7 @@ public:
private: private:
ObjectMan *_objMan; ObjectMan *_objMan;
OSystem *_system; OSystem *_system;
SoundMixer *_mixer; Audio::Mixer *_mixer;
ResMan *_resMan; ResMan *_resMan;
Screen *_screen; Screen *_screen;
Sound *_sound; Sound *_sound;

View file

@ -48,12 +48,12 @@ WaveAudioStream::WaveAudioStream(Common::File *source, uint32 pSize) {
_sampleBuf = (uint8*)malloc(SMP_BUFSIZE); _sampleBuf = (uint8*)malloc(SMP_BUFSIZE);
_sourceFile->incRef(); _sourceFile->incRef();
if (_sourceFile->isOpen() && loadWAVFromStream(*_sourceFile, size, rate, flags)) { if (_sourceFile->isOpen() && loadWAVFromStream(*_sourceFile, size, rate, flags)) {
_isStereo = (flags & SoundMixer::FLAG_STEREO) != 0; _isStereo = (flags & Audio::Mixer::FLAG_STEREO) != 0;
_rate = rate; _rate = rate;
if (pSize && (int)pSize < size) if (pSize && (int)pSize < size)
size = pSize; size = pSize;
assert((uint32)size <= (source->size() - source->pos())); assert((uint32)size <= (source->size() - source->pos()));
_bitsPerSample = ((flags & SoundMixer::FLAG_16BITS) != 0) ? 16 : 8; _bitsPerSample = ((flags & Audio::Mixer::FLAG_16BITS) != 0) ? 16 : 8;
_samplesLeft = (size * 8) / _bitsPerSample; _samplesLeft = (size * 8) / _bitsPerSample;
if ((_bitsPerSample != 16) && (_bitsPerSample != 8)) if ((_bitsPerSample != 16) && (_bitsPerSample != 8))
error("WaveAudioStream: unknown wave type"); error("WaveAudioStream: unknown wave type");
@ -251,7 +251,7 @@ void MusicHandle::stop() {
_looping = false; _looping = false;
} }
Music::Music(SoundMixer *pMixer) { Music::Music(Audio::Mixer *pMixer) {
_mixer = pMixer; _mixer = pMixer;
_sampleRate = pMixer->getOutputRate(); _sampleRate = pMixer->getOutputRate();
_converter[0] = NULL; _converter[0] = NULL;

View file

@ -28,7 +28,9 @@
#include "sound/audiostream.h" #include "sound/audiostream.h"
#include "sound/rate.h" #include "sound/rate.h"
class SoundMixer; namespace Audio {
class Mixer;
}
namespace Sword1 { namespace Sword1 {
@ -84,7 +86,7 @@ public:
class Music : public AudioStream { class Music : public AudioStream {
public: public:
Music(SoundMixer *pMixer); Music(Audio::Mixer *pMixer);
~Music(); ~Music();
void startMusic(int32 tuneId, int32 loopFlag); void startMusic(int32 tuneId, int32 loopFlag);
void fadeDown(); void fadeDown();
@ -104,7 +106,7 @@ private:
st_volume_t _volumeL, _volumeR; st_volume_t _volumeL, _volumeR;
MusicHandle _handles[2]; MusicHandle _handles[2];
RateConverter *_converter[2]; RateConverter *_converter[2];
SoundMixer *_mixer; Audio::Mixer *_mixer;
uint32 _sampleRate; uint32 _sampleRate;
Common::Mutex _mutex; Common::Mutex _mutex;

View file

@ -33,9 +33,9 @@
namespace Sword1 { namespace Sword1 {
#define SOUND_SPEECH_ID 1 #define SOUND_SPEECH_ID 1
#define SPEECH_FLAGS (SoundMixer::FLAG_16BITS | SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_LITTLE_ENDIAN) #define SPEECH_FLAGS (Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_LITTLE_ENDIAN)
Sound::Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan) { Sound::Sound(const char *searchPath, Audio::Mixer *mixer, ResMan *pResMan) {
strcpy(_filePath, searchPath); strcpy(_filePath, searchPath);
_mixer = mixer; _mixer = mixer;
_resMan = pResMan; _resMan = pResMan;
@ -161,11 +161,11 @@ void Sound::playSample(QueueElement *elem) {
uint32 size = READ_LE_UINT32(sampleData + 0x28); uint32 size = READ_LE_UINT32(sampleData + 0x28);
uint8 flags; uint8 flags;
if (READ_LE_UINT16(sampleData + 0x22) == 16) if (READ_LE_UINT16(sampleData + 0x22) == 16)
flags = SoundMixer::FLAG_16BITS | SoundMixer::FLAG_LITTLE_ENDIAN; flags = Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN;
else else
flags = SoundMixer::FLAG_UNSIGNED; flags = Audio::Mixer::FLAG_UNSIGNED;
if (READ_LE_UINT16(sampleData + 0x16) == 2) if (READ_LE_UINT16(sampleData + 0x16) == 2)
flags |= SoundMixer::FLAG_STEREO; flags |= Audio::Mixer::FLAG_STEREO;
_mixer->playRaw(&elem->handle, sampleData + 0x2C, size, 11025, flags, elem->id, volume, pan); _mixer->playRaw(&elem->handle, sampleData + 0x2C, size, 11025, flags, elem->id, volume, pan);
} }
} else } else
@ -195,7 +195,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
#ifdef USE_MAD #ifdef USE_MAD
else if (_cowMode == CowMp3) { else if (_cowMode == CowMp3) {
_cowFile.seek(index); _cowFile.seek(index);
_mixer->playInputStream(SoundMixer::kSFXSoundType, &_speechHandle, makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speechHandle, makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
// with compressed audio, we can't calculate the wave volume. // with compressed audio, we can't calculate the wave volume.
// so default to talking. // so default to talking.
for (int cnt = 0; cnt < 480; cnt++) for (int cnt = 0; cnt < 480; cnt++)
@ -206,7 +206,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
#ifdef USE_VORBIS #ifdef USE_VORBIS
else if (_cowMode == CowVorbis) { else if (_cowMode == CowVorbis) {
_cowFile.seek(index); _cowFile.seek(index);
_mixer->playInputStream(SoundMixer::kSFXSoundType, &_speechHandle, makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speechHandle, makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
for (int cnt = 0; cnt < 480; cnt++) for (int cnt = 0; cnt < 480; cnt++)
_waveVolume[cnt] = true; _waveVolume[cnt] = true;
_waveVolPos = 0; _waveVolPos = 0;

View file

@ -28,7 +28,9 @@
#include "sound/mixer.h" #include "sound/mixer.h"
#include "common/util.h" #include "common/util.h"
class SoundMixer; namespace Audio {
class Mixer;
}
namespace Sword1 { namespace Sword1 {
@ -67,7 +69,7 @@ enum CowMode {
class Sound { class Sound {
public: public:
Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan); Sound(const char *searchPath, Audio::Mixer *mixer, ResMan *pResMan);
~Sound(void); ~Sound(void);
void setSpeechVol(uint8 volL, uint8 volR) { _speechVolL = volL; _speechVolR = volR; }; void setSpeechVol(uint8 volL, uint8 volR) { _speechVolL = volL; _speechVolR = volR; };
void setSfxVol(uint8 volL, uint8 volR) { _sfxVolL = volL; _sfxVolR = volR; }; void setSfxVol(uint8 volL, uint8 volR) { _sfxVolL = volL; _sfxVolR = volR; };
@ -106,7 +108,7 @@ private:
QueueElement _fxQueue[MAX_FXQ_LENGTH]; QueueElement _fxQueue[MAX_FXQ_LENGTH];
uint8 _endOfQueue; uint8 _endOfQueue;
SoundMixer *_mixer; Audio::Mixer *_mixer;
ResMan *_resMan; ResMan *_resMan;
char _filePath[100]; char _filePath[100];
static const char _musicList[270]; static const char _musicList[270];

View file

@ -166,8 +166,8 @@ int SwordEngine::init(GameDetector &detector) {
_resMan = new ResMan("swordres.rif"); _resMan = new ResMan("swordres.rif");
debug(5, "Starting object manager"); debug(5, "Starting object manager");
_objectMan = new ObjectMan(_resMan); _objectMan = new ObjectMan(_resMan);
_mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, SoundMixer::kMaxMixerVolume); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, Audio::Mixer::kMaxMixerVolume);
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, SoundMixer::kMaxMixerVolume); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxMixerVolume);
_mouse = new Mouse(_system, _resMan, _objectMan); _mouse = new Mouse(_system, _resMan, _objectMan);
_screen = new Screen(_system, _resMan, _objectMan); _screen = new Screen(_system, _resMan, _objectMan);
_music = new Music(_mixer); _music = new Music(_mixer);

View file

@ -907,11 +907,11 @@ OptionsDialog::OptionsDialog(Sword2Engine *vm) : Dialog(vm) {
_fxSwitch->linkSurfaceImages(_musicSwitch, 516, 250); _fxSwitch->linkSurfaceImages(_musicSwitch, 516, 250);
_fxSwitch->reverseStates(); _fxSwitch->reverseStates();
int volStep = SoundMixer::kMaxMixerVolume / 10; int volStep = Audio::Mixer::kMaxMixerVolume / 10;
_musicSlider = new Slider(this, _panel, SoundMixer::kMaxMixerVolume, 309, 161, 170, 27, volStep); _musicSlider = new Slider(this, _panel, Audio::Mixer::kMaxMixerVolume, 309, 161, 170, 27, volStep);
_speechSlider = new Slider(this, _panel, SoundMixer::kMaxMixerVolume, 309, 208, 170, 27, volStep, _musicSlider); _speechSlider = new Slider(this, _panel, Audio::Mixer::kMaxMixerVolume, 309, 208, 170, 27, volStep, _musicSlider);
_fxSlider = new Slider(this, _panel, SoundMixer::kMaxMixerVolume, 309, 254, 170, 27, volStep, _musicSlider); _fxSlider = new Slider(this, _panel, Audio::Mixer::kMaxMixerVolume, 309, 254, 170, 27, volStep, _musicSlider);
_gfxSlider = new Slider(this, _panel, 3, 309, 341, 170, 27, 1, _musicSlider); _gfxSlider = new Slider(this, _panel, 3, 309, 341, 170, 27, 1, _musicSlider);
_gfxPreview = new Widget(this, 4); _gfxPreview = new Widget(this, 4);
@ -945,9 +945,9 @@ OptionsDialog::OptionsDialog(Sword2Engine *vm) : Dialog(vm) {
_speechSwitch->setValue(!_vm->_sound->isSpeechMute()); _speechSwitch->setValue(!_vm->_sound->isSpeechMute());
_fxSwitch->setValue(!_vm->_sound->isFxMute()); _fxSwitch->setValue(!_vm->_sound->isFxMute());
_musicSlider->setValue(_mixer->getVolumeForSoundType(SoundMixer::kMusicSoundType)); _musicSlider->setValue(_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType));
_speechSlider->setValue(_mixer->getVolumeForSoundType(SoundMixer::kSpeechSoundType)); _speechSlider->setValue(_mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType));
_fxSlider->setValue(_mixer->getVolumeForSoundType(SoundMixer::kSFXSoundType)); _fxSlider->setValue(_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType));
_gfxSlider->setValue(_vm->_screen->getRenderLevel()); _gfxSlider->setValue(_vm->_screen->getRenderLevel());
_gfxPreview->setState(_vm->_screen->getRenderLevel()); _gfxPreview->setState(_vm->_screen->getRenderLevel());
@ -997,7 +997,7 @@ void OptionsDialog::onAction(Widget *widget, int result) {
if (widget == _musicSwitch) { if (widget == _musicSwitch) {
_vm->_sound->muteMusic(result != 0); _vm->_sound->muteMusic(result != 0);
} else if (widget == _musicSlider) { } else if (widget == _musicSlider) {
_vm->_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, result); _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, result);
_vm->_sound->muteMusic(result == 0); _vm->_sound->muteMusic(result == 0);
_musicSwitch->setValue(result != 0); _musicSwitch->setValue(result != 0);
} else if (widget == _speechSlider) { } else if (widget == _speechSlider) {
@ -1015,9 +1015,9 @@ void OptionsDialog::onAction(Widget *widget, int result) {
_vm->_sound->muteSpeech(!_speechSwitch->getValue()); _vm->_sound->muteSpeech(!_speechSwitch->getValue());
_vm->_sound->muteFx(!_fxSwitch->getValue()); _vm->_sound->muteFx(!_fxSwitch->getValue());
_vm->_sound->setReverseStereo(_reverseStereoSwitch->getValue()); _vm->_sound->setReverseStereo(_reverseStereoSwitch->getValue());
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, _musicSlider->getValue()); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _musicSlider->getValue());
_mixer->setVolumeForSoundType(SoundMixer::kSpeechSoundType, _speechSlider->getValue()); _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, _speechSlider->getValue());
_mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, _fxSlider->getValue()); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, _fxSlider->getValue());
_vm->_screen->setRenderLevel(_gfxSlider->getValue()); _vm->_screen->setRenderLevel(_gfxSlider->getValue());
_vm->writeSettings(); _vm->writeSettings();

View file

@ -86,7 +86,7 @@ private:
Button *_okButton; Button *_okButton;
Button *_cancelButton; Button *_cancelButton;
SoundMixer *_mixer; Audio::Mixer *_mixer;
public: public:
OptionsDialog(Sword2Engine *vm); OptionsDialog(Sword2Engine *vm);

View file

@ -183,7 +183,7 @@ int32 MoviePlayer::play(const char *filename, MovieTextObject *text[], int32 lea
leadIn += sizeof(StandardHeader); leadIn += sizeof(StandardHeader);
_vm->_sound->playFx(&leadInHandle, leadIn, leadInLen, SoundMixer::kMaxChannelVolume, 0, false, SoundMixer::kMusicSoundType); _vm->_sound->playFx(&leadInHandle, leadIn, leadInLen, Audio::Mixer::kMaxChannelVolume, 0, false, Audio::Mixer::kMusicSoundType);
} }
byte *leadOut = NULL; byte *leadOut = NULL;
@ -248,7 +248,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *
uint frameCounter = 0, textCounter = 0; uint frameCounter = 0, textCounter = 0;
SoundHandle handle; SoundHandle handle;
bool skipCutscene = false, textVisible = false; bool skipCutscene = false, textVisible = false;
uint32 flags = SoundMixer::FLAG_16BITS; uint32 flags = Audio::Mixer::FLAG_16BITS;
bool startNextText = false; bool startNextText = false;
byte oldPal[256 * 4]; byte oldPal[256 * 4];
@ -271,7 +271,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *
_vm->_screen->updateDisplay(); _vm->_screen->updateDisplay();
#ifndef SCUMM_BIG_ENDIAN #ifndef SCUMM_BIG_ENDIAN
flags |= SoundMixer::FLAG_LITTLE_ENDIAN; flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
#endif #endif
while (!skipCutscene && anim->decodeFrame()) { while (!skipCutscene && anim->decodeFrame()) {
@ -307,7 +307,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *
frameCounter++; frameCounter++;
if (frameCounter == _leadOutFrame && leadOut) if (frameCounter == _leadOutFrame && leadOut)
_vm->_sound->playFx(&_leadOutHandle, leadOut, leadOutLen, SoundMixer::kMaxChannelVolume, 0, false, SoundMixer::kMusicSoundType); _vm->_sound->playFx(&_leadOutHandle, leadOut, leadOutLen, Audio::Mixer::kMaxChannelVolume, 0, false, Audio::Mixer::kMusicSoundType);
OSystem::Event event; OSystem::Event event;
while (_sys->pollEvent(event)) { while (_sys->pollEvent(event)) {
@ -456,10 +456,10 @@ void MoviePlayer::playDummy(const char *filename, MovieTextObject *text[], byte
bool skipCutscene = false; bool skipCutscene = false;
uint32 flags = SoundMixer::FLAG_16BITS; uint32 flags = Audio::Mixer::FLAG_16BITS;
#ifndef SCUMM_BIG_ENDIAN #ifndef SCUMM_BIG_ENDIAN
flags |= SoundMixer::FLAG_LITTLE_ENDIAN; flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
#endif #endif
while (1) { while (1) {
@ -527,7 +527,7 @@ void MoviePlayer::playDummy(const char *filename, MovieTextObject *text[], byte
// subtitles. // subtitles.
if (!skipCutscene && leadOut) if (!skipCutscene && leadOut)
_vm->_sound->playFx(&_leadOutHandle, leadOut, leadOutLen, SoundMixer::kMaxChannelVolume, 0, false, SoundMixer::kMusicSoundType); _vm->_sound->playFx(&_leadOutHandle, leadOut, leadOutLen, Audio::Mixer::kMaxChannelVolume, 0, false, Audio::Mixer::kMusicSoundType);
_vm->_screen->setPalette(0, 256, oldPal, RDPAL_INSTANT); _vm->_screen->setPalette(0, 256, oldPal, RDPAL_INSTANT);
} }

View file

@ -73,7 +73,7 @@ struct MovieInfo {
class MoviePlayer { class MoviePlayer {
private: private:
Sword2Engine *_vm; Sword2Engine *_vm;
SoundMixer *_snd; Audio::Mixer *_snd;
OSystem *_sys; OSystem *_sys;
byte *_textSurface; byte *_textSurface;

View file

@ -643,7 +643,7 @@ void Sound::muteSpeech(bool mute) {
_speechMuted = mute; _speechMuted = mute;
if (_vm->_mixer->isSoundHandleActive(_soundHandleSpeech)) { if (_vm->_mixer->isSoundHandleActive(_soundHandleSpeech)) {
uint volume = mute ? 0 : SoundMixer::kMaxChannelVolume; uint volume = mute ? 0 : Audio::Mixer::kMaxChannelVolume;
_vm->_mixer->setChannelVolume(_soundHandleSpeech, volume); _vm->_mixer->setChannelVolume(_soundHandleSpeech, volume);
} }
@ -764,14 +764,14 @@ int32 Sound::playCompSpeech(uint32 speechId, uint8 vol, int8 pan) {
// Modify the volume according to the master volume // Modify the volume according to the master volume
byte volume = _speechMuted ? 0 : vol * SoundMixer::kMaxChannelVolume / 16; byte volume = _speechMuted ? 0 : vol * Audio::Mixer::kMaxChannelVolume / 16;
int8 p = (pan * 127) / 16; int8 p = (pan * 127) / 16;
if (isReverseStereo()) if (isReverseStereo())
p = -p; p = -p;
// Start the speech playing // Start the speech playing
_vm->_mixer->playInputStream(SoundMixer::kSpeechSoundType, &_soundHandleSpeech, input, -1, volume, p); _vm->_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_soundHandleSpeech, input, -1, volume, p);
return RD_OK; return RD_OK;
} }
@ -810,7 +810,7 @@ int32 Sound::setFxIdVolumePan(int32 id, int vol, int pan) {
if (vol > 16) if (vol > 16)
vol = 16; vol = 16;
_fxQueue[id].volume = (vol * SoundMixer::kMaxChannelVolume) / 16; _fxQueue[id].volume = (vol * Audio::Mixer::kMaxChannelVolume) / 16;
if (pan != 255) { if (pan != 255) {
if (isReverseStereo()) if (isReverseStereo())

View file

@ -81,7 +81,7 @@ Sound::Sound(Sword2Engine *vm) {
_mixBuffer = NULL; _mixBuffer = NULL;
_mixBufferLen = 0; _mixBufferLen = 0;
_vm->_mixer->setupPremix(this, SoundMixer::kMusicSoundType); _vm->_mixer->setupPremix(this, Audio::Mixer::kMusicSoundType);
} }
Sound::~Sound() { Sound::~Sound() {
@ -220,7 +220,7 @@ void Sound::queueFx(int32 res, int32 type, int32 delay, int32 volume, int32 pan)
delay *= 12; delay *= 12;
} }
volume = (volume * SoundMixer::kMaxChannelVolume) / 16; volume = (volume * Audio::Mixer::kMaxChannelVolume) / 16;
pan = (pan * 127) / 16; pan = (pan * 127) / 16;
if (isReverseStereo()) if (isReverseStereo())
@ -247,10 +247,10 @@ void Sound::queueFx(int32 res, int32 type, int32 delay, int32 volume, int32 pan)
} }
int32 Sound::playFx(FxQueueEntry *fx) { int32 Sound::playFx(FxQueueEntry *fx) {
return playFx(&fx->handle, fx->data, fx->len, fx->volume, fx->pan, (fx->type == FX_LOOP), SoundMixer::kSFXSoundType); return playFx(&fx->handle, fx->data, fx->len, fx->volume, fx->pan, (fx->type == FX_LOOP), Audio::Mixer::kSFXSoundType);
} }
int32 Sound::playFx(SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, SoundMixer::SoundType soundType) { int32 Sound::playFx(SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, Audio::Mixer::SoundType soundType) {
if (_fxMuted) if (_fxMuted)
return RD_OK; return RD_OK;
@ -267,10 +267,10 @@ int32 Sound::playFx(SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8
} }
if (isReverseStereo()) if (isReverseStereo())
flags |= SoundMixer::FLAG_REVERSE_STEREO; flags |= Audio::Mixer::FLAG_REVERSE_STEREO;
if (loop) if (loop)
flags |= SoundMixer::FLAG_LOOP; flags |= Audio::Mixer::FLAG_LOOP;
_vm->_mixer->playRaw(handle, data + stream.pos(), size, rate, flags, -1, vol, pan, 0, 0, soundType); _vm->_mixer->playRaw(handle, data + stream.pos(), size, rate, flags, -1, vol, pan, 0, 0, soundType);
return RD_OK; return RD_OK;

View file

@ -253,7 +253,7 @@ public:
void queueFx(int32 res, int32 type, int32 delay, int32 volume, int32 pan); void queueFx(int32 res, int32 type, int32 delay, int32 volume, int32 pan);
int32 playFx(FxQueueEntry *fx); int32 playFx(FxQueueEntry *fx);
int32 playFx(SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, SoundMixer::SoundType soundType); int32 playFx(SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 pan, bool loop, Audio::Mixer::SoundType soundType);
int32 stopFx(int32 i); int32 stopFx(int32 i);
int32 setFxIdVolumePan(int32 id, int vol, int pan = 255); int32 setFxIdVolumePan(int32 id, int vol, int pan = 255);

View file

@ -188,9 +188,9 @@ void Sword2Engine::registerDefaultSettings() {
} }
void Sword2Engine::readSettings() { void Sword2Engine::readSettings() {
_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_mixer->setVolumeForSoundType(SoundMixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume"));
_mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
setSubtitles(ConfMan.getBool("subtitles")); setSubtitles(ConfMan.getBool("subtitles"));
_sound->muteMusic(ConfMan.getBool("music_mute")); _sound->muteMusic(ConfMan.getBool("music_mute"));
_sound->muteSpeech(ConfMan.getBool("speech_mute")); _sound->muteSpeech(ConfMan.getBool("speech_mute"));
@ -201,9 +201,9 @@ void Sword2Engine::readSettings() {
} }
void Sword2Engine::writeSettings() { void Sword2Engine::writeSettings() {
ConfMan.set("music_volume", _mixer->getVolumeForSoundType(SoundMixer::kMusicSoundType)); ConfMan.set("music_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType));
ConfMan.set("speech_volume", _mixer->getVolumeForSoundType(SoundMixer::kSpeechSoundType)); ConfMan.set("speech_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType));
ConfMan.set("sfx_volume", _mixer->getVolumeForSoundType(SoundMixer::kSFXSoundType)); ConfMan.set("sfx_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType));
ConfMan.set("music_mute", _sound->isMusicMute()); ConfMan.set("music_mute", _sound->isMusicMute());
ConfMan.set("speech_mute", _sound->isSpeechMute()); ConfMan.set("speech_mute", _sound->isSpeechMute());
ConfMan.set("sfx_mute", _sound->isFxMute()); ConfMan.set("sfx_mute", _sound->isFxMute());