aboutsummaryrefslogtreecommitdiff
path: root/sword1/sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sword1/sound.cpp')
-rw-r--r--sword1/sound.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/sword1/sound.cpp b/sword1/sound.cpp
index 31e6851f1a..026c6eb954 100644
--- a/sword1/sound.cpp
+++ b/sword1/sound.cpp
@@ -36,12 +36,7 @@ SwordSound::SwordSound(const char *searchPath, SoundMixer *mixer, ResMan *pResMa
_cowHeader = NULL;
_endOfQueue = 0;
_currentCowFile = 0;
- _speechVol = _sfxVol = 192;
-}
-
-void SwordSound::setVolume(uint8 sfxVol, uint8 speechVol) {
- _sfxVol = sfxVol;
- _speechVol = speechVol;
+ _speechVolL = _speechVolR = _sfxVolL = _sfxVolR = 192;
}
int SwordSound::addToQueue(int32 fxNo) {
@@ -140,11 +135,10 @@ void SwordSound::playSample(QueueElement *elem) {
if ((_fxList[elem->id].roomVolList[cnt].roomNo == (int)SwordLogic::_scriptVars[SCREEN]) ||
(_fxList[elem->id].roomVolList[cnt].roomNo == -1)) {
- uint8 volL = _fxList[elem->id].roomVolList[cnt].leftVol * 10;
- uint8 volR = _fxList[elem->id].roomVolList[cnt].rightVol * 10;
+ uint8 volL = (_fxList[elem->id].roomVolList[cnt].leftVol * 10 * _sfxVolL) / 255;
+ uint8 volR = (_fxList[elem->id].roomVolList[cnt].rightVol * 10 * _sfxVolR) / 255;
int8 pan = (volR - volL) / 2;
uint8 volume = (volR + volL) / 2;
- volume = (volume * _sfxVol) >> 8;
uint32 size = READ_LE_UINT32(sampleData + 0x28);
uint8 flags;
if (READ_LE_UINT16(sampleData + 0x22) == 16)
@@ -173,8 +167,10 @@ bool SwordSound::startSpeech(uint16 roomNo, uint16 localNo) {
if (sampleSize) {
uint32 size;
int16 *data = uncompressSpeech(index + _cowHeaderSize, sampleSize, &size);
+ uint8 speechVol = (_speechVolR + _speechVolL) / 2;
+ int8 speechPan = (_speechVolR - _speechVolL) / 2;
if (data)
- _mixer->playRaw(&_speechHandle, data, size, 11025, SPEECH_FLAGS, SOUND_SPEECH_ID, _speechVol);
+ _mixer->playRaw(&_speechHandle, data, size, 11025, SPEECH_FLAGS, SOUND_SPEECH_ID, speechVol, speechPan);
return true;
} else
return false;