diff options
author | James Brown | 2002-03-05 23:37:31 +0000 |
---|---|---|
committer | James Brown | 2002-03-05 23:37:31 +0000 |
commit | 8d6efb265f1d38599d80eebe80570b5bfba944f8 (patch) | |
tree | 114af9022be8af61aa19aa2b8e26f4cc9dd9c38b | |
parent | 6600b48be93a44a97f85de7d223c52ffa1225bf2 (diff) | |
download | scummvm-rg350-8d6efb265f1d38599d80eebe80570b5bfba944f8.tar.gz scummvm-rg350-8d6efb265f1d38599d80eebe80570b5bfba944f8.tar.bz2 scummvm-rg350-8d6efb265f1d38599d80eebe80570b5bfba944f8.zip |
Adding music volume control.
svn-id: r3657
-rw-r--r-- | sound.h | 6 | ||||
-rw-r--r-- | sound/imuse.cpp | 21 |
2 files changed, 27 insertions, 0 deletions
@@ -17,6 +17,9 @@ * * Change Log: * $Log$ + * Revision 1.4 2002/03/05 23:37:31 ender + * Adding music volume control. + * * Revision 1.3 2001/12/01 17:25:36 strigeus * fixed to compile on unix * @@ -469,6 +472,7 @@ private: byte _queue_marker; byte _queue_cleared; byte _master_volume; + byte _music_volume; /* Global music volume. Percantage */ uint16 _trigger_count; @@ -531,6 +535,8 @@ public: int initialize(Scumm *scumm, SoundDriver *driver); int terminate(); int save_or_load(Serializer *ser); + int set_music_volume(uint vol); + int get_music_volume(); int set_master_volume(uint vol); int get_master_volume(); bool start_sound(int sound); 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; |