aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorLionel Ulmer2002-05-03 19:47:51 +0000
committerLionel Ulmer2002-05-03 19:47:51 +0000
commitfe54e1caec7f50d5312816af6fb12d46050ca028 (patch)
tree0f4436dd8b0374a219c48da85dfbcbd00c118ea4 /sound
parent25800dabc379d6ff494e2c35c3b469745e78a022 (diff)
downloadscummvm-rg350-fe54e1caec7f50d5312816af6fb12d46050ca028.tar.gz
scummvm-rg350-fe54e1caec7f50d5312816af6fb12d46050ca028.tar.bz2
scummvm-rg350-fe54e1caec7f50d5312816af6fb12d46050ca028.zip
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. svn-id: r4184
Diffstat (limited to 'sound')
-rw-r--r--sound/mixer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 5b0be93ee4..e332b22103 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -291,6 +291,7 @@ static inline int scale_sample(mad_fixed_t sample)
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 @@ void SoundMixer::Channel_MP3::mix(int16 *data, uint len) {
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 @@ void SoundMixer::Channel_MP3_CDMUSIC::mix(int16 *data, uint len) {
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 @@ void SoundMixer::Channel_MP3_CDMUSIC::mix(int16 *data, uint len) {
// 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++;
}