aboutsummaryrefslogtreecommitdiff
path: root/sound/mixer.cpp
diff options
context:
space:
mode:
authorMax Horn2002-07-28 15:03:45 +0000
committerMax Horn2002-07-28 15:03:45 +0000
commit6dd5de48f91a3c693432723eb083491c0c3d4d74 (patch)
treeeb8a34305616f7cf54e5fd60cc604f721ff87051 /sound/mixer.cpp
parent14cd6ec272c5c854cc8a5990de8f8ba128847b01 (diff)
downloadscummvm-rg350-6dd5de48f91a3c693432723eb083491c0c3d4d74.tar.gz
scummvm-rg350-6dd5de48f91a3c693432723eb083491c0c3d4d74.tar.bz2
scummvm-rg350-6dd5de48f91a3c693432723eb083491c0c3d4d74.zip
added constants for the default volumes; changed the volume ranges from 0-255 to 0-256
svn-id: r4670
Diffstat (limited to 'sound/mixer.cpp')
-rw-r--r--sound/mixer.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 55c612ee29..545b10eb80 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -195,12 +195,24 @@ void SoundMixer::setup_premix(void *param, PremixProc *proc)
void SoundMixer::set_volume(int volume)
{
- for (int i = 0; i != 256; i++)
- _volume_table[i] = ((int8)i) * volume;
+ // Check range
+ if (volume > 256)
+ volume = 256;
+ else if (volume < 0)
+ volume = 0;
+
+ for (int i = 0; i < 256; i++)
+ _volume_table[i] = (i + 1) * volume - 1;
}
void SoundMixer::set_music_volume(int volume)
{
+ // Check range
+ if (volume > 256)
+ volume = 256;
+ else if (volume < 0)
+ volume = 0;
+
_music_volume = volume;
}
@@ -818,7 +830,8 @@ void SoundMixer::Channel_MP3_CDMUSIC::mix(int16 *data, uint len)
{
mad_fixed_t const *ch;
mad_timer_t frame_duration;
- unsigned char volume = _mixer->_music_volume * 32 / 255;
+// unsigned char volume = _mixer->_music_volume * 32 / 255;
+ unsigned char volume = _mixer->_music_volume >> 3;
if (_to_be_destroyed) {
real_destroy();