From 574a7924df26d9ebb072c6cd582442f4e29a5213 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 1 Feb 2009 20:35:51 +0000 Subject: Implemented per voice volume control. (Used for example in LoL intro) svn-id: r36184 --- engines/kyra/kyra_hof.cpp | 2 +- engines/kyra/script_tim.cpp | 2 +- engines/kyra/sound.cpp | 4 ++-- engines/kyra/sound.h | 11 ++++++----- engines/kyra/sound_towns.cpp | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) (limited to 'engines') diff --git a/engines/kyra/kyra_hof.cpp b/engines/kyra/kyra_hof.cpp index 9875a17491..00c630d3d4 100644 --- a/engines/kyra/kyra_hof.cpp +++ b/engines/kyra/kyra_hof.cpp @@ -1530,7 +1530,7 @@ void KyraEngine_HoF::snd_playSoundEffect(int track, int volume) { int16 vocIndex = (int16)READ_LE_UINT16(&_ingameSoundIndex[track * 2]); if (vocIndex != -1) { - _sound->voicePlay(_ingameSoundList[vocIndex], true); + _sound->voicePlay(_ingameSoundList[vocIndex], 255, true); } else if (_flags.platform == Common::kPlatformPC) { if (_sound->getSfxType() == Sound::kMidiMT32) track = track < _mt32SfxMapSize ? _mt32SfxMap[track] - 1 : -1; diff --git a/engines/kyra/script_tim.cpp b/engines/kyra/script_tim.cpp index 3df1daf306..d9d5e186fb 100644 --- a/engines/kyra/script_tim.cpp +++ b/engines/kyra/script_tim.cpp @@ -683,7 +683,7 @@ int TIMInterpreter::cmd_playVocFile(const uint16 *param) { const int volume = (param[1] * 255) / 100; if (index < ARRAYSIZE(_vocFiles) && !_vocFiles[index].empty()) - _vm->sound()->voicePlay(_vocFiles[index].c_str()/*, volume*/, true); + _vm->sound()->voicePlay(_vocFiles[index].c_str(), volume, true); else _vm->snd_playSoundEffect(index, volume); diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index 487e0cfc07..197d2cd2dd 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -66,7 +66,7 @@ bool Sound::voiceFileIsPresent(const char *file) { return false; } -int32 Sound::voicePlay(const char *file, bool isSfx) { +int32 Sound::voicePlay(const char *file, uint8 volume, bool isSfx) { char filenamebuffer[25]; int h = 0; @@ -110,7 +110,7 @@ int32 Sound::voicePlay(const char *file, bool isSfx) { } _soundChannels[h].file = file; - _mixer->playInputStream(isSfx ? Audio::Mixer::kSFXSoundType : Audio::Mixer::kSpeechSoundType, &_soundChannels[h].channelHandle, audioStream); + _mixer->playInputStream(isSfx ? Audio::Mixer::kSFXSoundType : Audio::Mixer::kSpeechSoundType, &_soundChannels[h].channelHandle, audioStream, -1, volume); return audioStream->getTotalPlayTime(); } diff --git a/engines/kyra/sound.h b/engines/kyra/sound.h index db344e7825..6f6a088b8b 100644 --- a/engines/kyra/sound.h +++ b/engines/kyra/sound.h @@ -190,11 +190,12 @@ public: * TODO: add support for queueing voice * files * - * @param file file to be played - * @param isSfx marks file as sfx instead of voice + * @param file file to be played + * @param volume volume of the voice file + * @param isSfx marks file as sfx instead of voice * @return playtime of the voice file (-1 marks unknown playtime) */ - virtual int32 voicePlay(const char *file, bool isSfx = false); + virtual int32 voicePlay(const char *file, uint8 volume = 255, bool isSfx = false); /** * Queues the specified voice files in an AppendableAudioStream @@ -455,7 +456,7 @@ public: void haltTrack(); void beginFadeOut(); - int32 voicePlay(const char *file, bool isSfx = false) { return -1; } + int32 voicePlay(const char *file, uint8 volume = 255, bool isSfx = false) { return -1; } void playSoundEffect(uint8); protected: @@ -482,7 +483,7 @@ public: void haltTrack(); void beginFadeOut(); - int32 voicePlay(const char *file, bool isSfx = false); + int32 voicePlay(const char *file, uint8 volume = 255, bool isSfx = false); void playSoundEffect(uint8 track); protected: diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp index 8ccbc736f3..712a3b16f8 100644 --- a/engines/kyra/sound_towns.cpp +++ b/engines/kyra/sound_towns.cpp @@ -4206,7 +4206,7 @@ void SoundTownsPC98_v2::beginFadeOut() { haltTrack(); } -int32 SoundTownsPC98_v2::voicePlay(const char *file, bool) { +int32 SoundTownsPC98_v2::voicePlay(const char *file, uint8, bool) { static const uint16 rates[] = { 0x10E1, 0x0CA9, 0x0870, 0x0654, 0x0438, 0x032A, 0x021C, 0x0194 }; int h = 0; -- cgit v1.2.3