[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.19,1.20
Lionel Ulmer
bbrox at users.sourceforge.net
Fri May 3 12:48:03 CEST 2002
Update of /cvsroot/scummvm/scummvm/sound
In directory usw-pr-cvs1:/tmp/cvs-serv20547/sound
Modified Files:
mixer.cpp
Log Message:
Remove floating point in the MP3 volume control (baaaaaaaad on PDAs
like the iPAQ where no FPU is present). Instead replace it by a '32
level' volume control.
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mixer.cpp 1 May 2002 22:22:22 -0000 1.19
+++ mixer.cpp 3 May 2002 19:47:51 -0000 1.20
@@ -291,6 +291,7 @@
void SoundMixer::Channel_MP3::mix(int16 *data, uint len) {
mad_fixed_t const *ch;
const int16 *vol_tab = _mixer->_volume_table;
+ unsigned char volume = ((int) vol_tab[1]) * 32 / 255;
if (_to_be_destroyed) {
real_destroy();
@@ -303,7 +304,7 @@
if (_silence_cut > 0) {
_silence_cut--;
} else {
- *data++ += (int16)((float)scale_sample(*ch++) * ((float)vol_tab[1] / (float)128));
+ *data++ += (int16) ((scale_sample(*ch++) * volume) / 32);
len--;
}
_pos_in_frame++;
@@ -369,6 +370,7 @@
mad_fixed_t const *ch;
mad_timer_t frame_duration;
const int16 *vol_tab = _mixer->_volume_table;
+ unsigned char volume = ((int) vol_tab[1]) * 32 / 255;
if (_to_be_destroyed) {
real_destroy();
@@ -420,7 +422,7 @@
// Get samples, play samples ...
ch = _synth.pcm.samples[0] + _pos_in_frame;
while ((_pos_in_frame < _synth.pcm.length) && (len > 0)) {
- *data++ += (int16)((float)scale_sample(*ch++) * ((float)vol_tab[1] / (float)128));
+ *data++ += (int16) ((scale_sample(*ch++) * volume) / 32);
len--;
_pos_in_frame++;
}
More information about the Scummvm-git-logs
mailing list