diff options
author | Johannes Schickel | 2008-04-17 17:57:16 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-04-17 17:57:16 +0000 |
commit | eb2ffce2fd3b5903d6fa29c67b9f97a5d6d85cb9 (patch) | |
tree | 226b03af639fd57fca6482be7c6dc93978d896bf /engines/kyra | |
parent | 0f34c16c1ea22b0e1591e8a9aa555a8a10daaafc (diff) | |
download | scummvm-rg350-eb2ffce2fd3b5903d6fa29c67b9f97a5d6d85cb9.tar.gz scummvm-rg350-eb2ffce2fd3b5903d6fa29c67b9f97a5d6d85cb9.tar.bz2 scummvm-rg350-eb2ffce2fd3b5903d6fa29c67b9f97a5d6d85cb9.zip |
Implemented volume handling for SFX.
svn-id: r31548
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/kyra_v3.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/sound.h | 4 | ||||
-rw-r--r-- | engines/kyra/sound_digital.cpp | 14 |
3 files changed, 12 insertions, 12 deletions
diff --git a/engines/kyra/kyra_v3.cpp b/engines/kyra/kyra_v3.cpp index 8b66955ffe..b8116a7cf6 100644 --- a/engines/kyra/kyra_v3.cpp +++ b/engines/kyra/kyra_v3.cpp @@ -386,15 +386,15 @@ void KyraEngine_v3::fadeOutMusic(int ticks) { } } -void KyraEngine_v3::playSoundEffect(uint32 item, int priority) { - debugC(9, kDebugLevelMain, "KyraEngine_v3::playSoundEffect(%d, %d)", item, priority); +void KyraEngine_v3::playSoundEffect(uint32 item, int volume) { + debugC(9, kDebugLevelMain, "KyraEngine_v3::playSoundEffect(%d, %d)", item, volume); if (_sfxFileMap[item*2+0] != 0xFF) { char filename[16]; snprintf(filename, 16, "%s.AUD", _sfxFileList[_sfxFileMap[item*2+0]]); Common::SeekableReadStream *stream = _res->getFileStream(filename); if (stream) - _soundDigital->playSound(stream, SoundDigital::kSoundTypeSfx); + _soundDigital->playSound(stream, SoundDigital::kSoundTypeSfx, volume); } } diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index 0ccca114de..fb70d6dcf1 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -516,13 +516,13 @@ public: * @param stream Data stream used for playback * It will be deleted when playback is finished * @param type type + * @param volume channel volume * @param loop true if the sound should loop (endlessly) - * @param fadeIn true if the sound should be faded in volume wise * @param channel tell the sound player to use a specific channel for playback * * @return channel playing the sound */ - int playSound(Common::SeekableReadStream *stream, kSoundTypes type, bool loop = false, bool fadeIn = false, int channel = -1); + int playSound(Common::SeekableReadStream *stream, kSoundTypes type, int volume = 255, bool loop = false, int channel = -1); /** * Checks if a given channel is playing a sound. diff --git a/engines/kyra/sound_digital.cpp b/engines/kyra/sound_digital.cpp index f6c3090df2..ca9f8ff58a 100644 --- a/engines/kyra/sound_digital.cpp +++ b/engines/kyra/sound_digital.cpp @@ -328,7 +328,7 @@ SoundDigital::~SoundDigital() { stopSound(i); } -int SoundDigital::playSound(Common::SeekableReadStream *stream, kSoundTypes type, bool loop, bool fadeIn, int channel) { +int SoundDigital::playSound(Common::SeekableReadStream *stream, kSoundTypes type, int volume, bool loop, int channel) { Sound *use = 0; if (channel != -1 && channel < ARRAYSIZE(_sounds)) { stopSound(channel); @@ -357,16 +357,16 @@ int SoundDigital::playSound(Common::SeekableReadStream *stream, kSoundTypes type return -1; } - // Just guessed - if (fadeIn) - use->stream->beginFadeIn(60 * _vm->tickLength()); + if (volume > 255) + volume = 255; + volume = (volume * Audio::Mixer::kMaxChannelVolume) / 255; if (type == kSoundTypeMusic) - _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &use->handle, use->stream); + _mixer->playInputStream(Audio::Mixer::kMusicSoundType, &use->handle, use->stream, -1, volume); else if (type == kSoundTypeSfx) - _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &use->handle, use->stream); + _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &use->handle, use->stream, -1, volume); else if (type == kSoundTypeSpeech) - _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &use->handle, use->stream); + _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &use->handle, use->stream, -1, volume); return use - _sounds; } |