Ooops, forgot to adjust 'fade on stop/pause' to dB volume. Sorry for any unpleasant noises.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8200 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-12-08 08:38:19 +00:00
parent a4a92c378f
commit e4b3ce6cb6

View file

@ -1066,34 +1066,35 @@ static void format_display(struct gui_wps *gwps, char* buf,
/* fades the volume */ /* fades the volume */
void fade(bool fade_in) void fade(bool fade_in)
{ {
unsigned fp_global_vol = global_settings.volume << 8; int fp_global_vol = global_settings.volume << 8;
unsigned fp_step = fp_global_vol / 30; int fp_min_vol = sound_min(SOUND_VOLUME) << 8;
int fp_step = (fp_global_vol - fp_min_vol) / 30;
if (fade_in) { if (fade_in) {
/* fade in */ /* fade in */
unsigned fp_volume = 0; int fp_volume = fp_min_vol;
/* zero out the sound */ /* zero out the sound */
sound_set_volume(0); sound_set_volume(fp_min_vol >> 8);
sleep(HZ/10); /* let audio thread run */ sleep(HZ/10); /* let audio thread run */
audio_resume(); audio_resume();
while (fp_volume < fp_global_vol) { while (fp_volume < fp_global_vol - fp_step) {
fp_volume += fp_step; fp_volume += fp_step;
sleep(1);
sound_set_volume(fp_volume >> 8); sound_set_volume(fp_volume >> 8);
sleep(1);
} }
sound_set_volume(global_settings.volume); sound_set_volume(global_settings.volume);
} }
else { else {
/* fade out */ /* fade out */
unsigned fp_volume = fp_global_vol; int fp_volume = fp_global_vol;
while (fp_volume > fp_step) { while (fp_volume > fp_min_vol + fp_step) {
fp_volume -= fp_step; fp_volume -= fp_step;
sleep(1);
sound_set_volume(fp_volume >> 8); sound_set_volume(fp_volume >> 8);
sleep(1);
} }
audio_pause(); audio_pause();
#ifndef SIMULATOR #ifndef SIMULATOR