[Scummvm-cvs-logs] CVS: scummvm/sound imuse.cpp,1.40,1.41 mixer.cpp,1.40,1.41
Max Horn
fingolfin at users.sourceforge.net
Sun Jul 28 08:04:04 CEST 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm scumm.h,1.191,1.192 sound.cpp,1.116,1.117 scummvm.cpp,1.193,1.194 gameDetector.cpp,1.79,1.80
- Next message: [Scummvm-cvs-logs] CVS: scummvm/morphos Makefile,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv17618/sound
Modified Files:
imuse.cpp mixer.cpp
Log Message:
added constants for the default volumes; changed the volume ranges from 0-255 to 0-256
Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/imuse.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- imuse.cpp 26 Jul 2002 00:41:07 -0000 1.40
+++ imuse.cpp 28 Jul 2002 15:03:45 -0000 1.41
@@ -342,8 +342,8 @@
byte _queue_marker;
byte _queue_cleared;
- byte _master_volume;
- byte _music_volume; /* Global music volume. Percantage */
+ byte _master_volume; /* Master volume. 0-127 */
+ byte _music_volume; /* Global music volume. 0-128 */
uint16 _trigger_count;
@@ -1250,20 +1250,17 @@
int IMuseInternal::get_music_volume()
{
- return _music_volume;
+ return _music_volume * 2;
}
int IMuseInternal::set_music_volume(uint vol)
{
- // recalibrate from 0-255 range
- vol = vol * 100 / 255;
-
- if (vol > 100)
- vol = 100;
- else if (vol < 1)
- vol = 1;
+ if (vol > 256)
+ vol = 256;
+ else if (vol < 0)
+ vol = 0;
- _music_volume = vol;
+ _music_volume = vol / 2;
return 0;
}
@@ -1271,14 +1268,14 @@
{
int i;
- // recalibrate from 0-255 range
- vol = vol * 127 / 255;
+ // recalibrate from 0-256 range
+ vol = vol * 127 / 256;
if (vol > 127)
return -1;
if (_music_volume > 0)
- vol = vol / (100 / _music_volume);
+ vol = vol * _music_volume / 128;
_master_volume = vol;
for (i = 0; i != 8; i++)
@@ -1289,7 +1286,8 @@
int IMuseInternal::get_master_volume()
{
- return _master_volume;
+ // recalibrate to 0-256 range
+ return _master_volume * 256 / 127;
}
int IMuseInternal::terminate()
@@ -1637,7 +1635,7 @@
_master_volume = 127;
if (_music_volume < 1)
- _music_volume = 60;
+ _music_volume = kDefaultMusicVolume;
for (i = 0; i != 8; i++)
_channel_volume[i] = _channel_volume_eff[i] = _volchan_table[i] = 127;
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- mixer.cpp 27 Jul 2002 13:16:32 -0000 1.40
+++ mixer.cpp 28 Jul 2002 15:03:45 -0000 1.41
@@ -195,12 +195,24 @@
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 @@
{
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();
- Previous message: [Scummvm-cvs-logs] CVS: scummvm scumm.h,1.191,1.192 sound.cpp,1.116,1.117 scummvm.cpp,1.193,1.194 gameDetector.cpp,1.79,1.80
- Next message: [Scummvm-cvs-logs] CVS: scummvm/morphos Makefile,1.7,1.8
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list