FS#10014 - Separate tracklocking out of skip length, skip length prevented to skip tracks. This is a seperate setting now. tracks can still change during normal playback (i.e. a song ends).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20553 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-03-27 13:53:29 +00:00
parent e95d33b35e
commit 62f3e95945
5 changed files with 58 additions and 29 deletions

View file

@ -79,10 +79,14 @@ static void wps_state_init(void);
static void prev_track(unsigned skip_thresh)
{
if (!wps_state.id3 || (wps_state.id3->elapsed < skip_thresh*1000)) {
if (!global_settings.prevent_skip
&& (wps_state.id3->elapsed < skip_thresh*1000))
{
audio_prev();
return;
}
else {
else
{
if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
{
curr_cuesheet_skip(-1, wps_state.id3->elapsed);
@ -107,6 +111,8 @@ static void prev_track(unsigned skip_thresh)
static void next_track(void)
{
if (global_settings.prevent_skip)
return;
/* take care of if we're playing a cuesheet */
if (cuesheet_is_enabled() && wps_state.id3->cuesheet_type)
{
@ -125,19 +131,37 @@ static void play_hop(int direction)
{
unsigned step = ((unsigned)global_settings.skip_length*1000);
unsigned long *elapsed = &(wps_state.id3->elapsed);
bool prevent_skip = global_settings.prevent_skip;
if (direction == 1 && wps_state.id3->length - *elapsed < step+1000) {
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);
if (prevent_skip)
{
if(global_settings.beep)
pcmbuf_beep(1000, 150, 1500*global_settings.beep);
}
else
#endif
next_track();
return;
} else if ((direction == -1 && *elapsed < step)) {
*elapsed = 0;
} else {
}
else if ((direction == -1 && *elapsed < step))
{
if (!prevent_skip)
{
prev_track(3);
return;
}
else
*elapsed = 0;
}
else
{
*elapsed += step * direction;
}
if((audio_status() & AUDIO_STATUS_PLAY) && !wps_state.paused) {
if((audio_status() & AUDIO_STATUS_PLAY) && !wps_state.paused)
{
#if (CONFIG_CODEC == SWCODEC)
audio_pre_ff_rewind();
#else
@ -421,8 +445,7 @@ long gui_wps_show(void)
}
break;
/* fast forward
OR next dir if this is straight after ACTION_WPS_SKIPNEXT
OR if skip length set, next track if straight after SKIPPREV. */
OR next dir if this is straight after ACTION_WPS_SKIPNEXT */
case ACTION_WPS_SEEKFWD:
if (global_settings.party_mode)
break;
@ -438,18 +461,12 @@ long gui_wps_show(void)
audio_next_dir();
}
}
else if (global_settings.skip_length > 0
&& current_tick -last_left < HZ) {
next_track();
update_track = true;
}
else ffwd_rew(ACTION_WPS_SEEKFWD);
else
ffwd_rew(ACTION_WPS_SEEKFWD);
last_right = last_left = 0;
break;
/* fast rewind
OR prev dir if this is straight after ACTION_WPS_SKIPPREV,
OR if skip length set, beg of track or prev track if this is
straight after SKIPPREV */
OR prev dir if this is straight after ACTION_WPS_SKIPPREV,*/
case ACTION_WPS_SEEKBACK:
if (global_settings.party_mode)
break;
@ -471,13 +488,8 @@ long gui_wps_show(void)
audio_prev_dir();
}
}
else if (global_settings.skip_length > 0
&& current_tick -last_right < HZ)
{
prev_track(3+global_settings.skip_length);
update_track = true;
}
else ffwd_rew(ACTION_WPS_SEEKBACK);
else
ffwd_rew(ACTION_WPS_SEEKBACK);
last_left = last_right = 0;
break;

View file

@ -12453,4 +12453,18 @@
*: none
touchscreen: "Absolute Point"
</voice>
</phrase>
</phrase>
<phrase>
id: LANG_PREVENT_SKIPPING
desc: in Settings -> Playback Settings
user: core
<source>
*: "Prevent Skipping"
</source>
<dest>
*: "Prevent Skipping"
</dest>
<voice>
*: "Prevent Skipping"
</voice>
</phrase>

View file

@ -176,6 +176,7 @@ MAKE_MENU(unplug_menu, ID2P(LANG_HEADPHONE_UNPLUG), 0, Icon_NOICON,
#endif
MENUITEM_SETTING(skip_length, &global_settings.skip_length, NULL);
MENUITEM_SETTING(prevent_skip, &global_settings.prevent_skip, NULL);
MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
Icon_Playback_menu,
@ -197,7 +198,7 @@ MAKE_MENU(playback_settings,ID2P(LANG_PLAYBACK),0,
#ifdef HAVE_HEADPHONE_DETECTION
,&unplug_menu
#endif
,&skip_length
,&skip_length, &prevent_skip,
);
static int playback_callback(int action,const struct menu_item_ex *this_item)

View file

@ -725,6 +725,7 @@ struct user_settings
#ifdef HAVE_SPEAKER
bool speaker_enabled;
#endif
bool prevent_skip;
#ifdef HAVE_TOUCHSCREEN
int touch_mode;

View file

@ -1467,6 +1467,7 @@ const struct settings_list settings[] = {
"touchscreen mode", "point,grid", NULL, 2,
ID2P(LANG_TOUCHSCREEN_POINT), ID2P(LANG_TOUCHSCREEN_GRID)),
#endif
OFFON_SETTING(0, prevent_skip, LANG_PREVENT_SKIPPING, false, "prevent_skip", NULL),
};
const int nb_settings = sizeof(settings)/sizeof(*settings);