diff options
Diffstat (limited to 'engines/saga/sound.cpp')
-rw-r--r-- | engines/saga/sound.cpp | 47 |
1 files changed, 13 insertions, 34 deletions
diff --git a/engines/saga/sound.cpp b/engines/saga/sound.cpp index 1d41d39cf2..1d3263d302 100644 --- a/engines/saga/sound.cpp +++ b/engines/saga/sound.cpp @@ -22,10 +22,8 @@ * $Id$ * */ - -#include "common/config-manager.h" - #include "saga/saga.h" + #include "saga/sound.h" #include "sound/audiostream.h" @@ -34,13 +32,13 @@ namespace Saga { -Sound::Sound(SagaEngine *vm, Audio::Mixer *mixer) : +Sound::Sound(SagaEngine *vm, Audio::Mixer *mixer, int volume) : _vm(vm), _mixer(mixer), _voxStream(0) { for (int i = 0; i < SOUND_HANDLES; i++) _handles[i].type = kFreeHandle; - setVolume(); + setVolume(volume == 10 ? 255 : volume * 25); } Sound::~Sound() { @@ -63,8 +61,7 @@ SndHandle *Sound::getHandle() { return NULL; } -void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, - sndHandleType handleType, bool loop) { +void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int volume, bool loop) { byte flags; flags = Audio::Mixer::FLAG_AUTOFREE; @@ -84,12 +81,7 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int flags |= Audio::Mixer::FLAG_UNSIGNED; if (!(_vm->getFeatures() & GF_COMPRESSED_SOUNDS)) { - if (handleType == kVoiceHandle) - _mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, - buffer.size, buffer.frequency, flags, -1, volume); - else - _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, - buffer.size, buffer.frequency, flags, -1, volume); + _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); } else { Audio::AudioStream *stream = NULL; MemoryReadStream *tmp = NULL; @@ -124,23 +116,12 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int #endif default: // No compression, play it as raw sound - if (handleType == kVoiceHandle) - _mixer->playRaw(Audio::Mixer::kSpeechSoundType, handle, buffer.buffer, - buffer.size, buffer.frequency, flags, -1, volume); - else - _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, - buffer.size, buffer.frequency, flags, -1, volume); + _mixer->playRaw(Audio::Mixer::kSFXSoundType, handle, buffer.buffer, buffer.size, buffer.frequency, flags, -1, volume); break; } - if (stream != NULL) { - if (handleType == kVoiceHandle) - _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, handle, stream, -1, - volume, 0, true, false); - else - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream, -1, - volume, 0, true, false); - } + if (stream != NULL) + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, stream, -1, volume, 0, true, false); } } @@ -148,7 +129,7 @@ void Sound::playSound(SoundBuffer &buffer, int volume, bool loop) { SndHandle *handle = getHandle(); handle->type = kEffectHandle; - playSoundBuffer(&handle->handle, buffer, 2 * volume, handle->type, loop); + playSoundBuffer(&handle->handle, buffer, 2 * volume, loop); } void Sound::pauseSound() { @@ -175,7 +156,7 @@ void Sound::playVoice(SoundBuffer &buffer) { SndHandle *handle = getHandle(); handle->type = kVoiceHandle; - playSoundBuffer(&handle->handle, buffer, 255, handle->type, false); + playSoundBuffer(&handle->handle, buffer, 255, false); } void Sound::pauseVoice() { @@ -203,11 +184,9 @@ void Sound::stopAll() { stopSound(); } -void Sound::setVolume() { - _vm->_soundVolume = ConfMan.getInt("sound_volume"); - _vm->_speechVolume = ConfMan.getInt("speech_volume"); - _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, _vm->_soundVolume); - _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, _vm->_speechVolume); +void Sound::setVolume(int volume) { + _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume); + _mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, volume); } } // End of namespace Saga |