[Scummvm-cvs-logs] SF.net SVN: scummvm: [31548] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Thu Apr 17 19:57:20 CEST 2008
Revision: 31548
http://scummvm.svn.sourceforge.net/scummvm/?rev=31548&view=rev
Author: lordhoto
Date: 2008-04-17 10:57:16 -0700 (Thu, 17 Apr 2008)
Log Message:
-----------
Implemented volume handling for SFX.
Modified Paths:
--------------
scummvm/trunk/engines/kyra/kyra_v3.cpp
scummvm/trunk/engines/kyra/sound.h
scummvm/trunk/engines/kyra/sound_digital.cpp
Modified: scummvm/trunk/engines/kyra/kyra_v3.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v3.cpp 2008-04-17 17:49:18 UTC (rev 31547)
+++ scummvm/trunk/engines/kyra/kyra_v3.cpp 2008-04-17 17:57:16 UTC (rev 31548)
@@ -386,15 +386,15 @@
}
}
-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);
}
}
Modified: scummvm/trunk/engines/kyra/sound.h
===================================================================
--- scummvm/trunk/engines/kyra/sound.h 2008-04-17 17:49:18 UTC (rev 31547)
+++ scummvm/trunk/engines/kyra/sound.h 2008-04-17 17:57:16 UTC (rev 31548)
@@ -516,13 +516,13 @@
* @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.
Modified: scummvm/trunk/engines/kyra/sound_digital.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_digital.cpp 2008-04-17 17:49:18 UTC (rev 31547)
+++ scummvm/trunk/engines/kyra/sound_digital.cpp 2008-04-17 17:57:16 UTC (rev 31548)
@@ -328,7 +328,7 @@
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 @@
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;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list