From a99fe80d4b721e7e8745c6fd0c9d8b75205bba6b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Mon, 29 Jul 2002 16:12:15 +0000 Subject: fixed imuse volume bug introduced recently by me and painelf - iMuse internally does require the 0-127 change svn-id: r4677 --- sound/imuse.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'sound') diff --git a/sound/imuse.cpp b/sound/imuse.cpp index 200a1ab008..8490f20b20 100644 --- a/sound/imuse.cpp +++ b/sound/imuse.cpp @@ -400,6 +400,8 @@ private: void lock(); void unlock(); + int set_master_volume_intern(uint vol); + public: Part *parts_ptr() { return _parts; @@ -1264,13 +1266,8 @@ int IMuseInternal::set_music_volume(uint vol) return 0; } -int IMuseInternal::set_master_volume(uint vol) +int IMuseInternal::set_master_volume_intern(uint vol) { - int i; - - // recalibrate from 0-256 range - vol = vol * 127 / 256; - if (vol > 127) return -1; @@ -1278,12 +1275,21 @@ int IMuseInternal::set_master_volume(uint vol) vol = vol * _music_volume / 128; _master_volume = vol; - for (i = 0; i != 8; i++) + for (int i = 0; i != 8; i++) _channel_volume_eff[i] = (_channel_volume[i] + 1) * vol >> 7; update_volumes(); + return 0; } +int IMuseInternal::set_master_volume(uint vol) +{ + // recalibrate from 0-256 range + vol = vol * 127 / 256; + + return set_master_volume_intern(vol); +} + int IMuseInternal::get_master_volume() { // recalibrate to 0-256 range @@ -1334,9 +1340,9 @@ int32 IMuseInternal::do_command(int a, int b, int c, int d, int e, int f, int g, if (param == 0) { switch (cmd) { case 6: - return set_master_volume(b); + return set_master_volume_intern(b); case 7: - return get_master_volume(); + return _master_volume; case 8: return start_sound(b) ? 0 : -1; case 9: -- cgit v1.2.3