diff options
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) | |||
153 | 153 | ||
154 | void play_hop(int direction) | 154 | void play_hop(int direction) |
155 | { | 155 | { |
156 | if(!wps_state.id3 || !wps_state.id3->length | 156 | unsigned step = ((unsigned)global_settings.skip_length*1000); |
157 | || global_settings.skip_length == 0) | 157 | unsigned long *elapsed = &(wps_state.id3->elapsed); |
158 | return; | 158 | |
159 | #define STEP ((unsigned)global_settings.skip_length*1000) | 159 | if (direction == 1 && wps_state.id3->length - *elapsed < step+1000) { |
160 | if(direction == 1 | ||
161 | && wps_state.id3->length - wps_state.id3->elapsed < STEP+1000) { | ||
162 | #if CONFIG_CODEC == SWCODEC | 160 | #if CONFIG_CODEC == SWCODEC |
163 | if(global_settings.beep) | 161 | if(global_settings.beep) |
164 | pcmbuf_beep(1000, 150, 1500*global_settings.beep); | 162 | pcmbuf_beep(1000, 150, 1500*global_settings.beep); |
165 | #endif | 163 | #endif |
166 | return; | 164 | return; |
165 | } else if ((direction == -1 && *elapsed < step)) { | ||
166 | *elapsed = 0; | ||
167 | } else { | ||
168 | *elapsed += step * direction; | ||
167 | } | 169 | } |
168 | if((direction == -1 && wps_state.id3->elapsed < STEP)) | ||
169 | wps_state.id3->elapsed = 0; | ||
170 | else | ||
171 | wps_state.id3->elapsed += STEP *direction; | ||
172 | if((audio_status() & AUDIO_STATUS_PLAY) && !wps_state.paused) { | 170 | if((audio_status() & AUDIO_STATUS_PLAY) && !wps_state.paused) { |
173 | #if (CONFIG_CODEC == SWCODEC) | 171 | #if (CONFIG_CODEC == SWCODEC) |
174 | audio_pre_ff_rewind(); | 172 | audio_pre_ff_rewind(); |
@@ -176,12 +174,11 @@ void play_hop(int direction) | |||
176 | audio_pause(); | 174 | audio_pause(); |
177 | #endif | 175 | #endif |
178 | } | 176 | } |
179 | audio_ff_rewind(wps_state.id3->elapsed); | 177 | audio_ff_rewind(*elapsed); |
180 | #if (CONFIG_CODEC != SWCODEC) | 178 | #if (CONFIG_CODEC != SWCODEC) |
181 | if (!wps_state.paused) | 179 | if (!wps_state.paused) |
182 | audio_resume(); | 180 | audio_resume(); |
183 | #endif | 181 | #endif |
184 | #undef STEP | ||
185 | } | 182 | } |
186 | 183 | ||
187 | bool ffwd_rew(int button) | 184 | bool ffwd_rew(int button) |
@@ -2190,4 +2187,3 @@ bool gui_wps_refresh(struct gui_wps *gwps, | |||
2190 | viewportmanager_draw_statusbars(NULL); | 2187 | viewportmanager_draw_statusbars(NULL); |
2191 | return true; | 2188 | return true; |
2192 | } | 2189 | } |
2193 | |||