diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-02-24 18:07:42 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-02-24 18:07:42 +0000 |
commit | 22b9eb424503c14799bf21f0a1bcd990ccb91a4b (patch) | |
tree | 1e4a879e49be8680fb1fe46a41d92ee5fbc9157b /apps | |
parent | fcbfef81751b1b4e387918c41c38a1f5fe904a9a (diff) | |
download | rockbox-22b9eb424503c14799bf21f0a1bcd990ccb91a4b.tar.gz rockbox-22b9eb424503c14799bf21f0a1bcd990ccb91a4b.zip |
Cleanup play_hop() slightly and remove redundant/uneeded checks, reclaim a tiny bit of binsize
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20097 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gui/gwps-common.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 0d788769bb..b43c357408 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -153,22 +153,20 @@ bool update_onvol_change(struct gui_wps * gwps) void play_hop(int direction) { - if(!wps_state.id3 || !wps_state.id3->length - || global_settings.skip_length == 0) - return; -#define STEP ((unsigned)global_settings.skip_length*1000) - if(direction == 1 - && wps_state.id3->length - wps_state.id3->elapsed < STEP+1000) { + unsigned step = ((unsigned)global_settings.skip_length*1000); + unsigned long *elapsed = &(wps_state.id3->elapsed); + + if (direction == 1 && wps_state.id3->length - *elapsed < step+1000) { #if CONFIG_CODEC == SWCODEC if(global_settings.beep) pcmbuf_beep(1000, 150, 1500*global_settings.beep); #endif return; + } else if ((direction == -1 && *elapsed < step)) { + *elapsed = 0; + } else { + *elapsed += step * direction; } - if((direction == -1 && wps_state.id3->elapsed < STEP)) - wps_state.id3->elapsed = 0; - else - wps_state.id3->elapsed += STEP *direction; if((audio_status() & AUDIO_STATUS_PLAY) && !wps_state.paused) { #if (CONFIG_CODEC == SWCODEC) audio_pre_ff_rewind(); @@ -176,12 +174,11 @@ void play_hop(int direction) audio_pause(); #endif } - audio_ff_rewind(wps_state.id3->elapsed); + audio_ff_rewind(*elapsed); #if (CONFIG_CODEC != SWCODEC) if (!wps_state.paused) audio_resume(); #endif -#undef STEP } bool ffwd_rew(int button) @@ -2190,4 +2187,3 @@ bool gui_wps_refresh(struct gui_wps *gwps, viewportmanager_draw_statusbars(NULL); return true; } - |