Implemented per voice volume control. (Used for example in LoL intro)

svn-id: r36184
This commit is contained in:
Johannes Schickel 2009-02-01 20:35:51 +00:00
parent 90184e6812
commit 574a7924df
5 changed files with 11 additions and 10 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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();
}

View file

@ -191,10 +191,11 @@ public:
* files
*
* @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:

View file

@ -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;