diff options
| author | Jens Arnold <amiconn@rockbox.org> | 2005-05-13 00:16:14 +0000 |
|---|---|---|
| committer | Jens Arnold <amiconn@rockbox.org> | 2005-05-13 00:16:14 +0000 |
| commit | 03d08ecc250ee095f46a77848bde28f162493276 (patch) | |
| tree | 2076b2d4ce8551be8ae47fcfb577250bb16cdca8 /apps | |
| parent | 61aa15969cce7a40ecac5243998ffe05129502b0 (diff) | |
| download | rockbox-03d08ecc250ee095f46a77848bde28f162493276.zip rockbox-03d08ecc250ee095f46a77848bde28f162493276.tar.gz rockbox-03d08ecc250ee095f46a77848bde28f162493276.tar.bz2 rockbox-03d08ecc250ee095f46a77848bde28f162493276.tar.xz | |
(1) Wait for the MAS to run out of buffered data on fade out. Fixes bug #778930/#1189756. (2) Fade in/out from/to zero. (3) Always fade in 30 steps, independent of the global volume.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6463 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/wps.c | 27 |
1 files changed, 16 insertions, 11 deletions
@@ -384,34 +384,39 @@ static bool update(void) static void fade(bool fade_in) { + unsigned fp_global_vol = global_settings.volume << 8; + unsigned fp_step = fp_global_vol / 30; + if (fade_in) { /* fade in */ - int current_volume = 20; - + unsigned fp_volume = 0; + /* zero out the sound */ - sound_set(SOUND_VOLUME, current_volume); + sound_set(SOUND_VOLUME, 0); sleep(HZ/10); /* let audio thread run */ audio_resume(); - while (current_volume < global_settings.volume) { - current_volume += 2; + while (fp_volume < fp_global_vol) { + fp_volume += fp_step; sleep(1); - sound_set(SOUND_VOLUME, current_volume); + sound_set(SOUND_VOLUME, fp_volume >> 8); } sound_set(SOUND_VOLUME, global_settings.volume); } else { /* fade out */ - int current_volume = global_settings.volume; + unsigned fp_volume = fp_global_vol; - while (current_volume > 20) { - current_volume -= 2; + while (fp_volume > fp_step) { + fp_volume -= fp_step; sleep(1); - sound_set(SOUND_VOLUME, current_volume); + sound_set(SOUND_VOLUME, fp_volume >> 8); } audio_pause(); - sleep(HZ/5); /* let audio thread run */ + /* let audio thread run and wait for the mas to run out of data */ + while (!mp3_pause_done()) + sleep(HZ/10); /* reset volume to what it was before the fade */ sound_set(SOUND_VOLUME, global_settings.volume); |