diff options
author | Marisa-Chan | 2015-01-23 16:25:21 +0600 |
---|---|---|
committer | Marisa-Chan | 2015-01-23 16:25:21 +0600 |
commit | 0bc61d3c2130981e06199b60fe553b2095af287a (patch) | |
tree | e4e9bd95de27980e1e308bf8db8f1d51c8a1df10 /engines/zvision/scripting/effects | |
parent | ad2ab98474cecc8f8764697b3aa2acc16912368f (diff) | |
download | scummvm-rg350-0bc61d3c2130981e06199b60fe553b2095af287a.tar.gz scummvm-rg350-0bc61d3c2130981e06199b60fe553b2095af287a.tar.bz2 scummvm-rg350-0bc61d3c2130981e06199b60fe553b2095af287a.zip |
ZVISION: Volume is not linear value, use dB map to linear for -100...0dB
Diffstat (limited to 'engines/zvision/scripting/effects')
-rw-r--r-- | engines/zvision/scripting/effects/music_effect.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/engines/zvision/scripting/effects/music_effect.cpp b/engines/zvision/scripting/effects/music_effect.cpp index 6c1a5f7376..ee2232d962 100644 --- a/engines/zvision/scripting/effects/music_effect.cpp +++ b/engines/zvision/scripting/effects/music_effect.cpp @@ -36,6 +36,24 @@ namespace ZVision { +static const uint8 dbMapLinear[256] = +{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, +2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, +4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, +8, 8, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 12, 13, 13, 14, +14, 15, 15, 16, 16, 17, 18, 18, 19, 20, 21, 21, 22, 23, 24, 25, +26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 40, 41, 43, 45, +46, 48, 50, 52, 53, 55, 57, 60, 62, 64, 67, 69, 72, 74, 77, 80, +83, 86, 89, 92, 96, 99, 103, 107, 111, 115, 119, 123, 128, 133, 137, 143, +148, 153, 159, 165, 171, 177, 184, 191, 198, 205, 212, 220, 228, 237, 245, 255}; + MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool loop, uint8 volume) : MusicNodeBASE(engine, key, SCRIPTING_EFFECT_AUDIO) { _loop = loop; @@ -65,9 +83,9 @@ MusicNode::MusicNode(ZVision *engine, uint32 key, Common::String &filename, bool if (_loop) { Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES); - _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_handle, loopingAudioStream, -1, _volume); + _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_handle, loopingAudioStream, -1, dbMapLinear[_volume]); } else { - _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_handle, audioStream, -1, _volume); + _engine->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_handle, audioStream, -1, dbMapLinear[_volume]); } if (_key != StateKey_NotSet) @@ -148,7 +166,7 @@ void MusicNode::setVolume(uint8 newVolume) { if (_deltaVolume >= _volume) _engine->_mixer->setChannelVolume(_handle, 0); else - _engine->_mixer->setChannelVolume(_handle, _volume - _deltaVolume); + _engine->_mixer->setChannelVolume(_handle, dbMapLinear[_volume - _deltaVolume]); } uint8 MusicNode::getVolume() { |