diff options
80 files changed, 360 insertions, 330 deletions
diff --git a/base/engine.h b/base/engine.h index 1aa2a07084..6c34b988de 100644 --- a/base/engine.h +++ b/base/engine.h @@ -26,7 +26,9 @@ class GameDetector; class OSystem; -class SoundMixer; +namespace Audio { + class Mixer; +} namespace Common { class SaveFileManager; class Timer; @@ -35,7 +37,7 @@ namespace Common { class Engine { public: OSystem *_system; - SoundMixer *_mixer; + Audio::Mixer *_mixer; Common::Timer * _timer; protected: diff --git a/base/gameDetector.cpp b/base/gameDetector.cpp index aa08306e75..ab3b2559fb 100644 --- a/base/gameDetector.cpp +++ b/base/gameDetector.cpp @@ -633,6 +633,6 @@ Engine *GameDetector::createEngine(OSystem *sys) { return _plugin->createInstance(this, sys); } -SoundMixer *GameDetector::createMixer() { - return new SoundMixer(); +Audio::Mixer *GameDetector::createMixer() { + return new Audio::Mixer(); } diff --git a/base/gameDetector.h b/base/gameDetector.h index dc9dc1ed6f..90eb57675e 100644 --- a/base/gameDetector.h +++ b/base/gameDetector.h @@ -29,7 +29,9 @@ class Engine; class GameDetector; class OSystem; class Plugin; -class SoundMixer; +namespace Audio { + class Mixer; +} /** Global (shared) game feature flags. */ enum { @@ -66,7 +68,7 @@ public: public: Engine *createEngine(OSystem *system); - static SoundMixer *createMixer(); + static Audio::Mixer *createMixer(); static GameSettings findGame(const String &gameName, const Plugin **plugin = NULL); diff --git a/common/system.h b/common/system.h index 3566f5ea14..4b72c3ec5f 100644 --- a/common/system.h +++ b/common/system.h @@ -823,7 +823,7 @@ public: * Determine the output sample rate. Audio data provided by the sound * callback will be played using this rate. * @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 */ virtual int getOutputSampleRate() const = 0; diff --git a/gob/gob.cpp b/gob/gob.cpp index 43a21d61d8..de0ece0088 100644 --- a/gob/gob.cpp +++ b/gob/gob.cpp @@ -130,8 +130,8 @@ GobEngine::GobEngine(GameDetector *detector, OSystem * syst) : Engine(syst) { warning("Sound initialization failed."); } - _mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); - _mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); _vm = this; } diff --git a/gob/sound.cpp b/gob/sound.cpp index bcab86b8b3..018fc48ab2 100644 --- a/gob/sound.cpp +++ b/gob/sound.cpp @@ -114,7 +114,7 @@ void snd_setBlasterPort(int16 port) {return;} void snd_speakerOn(int16 frequency, int32 length) { speakerStream.playNote(frequency, length); 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); } } diff --git a/graphics/animation.cpp b/graphics/animation.cpp index 77be43fdc5..9a237e5f72 100644 --- a/graphics/animation.cpp +++ b/graphics/animation.cpp @@ -30,7 +30,7 @@ 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) { #ifndef BACKEND_8BIT _colorTab = NULL; @@ -143,7 +143,7 @@ bool BaseAnimationState::init(const char *name, void *audioArg) { _bgSoundStream = createAudioStream(name, audioArg); 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 { warning("Cutscene: Could not open Audio Track for %s", name); } diff --git a/graphics/animation.h b/graphics/animation.h index 087d9febc7..7a437c08ae 100644 --- a/graphics/animation.h +++ b/graphics/animation.h @@ -74,7 +74,7 @@ protected: const int _movieWidth; const int _movieHeight; - SoundMixer *_snd; + Audio::Mixer *_snd; OSystem *_sys; uint _frameNum; @@ -117,7 +117,7 @@ protected: #endif public: - BaseAnimationState(SoundMixer *snd, OSystem *sys, int width, int height); + BaseAnimationState(Audio::Mixer *snd, OSystem *sys, int width, int height); virtual ~BaseAnimationState(); bool init(const char *name, void *audioArg = NULL); diff --git a/gui/options.cpp b/gui/options.cpp index 9384c97b50..ec2f65e713 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -408,19 +408,19 @@ int OptionsDialog::addVolumeControls(GuiObject *boss, int yoffset) { // Volume controllers _musicVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Music volume: ", 100, kMusicVolumeChanged); _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); yoffset += 16; _sfxVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "SFX volume: ", 100, kSfxVolumeChanged); _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); yoffset += 16; _speechVolumeSlider = new SliderWidget(boss, 5, yoffset, 185, 12, "Speech volume: ", 100, kSpeechVolumeChanged); _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); yoffset += 16; diff --git a/kyra/kyra.cpp b/kyra/kyra.cpp index 595d820e54..641a490430 100644 --- a/kyra/kyra.cpp +++ b/kyra/kyra.cpp @@ -106,8 +106,8 @@ KyraEngine::KyraEngine(GameDetector *detector, OSystem *syst) warning("Sound initialization failed."); } - _mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); - _mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + _mixer->setVolumeForSoundType(Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); // gets the game if (detector->_game.features & GF_KYRA1) { diff --git a/queen/queen.cpp b/queen/queen.cpp index a1d1ecae67..07bdf58a0f 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -419,9 +419,9 @@ int QueenEngine::init(GameDetector &detector) { if (!_mixer->isReady()) 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 - _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); MidiDriver *driver = MidiDriver::createMidi(midiDriver); diff --git a/queen/sound.cpp b/queen/sound.cpp index 7e8b8bc306..3181d15843 100644 --- a/queen/sound.cpp +++ b/queen/sound.cpp @@ -36,14 +36,14 @@ 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) { } Sound::~Sound() { } -Sound *Sound::giveSound(SoundMixer *mixer, QueenEngine *vm, uint8 compression) { +Sound *Sound::giveSound(Audio::Mixer *mixer, QueenEngine *vm, uint8 compression) { if (!mixer->isReady()) 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) { - 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); } @@ -201,7 +201,7 @@ void SBSound::sfxPlay(const char *name, bool isSpeech) { void MP3Sound::sfxPlay(const char *name, bool isSpeech) { uint32 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 @@ -209,7 +209,7 @@ void MP3Sound::sfxPlay(const char *name, bool isSpeech) { void OGGSound::sfxPlay(const char *name, bool isSpeech) { uint32 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 @@ -217,7 +217,7 @@ void OGGSound::sfxPlay(const char *name, bool isSpeech) { void FLACSound::sfxPlay(const char *name, bool isSpeech) { uint32 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 diff --git a/queen/sound.h b/queen/sound.h index 6aaee1d2bf..34e860a567 100644 --- a/queen/sound.h +++ b/queen/sound.h @@ -51,10 +51,10 @@ class QueenEngine; class Sound { public: - Sound(SoundMixer *mixer, QueenEngine *vm); + Sound(Audio::Mixer *mixer, QueenEngine *vm); virtual ~Sound(); 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(const char *base, bool isSpeech); void playSong(int16 songNum); @@ -103,7 +103,7 @@ public: protected: void waitFinished(bool isSpeech); - SoundMixer *_mixer; + Audio::Mixer *_mixer; QueenEngine *_vm; bool _sfxToggle; @@ -118,13 +118,13 @@ protected: class SilentSound : public Sound { 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) { } }; class SBSound : public Sound { 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); protected: void playSound(byte *sound, uint32 size, bool isSpeech); @@ -133,7 +133,7 @@ protected: #ifdef USE_MAD class MP3Sound : public Sound { 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); }; #endif @@ -141,7 +141,7 @@ public: #ifdef USE_VORBIS class OGGSound : public Sound { 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); }; #endif @@ -149,7 +149,7 @@ public: #ifdef USE_FLAC class FLACSound : public Sound { 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); }; #endif // #ifdef USE_FLAC diff --git a/saga/music.cpp b/saga/music.cpp index 2a6e1b9d82..9a44d0ed38 100644 --- a/saga/music.cpp +++ b/saga/music.cpp @@ -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); _musicInitialized = 1; - _mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); if (_vm->getGameType() == GType_ITE) { Common::File file; @@ -434,7 +434,7 @@ int Music::play(uint32 music_rn, uint16 flags) { if (audioStream) { debug(0, "Playing digitized music"); - _mixer->playInputStream(SoundMixer::kMusicSoundType, &_musicHandle, audioStream); + _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &_musicHandle, audioStream); return SUCCESS; } diff --git a/saga/music.h b/saga/music.h index 993df56a27..9fcd66558d 100644 --- a/saga/music.h +++ b/saga/music.h @@ -106,7 +106,7 @@ protected: class Music { public: - Music(SoundMixer *mixer, MidiDriver *driver, int enabled); + Music(Audio::Mixer *mixer, MidiDriver *driver, int enabled); ~Music(void); void setNativeMT32(bool b) { _player->setNativeMT32(b); } bool hasNativeMT32() { return _player->hasNativeMT32(); } @@ -122,7 +122,7 @@ public: private: - SoundMixer *_mixer; + Audio::Mixer *_mixer; MusicPlayer *_player; SoundHandle _musicHandle; diff --git a/saga/saga.cpp b/saga/saga.cpp index c3a5ff528d..591850b25f 100644 --- a/saga/saga.cpp +++ b/saga/saga.cpp @@ -158,8 +158,8 @@ SagaEngine::SagaEngine(GameDetector *detector, OSystem *syst) warning("Sound initialization failed."); } - _mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); - _mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); _vm = this; } diff --git a/saga/sndres.cpp b/saga/sndres.cpp index 2d77d3e779..6b12285a91 100644 --- a/saga/sndres.cpp +++ b/saga/sndres.cpp @@ -207,7 +207,7 @@ int SndRes::loadWavSound(byte *snd_res, size_t snd_res_len, SOUNDBUFFER *snd_buf 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_samplebits = 16; snd_buf_i->s_signed = 1; diff --git a/saga/sound.cpp b/saga/sound.cpp index 2ba533d26a..ae1a14cf04 100644 --- a/saga/sound.cpp +++ b/saga/sound.cpp @@ -30,7 +30,7 @@ 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) { _soundInitialized = 1; @@ -53,20 +53,20 @@ int Sound::playSoundBuffer(SoundHandle *handle, SOUNDBUFFER *buf, int volume, bo return FAILURE; } - flags = SoundMixer::FLAG_AUTOFREE; + flags = Audio::Mixer::FLAG_AUTOFREE; if (loop) - flags |= SoundMixer::FLAG_LOOP; + flags |= Audio::Mixer::FLAG_LOOP; if (buf->s_samplebits == 16) { - flags |= SoundMixer::FLAG_16BITS; + flags |= Audio::Mixer::FLAG_16BITS; if (!(_vm->getFeatures() & GF_BIG_ENDIAN_DATA)) - flags |= SoundMixer::FLAG_LITTLE_ENDIAN; + flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN; } if (buf->s_stereo) - flags |= SoundMixer::FLAG_STEREO; + flags |= Audio::Mixer::FLAG_STEREO; 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); @@ -120,7 +120,7 @@ int Sound::playVoxVoice(SOUNDBUFFER *buf) { _voxStream = new Common::MemoryReadStream(buf->s_buf, buf->s_buf_len); audioStream = makeADPCMStream(*_voxStream, buf->s_buf_len, kADPCMOki); - _mixer->playInputStream(SoundMixer::kSFXSoundType, &_voiceHandle, audioStream); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_voiceHandle, audioStream); return SUCCESS; } diff --git a/saga/sound.h b/saga/sound.h index 4418583acb..4bf126edcf 100644 --- a/saga/sound.h +++ b/saga/sound.h @@ -48,7 +48,7 @@ struct SOUNDBUFFER { class Sound { public: - Sound(SagaEngine *vm, SoundMixer *mixer, int enabled); + Sound(SagaEngine *vm, Audio::Mixer *mixer, int enabled); ~Sound(); int playSound(SOUNDBUFFER *buf, int volume, bool loop); @@ -70,7 +70,7 @@ public: int _enabled; SagaEngine *_vm; - SoundMixer *_mixer; + Audio::Mixer *_mixer; Common::MemoryReadStream *_voxStream; SoundHandle _effectHandle; diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index 0dc5764375..20165f41a8 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -171,19 +171,19 @@ void IMuseDigital::saveOrLoad(Serializer *ser) { track->iteration = freq * channels; track->mixerFlags = 0; 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)) { - track->mixerFlags |= SoundMixer::FLAG_16BITS; + track->mixerFlags |= Audio::Mixer::FLAG_16BITS; track->iteration *= 2; } else if (bits == 8) { - track->mixerFlags |= SoundMixer::FLAG_UNSIGNED; + track->mixerFlags |= Audio::Mixer::FLAG_UNSIGNED; } else error("IMuseDigital::saveOrLoad(): Can't handle %d bit samples", bits); #ifdef SCUMM_LITTLE_ENDIAN if (track->compressed) - track->mixerFlags |= SoundMixer::FLAG_LITTLE_ENDIAN; + track->mixerFlags |= Audio::Mixer::FLAG_LITTLE_ENDIAN; #endif 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 vol = track->vol / 1000; - SoundMixer::SoundType type = SoundMixer::kPlainSoundType; + Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; if (track->volGroupId == 1) - type = SoundMixer::kSpeechSoundType; + type = Audio::Mixer::kSpeechSoundType; if (track->volGroupId == 2) - type = SoundMixer::kSFXSoundType; + type = Audio::Mixer::kSFXSoundType; if (track->volGroupId == 3) - type = SoundMixer::kMusicSoundType; + type = Audio::Mixer::kMusicSoundType; _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 vol = track->vol / 1000; - SoundMixer::SoundType type = SoundMixer::kPlainSoundType; + Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; if (track->volGroupId == 1) - type = SoundMixer::kSpeechSoundType; + type = Audio::Mixer::kSpeechSoundType; if (track->volGroupId == 2) - type = SoundMixer::kSFXSoundType; + type = Audio::Mixer::kSFXSoundType; if (track->volGroupId == 3) - type = SoundMixer::kMusicSoundType; + type = Audio::Mixer::kMusicSoundType; if (track->stream) { byte *data = NULL; diff --git a/scumm/imuse_digi/dimuse_script.cpp b/scumm/imuse_digi/dimuse_script.cpp index 315ac03c0c..b7f3691e35 100644 --- a/scumm/imuse_digi/dimuse_script.cpp +++ b/scumm/imuse_digi/dimuse_script.cpp @@ -170,7 +170,7 @@ void IMuseDigital::flushTracks() { track->stream->finish(); } 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->_mixer->stopHandle(track->handle); delete track->stream; diff --git a/scumm/imuse_digi/dimuse_track.cpp b/scumm/imuse_digi/dimuse_track.cpp index 06a03e6227..5a32beff1a 100644 --- a/scumm/imuse_digi/dimuse_track.cpp +++ b/scumm/imuse_digi/dimuse_track.cpp @@ -140,19 +140,19 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, track->iteration = freq * channels; 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)) { - track->mixerFlags |= SoundMixer::FLAG_16BITS; + track->mixerFlags |= Audio::Mixer::FLAG_16BITS; track->iteration *= 2; } else if (bits == 8) { - track->mixerFlags |= SoundMixer::FLAG_UNSIGNED; + track->mixerFlags |= Audio::Mixer::FLAG_UNSIGNED; } else error("IMuseDigital::startSound(): Can't handle %d bit samples", bits); #ifdef SCUMM_LITTLE_ENDIAN if (track->compressed) - track->mixerFlags |= SoundMixer::FLAG_LITTLE_ENDIAN; + track->mixerFlags |= Audio::Mixer::FLAG_LITTLE_ENDIAN; #endif } @@ -163,14 +163,14 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, } else { const int pan = (track->pan != 64) ? 2 * track->pan - 127 : 0; const int vol = track->vol / 1000; - SoundMixer::SoundType type = SoundMixer::kPlainSoundType; + Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; if (track->volGroupId == 1) - type = SoundMixer::kSpeechSoundType; + type = Audio::Mixer::kSpeechSoundType; if (track->volGroupId == 2) - type = SoundMixer::kSFXSoundType; + type = Audio::Mixer::kSFXSoundType; if (track->volGroupId == 3) - type = SoundMixer::kMusicSoundType; + type = Audio::Mixer::kMusicSoundType; // setup 1 second stream wrapped buffer 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->volFadeUsed = true; - SoundMixer::SoundType type = SoundMixer::kPlainSoundType; + Audio::Mixer::SoundType type = Audio::Mixer::kPlainSoundType; if (fadeTrack->volGroupId == 1) - type = SoundMixer::kSpeechSoundType; + type = Audio::Mixer::kSpeechSoundType; if (fadeTrack->volGroupId == 2) - type = SoundMixer::kSFXSoundType; + type = Audio::Mixer::kSFXSoundType; if (fadeTrack->volGroupId == 3) - type = SoundMixer::kMusicSoundType; + type = Audio::Mixer::kMusicSoundType; // setup 1 second stream wrapped buffer int32 streamBufferSize = fadeTrack->iteration; diff --git a/scumm/input.cpp b/scumm/input.cpp index dd2f29cafe..29b3ddfef8 100644 --- a/scumm/input.cpp +++ b/scumm/input.cpp @@ -448,8 +448,8 @@ void ScummEngine::processKbd(bool smushMode) { vol = runDialog(dlg); vol *= 16; - if (vol > SoundMixer::kMaxMixerVolume) - vol = SoundMixer::kMaxMixerVolume; + if (vol > Audio::Mixer::kMaxMixerVolume) + vol = Audio::Mixer::kMaxMixerVolume; ConfMan.set("music_volume", vol); setupVolumes(); diff --git a/scumm/player_mod.cpp b/scumm/player_mod.cpp index fd915622cb..1649d98c3c 100644 --- a/scumm/player_mod.cpp +++ b/scumm/player_mod.cpp @@ -91,7 +91,7 @@ void Player_MOD::startChannel(int id, void *data, int size, int rate, uint8 vol, _channels[i].vol = vol; _channels[i].pan = pan; _channels[i].freq = rate; - _channels[i].input = makeLinearInputStream(rate, 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); } diff --git a/scumm/player_mod.h b/scumm/player_mod.h index 9a6e5449ca..e211aa1cf4 100644 --- a/scumm/player_mod.h +++ b/scumm/player_mod.h @@ -26,7 +26,6 @@ #include "scumm/scumm.h" #include "sound/audiostream.h" -class AudioStream; class RateConverter; namespace Scumm { @@ -74,7 +73,7 @@ private: AudioStream *input; }; - SoundMixer *_mixer; + Audio::Mixer *_mixer; uint32 _mixamt; uint32 _mixpos; diff --git a/scumm/player_nes.h b/scumm/player_nes.h index 6674ff080a..1c5ec00c5e 100644 --- a/scumm/player_nes.h +++ b/scumm/player_nes.h @@ -27,7 +27,9 @@ #include "scumm/music.h" #include "sound/audiostream.h" -class SoundMixer; +namespace Audio { + class Mixer; +} namespace Scumm { @@ -69,7 +71,7 @@ private: void do_mix(int16 *buf, uint len); ScummEngine *_vm; - SoundMixer *_mixer; + Audio::Mixer *_mixer; int _sample_rate; int _samples_per_frame; int _current_sample; diff --git a/scumm/player_v2.h b/scumm/player_v2.h index 045e8f1aa6..b87f9c3f7d 100644 --- a/scumm/player_v2.h +++ b/scumm/player_v2.h @@ -28,7 +28,9 @@ #include "scumm/music.h" #include "sound/audiostream.h" -class SoundMixer; +namespace Audio { + class Mixer; +} namespace Scumm { @@ -96,7 +98,7 @@ public: protected: bool _isV3Game; - SoundMixer *_mixer; + Audio::Mixer *_mixer; ScummEngine *_vm; bool _pcjr; diff --git a/scumm/player_v2a.h b/scumm/player_v2a.h index 9462e7c50f..ffc821ad0b 100644 --- a/scumm/player_v2a.h +++ b/scumm/player_v2a.h @@ -27,7 +27,7 @@ #include "scumm/music.h" #include "scumm/player_mod.h" -class SoundMixer; +class Mixer; namespace Scumm { diff --git a/scumm/player_v3a.h b/scumm/player_v3a.h index 31fe4d8840..5c92ea90de 100644 --- a/scumm/player_v3a.h +++ b/scumm/player_v3a.h @@ -27,7 +27,7 @@ #include "scumm/music.h" #include "scumm/player_mod.h" -class SoundMixer; +class Mixer; namespace Scumm { diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index 8db393bc75..305d538fbc 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -1384,13 +1384,13 @@ void ScummEngine_v8::o8_kernelGetFunctions() { } break; case 0xDD: // getGroupSfxVol - push(_mixer->getVolumeForSoundType(SoundMixer::kSFXSoundType) / 2); + push(_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 2); break; case 0xDE: // getGroupVoiceVol - push(_mixer->getVolumeForSoundType(SoundMixer::kSpeechSoundType) / 2); + push(_mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType) / 2); break; case 0xDF: // getGroupMusicVol - push(_mixer->getVolumeForSoundType(SoundMixer::kMusicSoundType) / 2); + push(_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 2); break; case 0xE0: // readRegistryValue { diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 38350d1e4b..8e0710c2d5 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1879,9 +1879,9 @@ void ScummEngine::setupVolumes() { _musicEngine->setMusicVolume(soundVolumeMusic); } - _mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, soundVolumeSfx); - _mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, soundVolumeMusic); - _mixer->setVolumeForSoundType(SoundMixer::kSpeechSoundType, soundVolumeSpeech); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSfx); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, soundVolumeMusic); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech); } diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index c97d8c23ee..b24761ff72 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -33,7 +33,7 @@ namespace Scumm { -SmushMixer::SmushMixer(SoundMixer *m) : +SmushMixer::SmushMixer(Audio::Mixer *m) : _mixer(m), _soundFrequency(22050) { 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); int32 size = _channels[i].chan->availableSoundData(); - byte flags = stereo ? SoundMixer::FLAG_STEREO : 0; + byte flags = stereo ? Audio::Mixer::FLAG_STEREO : 0; if (is_16bit) { data = malloc(size * (stereo ? 2 : 1) * 4); _channels[i].chan->getSoundData((int16 *)data, size); size *= stereo ? 4 : 2; - flags |= SoundMixer::FLAG_16BITS; + flags |= Audio::Mixer::FLAG_16BITS; } else { data = malloc(size * (stereo ? 2 : 1) * 2); _channels[i].chan->getSoundData((int8 *)data, size); size *= stereo ? 2 : 1; - flags |= SoundMixer::FLAG_UNSIGNED; + flags |= Audio::Mixer::FLAG_UNSIGNED; } if (_mixer->isReady()) { if (!_channels[i].stream) { _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->setChannelBalance(_channels[i].handle, pan); diff --git a/scumm/smush/smush_mixer.h b/scumm/smush/smush_mixer.h index 5e56103190..0f6417f721 100644 --- a/scumm/smush/smush_mixer.h +++ b/scumm/smush/smush_mixer.h @@ -35,7 +35,7 @@ class SmushMixer { }; private: - SoundMixer *_mixer; + Audio::Mixer *_mixer; struct channels { int id; SmushChannel *chan; @@ -49,7 +49,7 @@ private: public: - SmushMixer(SoundMixer *); + SmushMixer(Audio::Mixer *); virtual ~SmushMixer(); SmushChannel *findChannel(int32 track); void addChannel(SmushChannel *c); diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index e49cf081bc..24c11d6bc5 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -511,8 +511,8 @@ void SmushPlayer::handleIACT(Chunk &b) { } while (--count); if (!_IACTstream) { - _IACTstream = makeAppendableAudioStream(22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 400000); - _vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_IACTchannel, _IACTstream); + _IACTstream = makeAppendableAudioStream(22050, Audio::Mixer::FLAG_STEREO | Audio::Mixer::FLAG_16BITS, 400000); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_IACTchannel, _IACTstream); } _IACTstream->append(output_data, 0x1000); @@ -1187,7 +1187,7 @@ void SmushPlayer::tryCmpFile(const char *filename) { if (_compressedFile.isOpen()) { int size = _compressedFile.size(); _compressedFileMode = true; - _vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_compressedFileSoundHandle, makeMP3Stream(&_compressedFile, size)); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, makeMP3Stream(&_compressedFile, size)); return; } #endif @@ -1198,7 +1198,7 @@ void SmushPlayer::tryCmpFile(const char *filename) { if (_compressedFile.isOpen()) { int size = _compressedFile.size(); _compressedFileMode = true; - _vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size)); + _vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size)); return; } #endif diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 63f2af0b2c..f0380b5bd6 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -223,7 +223,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { char *sound; int size = -1; int rate; - byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE; + byte flags = Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_AUTOFREE; if (heChannel == -1) { heChannel = 1; @@ -337,7 +337,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { if (heFlags & 1) { // TODO - // flags |= SoundMixer::FLAG_LOOP; + // flags |= Audio::Mixer::FLAG_LOOP; } // 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; rate = 22050; - flags = SoundMixer::FLAG_AUTOFREE; + flags = Audio::Mixer::FLAG_AUTOFREE; // Allocate a sound buffer, copy the data into it, and play sound = (char *)malloc(size); @@ -482,7 +482,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { size -= waveSize; 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); } @@ -546,7 +546,7 @@ void Sound::playSound(int soundID, int heOffset, int heChannel, int heFlags) { sound = (char *)malloc(size); int vol = ptr[24] * 4; 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 { @@ -806,7 +806,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, SoundHandle *handl //_vm->_imuseDigital->stopSound(kTalkSoundID); _vm->_imuseDigital->startVoice(kTalkSoundID, input); } 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 { - 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 @@ -2436,10 +2436,10 @@ void AppendableMemoryStream<stereo, is16Bit, isUnsigned, isLE>::append(const byt return new AppendableMemoryStream<STEREO, false, UNSIGNED, false>(rate, len) AppendableAudioStream *makeAppendableAudioStream(int rate, byte _flags, uint32 len) { - const bool isStereo = (_flags & SoundMixer::FLAG_STEREO) != 0; - const bool is16Bit = (_flags & SoundMixer::FLAG_16BITS) != 0; - const bool isUnsigned = (_flags & SoundMixer::FLAG_UNSIGNED) != 0; - const bool isLE = (_flags & SoundMixer::FLAG_LITTLE_ENDIAN) != 0; + const bool isStereo = (_flags & Audio::Mixer::FLAG_STEREO) != 0; + const bool is16Bit = (_flags & Audio::Mixer::FLAG_16BITS) != 0; + const bool isUnsigned = (_flags & Audio::Mixer::FLAG_UNSIGNED) != 0; + const bool isLE = (_flags & Audio::Mixer::FLAG_LITTLE_ENDIAN) != 0; if (isStereo) { if (isUnsigned) { diff --git a/simon/simon.cpp b/simon/simon.cpp index 31ddcf820d..ccb8ddfc6d 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -673,7 +673,7 @@ int SimonEngine::init(GameDetector &detector) { warning("Sound initialization failed. " "Features of the game that depend on sound synchronization will most likely break"); 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(); initCommonGFX(detector); @@ -4254,7 +4254,7 @@ void SimonEngine::dx_unlock_attached() { } void SimonEngine::set_volume(int volume) { - _mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, volume); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume); } byte SimonEngine::getByte() { diff --git a/simon/sound.cpp b/simon/sound.cpp index ca95d19f2f..d34371874d 100644 --- a/simon/sound.cpp +++ b/simon/sound.cpp @@ -40,35 +40,35 @@ class BaseSound { protected: File *_file; uint32 *_offsets; - SoundMixer *_mixer; + Audio::Mixer *_mixer; bool _freeOffsets; public: - BaseSound(SoundMixer *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 base = 0, bool bigendian = false); + BaseSound(Audio::Mixer *mixer, File *file, uint32 *offsets, bool bigendian = false); virtual ~BaseSound(); virtual void playSound(uint sound, SoundHandle *handle, byte flags) = 0; }; class WavSound : public BaseSound { public: - WavSound(SoundMixer *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 base = 0, bool bigendian = false) : BaseSound(mixer, file, base, bigendian) {}; + WavSound(Audio::Mixer *mixer, File *file, uint32 *offsets) : BaseSound(mixer, file, offsets) {}; void playSound(uint sound, SoundHandle *handle, byte flags); }; class VocSound : public BaseSound { 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); }; class RawSound : public BaseSound { 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); }; -BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 base, bool bigendian) { +BaseSound::BaseSound(Audio::Mixer *mixer, File *file, uint32 base, bool bigendian) { _mixer = mixer; _file = file; @@ -106,7 +106,7 @@ BaseSound::BaseSound(SoundMixer *mixer, File *file, uint32 base, bool bigendian) _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; _file = file; _offsets = offsets; @@ -131,7 +131,7 @@ void WavSound::playSound(uint sound, SoundHandle *handle, byte flags) { 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) { @@ -143,7 +143,7 @@ void VocSound::playSound(uint sound, SoundHandle *handle, byte flags) { int 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) { @@ -156,13 +156,13 @@ void RawSound::playSound(uint sound, SoundHandle *handle, byte flags) { byte *buffer = (byte *)malloc(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 class MP3Sound : public BaseSound { 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); }; @@ -179,14 +179,14 @@ void MP3Sound::playSound(uint sound, SoundHandle *handle, byte flags) 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 #ifdef USE_VORBIS class VorbisSound : public BaseSound { 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); }; @@ -203,14 +203,14 @@ void VorbisSound::playSound(uint sound, SoundHandle *handle, byte flags) 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 #ifdef USE_FLAC class FlacSound : public BaseSound { 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); }; @@ -227,11 +227,11 @@ void FlacSound::playSound(uint sound, SoundHandle *handle, byte flags) 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 -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) { _voice = 0; _effects = 0; @@ -444,7 +444,7 @@ void Sound::playVoice(uint sound) { return; _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) { @@ -454,7 +454,7 @@ void Sound::playEffects(uint sound) { if (_effectsPaused) 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) { @@ -470,7 +470,7 @@ void Sound::playAmbient(uint sound) { return; _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 { diff --git a/simon/sound.h b/simon/sound.h index c95dd1d321..75efe46cb5 100644 --- a/simon/sound.h +++ b/simon/sound.h @@ -32,7 +32,7 @@ class Sound { private: byte _game; - SoundMixer *_mixer; + Audio::Mixer *_mixer; BaseSound *_voice; BaseSound *_effects; @@ -53,7 +53,7 @@ private: uint _ambientPlaying; public: - Sound(const byte game, const GameSpecificSettings *gss, SoundMixer *mixer); + Sound(const byte game, const GameSpecificSettings *gss, Audio::Mixer *mixer); ~Sound(); void readSfxFile(const char *filename); diff --git a/sky/intro.cpp b/sky/intro.cpp index e4a517b0e9..f677282c54 100644 --- a/sky/intro.cpp +++ b/sky/intro.cpp @@ -618,7 +618,7 @@ uint16 Intro::_floppyIntroSeq[] = { 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; _skyScreen = screen; @@ -739,7 +739,7 @@ bool Intro::nextPart(uint16 *&data) { // directly, but this will have to do for now. memset(vData, 127, sizeof(struct dataFileHeader)); _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; case WAITVOICE: while (_mixer->isSoundHandleActive(_voice)) @@ -756,12 +756,12 @@ bool Intro::nextPart(uint16 *&data) { case LOOPBG: _mixer->stopID(SOUND_BG); _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; case PLAYBG: _mixer->stopID(SOUND_BG); _mixer->playRaw(&_bgSfx, _bgBuf + 256, _bgSize - 768, 11025, - SoundMixer::FLAG_UNSIGNED, SOUND_BG); + Audio::Mixer::FLAG_UNSIGNED, SOUND_BG); return true; case STOPBG: _mixer->stopID(SOUND_BG); diff --git a/sky/intro.h b/sky/intro.h index 2e97663781..e7840fa120 100644 --- a/sky/intro.h +++ b/sky/intro.h @@ -36,7 +36,7 @@ class Text; class Intro { 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); bool doIntro(bool floppyIntro); bool _quitProg; @@ -51,7 +51,7 @@ private: Sound *_skySound; Text *_skyText; OSystem *_system; - SoundMixer *_mixer; + Audio::Mixer *_mixer; uint8 *_textBuf, *_saveBuf; uint8 *_bgBuf; diff --git a/sky/music/adlibmusic.cpp b/sky/music/adlibmusic.cpp index 6db9b83359..57f507ff46 100644 --- a/sky/music/adlibmusic.cpp +++ b/sky/music/adlibmusic.cpp @@ -26,7 +26,7 @@ namespace Sky { -AdlibMusic::AdlibMusic(SoundMixer *pMixer, Disk *pDisk) +AdlibMusic::AdlibMusic(Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pDisk) { _driverFileBase = 60202; diff --git a/sky/music/adlibmusic.h b/sky/music/adlibmusic.h index b4be9b8cde..d24fe7256e 100644 --- a/sky/music/adlibmusic.h +++ b/sky/music/adlibmusic.h @@ -26,13 +26,15 @@ #include "sound/audiostream.h" #include "sound/fmopl.h" -class SoundMixer; +namespace Audio { + class Mixer; +} namespace Sky { class AdlibMusic : public AudioStream, public MusicBase { public: - AdlibMusic(SoundMixer *pMixer, Disk *pDisk); + AdlibMusic(Audio::Mixer *pMixer, Disk *pDisk); ~AdlibMusic(void); virtual void setVolume(uint8 volume); @@ -47,7 +49,7 @@ public: private: FM_OPL *_opl; - SoundMixer *_mixer; + Audio::Mixer *_mixer; uint8 *_initSequence; uint32 _sampleRate, _nextMusicPoll; virtual void setupPointers(void); diff --git a/sky/sky.cpp b/sky/sky.cpp index c3b93ebd76..47458e431f 100644 --- a/sky/sky.cpp +++ b/sky/sky.cpp @@ -283,8 +283,8 @@ int SkyEngine::init(GameDetector &detector) { if (!_mixer->isReady()) warning("Sound initialisation failed"); - _mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); - _mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); _floppyIntro = ConfMan.getBool("alt_intro"); _skyDisk = new Disk(_gameDataPath); diff --git a/sky/sound.cpp b/sky/sound.cpp index 0efc41bf9e..c65579d950 100644 --- a/sky/sound.cpp +++ b/sky/sound.cpp @@ -1017,7 +1017,7 @@ SfxQueue Sound::_sfxQueue[MAX_QUEUED_FX] = { { 0, 0, 0, 0} }; -Sound::Sound(SoundMixer *mixer, Disk *pDisk, uint8 pVolume) { +Sound::Sound(Audio::Mixer *mixer, Disk *pDisk, uint8 pVolume) { _skyDisk = pDisk; _soundData = NULL; _mixer = mixer; @@ -1034,7 +1034,7 @@ Sound::~Sound(void) { void Sound::playSound(uint32 id, byte *sound, uint32 size, SoundHandle *handle) { byte flags = 0; - flags |= SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE; + flags |= Audio::Mixer::FLAG_UNSIGNED|Audio::Mixer::FLAG_AUTOFREE; size -= sizeof(struct dataFileHeader); byte *buffer = (byte *)malloc(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 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; if (dataLoop) { loopSta = dataSize - dataLoop; loopEnd = dataSize; - flags |= SoundMixer::FLAG_LOOP; + flags |= Audio::Mixer::FLAG_LOOP; } if (channel == 0) @@ -1242,7 +1242,7 @@ bool Sound::startSpeech(uint16 textNum) { rate = 11025; _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; } diff --git a/sky/sound.h b/sky/sound.h index b6888977c7..2f9d68c3a9 100644 --- a/sky/sound.h +++ b/sky/sound.h @@ -49,7 +49,7 @@ protected: public: - SoundMixer *_mixer; + Audio::Mixer *_mixer; SoundHandle _voiceHandle; SoundHandle _effectHandle; SoundHandle _bgSoundHandle; @@ -62,7 +62,7 @@ protected: void playSound(uint32 id, byte *sound, uint32 size, SoundHandle *handle); public: - Sound(SoundMixer *mixer, Disk *pDisk, uint8 pVolume); + Sound(Audio::Mixer *mixer, Disk *pDisk, uint8 pVolume); ~Sound(void); void loadSection(uint8 pSection); diff --git a/sound/audiocd.h b/sound/audiocd.h index 72bb3be389..9a2ffc4810 100644 --- a/sound/audiocd.h +++ b/sound/audiocd.h @@ -30,7 +30,7 @@ class DigitalTrackInfo { public: 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() { } }; diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index 2194267708..c9bd43e51c 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -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) 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 is16Bit = (flags & SoundMixer::FLAG_16BITS) != 0; - const bool isUnsigned = (flags & SoundMixer::FLAG_UNSIGNED) != 0; - const bool isLE = (flags & SoundMixer::FLAG_LITTLE_ENDIAN) != 0; - const bool autoFree = (flags & SoundMixer::FLAG_AUTOFREE) != 0; + const bool isStereo = (flags & Audio::Mixer::FLAG_STEREO) != 0; + const bool is16Bit = (flags & Audio::Mixer::FLAG_16BITS) != 0; + const bool isUnsigned = (flags & Audio::Mixer::FLAG_UNSIGNED) != 0; + const bool isLE = (flags & Audio::Mixer::FLAG_LITTLE_ENDIAN) != 0; + const bool autoFree = (flags & Audio::Mixer::FLAG_AUTOFREE) != 0; if (isStereo) { if (isUnsigned) { diff --git a/sound/flac.cpp b/sound/flac.cpp index 412f4c8651..d0d6403252 100644 --- a/sound/flac.cpp +++ b/sound/flac.cpp @@ -750,7 +750,7 @@ public: FlacTrackInfo(File *file); ~FlacTrackInfo(); 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) @@ -764,7 +764,7 @@ FlacTrackInfo::FlacTrackInfo(File *file) : _file(NULL), _firstStream(NULL) 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()) { 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); 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; } // startSample is beyond the existing Samples diff --git a/sound/mididrv.h b/sound/mididrv.h index 98b29747d2..7575916780 100644 --- a/sound/mididrv.h +++ b/sound/mididrv.h @@ -27,7 +27,9 @@ #include "common/timer.h" class MidiChannel; -class SoundMixer; +namespace Audio { + class Mixer; +} namespace Common { class String; } /** MIDI Driver Types */ @@ -190,19 +192,19 @@ public: // Factory functions, for faster compile 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_SEQ_create(); extern MidiDriver *MidiDriver_QT_create(); extern MidiDriver *MidiDriver_CORE_create(); extern MidiDriver *MidiDriver_ETUDE_create(); extern MidiDriver *MidiDriver_ALSA_create(); -extern MidiDriver *MidiDriver_YM2612_create(SoundMixer *mixer); +extern MidiDriver *MidiDriver_YM2612_create(Audio::Mixer *mixer); #ifdef USE_FLUIDSYNTH -extern MidiDriver *MidiDriver_FluidSynth_create(SoundMixer *mixer); +extern MidiDriver *MidiDriver_FluidSynth_create(Audio::Mixer *mixer); #endif #ifdef USE_MT32EMU -extern MidiDriver *MidiDriver_MT32_create(SoundMixer *mixer); +extern MidiDriver *MidiDriver_MT32_create(Audio::Mixer *mixer); #endif extern MidiDriver *MidiDriver_YamahaPa1_create(); extern MidiDriver *MidiDriver_Zodiac_create(); diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 18b55746cf..b2d46322fa 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -34,6 +34,8 @@ #include "sound/vorbis.h" +namespace Audio { + #pragma mark - #pragma mark --- Channel classes --- #pragma mark - @@ -44,10 +46,10 @@ */ class Channel { public: - const SoundMixer::SoundType _type; + const Mixer::SoundType _type; SoundHandle _handle; private: - SoundMixer *_mixer; + Mixer *_mixer; bool _autofreeStream; bool _permanent; byte _volume; @@ -64,8 +66,8 @@ protected: public: - Channel(SoundMixer *mixer, SoundMixer::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, int id = -1); + Channel(Mixer *mixer, Mixer::SoundType type, AudioStream *input, bool autofreeStream, bool reverseStereo = false, int id = -1, bool permanent = false); virtual ~Channel(); void mix(int16 *data, uint len); @@ -96,11 +98,11 @@ public: #pragma mark - -#pragma mark --- SoundMixer --- +#pragma mark --- Mixer --- #pragma mark - -SoundMixer::SoundMixer() { +Mixer::Mixer() { _syst = &OSystem::instance(); _handleSeed = 0; @@ -125,7 +127,7 @@ SoundMixer::SoundMixer() { debug(1, "Output sample rate: %d Hz", _outputRate); } -SoundMixer::~SoundMixer() { +Mixer::~Mixer() { _syst->clearSoundCallback(); stopAll(true); @@ -133,11 +135,11 @@ SoundMixer::~SoundMixer() { _premixChannel = 0; } -bool SoundMixer::isPaused() { +bool Mixer::isPaused() { return _paused; } -void SoundMixer::setupPremix(AudioStream *stream, SoundType type) { +void Mixer::setupPremix(AudioStream *stream, SoundType type) { Common::StackLock lock(_mutex); delete _premixChannel; @@ -150,7 +152,7 @@ void SoundMixer::setupPremix(AudioStream *stream, SoundType type) { _premixChannel = new Channel(this, type, stream, false); } -void SoundMixer::insertChannel(SoundHandle *handle, Channel *chan) { +void Mixer::insertChannel(SoundHandle *handle, Channel *chan) { int index = -1; for (int i = 0; i != NUM_CHANNELS; i++) { @@ -160,7 +162,7 @@ void SoundMixer::insertChannel(SoundHandle *handle, Channel *chan) { } } if (index == -1) { - warning("SoundMixer::out of mixer slots"); + warning("Mixer::out of mixer slots"); delete chan; 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) { Common::StackLock lock(_mutex); @@ -181,7 +183,7 @@ void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rat if (id != -1) { for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i] != 0 && _channels[i]->getId() == id) { - if ((flags & SoundMixer::FLAG_AUTOFREE) != 0) + if ((flags & Mixer::FLAG_AUTOFREE) != 0) free(sound); return; } @@ -189,7 +191,7 @@ void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rat // Create the input stream AudioStream *input; - if (flags & SoundMixer::FLAG_LOOP) { + if (flags & Mixer::FLAG_LOOP) { if (loopEnd == 0) { input = makeLinearInputStream(rate, flags, (byte *)sound, size, 0, size); } else { @@ -201,13 +203,13 @@ void SoundMixer::playRaw(SoundHandle *handle, void *sound, uint32 size, uint rat } // 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->setBalance(balance); 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) { Common::StackLock lock(_mutex); @@ -233,7 +235,7 @@ void SoundMixer::playInputStream(SoundType type, SoundHandle *handle, AudioStrea insertChannel(handle, chan); } -void SoundMixer::mix(int16 *buf, uint len) { +void Mixer::mix(int16 *buf, uint len) { Common::StackLock lock(_mutex); // 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(samples); // Len is the number of bytes in the buffer; we divide it by // 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); for (int i = 0; i != NUM_CHANNELS; i++) 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); for (int i = 0; i != NUM_CHANNELS; i++) { 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); // Simply ignore stop requests for handles of sounds that already terminated @@ -296,7 +298,7 @@ void SoundMixer::stopHandle(SoundHandle handle) { _channels[index] = 0; } -void SoundMixer::setChannelVolume(SoundHandle handle, byte volume) { +void Mixer::setChannelVolume(SoundHandle handle, byte volume) { Common::StackLock lock(_mutex); const int index = handle._val % NUM_CHANNELS; @@ -306,7 +308,7 @@ void SoundMixer::setChannelVolume(SoundHandle handle, byte volume) { _channels[index]->setVolume(volume); } -void SoundMixer::setChannelBalance(SoundHandle handle, int8 balance) { +void Mixer::setChannelBalance(SoundHandle handle, int8 balance) { Common::StackLock lock(_mutex); const int index = handle._val % NUM_CHANNELS; @@ -316,7 +318,7 @@ void SoundMixer::setChannelBalance(SoundHandle handle, int8 balance) { _channels[index]->setBalance(balance); } -uint32 SoundMixer::getSoundElapsedTimeOfSoundID(int id) { +uint32 Mixer::getSoundElapsedTimeOfSoundID(int id) { Common::StackLock lock(_mutex); for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i] && _channels[i]->getId() == id) @@ -324,7 +326,7 @@ uint32 SoundMixer::getSoundElapsedTimeOfSoundID(int id) { return 0; } -uint32 SoundMixer::getSoundElapsedTime(SoundHandle handle) { +uint32 Mixer::getSoundElapsedTime(SoundHandle handle) { Common::StackLock lock(_mutex); const int index = handle._val % NUM_CHANNELS; @@ -334,11 +336,11 @@ uint32 SoundMixer::getSoundElapsedTime(SoundHandle handle) { return _channels[index]->getElapsedTime(); } -void SoundMixer::pauseAll(bool paused) { +void Mixer::pauseAll(bool paused) { _paused = paused; } -void SoundMixer::pauseID(int id, bool paused) { +void Mixer::pauseID(int id, bool paused) { Common::StackLock lock(_mutex); for (int i = 0; i != NUM_CHANNELS; i++) { 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); // 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); } -bool SoundMixer::isSoundIDActive(int id) { +bool Mixer::isSoundIDActive(int id) { Common::StackLock lock(_mutex); for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i] && _channels[i]->getId() == id) @@ -367,7 +369,7 @@ bool SoundMixer::isSoundIDActive(int id) { return false; } -int SoundMixer::getSoundID(SoundHandle handle) { +int Mixer::getSoundID(SoundHandle handle) { Common::StackLock lock(_mutex); const int index = handle._val % NUM_CHANNELS; if (_channels[index] && _channels[index]->_handle._val == handle._val) @@ -375,13 +377,13 @@ int SoundMixer::getSoundID(SoundHandle handle) { return 0; } -bool SoundMixer::isSoundHandleActive(SoundHandle handle) { +bool Mixer::isSoundHandleActive(SoundHandle handle) { Common::StackLock lock(_mutex); const int index = handle._val % NUM_CHANNELS; return _channels[index] && _channels[index]->_handle._val == handle._val; } -bool SoundMixer::hasActiveChannelOfType(SoundType type) { +bool Mixer::hasActiveChannelOfType(SoundType type) { Common::StackLock lock(_mutex); for (int i = 0; i != NUM_CHANNELS; i++) if (_channels[i] && _channels[i]->_type == type) @@ -389,7 +391,7 @@ bool SoundMixer::hasActiveChannelOfType(SoundType type) { return false; } -void SoundMixer::setVolumeForSoundType(SoundType type, int volume) { +void Mixer::setVolumeForSoundType(SoundType type, int volume) { assert(0 <= type && type < ARRAYSIZE(_volumeForSoundType)); // Check range @@ -404,7 +406,7 @@ void SoundMixer::setVolumeForSoundType(SoundType type, int volume) { _volumeForSoundType[type] = volume; } -int SoundMixer::getVolumeForSoundType(SoundType type) const { +int Mixer::getVolumeForSoundType(SoundType type) const { assert(0 <= type && type < ARRAYSIZE(_volumeForSoundType)); return _volumeForSoundType[type]; @@ -416,17 +418,17 @@ int SoundMixer::getVolumeForSoundType(SoundType type) const { #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), - _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) { 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) : _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) { assert(mixer); assert(input); @@ -465,14 +467,14 @@ void Channel::mix(int16 *data, uint len) { st_volume_t vol_l, vol_r; if (_balance == 0) { - vol_l = vol / SoundMixer::kMaxChannelVolume; - vol_r = vol / SoundMixer::kMaxChannelVolume; + vol_l = vol / Mixer::kMaxChannelVolume; + vol_r = vol / Mixer::kMaxChannelVolume; } else if (_balance < 0) { - vol_l = vol / SoundMixer::kMaxChannelVolume; - vol_r = ((127 + _balance) * vol) / (SoundMixer::kMaxChannelVolume * 127); + vol_l = vol / Mixer::kMaxChannelVolume; + vol_r = ((127 + _balance) * vol) / (Mixer::kMaxChannelVolume * 127); } else { - vol_l = ((127 - _balance) * vol) / (SoundMixer::kMaxChannelVolume * 127); - vol_r = vol / SoundMixer::kMaxChannelVolume; + vol_l = ((127 - _balance) * vol) / (Mixer::kMaxChannelVolume * 127); + vol_r = vol / Mixer::kMaxChannelVolume; } _samplesConsumed = _samplesDecoded; @@ -507,3 +509,6 @@ uint32 Channel::getElapsedTime() { // FIXME: This won't work very well if the sound is paused. return 1000 * seconds + milliseconds + delta; } + + +} // End of namespace Audio diff --git a/sound/mixer.h b/sound/mixer.h index dfa7573738..0293f3c394 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -29,19 +29,23 @@ class AudioStream; -class Channel; +namespace Audio { + class Channel; + class Mixer; +} class OSystem; class SoundHandle { - friend class Channel; - friend class SoundMixer; + friend class Audio::Channel; + friend class Audio::Mixer; uint32 _val; public: inline SoundHandle() : _val(0xFFFFFFFF) {} }; +namespace Audio { -class SoundMixer { +class Mixer { public: enum { /** unsigned samples (default: signed) */ @@ -101,8 +105,8 @@ private: bool _mixerReady; public: - SoundMixer(); - ~SoundMixer(); + Mixer(); + ~Mixer(); @@ -304,4 +308,7 @@ private: static void mixCallback(void *s, byte *samples, int len); }; + +} // End of namespace Audio + #endif diff --git a/sound/mp3.cpp b/sound/mp3.cpp index 3028c22421..8638e3265f 100644 --- a/sound/mp3.cpp +++ b/sound/mp3.cpp @@ -288,7 +288,7 @@ public: MP3TrackInfo(File *file); ~MP3TrackInfo(); 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; } -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; mad_timer_t durationTime; @@ -383,7 +383,7 @@ void MP3TrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFrame, // Play it AudioStream *input = new MP3InputStream(_file, durationTime); - mixer->playInputStream(SoundMixer::kMusicSoundType, handle, input); + mixer->playInputStream(Audio::Mixer::kMusicSoundType, handle, input); } MP3TrackInfo::~MP3TrackInfo() { diff --git a/sound/rate.cpp b/sound/rate.cpp index b7ac1160d9..94db083225 100644 --- a/sound/rate.cpp +++ b/sound/rate.cpp @@ -168,10 +168,10 @@ int LinearRateConverter<stereo, reverseStereo>::flow(AudioStream &input, st_samp } // 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 - clampedAdd(*obuf++, (out[1] * (int)vol_r) / SoundMixer::kMaxMixerVolume); + clampedAdd(*obuf++, (out[1] * (int)vol_r) / Audio::Mixer::kMaxMixerVolume); // Increment output position unsigned long tmp = opos_frac + opos_inc_frac; @@ -238,10 +238,10 @@ public: } // output left channel - clampedAdd(*obuf++, (tmp0 * (int)vol_l) / SoundMixer::kMaxMixerVolume); + clampedAdd(*obuf++, (tmp0 * (int)vol_l) / Audio::Mixer::kMaxMixerVolume); // output right channel - clampedAdd(*obuf++, (tmp1 * (int)vol_r) / SoundMixer::kMaxMixerVolume); + clampedAdd(*obuf++, (tmp1 * (int)vol_r) / Audio::Mixer::kMaxMixerVolume); } return (ST_SUCCESS); } diff --git a/sound/softsynth/adlib.cpp b/sound/softsynth/adlib.cpp index d77c7e4992..5f0d0435bd 100644 --- a/sound/softsynth/adlib.cpp +++ b/sound/softsynth/adlib.cpp @@ -543,7 +543,7 @@ class MidiDriver_ADLIB : public MidiDriver_Emulated { friend class AdlibPercussionChannel; public: - MidiDriver_ADLIB(SoundMixer *mixer); + MidiDriver_ADLIB(Audio::Mixer *mixer); int open(); void close(); @@ -798,7 +798,7 @@ void AdlibPercussionChannel::noteOn(byte note, byte velocity) { // MidiDriver method implementations -MidiDriver_ADLIB::MidiDriver_ADLIB(SoundMixer *mixer) +MidiDriver_ADLIB::MidiDriver_ADLIB(Audio::Mixer *mixer) : MidiDriver_Emulated(mixer) { uint i; @@ -962,7 +962,7 @@ MidiChannel *MidiDriver_ADLIB::allocateChannel() { return NULL; } -MidiDriver *MidiDriver_ADLIB_create(SoundMixer *mixer) { +MidiDriver *MidiDriver_ADLIB_create(Audio::Mixer *mixer) { return new MidiDriver_ADLIB(mixer); } diff --git a/sound/softsynth/emumidi.h b/sound/softsynth/emumidi.h index 19e2e86476..9fd0113a7f 100644 --- a/sound/softsynth/emumidi.h +++ b/sound/softsynth/emumidi.h @@ -28,7 +28,7 @@ class MidiDriver_Emulated : public AudioStream, public MidiDriver { protected: bool _isOpen; - SoundMixer *_mixer; + Audio::Mixer *_mixer; private: Common::Timer::TimerProc _timerProc; @@ -44,7 +44,7 @@ protected: int _baseFreq; public: - MidiDriver_Emulated(SoundMixer *mixer) : _mixer(mixer) { + MidiDriver_Emulated(Audio::Mixer *mixer) : _mixer(mixer) { _isOpen = false; _timerProc = 0; diff --git a/sound/softsynth/fluidsynth.cpp b/sound/softsynth/fluidsynth.cpp index 8c3c9cb99d..ba45d527ce 100644 --- a/sound/softsynth/fluidsynth.cpp +++ b/sound/softsynth/fluidsynth.cpp @@ -49,7 +49,7 @@ protected: void generateSamples(int16 *buf, int len); public: - MidiDriver_FluidSynth(SoundMixer *mixer); + MidiDriver_FluidSynth(Mixer *mixer); int open(); void close(); @@ -65,7 +65,7 @@ public: // MidiDriver method implementations -MidiDriver_FluidSynth::MidiDriver_FluidSynth(SoundMixer *mixer) +MidiDriver_FluidSynth::MidiDriver_FluidSynth(Mixer *mixer) : MidiDriver_Emulated(mixer) { for (int i = 0; i < ARRAYSIZE(_midiChannels); i++) { @@ -138,7 +138,7 @@ int MidiDriver_FluidSynth::open() { MidiDriver_Emulated::open(); // 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; } @@ -206,7 +206,7 @@ MidiChannel *MidiDriver_FluidSynth::getPercussionChannel() { return &_midiChannels[9]; } -MidiDriver *MidiDriver_FluidSynth_create(SoundMixer *mixer) { +MidiDriver *MidiDriver_FluidSynth_create(Mixer *mixer) { return new MidiDriver_FluidSynth(mixer); } diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp index 58f13f45c6..a64bbe3251 100644 --- a/sound/softsynth/mt32.cpp +++ b/sound/softsynth/mt32.cpp @@ -56,7 +56,7 @@ protected: public: bool _initialising; - MidiDriver_MT32(SoundMixer *mixer); + MidiDriver_MT32(Audio::Mixer *mixer); virtual ~MidiDriver_MT32(); 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 uint i; for (i = 0; i < ARRAYSIZE(_midiChannels); ++i) { @@ -221,7 +221,7 @@ MidiDriver_MT32::MidiDriver_MT32(SoundMixer *mixer) : MidiDriver_Emulated(mixer) _baseFreq = 10000; // Unfortunately bugs in the emulator cause inaccurate tuning // 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(); _initialising = false; } @@ -267,7 +267,7 @@ int MidiDriver_MT32::open() { _initialising = false; g_system->clearScreen(); 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; } @@ -388,7 +388,7 @@ protected: void sysEx(byte *msg, uint16 length); public: - MidiDriver_ThreadedMT32(SoundMixer *mixer); + MidiDriver_ThreadedMT32(Audio::Mixer *mixer); void onTimer(); 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; _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 if (ConfMan.hasKey("extrapath")) Common::File::addDefaultDirectory(ConfMan.get("extrapath")); diff --git a/sound/softsynth/ym2612.cpp b/sound/softsynth/ym2612.cpp index 8d37ee8ec6..e37b50170e 100644 --- a/sound/softsynth/ym2612.cpp +++ b/sound/softsynth/ym2612.cpp @@ -168,7 +168,7 @@ protected: void generateSamples(int16 *buf, int len); public: - MidiDriver_YM2612(SoundMixer *mixer); + MidiDriver_YM2612(Audio::Mixer *mixer); virtual ~MidiDriver_YM2612(); 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) { _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); } diff --git a/sound/voc.cpp b/sound/voc.cpp index 12c2c520a5..5df91afad3 100644 --- a/sound/voc.cpp +++ b/sound/voc.cpp @@ -135,6 +135,6 @@ AudioStream *makeVOCStream(Common::ReadStream &stream) { if (!data) 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); } diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp index f2f7781220..a92867b660 100644 --- a/sound/vorbis.cpp +++ b/sound/vorbis.cpp @@ -52,7 +52,7 @@ public: ~VorbisTrackInfo(); bool openTrack(); 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 #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(); assert(!err); @@ -180,7 +180,7 @@ void VorbisTrackInfo::play(SoundMixer *mixer, SoundHandle *handle, int startFram #endif 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) { diff --git a/sound/wave.cpp b/sound/wave.cpp index 9822201215..911c4cbdbe 100644 --- a/sound/wave.cpp +++ b/sound/wave.cpp @@ -109,18 +109,18 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, flags = 0; 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 - 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 - flags |= (SoundMixer::FLAG_16BITS | SoundMixer::FLAG_LITTLE_ENDIAN); + flags |= (Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN); else { warning("getWavInfo: unsupported bitsPerSample %d", bitsPerSample); return false; } if (numChannels == 2) - flags |= SoundMixer::FLAG_STEREO; + flags |= Audio::Mixer::FLAG_STEREO; else if (numChannels != 1) { warning("getWavInfo: unsupported number of channels %d", numChannels); return false; @@ -166,7 +166,7 @@ AudioStream *makeWAVStream(Common::SeekableReadStream &stream) { byte *data = (byte *)malloc(size); assert(data); stream.read(data, size); - flags |= SoundMixer::FLAG_AUTOFREE; + flags |= Audio::Mixer::FLAG_AUTOFREE; return makeLinearInputStream(rate, flags, data, size, 0, 0); } diff --git a/sword1/animation.cpp b/sword1/animation.cpp index e0c9794f85..18082374a3 100644 --- a/sword1/animation.cpp +++ b/sword1/animation.cpp @@ -32,7 +32,7 @@ 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) { } @@ -80,7 +80,7 @@ AudioStream *AnimationState::createAudioStream(const char *name, void *arg) { 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) { for (uint8 cnt = 0; cnt < INTRO_LOGO_OVLS; cnt++) _logoOvls[cnt] = NULL; diff --git a/sword1/animation.h b/sword1/animation.h index bb931af50a..73f46efe59 100644 --- a/sword1/animation.h +++ b/sword1/animation.h @@ -61,7 +61,7 @@ private: Screen *_scr; public: - AnimationState(Screen *scr, SoundMixer *snd, OSystem *sys); + AnimationState(Screen *scr, Audio::Mixer *snd, OSystem *sys); ~AnimationState(); void updateScreen(); OverlayColor *giveRgbBuffer(void); @@ -80,7 +80,7 @@ protected: class MoviePlayer { public: - MoviePlayer(Screen *scr, SoundMixer *snd, OSystem *sys); + MoviePlayer(Screen *scr, Audio::Mixer *snd, OSystem *sys); ~MoviePlayer(void); void play(uint32 id); private: @@ -88,7 +88,7 @@ private: void processFrame(uint32 animId, AnimationState *anim, uint32 frameNo); bool initOverlays(uint32 id); Screen *_scr; - SoundMixer *_snd; + Audio::Mixer *_snd; OSystem *_sys; static const char *_sequenceList[20]; diff --git a/sword1/credits.cpp b/sword1/credits.cpp index 511dd37e42..d207c7b4db 100644 --- a/sword1/credits.cpp +++ b/sword1/credits.cpp @@ -66,7 +66,7 @@ enum { }; -CreditsPlayer::CreditsPlayer(OSystem *pSystem, SoundMixer *pMixer) { +CreditsPlayer::CreditsPlayer(OSystem *pSystem, Audio::Mixer *pMixer) { _system = pSystem; _mixer = pMixer; _smlFont = _bigFont = NULL; @@ -113,7 +113,7 @@ void CreditsPlayer::play(void) { // everything's initialized, time to render and show the credits. SoundHandle bgSound; - _mixer->playInputStream(SoundMixer::kMusicSoundType, &bgSound, bgSoundStream, 0); + _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &bgSound, bgSoundStream, 0); int relDelay = 0; uint16 scrollY = 0; diff --git a/sword1/credits.h b/sword1/credits.h index c64985df58..159475eaa7 100644 --- a/sword1/credits.h +++ b/sword1/credits.h @@ -23,7 +23,10 @@ #define BS1CREDITS_H #include "common/util.h" -class SoundMixer; + +namespace Audio { + class Mixer; +} class OSystem; namespace Sword1 { @@ -44,7 +47,7 @@ private: class CreditsPlayer { public: - CreditsPlayer(OSystem *pSystem, SoundMixer *pMixer); + CreditsPlayer(OSystem *pSystem, Audio::Mixer *pMixer); void play(void); private: void generateFonts(ArcFile *arcFile); @@ -58,7 +61,7 @@ private: uint8 _numChars; OSystem *_system; - SoundMixer *_mixer; + Audio::Mixer *_mixer; uint8 *_smlFont, *_bigFont; }; diff --git a/sword1/logic.cpp b/sword1/logic.cpp index 9151a8d05e..9206007616 100644 --- a/sword1/logic.cpp +++ b/sword1/logic.cpp @@ -48,7 +48,7 @@ namespace Sword1 { 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; _resMan = resMan; _screen = pScreen; diff --git a/sword1/logic.h b/sword1/logic.h index 37fbc82319..62f750ea0f 100644 --- a/sword1/logic.h +++ b/sword1/logic.h @@ -47,7 +47,7 @@ typedef int (Logic::*BSMcodeTable)(Object *, int32, int32, int32, int32, int32, class Logic { 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); void initialize(void); void newScreen(uint32 screen); @@ -62,7 +62,7 @@ public: private: ObjectMan *_objMan; OSystem *_system; - SoundMixer *_mixer; + Audio::Mixer *_mixer; ResMan *_resMan; Screen *_screen; Sound *_sound; diff --git a/sword1/music.cpp b/sword1/music.cpp index f8b60bca5b..f0b70f5731 100644 --- a/sword1/music.cpp +++ b/sword1/music.cpp @@ -48,12 +48,12 @@ WaveAudioStream::WaveAudioStream(Common::File *source, uint32 pSize) { _sampleBuf = (uint8*)malloc(SMP_BUFSIZE); _sourceFile->incRef(); if (_sourceFile->isOpen() && loadWAVFromStream(*_sourceFile, size, rate, flags)) { - _isStereo = (flags & SoundMixer::FLAG_STEREO) != 0; + _isStereo = (flags & Audio::Mixer::FLAG_STEREO) != 0; _rate = rate; if (pSize && (int)pSize < size) size = pSize; 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; if ((_bitsPerSample != 16) && (_bitsPerSample != 8)) error("WaveAudioStream: unknown wave type"); @@ -251,7 +251,7 @@ void MusicHandle::stop() { _looping = false; } -Music::Music(SoundMixer *pMixer) { +Music::Music(Audio::Mixer *pMixer) { _mixer = pMixer; _sampleRate = pMixer->getOutputRate(); _converter[0] = NULL; diff --git a/sword1/music.h b/sword1/music.h index 53873c87cc..5628cbce40 100644 --- a/sword1/music.h +++ b/sword1/music.h @@ -28,7 +28,9 @@ #include "sound/audiostream.h" #include "sound/rate.h" -class SoundMixer; +namespace Audio { + class Mixer; +} namespace Sword1 { @@ -84,7 +86,7 @@ public: class Music : public AudioStream { public: - Music(SoundMixer *pMixer); + Music(Audio::Mixer *pMixer); ~Music(); void startMusic(int32 tuneId, int32 loopFlag); void fadeDown(); @@ -104,7 +106,7 @@ private: st_volume_t _volumeL, _volumeR; MusicHandle _handles[2]; RateConverter *_converter[2]; - SoundMixer *_mixer; + Audio::Mixer *_mixer; uint32 _sampleRate; Common::Mutex _mutex; diff --git a/sword1/sound.cpp b/sword1/sound.cpp index cde9e867dc..2673c9fc92 100644 --- a/sword1/sound.cpp +++ b/sword1/sound.cpp @@ -33,9 +33,9 @@ namespace Sword1 { #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); _mixer = mixer; _resMan = pResMan; @@ -161,11 +161,11 @@ void Sound::playSample(QueueElement *elem) { uint32 size = READ_LE_UINT32(sampleData + 0x28); uint8 flags; 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 - flags = SoundMixer::FLAG_UNSIGNED; + flags = Audio::Mixer::FLAG_UNSIGNED; 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); } } else @@ -195,7 +195,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_MAD else if (_cowMode == CowMp3) { _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. // so default to talking. for (int cnt = 0; cnt < 480; cnt++) @@ -206,7 +206,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) { #ifdef USE_VORBIS else if (_cowMode == CowVorbis) { _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++) _waveVolume[cnt] = true; _waveVolPos = 0; diff --git a/sword1/sound.h b/sword1/sound.h index 8a65f0dcf0..5b2469aa81 100644 --- a/sword1/sound.h +++ b/sword1/sound.h @@ -28,7 +28,9 @@ #include "sound/mixer.h" #include "common/util.h" -class SoundMixer; +namespace Audio { + class Mixer; +} namespace Sword1 { @@ -67,7 +69,7 @@ enum CowMode { class Sound { public: - Sound(const char *searchPath, SoundMixer *mixer, ResMan *pResMan); + Sound(const char *searchPath, Audio::Mixer *mixer, ResMan *pResMan); ~Sound(void); void setSpeechVol(uint8 volL, uint8 volR) { _speechVolL = volL; _speechVolR = volR; }; void setSfxVol(uint8 volL, uint8 volR) { _sfxVolL = volL; _sfxVolR = volR; }; @@ -106,7 +108,7 @@ private: QueueElement _fxQueue[MAX_FXQ_LENGTH]; uint8 _endOfQueue; - SoundMixer *_mixer; + Audio::Mixer *_mixer; ResMan *_resMan; char _filePath[100]; static const char _musicList[270]; diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp index aa08e352d0..87c9d3d46e 100644 --- a/sword1/sword1.cpp +++ b/sword1/sword1.cpp @@ -166,8 +166,8 @@ int SwordEngine::init(GameDetector &detector) { _resMan = new ResMan("swordres.rif"); debug(5, "Starting object manager"); _objectMan = new ObjectMan(_resMan); - _mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, SoundMixer::kMaxMixerVolume); - _mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, SoundMixer::kMaxMixerVolume); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, Audio::Mixer::kMaxMixerVolume); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, Audio::Mixer::kMaxMixerVolume); _mouse = new Mouse(_system, _resMan, _objectMan); _screen = new Screen(_system, _resMan, _objectMan); _music = new Music(_mixer); diff --git a/sword2/controls.cpp b/sword2/controls.cpp index 8f42521696..39a3bca8a7 100644 --- a/sword2/controls.cpp +++ b/sword2/controls.cpp @@ -907,11 +907,11 @@ OptionsDialog::OptionsDialog(Sword2Engine *vm) : Dialog(vm) { _fxSwitch->linkSurfaceImages(_musicSwitch, 516, 250); _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); - _speechSlider = new Slider(this, _panel, SoundMixer::kMaxMixerVolume, 309, 208, 170, 27, volStep, _musicSlider); - _fxSlider = new Slider(this, _panel, SoundMixer::kMaxMixerVolume, 309, 254, 170, 27, volStep, _musicSlider); + _musicSlider = new Slider(this, _panel, Audio::Mixer::kMaxMixerVolume, 309, 161, 170, 27, volStep); + _speechSlider = new Slider(this, _panel, Audio::Mixer::kMaxMixerVolume, 309, 208, 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); _gfxPreview = new Widget(this, 4); @@ -945,9 +945,9 @@ OptionsDialog::OptionsDialog(Sword2Engine *vm) : Dialog(vm) { _speechSwitch->setValue(!_vm->_sound->isSpeechMute()); _fxSwitch->setValue(!_vm->_sound->isFxMute()); - _musicSlider->setValue(_mixer->getVolumeForSoundType(SoundMixer::kMusicSoundType)); - _speechSlider->setValue(_mixer->getVolumeForSoundType(SoundMixer::kSpeechSoundType)); - _fxSlider->setValue(_mixer->getVolumeForSoundType(SoundMixer::kSFXSoundType)); + _musicSlider->setValue(_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType)); + _speechSlider->setValue(_mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType)); + _fxSlider->setValue(_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType)); _gfxSlider->setValue(_vm->_screen->getRenderLevel()); _gfxPreview->setState(_vm->_screen->getRenderLevel()); @@ -997,7 +997,7 @@ void OptionsDialog::onAction(Widget *widget, int result) { if (widget == _musicSwitch) { _vm->_sound->muteMusic(result != 0); } else if (widget == _musicSlider) { - _vm->_mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, result); + _vm->_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, result); _vm->_sound->muteMusic(result == 0); _musicSwitch->setValue(result != 0); } else if (widget == _speechSlider) { @@ -1015,9 +1015,9 @@ void OptionsDialog::onAction(Widget *widget, int result) { _vm->_sound->muteSpeech(!_speechSwitch->getValue()); _vm->_sound->muteFx(!_fxSwitch->getValue()); _vm->_sound->setReverseStereo(_reverseStereoSwitch->getValue()); - _mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, _musicSlider->getValue()); - _mixer->setVolumeForSoundType(SoundMixer::kSpeechSoundType, _speechSlider->getValue()); - _mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, _fxSlider->getValue()); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _musicSlider->getValue()); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, _speechSlider->getValue()); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, _fxSlider->getValue()); _vm->_screen->setRenderLevel(_gfxSlider->getValue()); _vm->writeSettings(); diff --git a/sword2/controls.h b/sword2/controls.h index 986b739961..a2b199e6e2 100644 --- a/sword2/controls.h +++ b/sword2/controls.h @@ -86,7 +86,7 @@ private: Button *_okButton; Button *_cancelButton; - SoundMixer *_mixer; + Audio::Mixer *_mixer; public: OptionsDialog(Sword2Engine *vm); diff --git a/sword2/driver/animation.cpp b/sword2/driver/animation.cpp index 0d9c376ea1..d70397eb4e 100644 --- a/sword2/driver/animation.cpp +++ b/sword2/driver/animation.cpp @@ -183,7 +183,7 @@ int32 MoviePlayer::play(const char *filename, MovieTextObject *text[], int32 lea 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; @@ -248,7 +248,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte * uint frameCounter = 0, textCounter = 0; SoundHandle handle; bool skipCutscene = false, textVisible = false; - uint32 flags = SoundMixer::FLAG_16BITS; + uint32 flags = Audio::Mixer::FLAG_16BITS; bool startNextText = false; byte oldPal[256 * 4]; @@ -271,7 +271,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte * _vm->_screen->updateDisplay(); #ifndef SCUMM_BIG_ENDIAN - flags |= SoundMixer::FLAG_LITTLE_ENDIAN; + flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN; #endif while (!skipCutscene && anim->decodeFrame()) { @@ -307,7 +307,7 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte * frameCounter++; 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; while (_sys->pollEvent(event)) { @@ -456,10 +456,10 @@ void MoviePlayer::playDummy(const char *filename, MovieTextObject *text[], byte bool skipCutscene = false; - uint32 flags = SoundMixer::FLAG_16BITS; + uint32 flags = Audio::Mixer::FLAG_16BITS; #ifndef SCUMM_BIG_ENDIAN - flags |= SoundMixer::FLAG_LITTLE_ENDIAN; + flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN; #endif while (1) { @@ -527,7 +527,7 @@ void MoviePlayer::playDummy(const char *filename, MovieTextObject *text[], byte // subtitles. 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); } diff --git a/sword2/driver/animation.h b/sword2/driver/animation.h index ae9495dc57..b2d0332281 100644 --- a/sword2/driver/animation.h +++ b/sword2/driver/animation.h @@ -73,7 +73,7 @@ struct MovieInfo { class MoviePlayer { private: Sword2Engine *_vm; - SoundMixer *_snd; + Audio::Mixer *_snd; OSystem *_sys; byte *_textSurface; diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 7a792417b6..fd8e7e8671 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -643,7 +643,7 @@ void Sound::muteSpeech(bool mute) { _speechMuted = mute; if (_vm->_mixer->isSoundHandleActive(_soundHandleSpeech)) { - uint volume = mute ? 0 : SoundMixer::kMaxChannelVolume; + uint volume = mute ? 0 : Audio::Mixer::kMaxChannelVolume; _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 - byte volume = _speechMuted ? 0 : vol * SoundMixer::kMaxChannelVolume / 16; + byte volume = _speechMuted ? 0 : vol * Audio::Mixer::kMaxChannelVolume / 16; int8 p = (pan * 127) / 16; if (isReverseStereo()) p = -p; // 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; } @@ -810,7 +810,7 @@ int32 Sound::setFxIdVolumePan(int32 id, int vol, int pan) { if (vol > 16) vol = 16; - _fxQueue[id].volume = (vol * SoundMixer::kMaxChannelVolume) / 16; + _fxQueue[id].volume = (vol * Audio::Mixer::kMaxChannelVolume) / 16; if (pan != 255) { if (isReverseStereo()) diff --git a/sword2/sound.cpp b/sword2/sound.cpp index 738f470f23..67ac46388d 100644 --- a/sword2/sound.cpp +++ b/sword2/sound.cpp @@ -81,7 +81,7 @@ Sound::Sound(Sword2Engine *vm) { _mixBuffer = NULL; _mixBufferLen = 0; - _vm->_mixer->setupPremix(this, SoundMixer::kMusicSoundType); + _vm->_mixer->setupPremix(this, Audio::Mixer::kMusicSoundType); } Sound::~Sound() { @@ -220,7 +220,7 @@ void Sound::queueFx(int32 res, int32 type, int32 delay, int32 volume, int32 pan) delay *= 12; } - volume = (volume * SoundMixer::kMaxChannelVolume) / 16; + volume = (volume * Audio::Mixer::kMaxChannelVolume) / 16; pan = (pan * 127) / 16; if (isReverseStereo()) @@ -247,10 +247,10 @@ void Sound::queueFx(int32 res, int32 type, int32 delay, int32 volume, int32 pan) } 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) return RD_OK; @@ -267,10 +267,10 @@ int32 Sound::playFx(SoundHandle *handle, byte *data, uint32 len, uint8 vol, int8 } if (isReverseStereo()) - flags |= SoundMixer::FLAG_REVERSE_STEREO; + flags |= Audio::Mixer::FLAG_REVERSE_STEREO; 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); return RD_OK; diff --git a/sword2/sound.h b/sword2/sound.h index 1866ec1225..f717aab33d 100644 --- a/sword2/sound.h +++ b/sword2/sound.h @@ -253,7 +253,7 @@ public: void queueFx(int32 res, int32 type, int32 delay, int32 volume, int32 pan); 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 setFxIdVolumePan(int32 id, int vol, int pan = 255); diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index 0f64db936d..1e2858cd0f 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -188,9 +188,9 @@ void Sword2Engine::registerDefaultSettings() { } void Sword2Engine::readSettings() { - _mixer->setVolumeForSoundType(SoundMixer::kMusicSoundType, ConfMan.getInt("music_volume")); - _mixer->setVolumeForSoundType(SoundMixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); - _mixer->setVolumeForSoundType(SoundMixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, ConfMan.getInt("speech_volume")); + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); setSubtitles(ConfMan.getBool("subtitles")); _sound->muteMusic(ConfMan.getBool("music_mute")); _sound->muteSpeech(ConfMan.getBool("speech_mute")); @@ -201,9 +201,9 @@ void Sword2Engine::readSettings() { } void Sword2Engine::writeSettings() { - ConfMan.set("music_volume", _mixer->getVolumeForSoundType(SoundMixer::kMusicSoundType)); - ConfMan.set("speech_volume", _mixer->getVolumeForSoundType(SoundMixer::kSpeechSoundType)); - ConfMan.set("sfx_volume", _mixer->getVolumeForSoundType(SoundMixer::kSFXSoundType)); + ConfMan.set("music_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType)); + ConfMan.set("speech_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kSpeechSoundType)); + ConfMan.set("sfx_volume", _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType)); ConfMan.set("music_mute", _sound->isMusicMute()); ConfMan.set("speech_mute", _sound->isSpeechMute()); ConfMan.set("sfx_mute", _sound->isFxMute()); |