diff options
author | Robert Göffringmann | 2004-01-07 17:47:46 +0000 |
---|---|---|
committer | Robert Göffringmann | 2004-01-07 17:47:46 +0000 |
commit | 8030f1b1483da8a96b7b8ff6bab246ffd3faad38 (patch) | |
tree | d8b6fc6bde1de078f6bd8fc69308620059d0f584 /sword1/sound.cpp | |
parent | c46d2f05304b1b871df549bba9b2aed0656b7c44 (diff) | |
download | scummvm-rg350-8030f1b1483da8a96b7b8ff6bab246ffd3faad38.tar.gz scummvm-rg350-8030f1b1483da8a96b7b8ff6bab246ffd3faad38.tar.bz2 scummvm-rg350-8030f1b1483da8a96b7b8ff6bab246ffd3faad38.zip |
implemented volume control panel
svn-id: r12220
Diffstat (limited to 'sword1/sound.cpp')
-rw-r--r-- | sword1/sound.cpp | 16 |
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; |