aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2002-07-28 14:56:43 +0000
committerMax Horn2002-07-28 14:56:43 +0000
commita17dcb3ed6b12603384cbdf6b79e06f9e7f61523 (patch)
tree3317255e0494500a629d81a8c044b5390a6680f0
parent027ef33b6b1f6e47274fc641e754d2f42d826e61 (diff)
downloadscummvm-rg350-a17dcb3ed6b12603384cbdf6b79e06f9e7f61523.tar.gz
scummvm-rg350-a17dcb3ed6b12603384cbdf6b79e06f9e7f61523.tar.bz2
scummvm-rg350-a17dcb3ed6b12603384cbdf6b79e06f9e7f61523.zip
fixed volume ranges
svn-id: r4668
-rw-r--r--gui.cpp41
1 files changed, 9 insertions, 32 deletions
diff --git a/gui.cpp b/gui.cpp
index 8603bfa316..2b6b7362ed 100644
--- a/gui.cpp
+++ b/gui.cpp
@@ -601,34 +601,9 @@ void Gui::handleSoundDialogCommand(int cmd)
if (cmd == 50) {
close();
} else if (cmd == 40) {
- // FIXME - slider ranges are 0-100, yet the volumes use different ones.
- // We want to fix this, ideally by simply converting the GUI value
- // range 0-100 to the 'real' ranges and back (for maximal backward
- // compatibility). However, this is not easy, in fact with the current
- // system it is impossible. For a quick overview, read this:
- //
- // Music volume range: 1-100
- // iMUSE master volume range: 0-128
- // Mixer master volume range: 0-256
- // SFX volume range: 0-256
- //
- // Correct, the master volume range of iMUSE and the mixer don't match!
- // Since both are steered by _sound_volume_master, we are screwed.
- // This is really a big mess and sadly is not the only case of similar
- // issues. The almost complete lack of any documentation (and I am not
- // very demanding, I even count comments as docs) are not helping us
- // either.
- //
- // Somebody (me if I have the time) should fix this by rewriting all
- // the functions to take a nice range like 0-255 or 0-256. And while
- // (s)he is at it, HiFi equipment uses logarithmic volume controls
- // (not linear ones as we do) since they match the human ear better.
-
- // The * 256 / 100 is a quick recalibration hack, it will go
- // away when we move to newgui
- _s->_sound_volume_master = _gui_variables[0] * 255 / 100; // Master
- _s->_sound_volume_music = _gui_variables[1] * 255 / 100; // Music
- _s->_sound_volume_sfx = _gui_variables[2] * 255 / 100; // SFX
+ _s->_sound_volume_master = _gui_variables[0]; // Master
+ _s->_sound_volume_music = _gui_variables[1]; // Music
+ _s->_sound_volume_sfx = _gui_variables[2]; // SFX
_s->_imuse->set_music_volume(_s->_sound_volume_music);
_s->_imuse->set_master_volume(_s->_sound_volume_master);
@@ -643,11 +618,13 @@ void Gui::handleSoundDialogCommand(int cmd)
close();
} else {
if ((cmd % 10) == 1) {
- if (_gui_variables[cmd / 10] < 100)
- _gui_variables[cmd / 10] += 5;
+ _gui_variables[cmd / 10] += 5;
+ if (_gui_variables[cmd / 10] > 256)
+ _gui_variables[cmd / 10] = 256;
} else {
- if (_gui_variables[cmd / 10] > 0)
- _gui_variables[cmd / 10] -= 5;
+ _gui_variables[cmd / 10] -= 5;
+ if (_gui_variables[cmd / 10] < 0)
+ _gui_variables[cmd / 10] = 0;
}
draw((cmd / 10) * 10 + 3, (cmd / 10) * 10 + 3);