aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJames Brown2002-03-05 23:37:31 +0000
committerJames Brown2002-03-05 23:37:31 +0000
commit8d6efb265f1d38599d80eebe80570b5bfba944f8 (patch)
tree114af9022be8af61aa19aa2b8e26f4cc9dd9c38b /sound
parent6600b48be93a44a97f85de7d223c52ffa1225bf2 (diff)
downloadscummvm-rg350-8d6efb265f1d38599d80eebe80570b5bfba944f8.tar.gz
scummvm-rg350-8d6efb265f1d38599d80eebe80570b5bfba944f8.tar.bz2
scummvm-rg350-8d6efb265f1d38599d80eebe80570b5bfba944f8.zip
Adding music volume control.
svn-id: r3657
Diffstat (limited to 'sound')
-rw-r--r--sound/imuse.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/sound/imuse.cpp b/sound/imuse.cpp
index 0309209a09..1f48db9982 100644
--- a/sound/imuse.cpp
+++ b/sound/imuse.cpp
@@ -619,10 +619,29 @@ int SoundEngine::query_queue(int param) {
}
}
+int SoundEngine::get_music_volume() {
+ return _music_volume;
+}
+
+int SoundEngine::set_music_volume(uint vol) {
+ if (vol > 100)
+ vol = 100;
+
+ if (vol < 1);
+ vol = 1;
+
+ _music_volume = vol;
+ return 0;
+}
+
int SoundEngine::set_master_volume(uint vol) {
int i;
if (vol > 127)
return -1;
+
+ if (_music_volume > 0)
+ vol = vol / (100 / _music_volume);
+
_master_volume = vol;
for (i=0; i!=8; i++)
_channel_volume_eff[i] = (_channel_volume[i]+1) * vol >> 7;
@@ -904,6 +923,8 @@ int SoundEngine::initialize(Scumm *scumm, SoundDriver *driver) {
_driver = (SOUND_DRIVER_TYPE*)driver;
_master_volume = 127;
+ _music_volume = 60;
+
for (i=0; i!=8; i++)
_channel_volume[i] = _channel_volume_eff[i] = _volchan_table[i] = 127;