1
0
Fork 0
forked from len0rd/rockbox

Move play_hop() to gwps.c and make it static. It's the only file that calls it.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20306 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-03-12 18:50:24 +00:00
parent 23722d5ff4
commit 74aba34b58
3 changed files with 32 additions and 32 deletions

View file

@ -62,7 +62,6 @@
#endif
#include "backdrop.h"
#include "viewport.h"
#include "pcmbuf.h"
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
/* 3% of 30min file == 54s step size */
@ -151,36 +150,6 @@ bool update_onvol_change(struct gui_wps * gwps)
return false;
}
void play_hop(int direction)
{
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((audio_status() & AUDIO_STATUS_PLAY) && !wps_state.paused) {
#if (CONFIG_CODEC == SWCODEC)
audio_pre_ff_rewind();
#else
audio_pause();
#endif
}
audio_ff_rewind(*elapsed);
#if (CONFIG_CODEC != SWCODEC)
if (!wps_state.paused)
audio_resume();
#endif
}
bool ffwd_rew(int button)
{
unsigned int step = 0; /* current ff/rewind step */

View file

@ -29,7 +29,6 @@ void fade(bool fade_in, bool updatewps);
bool gui_wps_display(void);
bool update_onvol_change(struct gui_wps * gwps);
bool update(struct gui_wps *gwps);
void play_hop(int direction);
bool ffwd_rew(int button);
void display_keylock_text(bool locked);

View file

@ -63,6 +63,7 @@
#include "pitchscreen.h"
#include "appevents.h"
#include "viewport.h"
#include "pcmbuf.h"
/* currently only one wps_state is needed */
struct wps_state wps_state;
@ -115,6 +116,37 @@ static void next_track(void)
audio_next();
}
static void play_hop(int direction)
{
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((audio_status() & AUDIO_STATUS_PLAY) && !wps_state.paused) {
#if (CONFIG_CODEC == SWCODEC)
audio_pre_ff_rewind();
#else
audio_pause();
#endif
}
audio_ff_rewind(*elapsed);
#if (CONFIG_CODEC != SWCODEC)
if (!wps_state.paused)
audio_resume();
#endif
}
static int fix_wps_bars(void)
{
#ifdef HAVE_LCD_BITMAP