diff options
-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; } |