2005-11-18 09:03:25 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 Jerome Kuptz
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2005-11-18 09:03:25 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2005-11-17 20:20:01 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2006-08-16 13:25:45 +00:00
|
|
|
#include "config.h"
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
#include "system.h"
|
|
|
|
#include "file.h"
|
|
|
|
#include "lcd.h"
|
|
|
|
#include "font.h"
|
|
|
|
#include "backlight.h"
|
2006-08-15 12:27:07 +00:00
|
|
|
#include "action.h"
|
2005-11-17 20:20:01 +00:00
|
|
|
#include "kernel.h"
|
2007-04-18 13:03:01 +00:00
|
|
|
#include "filetypes.h"
|
2005-11-17 20:20:01 +00:00
|
|
|
#include "settings.h"
|
2009-08-03 04:57:43 +00:00
|
|
|
#include "skin_engine/skin_engine.h"
|
2005-11-17 20:20:01 +00:00
|
|
|
#include "audio.h"
|
|
|
|
#include "usb.h"
|
|
|
|
#include "status.h"
|
2008-11-01 16:14:28 +00:00
|
|
|
#include "storage.h"
|
2005-11-17 20:20:01 +00:00
|
|
|
#include "screens.h"
|
|
|
|
#include "playlist.h"
|
|
|
|
#include "icons.h"
|
|
|
|
#include "lang.h"
|
|
|
|
#include "bookmark.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "sound.h"
|
|
|
|
#include "onplay.h"
|
|
|
|
#include "abrepeat.h"
|
|
|
|
#include "playback.h"
|
|
|
|
#include "splash.h"
|
2007-02-14 14:40:24 +00:00
|
|
|
#include "cuesheet.h"
|
2006-11-08 02:23:01 +00:00
|
|
|
#include "ata_idle_notify.h"
|
2007-03-01 11:14:46 +00:00
|
|
|
#include "root_menu.h"
|
2007-04-25 22:08:00 +00:00
|
|
|
#include "backdrop.h"
|
2008-05-03 12:30:40 +00:00
|
|
|
#include "quickscreen.h"
|
2021-10-26 01:05:50 +00:00
|
|
|
#include "shortcuts.h"
|
2008-10-05 13:01:54 +00:00
|
|
|
#include "pitchscreen.h"
|
2008-10-16 10:38:03 +00:00
|
|
|
#include "appevents.h"
|
2009-01-02 01:43:00 +00:00
|
|
|
#include "viewport.h"
|
2009-03-12 18:50:24 +00:00
|
|
|
#include "pcmbuf.h"
|
2009-05-15 05:36:16 +00:00
|
|
|
#include "option_select.h"
|
2009-07-22 22:10:25 +00:00
|
|
|
#include "playlist_viewer.h"
|
2009-08-03 04:57:43 +00:00
|
|
|
#include "wps.h"
|
2009-10-19 15:28:15 +00:00
|
|
|
#include "statusbar-skinned.h"
|
2022-10-02 17:02:27 +00:00
|
|
|
#include "skin_engine/wps_internals.h"
|
2007-04-25 22:08:00 +00:00
|
|
|
|
2009-03-17 01:56:20 +00:00
|
|
|
#define RESTORE_WPS_INSTANTLY 0l
|
|
|
|
#define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick))
|
2009-08-03 22:39:27 +00:00
|
|
|
|
2013-07-12 16:03:20 +00:00
|
|
|
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
|
2009-08-03 22:39:27 +00:00
|
|
|
/* 3% of 30min file == 54s step size */
|
|
|
|
#define MIN_FF_REWIND_STEP 500
|
|
|
|
|
2022-10-02 20:05:32 +00:00
|
|
|
static struct wps_state wps_state;
|
|
|
|
|
2006-12-13 11:52:21 +00:00
|
|
|
/* initial setup of wps_data */
|
|
|
|
static void wps_state_init(void);
|
2014-03-14 22:15:16 +00:00
|
|
|
static void track_info_callback(unsigned short id, void *param);
|
2009-04-14 22:13:29 +00:00
|
|
|
|
2009-08-20 14:29:03 +00:00
|
|
|
#define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
#define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps"
|
|
|
|
#define DEFAULT_WPS(screen) ((screen) == SCREEN_MAIN ? \
|
|
|
|
WPS_DEFAULTCFG:RWPS_DEFAULTCFG)
|
|
|
|
#else
|
|
|
|
#define DEFAULT_WPS(screen) (WPS_DEFAULTCFG)
|
|
|
|
#endif
|
|
|
|
|
2010-09-14 11:56:50 +00:00
|
|
|
char* wps_default_skin(enum screen_type screen)
|
2009-08-03 15:06:30 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
static char *skin_buf[NB_SCREENS] = {
|
2010-01-29 07:52:13 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2010-06-07 03:44:11 +00:00
|
|
|
"%X(d)\n"
|
2010-01-29 07:52:13 +00:00
|
|
|
#endif
|
2009-08-03 22:39:27 +00:00
|
|
|
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
2010-06-07 03:44:11 +00:00
|
|
|
"%s%?ia<%ia|%?d(2)<%d(2)|%(root%)>>\n"
|
|
|
|
"%s%?id<%id|%?d(1)<%d(1)|%(root%)>> %?iy<%(%iy%)|>\n\n"
|
2009-08-03 22:39:27 +00:00
|
|
|
"%al%pc/%pt%ar[%pp:%pe]\n"
|
2010-06-07 03:44:11 +00:00
|
|
|
"%fbkBit %?fv<avg|> %?iv<%(id3v%iv%)|%(no id3%)>\n"
|
2009-08-03 22:39:27 +00:00
|
|
|
"%pb\n%pm\n",
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2010-01-29 07:52:13 +00:00
|
|
|
#if LCD_REMOTE_DEPTH > 1
|
2010-06-07 03:44:11 +00:00
|
|
|
"%X(d)\n"
|
2010-01-29 07:52:13 +00:00
|
|
|
#endif
|
2010-06-07 03:44:11 +00:00
|
|
|
"%s%?ia<%ia|%?d(2)<%d(2)|%(root%)>>\n"
|
2009-08-03 22:39:27 +00:00
|
|
|
"%s%?it<%?in<%in. |>%it|%fn>\n"
|
|
|
|
"%al%pc/%pt%ar[%pp:%pe]\n"
|
2010-06-07 03:44:11 +00:00
|
|
|
"%fbkBit %?fv<avg|> %?iv<%(id3v%iv%)|%(no id3%)>\n"
|
2009-08-03 22:39:27 +00:00
|
|
|
"%pb\n",
|
|
|
|
#endif
|
|
|
|
};
|
2010-09-14 11:56:50 +00:00
|
|
|
return skin_buf[screen];
|
2009-08-03 15:06:30 +00:00
|
|
|
}
|
|
|
|
|
2011-08-23 01:37:59 +00:00
|
|
|
static void update_non_static(void)
|
|
|
|
{
|
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
skin_update(WPS, i, SKIN_REFRESH_NON_STATIC);
|
|
|
|
}
|
|
|
|
|
2022-10-02 18:47:51 +00:00
|
|
|
void pause_action(bool updatewps)
|
2011-05-09 12:59:46 +00:00
|
|
|
{
|
2011-08-23 01:37:59 +00:00
|
|
|
/* Do audio first, then update, unless skin were to use its local
|
|
|
|
status in which case, reverse it */
|
|
|
|
audio_pause();
|
|
|
|
|
|
|
|
if (updatewps)
|
|
|
|
update_non_static();
|
2011-05-13 22:28:47 +00:00
|
|
|
|
|
|
|
if (global_settings.pause_rewind) {
|
|
|
|
long newpos;
|
|
|
|
|
|
|
|
audio_pre_ff_rewind();
|
|
|
|
newpos = audio_current_track()->elapsed
|
|
|
|
- global_settings.pause_rewind * 1000;
|
|
|
|
audio_ff_rewind(newpos > 0 ? newpos : 0);
|
|
|
|
}
|
2011-05-09 12:59:46 +00:00
|
|
|
}
|
|
|
|
|
2022-10-02 18:47:51 +00:00
|
|
|
void unpause_action(bool updatewps)
|
2011-05-09 12:59:46 +00:00
|
|
|
{
|
2011-08-23 01:37:59 +00:00
|
|
|
/* Do audio first, then update, unless skin were to use its local
|
|
|
|
status in which case, reverse it */
|
|
|
|
audio_resume();
|
|
|
|
|
|
|
|
if (updatewps)
|
|
|
|
update_non_static();
|
2013-07-12 16:03:20 +00:00
|
|
|
}
|
2011-05-09 12:59:46 +00:00
|
|
|
|
2010-09-14 11:56:50 +00:00
|
|
|
static bool update_onvol_change(enum screen_type screen)
|
2009-07-27 07:21:05 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_update(WPS, screen, SKIN_REFRESH_NON_STATIC);
|
2009-07-27 07:21:05 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-08-03 15:06:30 +00:00
|
|
|
|
2010-06-21 06:04:19 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2022-10-04 22:22:21 +00:00
|
|
|
static int skintouch_to_wps(void)
|
2010-06-21 06:04:19 +00:00
|
|
|
{
|
|
|
|
int offset = 0;
|
2022-10-02 20:05:32 +00:00
|
|
|
struct wps_state *gstate = get_wps_state();
|
2022-10-04 22:22:21 +00:00
|
|
|
struct gui_wps *gwps = skin_get_gwps(WPS, SCREEN_MAIN);
|
|
|
|
int button = skin_get_touchaction(gwps, &offset);
|
2010-06-21 06:04:19 +00:00
|
|
|
switch (button)
|
|
|
|
{
|
|
|
|
case ACTION_STD_PREV:
|
|
|
|
return ACTION_WPS_SKIPPREV;
|
|
|
|
case ACTION_STD_PREVREPEAT:
|
|
|
|
return ACTION_WPS_SEEKBACK;
|
|
|
|
case ACTION_STD_NEXT:
|
|
|
|
return ACTION_WPS_SKIPNEXT;
|
|
|
|
case ACTION_STD_NEXTREPEAT:
|
|
|
|
return ACTION_WPS_SEEKFWD;
|
|
|
|
case ACTION_STD_MENU:
|
|
|
|
return ACTION_WPS_MENU;
|
|
|
|
case ACTION_STD_CONTEXT:
|
|
|
|
return ACTION_WPS_CONTEXT;
|
|
|
|
case ACTION_STD_QUICKSCREEN:
|
|
|
|
return ACTION_WPS_QUICKSCREEN;
|
2010-06-21 12:14:16 +00:00
|
|
|
#ifdef HAVE_HOTKEY
|
|
|
|
case ACTION_STD_HOTKEY:
|
|
|
|
return ACTION_WPS_HOTKEY;
|
|
|
|
#endif
|
2011-03-27 07:23:38 +00:00
|
|
|
case ACTION_TOUCH_SCROLLBAR:
|
2022-10-02 20:05:32 +00:00
|
|
|
gstate->id3->elapsed = gstate->id3->length*offset/1000;
|
2011-04-27 03:08:23 +00:00
|
|
|
audio_pre_ff_rewind();
|
2022-10-02 20:05:32 +00:00
|
|
|
audio_ff_rewind(gstate->id3->elapsed);
|
2010-06-21 06:04:19 +00:00
|
|
|
return ACTION_TOUCHSCREEN;
|
2011-03-27 07:23:38 +00:00
|
|
|
case ACTION_TOUCH_VOLUME:
|
2010-06-21 06:04:19 +00:00
|
|
|
{
|
|
|
|
const int min_vol = sound_min(SOUND_VOLUME);
|
|
|
|
const int max_vol = sound_max(SOUND_VOLUME);
|
2021-06-16 12:51:09 +00:00
|
|
|
const int step_vol = sound_steps(SOUND_VOLUME);
|
2021-06-16 12:55:35 +00:00
|
|
|
global_settings.volume = (offset * (max_vol - min_vol)) / 1000;
|
2010-06-21 06:04:19 +00:00
|
|
|
global_settings.volume += min_vol;
|
2021-06-16 12:51:09 +00:00
|
|
|
global_settings.volume -= (global_settings.volume % step_vol);
|
2010-06-21 06:04:19 +00:00
|
|
|
setvol();
|
|
|
|
}
|
|
|
|
return ACTION_TOUCHSCREEN;
|
|
|
|
}
|
|
|
|
return button;
|
|
|
|
}
|
2010-07-31 13:41:06 +00:00
|
|
|
#endif /* HAVE_TOUCHSCREEN */
|
2010-06-21 06:04:19 +00:00
|
|
|
|
2022-11-05 18:51:02 +00:00
|
|
|
static bool ffwd_rew(int button, bool seek_from_end)
|
2009-07-27 07:21:05 +00:00
|
|
|
{
|
2013-07-12 16:03:20 +00:00
|
|
|
unsigned int step = 0; /* current ff/rewind step */
|
|
|
|
unsigned int max_step = 0; /* maximum ff/rewind step */
|
2009-07-27 07:21:05 +00:00
|
|
|
int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */
|
|
|
|
int direction = -1; /* forward=1 or backward=-1 */
|
|
|
|
bool exit = false;
|
|
|
|
bool usb = false;
|
2022-10-02 19:42:25 +00:00
|
|
|
bool ff_rewind = false;
|
2009-07-27 07:21:05 +00:00
|
|
|
const long ff_rw_accel = (global_settings.ff_rewind_accel + 3);
|
2022-10-02 20:05:32 +00:00
|
|
|
struct wps_state *gstate = get_wps_state();
|
2022-11-05 18:51:02 +00:00
|
|
|
struct mp3entry *old_id3 = gstate->id3;
|
2009-07-27 07:21:05 +00:00
|
|
|
|
|
|
|
if (button == ACTION_NONE)
|
|
|
|
{
|
|
|
|
status_set_ffmode(0);
|
|
|
|
return usb;
|
|
|
|
}
|
|
|
|
while (!exit)
|
|
|
|
{
|
2022-11-05 18:51:02 +00:00
|
|
|
struct mp3entry *id3 = gstate->id3;
|
|
|
|
if (id3 != old_id3)
|
|
|
|
{
|
|
|
|
ff_rewind = false;
|
|
|
|
ff_rewind_count = 0;
|
|
|
|
old_id3 = id3;
|
|
|
|
}
|
|
|
|
if (id3 && seek_from_end)
|
|
|
|
id3->elapsed = id3->length;
|
|
|
|
|
2009-07-27 07:21:05 +00:00
|
|
|
switch ( button )
|
|
|
|
{
|
|
|
|
case ACTION_WPS_SEEKFWD:
|
|
|
|
direction = 1;
|
2021-07-24 14:39:01 +00:00
|
|
|
/* Fallthrough */
|
2009-07-27 07:21:05 +00:00
|
|
|
case ACTION_WPS_SEEKBACK:
|
2022-10-02 19:42:25 +00:00
|
|
|
if (ff_rewind)
|
2009-07-27 07:21:05 +00:00
|
|
|
{
|
|
|
|
if (direction == 1)
|
|
|
|
{
|
|
|
|
/* fast forwarding, calc max step relative to end */
|
2022-11-05 18:51:02 +00:00
|
|
|
max_step = (id3->length -
|
|
|
|
(id3->elapsed +
|
2009-07-27 07:21:05 +00:00
|
|
|
ff_rewind_count)) *
|
|
|
|
FF_REWIND_MAX_PERCENT / 100;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* rewinding, calc max step relative to start */
|
2022-11-05 18:51:02 +00:00
|
|
|
max_step = (id3->elapsed + ff_rewind_count) *
|
|
|
|
FF_REWIND_MAX_PERCENT / 100;
|
2009-07-27 07:21:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
max_step = MAX(max_step, MIN_FF_REWIND_STEP);
|
|
|
|
|
|
|
|
if (step > max_step)
|
|
|
|
step = max_step;
|
|
|
|
|
|
|
|
ff_rewind_count += step * direction;
|
|
|
|
|
|
|
|
/* smooth seeking by multiplying step by: 1 + (2 ^ -accel) */
|
|
|
|
step += step >> ff_rw_accel;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-11-05 18:51:02 +00:00
|
|
|
if ((audio_status() & AUDIO_STATUS_PLAY) && id3 && id3->length )
|
2009-07-27 07:21:05 +00:00
|
|
|
{
|
2011-04-27 03:08:23 +00:00
|
|
|
audio_pre_ff_rewind();
|
2013-07-12 16:03:20 +00:00
|
|
|
if (direction > 0)
|
2009-07-27 07:21:05 +00:00
|
|
|
status_set_ffmode(STATUS_FASTFORWARD);
|
|
|
|
else
|
|
|
|
status_set_ffmode(STATUS_FASTBACKWARD);
|
|
|
|
|
2022-10-02 19:42:25 +00:00
|
|
|
ff_rewind = true;
|
2009-07-27 07:21:05 +00:00
|
|
|
|
|
|
|
step = 1000 * global_settings.ff_rewind_min_step;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (direction > 0) {
|
2022-11-05 18:51:02 +00:00
|
|
|
if ((id3->elapsed + ff_rewind_count) > id3->length)
|
|
|
|
ff_rewind_count = id3->length - id3->elapsed;
|
2009-07-27 07:21:05 +00:00
|
|
|
}
|
|
|
|
else {
|
2022-11-05 18:51:02 +00:00
|
|
|
if ((int)(id3->elapsed + ff_rewind_count) < 0)
|
|
|
|
ff_rewind_count = -id3->elapsed;
|
2009-07-27 07:21:05 +00:00
|
|
|
}
|
|
|
|
|
2009-08-03 04:57:43 +00:00
|
|
|
/* set the wps state ff_rewind_count so the progess info
|
|
|
|
displays corectly */
|
2022-10-02 20:05:32 +00:00
|
|
|
gstate->ff_rewind_count = ff_rewind_count;
|
2011-01-25 21:40:55 +00:00
|
|
|
|
2009-07-27 07:21:05 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
2009-08-03 04:57:43 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_update(WPS, i,
|
2010-07-29 12:37:48 +00:00
|
|
|
SKIN_REFRESH_PLAYER_PROGRESS |
|
|
|
|
SKIN_REFRESH_DYNAMIC);
|
2009-08-03 04:57:43 +00:00
|
|
|
}
|
2009-07-27 07:21:05 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACTION_WPS_STOPSEEK:
|
2022-11-05 18:51:02 +00:00
|
|
|
id3->elapsed = id3->elapsed + ff_rewind_count;
|
|
|
|
audio_ff_rewind(id3->elapsed);
|
2022-10-02 20:05:32 +00:00
|
|
|
gstate->ff_rewind_count = 0;
|
2022-10-02 19:42:25 +00:00
|
|
|
ff_rewind = false;
|
2009-07-27 07:21:05 +00:00
|
|
|
status_set_ffmode(0);
|
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if(default_event_handler(button) == SYS_USB_CONNECTED) {
|
|
|
|
status_set_ffmode(0);
|
|
|
|
usb = true;
|
|
|
|
exit = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (!exit)
|
|
|
|
{
|
|
|
|
button = get_action(CONTEXT_WPS|ALLOW_SOFTLOCK,TIMEOUT_BLOCK);
|
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
if (button == ACTION_TOUCHSCREEN)
|
2022-10-04 22:22:21 +00:00
|
|
|
button = skintouch_to_wps();
|
2012-02-07 11:06:09 +00:00
|
|
|
#endif
|
2022-11-05 18:51:02 +00:00
|
|
|
if (button != ACTION_WPS_SEEKFWD
|
|
|
|
&& button != ACTION_WPS_SEEKBACK
|
|
|
|
&& button != 0)
|
2010-06-20 13:17:24 +00:00
|
|
|
button = ACTION_WPS_STOPSEEK;
|
2009-08-29 16:25:04 +00:00
|
|
|
}
|
2009-07-27 07:21:05 +00:00
|
|
|
}
|
|
|
|
return usb;
|
|
|
|
}
|
|
|
|
|
2009-04-14 22:13:29 +00:00
|
|
|
#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD)
|
|
|
|
static void gwps_caption_backlight(struct wps_state *state)
|
|
|
|
{
|
2022-10-02 20:05:32 +00:00
|
|
|
if (state->id3)
|
2009-04-14 22:13:29 +00:00
|
|
|
{
|
|
|
|
#ifdef HAVE_BACKLIGHT
|
|
|
|
if (global_settings.caption_backlight)
|
|
|
|
{
|
|
|
|
/* turn on backlight n seconds before track ends, and turn it off n
|
|
|
|
seconds into the new track. n == backlight_timeout, or 5s */
|
|
|
|
int n = global_settings.backlight_timeout * 1000;
|
|
|
|
|
|
|
|
if ( n < 1000 )
|
|
|
|
n = 5000; /* use 5s if backlight is always on or off */
|
|
|
|
|
|
|
|
if (((state->id3->elapsed < 1000) ||
|
|
|
|
((state->id3->length - state->id3->elapsed) < (unsigned)n)) &&
|
|
|
|
(state->paused == false))
|
|
|
|
backlight_on();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
if (global_settings.remote_caption_backlight)
|
|
|
|
{
|
|
|
|
/* turn on remote backlight n seconds before track ends, and turn it
|
|
|
|
off n seconds into the new track. n == remote_backlight_timeout,
|
|
|
|
or 5s */
|
|
|
|
int n = global_settings.remote_backlight_timeout * 1000;
|
|
|
|
|
|
|
|
if ( n < 1000 )
|
|
|
|
n = 5000; /* use 5s if backlight is always on or off */
|
|
|
|
|
|
|
|
if (((state->id3->elapsed < 1000) ||
|
|
|
|
((state->id3->length - state->id3->elapsed) < (unsigned)n)) &&
|
|
|
|
(state->paused == false))
|
|
|
|
remote_backlight_on();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2009-04-04 20:33:38 +00:00
|
|
|
static void change_dir(int direction)
|
|
|
|
{
|
|
|
|
if (global_settings.prevent_skip)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (direction < 0)
|
|
|
|
audio_prev_dir();
|
|
|
|
else if (direction > 0)
|
|
|
|
audio_next_dir();
|
2013-07-12 16:03:20 +00:00
|
|
|
/* prevent the next dir to immediatly start being ffw'd */
|
|
|
|
action_wait_for_release();
|
2009-04-04 20:33:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void prev_track(unsigned long skip_thresh)
|
2008-05-04 13:47:58 +00:00
|
|
|
{
|
2022-10-02 20:05:32 +00:00
|
|
|
struct wps_state *state = get_wps_state();
|
2010-09-14 11:56:50 +00:00
|
|
|
if (state->id3->elapsed < skip_thresh)
|
2009-03-27 13:53:29 +00:00
|
|
|
{
|
2008-05-04 13:47:58 +00:00
|
|
|
audio_prev();
|
2009-03-27 13:53:29 +00:00
|
|
|
return;
|
2008-05-04 13:47:58 +00:00
|
|
|
}
|
2009-03-27 13:53:29 +00:00
|
|
|
else
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
if (state->id3->cuesheet)
|
2008-05-04 13:47:58 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
curr_cuesheet_skip(state->id3->cuesheet, -1, state->id3->elapsed);
|
2008-05-04 13:47:58 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-04-27 03:08:23 +00:00
|
|
|
audio_pre_ff_rewind();
|
2008-05-04 13:47:58 +00:00
|
|
|
audio_ff_rewind(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-08 20:37:26 +00:00
|
|
|
static void next_track(void)
|
2008-05-04 13:47:58 +00:00
|
|
|
{
|
2022-10-02 20:05:32 +00:00
|
|
|
struct wps_state *state = get_wps_state();
|
2008-05-04 13:47:58 +00:00
|
|
|
/* take care of if we're playing a cuesheet */
|
2010-09-14 11:56:50 +00:00
|
|
|
if (state->id3->cuesheet)
|
2008-05-04 13:47:58 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
if (curr_cuesheet_skip(state->id3->cuesheet, 1, state->id3->elapsed))
|
2008-05-04 13:47:58 +00:00
|
|
|
{
|
|
|
|
/* if the result was false, then we really want
|
|
|
|
to skip to the next track */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
audio_next();
|
|
|
|
}
|
2009-03-12 18:50:24 +00:00
|
|
|
|
|
|
|
static void play_hop(int direction)
|
|
|
|
{
|
2022-10-02 20:05:32 +00:00
|
|
|
struct wps_state *state = get_wps_state();
|
2012-01-30 20:21:41 +00:00
|
|
|
struct cuesheet *cue = state->id3->cuesheet;
|
2009-10-17 16:05:23 +00:00
|
|
|
long step = global_settings.skip_length*1000;
|
2010-09-14 11:56:50 +00:00
|
|
|
long elapsed = state->id3->elapsed;
|
|
|
|
long remaining = state->id3->length - elapsed;
|
2009-03-12 18:50:24 +00:00
|
|
|
|
2012-01-30 20:21:41 +00:00
|
|
|
/* if cuesheet is active, then we want the current tracks end instead of
|
|
|
|
* the total end */
|
|
|
|
if (cue && (cue->curr_track_idx+1 < cue->track_count))
|
|
|
|
{
|
|
|
|
int next = cue->curr_track_idx+1;
|
|
|
|
struct cue_track_info *t = &cue->tracks[next];
|
|
|
|
remaining = t->offset - elapsed;
|
|
|
|
}
|
|
|
|
|
2009-10-17 16:05:23 +00:00
|
|
|
if (step < 0)
|
|
|
|
{
|
|
|
|
if (direction < 0)
|
|
|
|
{
|
2022-10-02 18:45:20 +00:00
|
|
|
prev_track(DEFAULT_SKIP_THRESH);
|
2009-10-17 16:05:23 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-10-02 18:45:20 +00:00
|
|
|
else if (remaining < DEFAULT_SKIP_THRESH*2)
|
2009-10-17 16:05:23 +00:00
|
|
|
{
|
|
|
|
next_track();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
2022-10-02 18:45:20 +00:00
|
|
|
elapsed += (remaining - DEFAULT_SKIP_THRESH*2);
|
2009-10-17 16:05:23 +00:00
|
|
|
}
|
|
|
|
else if (!global_settings.prevent_skip &&
|
2009-04-05 19:29:21 +00:00
|
|
|
(!step ||
|
|
|
|
(direction > 0 && step >= remaining) ||
|
2022-10-02 18:45:20 +00:00
|
|
|
(direction < 0 && elapsed < DEFAULT_SKIP_THRESH)))
|
2009-04-04 20:33:38 +00:00
|
|
|
{ /* Do normal track skipping */
|
|
|
|
if (direction > 0)
|
2009-03-27 13:57:56 +00:00
|
|
|
next_track();
|
2009-04-04 20:33:38 +00:00
|
|
|
else if (direction < 0)
|
2022-10-02 18:45:20 +00:00
|
|
|
prev_track(DEFAULT_SKIP_THRESH);
|
2009-04-04 20:33:38 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-10-17 16:05:23 +00:00
|
|
|
else if (direction == 1 && step >= remaining)
|
2009-04-04 20:33:38 +00:00
|
|
|
{
|
2011-07-08 22:31:15 +00:00
|
|
|
system_sound_play(SOUND_TRACK_NO_MORE);
|
2009-03-12 18:50:24 +00:00
|
|
|
return;
|
2009-03-27 13:53:29 +00:00
|
|
|
}
|
2012-05-07 03:10:19 +00:00
|
|
|
else if (direction == -1 && elapsed < step)
|
2009-03-27 13:53:29 +00:00
|
|
|
{
|
2009-04-04 20:33:38 +00:00
|
|
|
elapsed = 0;
|
2009-03-27 13:53:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-04-04 20:33:38 +00:00
|
|
|
elapsed += step * direction;
|
2009-03-12 18:50:24 +00:00
|
|
|
}
|
2011-04-27 03:08:23 +00:00
|
|
|
if(audio_status() & AUDIO_STATUS_PLAY)
|
2009-03-27 13:53:29 +00:00
|
|
|
{
|
2009-03-12 18:50:24 +00:00
|
|
|
audio_pre_ff_rewind();
|
|
|
|
}
|
2011-04-27 03:08:23 +00:00
|
|
|
|
|
|
|
audio_ff_rewind(elapsed);
|
2009-03-12 18:50:24 +00:00
|
|
|
}
|
|
|
|
|
2009-02-01 13:43:08 +00:00
|
|
|
|
2009-04-09 08:30:05 +00:00
|
|
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
|
|
|
/*
|
|
|
|
* If the user is unable to see the wps, because the display is deactivated,
|
2009-07-10 16:27:24 +00:00
|
|
|
* we suppress updates until the wps is activated again (the lcd driver will
|
2009-04-25 19:23:40 +00:00
|
|
|
* call this hook to issue an instant update)
|
2009-04-09 08:30:05 +00:00
|
|
|
* */
|
2014-03-14 22:15:16 +00:00
|
|
|
static void wps_lcd_activation_hook(unsigned short id, void *param)
|
2009-04-09 08:30:05 +00:00
|
|
|
{
|
2014-03-14 22:15:16 +00:00
|
|
|
(void)id;
|
2009-10-20 21:54:59 +00:00
|
|
|
(void)param;
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_request_full_update(WPS);
|
2009-04-09 08:30:05 +00:00
|
|
|
/* force timeout in wps main loop, so that the update is instantly */
|
|
|
|
queue_post(&button_queue, BUTTON_NONE, 0);
|
|
|
|
}
|
|
|
|
#endif
|
2009-03-17 01:39:20 +00:00
|
|
|
|
2009-03-17 01:56:20 +00:00
|
|
|
static void gwps_leave_wps(void)
|
|
|
|
{
|
2009-03-19 23:04:39 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
2009-08-06 00:14:40 +00:00
|
|
|
{
|
2022-10-04 22:22:21 +00:00
|
|
|
struct gui_wps *gwps = skin_get_gwps(WPS, i);
|
|
|
|
gwps->display->scroll_stop();
|
2011-11-19 13:46:25 +00:00
|
|
|
#ifdef HAVE_BACKDROP_IMAGE
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_backdrop_show(sb_get_backdrop(i));
|
2010-02-08 09:47:08 +00:00
|
|
|
#endif
|
2022-10-04 22:22:21 +00:00
|
|
|
viewportmanager_theme_undo(i, skin_has_sbs(gwps));
|
2009-08-06 00:14:40 +00:00
|
|
|
}
|
2009-03-17 01:56:20 +00:00
|
|
|
|
2009-04-09 08:30:05 +00:00
|
|
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
|
|
|
/* Play safe and unregister the hook */
|
2009-10-20 21:54:59 +00:00
|
|
|
remove_event(LCD_EVENT_ACTIVATION, wps_lcd_activation_hook);
|
2009-04-09 08:30:05 +00:00
|
|
|
#endif
|
2009-10-19 15:28:15 +00:00
|
|
|
/* unhandle statusbar update delay */
|
|
|
|
sb_skin_set_update_delay(DEFAULT_UPDATE_DELAY);
|
2010-08-04 12:00:18 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
touchscreen_set_mode(global_settings.touch_mode);
|
|
|
|
#endif
|
2009-03-17 01:56:20 +00:00
|
|
|
}
|
|
|
|
|
2009-11-16 01:38:30 +00:00
|
|
|
/*
|
|
|
|
* display the wps on entering or restoring */
|
|
|
|
static void gwps_enter_wps(void)
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
struct gui_wps *gwps;
|
|
|
|
struct screen *display;
|
2009-11-16 01:38:30 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
gwps = skin_get_gwps(WPS, i);
|
|
|
|
display = gwps->display;
|
2013-04-03 14:33:23 +00:00
|
|
|
display->scroll_stop();
|
2022-10-04 22:22:21 +00:00
|
|
|
viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL);
|
2009-11-16 01:38:30 +00:00
|
|
|
|
|
|
|
/* Update the values in the first (default) viewport - in case the user
|
|
|
|
has modified the statusbar or colour settings */
|
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
if (display->depth > 1)
|
|
|
|
{
|
2013-07-12 16:03:20 +00:00
|
|
|
struct skin_viewport *svp = skin_find_item(VP_DEFAULT_LABEL_STRING,
|
2011-03-07 12:45:45 +00:00
|
|
|
SKIN_FIND_VP, gwps->data);
|
2010-08-10 14:15:03 +00:00
|
|
|
if (svp)
|
|
|
|
{
|
|
|
|
struct viewport *vp = &svp->vp;
|
|
|
|
vp->fg_pattern = display->get_foreground();
|
|
|
|
vp->bg_pattern = display->get_background();
|
|
|
|
}
|
2009-11-16 01:38:30 +00:00
|
|
|
}
|
2010-01-27 06:47:56 +00:00
|
|
|
#endif
|
2010-01-26 21:29:08 +00:00
|
|
|
/* make the backdrop actually take effect */
|
2011-11-19 13:46:25 +00:00
|
|
|
#ifdef HAVE_BACKDROP_IMAGE
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_backdrop_show(gwps->data->backdrop_id);
|
2010-02-08 22:34:04 +00:00
|
|
|
#endif
|
2010-01-26 21:29:08 +00:00
|
|
|
display->clear_display();
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_update(WPS, i, SKIN_REFRESH_ALL);
|
2010-02-24 06:19:25 +00:00
|
|
|
|
2010-08-04 12:00:18 +00:00
|
|
|
}
|
2010-02-24 06:19:25 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2010-09-14 11:56:50 +00:00
|
|
|
gwps = skin_get_gwps(WPS, SCREEN_MAIN);
|
2022-10-04 22:22:21 +00:00
|
|
|
skin_disarm_touchregions(gwps);
|
2011-12-06 10:30:13 +00:00
|
|
|
if (gwps->data->touchregions < 0)
|
2010-08-04 12:00:18 +00:00
|
|
|
touchscreen_set_mode(TOUCHSCREEN_BUTTON);
|
2010-02-24 06:19:25 +00:00
|
|
|
#endif
|
2010-01-26 21:29:08 +00:00
|
|
|
/* force statusbar/skin update since we just cleared the whole screen */
|
|
|
|
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1);
|
2009-11-16 01:38:30 +00:00
|
|
|
}
|
|
|
|
|
2011-03-22 09:31:45 +00:00
|
|
|
void wps_do_playpause(bool updatewps)
|
|
|
|
{
|
2022-10-02 20:05:32 +00:00
|
|
|
struct wps_state *state = get_wps_state();
|
2011-03-22 09:31:45 +00:00
|
|
|
if ( state->paused )
|
|
|
|
{
|
|
|
|
state->paused = false;
|
2022-10-02 18:47:51 +00:00
|
|
|
unpause_action(updatewps);
|
2011-03-22 09:31:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
state->paused = true;
|
2022-10-02 18:47:51 +00:00
|
|
|
pause_action(updatewps);
|
2011-03-22 09:31:45 +00:00
|
|
|
settings_save();
|
2021-08-15 16:14:06 +00:00
|
|
|
#if !defined(HAVE_SW_POWEROFF)
|
2011-03-22 09:31:45 +00:00
|
|
|
call_storage_idle_notifys(true); /* make sure resume info is saved */
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2013-07-12 16:03:20 +00:00
|
|
|
|
2011-03-22 09:31:45 +00:00
|
|
|
|
2009-03-17 01:39:20 +00:00
|
|
|
/* The WPS can be left in two ways:
|
|
|
|
* a) call a function, which draws over the wps. In this case, the wps
|
|
|
|
* will be still active (i.e. the below function didn't return)
|
|
|
|
* b) return with a value evaluated by root_menu.c, in this case the wps
|
|
|
|
* is really left, and root_menu will handle the next screen
|
|
|
|
*
|
|
|
|
* In either way, call gwps_leave_wps(), in order to restore the correct
|
|
|
|
* "main screen" backdrops and statusbars
|
|
|
|
*/
|
2005-11-18 09:03:25 +00:00
|
|
|
long gui_wps_show(void)
|
2005-11-17 20:20:01 +00:00
|
|
|
{
|
2006-08-15 12:27:07 +00:00
|
|
|
long button = 0;
|
2009-04-08 17:11:50 +00:00
|
|
|
bool restore = true;
|
2009-03-17 01:56:20 +00:00
|
|
|
long restoretimer = RESTORE_WPS_INSTANTLY; /* timer to delay screen redraw temporarily */
|
2005-11-17 20:20:01 +00:00
|
|
|
bool exit = false;
|
2007-08-22 16:33:34 +00:00
|
|
|
bool bookmark = false;
|
2009-04-08 17:11:50 +00:00
|
|
|
bool update = false;
|
2009-10-31 14:55:13 +00:00
|
|
|
bool vol_changed = false;
|
2006-08-22 07:57:40 +00:00
|
|
|
long last_left = 0, last_right = 0;
|
2022-10-02 20:05:32 +00:00
|
|
|
struct wps_state *state = get_wps_state();
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
#ifdef AB_REPEAT_ENABLE
|
|
|
|
ab_repeat_init();
|
|
|
|
ab_reset_markers();
|
|
|
|
#endif
|
2009-04-08 17:11:50 +00:00
|
|
|
wps_state_init();
|
2013-07-12 16:03:20 +00:00
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
while ( 1 )
|
|
|
|
{
|
|
|
|
bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false;
|
2006-03-21 07:59:23 +00:00
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
/* did someone else (i.e power thread) change audio pause mode? */
|
2010-09-14 11:56:50 +00:00
|
|
|
if (state->paused != audio_paused) {
|
|
|
|
state->paused = audio_paused;
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
/* if another thread paused audio, we are probably in car mode,
|
|
|
|
about to shut down. lets save the settings. */
|
2010-09-14 11:56:50 +00:00
|
|
|
if (state->paused) {
|
2005-11-17 20:20:01 +00:00
|
|
|
settings_save();
|
2021-08-15 16:14:06 +00:00
|
|
|
#if !defined(HAVE_SW_POWEROFF)
|
2008-11-01 16:14:28 +00:00
|
|
|
call_storage_idle_notifys(true);
|
2005-11-17 20:20:01 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
2013-07-12 16:03:20 +00:00
|
|
|
button = skin_wait_for_action(WPS, CONTEXT_WPS|ALLOW_SOFTLOCK,
|
2010-05-12 10:38:00 +00:00
|
|
|
restore ? 1 : HZ/5);
|
2008-11-16 09:56:38 +00:00
|
|
|
|
2009-03-29 17:58:24 +00:00
|
|
|
/* Exit if audio has stopped playing. This happens e.g. at end of
|
|
|
|
playlist or if using the sleep timer. */
|
|
|
|
if (!(audio_status() & AUDIO_STATUS_PLAY))
|
2005-11-17 20:20:01 +00:00
|
|
|
exit = true;
|
2009-04-20 01:41:56 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
if (button == ACTION_TOUCHSCREEN)
|
2022-10-04 22:22:21 +00:00
|
|
|
button = skintouch_to_wps();
|
2009-04-20 01:41:56 +00:00
|
|
|
#endif
|
2008-07-07 05:17:15 +00:00
|
|
|
/* The iPods/X5/M5 use a single button for the A-B mode markers,
|
|
|
|
defined as ACTION_WPSAB_SINGLE in their config files. */
|
2006-12-22 05:19:56 +00:00
|
|
|
#ifdef ACTION_WPSAB_SINGLE
|
|
|
|
if (!global_settings.party_mode && ab_repeat_mode_enabled())
|
|
|
|
{
|
|
|
|
static int wps_ab_state = 0;
|
|
|
|
if (button == ACTION_WPSAB_SINGLE)
|
|
|
|
{
|
|
|
|
switch (wps_ab_state)
|
|
|
|
{
|
|
|
|
case 0: /* set the A spot */
|
|
|
|
button = ACTION_WPS_ABSETA_PREVDIR;
|
|
|
|
break;
|
|
|
|
case 1: /* set the B spot */
|
|
|
|
button = ACTION_WPS_ABSETB_NEXTDIR;
|
|
|
|
break;
|
|
|
|
case 2:
|
2007-04-13 15:42:25 +00:00
|
|
|
button = ACTION_WPS_ABRESET;
|
2006-12-22 05:19:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
wps_ab_state = (wps_ab_state+1) % 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2005-11-17 20:20:01 +00:00
|
|
|
switch(button)
|
|
|
|
{
|
2010-05-09 02:07:42 +00:00
|
|
|
#ifdef HAVE_HOTKEY
|
2010-04-01 03:14:44 +00:00
|
|
|
case ACTION_WPS_HOTKEY:
|
2010-05-09 02:02:51 +00:00
|
|
|
if (!global_settings.hotkey_wps)
|
|
|
|
break;
|
|
|
|
/* fall through */
|
2010-05-09 02:07:42 +00:00
|
|
|
#endif
|
2010-05-09 02:02:51 +00:00
|
|
|
case ACTION_WPS_CONTEXT:
|
2009-01-02 01:29:13 +00:00
|
|
|
{
|
2010-04-01 03:14:44 +00:00
|
|
|
bool hotkey = button == ACTION_WPS_HOTKEY;
|
2009-03-17 01:39:20 +00:00
|
|
|
gwps_leave_wps();
|
2013-07-12 16:03:20 +00:00
|
|
|
int retval = onplay(state->id3->path,
|
2010-04-01 03:14:44 +00:00
|
|
|
FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey);
|
2007-11-04 12:40:18 +00:00
|
|
|
/* if music is stopped in the context menu we want to exit the wps */
|
2013-07-12 16:03:20 +00:00
|
|
|
if (retval == ONPLAY_MAINMENU
|
2007-11-04 12:40:18 +00:00
|
|
|
|| !audio_status())
|
2007-03-01 11:14:46 +00:00
|
|
|
return GO_TO_ROOT;
|
2010-02-20 19:06:39 +00:00
|
|
|
else if (retval == ONPLAY_PLAYLIST)
|
|
|
|
return GO_TO_PLAYLIST_VIEWER;
|
2020-08-01 02:45:10 +00:00
|
|
|
else if (retval == ONPLAY_PLUGIN)
|
|
|
|
return GO_TO_PLUGIN;
|
2005-11-17 20:20:01 +00:00
|
|
|
restore = true;
|
2009-01-02 01:29:13 +00:00
|
|
|
}
|
|
|
|
break;
|
2005-11-17 20:20:01 +00:00
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_BROWSE:
|
2009-03-19 23:04:39 +00:00
|
|
|
gwps_leave_wps();
|
2008-11-16 09:56:38 +00:00
|
|
|
return GO_TO_PREVIOUS_BROWSER;
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* play/pause */
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_PLAY:
|
2006-03-19 08:40:31 +00:00
|
|
|
if (global_settings.party_mode)
|
|
|
|
break;
|
2011-03-22 09:31:45 +00:00
|
|
|
wps_do_playpause(true);
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_VOLUP:
|
2018-06-20 10:19:33 +00:00
|
|
|
global_settings.volume += sound_steps(SOUND_VOLUME);
|
2009-10-31 14:55:13 +00:00
|
|
|
vol_changed = true;
|
|
|
|
break;
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_VOLDOWN:
|
2018-06-20 10:19:33 +00:00
|
|
|
global_settings.volume -= sound_steps(SOUND_VOLUME);
|
2009-10-31 14:55:13 +00:00
|
|
|
vol_changed = true;
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
2013-07-12 16:03:20 +00:00
|
|
|
/* fast forward
|
2009-03-27 13:53:29 +00:00
|
|
|
OR next dir if this is straight after ACTION_WPS_SKIPNEXT */
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_SEEKFWD:
|
2006-08-22 07:57:40 +00:00
|
|
|
if (global_settings.party_mode)
|
|
|
|
break;
|
2009-04-04 20:33:38 +00:00
|
|
|
if (current_tick -last_right < HZ)
|
2007-02-14 14:40:24 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
if (state->id3->cuesheet)
|
2007-02-14 14:40:24 +00:00
|
|
|
{
|
|
|
|
audio_next();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-04-04 20:33:38 +00:00
|
|
|
change_dir(1);
|
2007-02-14 14:40:24 +00:00
|
|
|
}
|
|
|
|
}
|
2009-03-27 13:53:29 +00:00
|
|
|
else
|
2022-11-05 18:51:02 +00:00
|
|
|
ffwd_rew(ACTION_WPS_SEEKFWD, false);
|
2008-05-04 13:47:58 +00:00
|
|
|
last_right = last_left = 0;
|
2006-08-22 07:57:40 +00:00
|
|
|
break;
|
2013-07-12 16:03:20 +00:00
|
|
|
/* fast rewind
|
2009-03-27 13:53:29 +00:00
|
|
|
OR prev dir if this is straight after ACTION_WPS_SKIPPREV,*/
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_SEEKBACK:
|
2006-03-19 08:40:31 +00:00
|
|
|
if (global_settings.party_mode)
|
|
|
|
break;
|
2009-04-04 20:33:38 +00:00
|
|
|
if (current_tick -last_left < HZ)
|
2007-02-14 14:40:24 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
if (state->id3->cuesheet)
|
2007-02-14 14:40:24 +00:00
|
|
|
{
|
2011-04-27 03:08:23 +00:00
|
|
|
audio_pre_ff_rewind();
|
2007-02-14 14:40:24 +00:00
|
|
|
audio_ff_rewind(0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-04-04 20:33:38 +00:00
|
|
|
change_dir(-1);
|
2007-02-14 14:40:24 +00:00
|
|
|
}
|
2022-11-05 18:51:02 +00:00
|
|
|
} else if (global_settings.rewind_across_tracks
|
|
|
|
&& get_wps_state()->id3->elapsed < DEFAULT_SKIP_THRESH
|
|
|
|
&& playlist_check(-1))
|
|
|
|
{
|
|
|
|
if (!audio_paused)
|
|
|
|
audio_pause();
|
|
|
|
audio_prev();
|
|
|
|
ffwd_rew(ACTION_WPS_SEEKBACK, true);
|
|
|
|
if (!audio_paused)
|
|
|
|
audio_resume();
|
2007-02-14 14:40:24 +00:00
|
|
|
}
|
2009-03-27 13:53:29 +00:00
|
|
|
else
|
2022-11-05 18:51:02 +00:00
|
|
|
ffwd_rew(ACTION_WPS_SEEKBACK, false);
|
2008-05-04 13:47:58 +00:00
|
|
|
last_left = last_right = 0;
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* prev / restart */
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_SKIPPREV:
|
2006-03-19 08:40:31 +00:00
|
|
|
if (global_settings.party_mode)
|
|
|
|
break;
|
2006-08-22 07:57:40 +00:00
|
|
|
last_left = current_tick;
|
2005-11-17 20:20:01 +00:00
|
|
|
#ifdef AB_REPEAT_ENABLE
|
|
|
|
/* if we're in A/B repeat mode and the current position
|
|
|
|
is past the A marker, jump back to the A marker... */
|
2015-10-25 19:58:36 +00:00
|
|
|
if ( ab_repeat_mode_enabled() && ab_after_A_marker(state->id3->elapsed) )
|
2005-11-17 20:20:01 +00:00
|
|
|
{
|
2015-10-25 19:58:36 +00:00
|
|
|
ab_jump_to_A_marker();
|
|
|
|
break;
|
2005-11-17 20:20:01 +00:00
|
|
|
}
|
2009-04-04 20:33:38 +00:00
|
|
|
else
|
2005-11-17 20:20:01 +00:00
|
|
|
/* ...otherwise, do it normally */
|
|
|
|
#endif
|
2008-05-04 13:47:58 +00:00
|
|
|
play_hop(-1);
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
|
|
|
|
2008-05-04 13:47:58 +00:00
|
|
|
/* next
|
2008-07-14 20:39:30 +00:00
|
|
|
OR if skip length set, hop by predetermined amount. */
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_SKIPNEXT:
|
2006-03-19 08:40:31 +00:00
|
|
|
if (global_settings.party_mode)
|
|
|
|
break;
|
2006-08-22 07:57:40 +00:00
|
|
|
last_right = current_tick;
|
2005-11-17 20:20:01 +00:00
|
|
|
#ifdef AB_REPEAT_ENABLE
|
|
|
|
/* if we're in A/B repeat mode and the current position is
|
|
|
|
before the A marker, jump to the A marker... */
|
2006-01-21 23:43:57 +00:00
|
|
|
if ( ab_repeat_mode_enabled() )
|
2005-11-17 20:20:01 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
if ( ab_before_A_marker(state->id3->elapsed) )
|
2006-01-21 23:43:57 +00:00
|
|
|
{
|
|
|
|
ab_jump_to_A_marker();
|
|
|
|
break;
|
|
|
|
}
|
2005-11-17 20:20:01 +00:00
|
|
|
}
|
2009-04-04 20:33:38 +00:00
|
|
|
else
|
2005-11-17 20:20:01 +00:00
|
|
|
/* ...otherwise, do it normally */
|
|
|
|
#endif
|
2008-05-04 13:47:58 +00:00
|
|
|
play_hop(1);
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
2006-08-15 12:27:07 +00:00
|
|
|
/* next / prev directories */
|
2006-08-16 13:25:45 +00:00
|
|
|
/* and set A-B markers if in a-b mode */
|
|
|
|
case ACTION_WPS_ABSETB_NEXTDIR:
|
2006-08-15 12:27:07 +00:00
|
|
|
if (global_settings.party_mode)
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
2006-08-16 13:25:45 +00:00
|
|
|
#if defined(AB_REPEAT_ENABLE)
|
2006-08-15 12:27:07 +00:00
|
|
|
if (ab_repeat_mode_enabled())
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
ab_set_B_marker(state->id3->elapsed);
|
2006-08-15 12:27:07 +00:00
|
|
|
ab_jump_to_A_marker();
|
|
|
|
}
|
|
|
|
else
|
2005-11-17 20:20:01 +00:00
|
|
|
#endif
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
2009-04-04 20:33:38 +00:00
|
|
|
change_dir(1);
|
2006-08-15 12:27:07 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-08-16 13:25:45 +00:00
|
|
|
case ACTION_WPS_ABSETA_PREVDIR:
|
2006-08-15 12:27:07 +00:00
|
|
|
if (global_settings.party_mode)
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
2006-08-16 13:25:45 +00:00
|
|
|
#if defined(AB_REPEAT_ENABLE)
|
2006-08-15 12:27:07 +00:00
|
|
|
if (ab_repeat_mode_enabled())
|
2010-09-14 11:56:50 +00:00
|
|
|
ab_set_A_marker(state->id3->elapsed);
|
2006-08-15 12:27:07 +00:00
|
|
|
else
|
2005-11-17 20:20:01 +00:00
|
|
|
#endif
|
2006-08-15 12:27:07 +00:00
|
|
|
{
|
2009-04-04 20:33:38 +00:00
|
|
|
change_dir(-1);
|
2006-08-15 12:27:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* menu key functions */
|
|
|
|
case ACTION_WPS_MENU:
|
2009-03-19 23:04:39 +00:00
|
|
|
gwps_leave_wps();
|
2007-03-01 11:14:46 +00:00
|
|
|
return GO_TO_ROOT;
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
2006-04-10 03:51:17 +00:00
|
|
|
#ifdef HAVE_QUICKSCREEN
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_QUICKSCREEN:
|
2009-01-02 01:29:13 +00:00
|
|
|
{
|
2009-03-17 01:39:20 +00:00
|
|
|
gwps_leave_wps();
|
2021-10-26 01:05:50 +00:00
|
|
|
bool enter_shortcuts_menu = global_settings.shortcuts_replaces_qs;
|
|
|
|
if (!enter_shortcuts_menu)
|
2021-03-07 15:07:49 +00:00
|
|
|
{
|
2021-03-09 13:21:20 +00:00
|
|
|
int ret = quick_screen_quick(button);
|
2021-10-26 01:05:50 +00:00
|
|
|
if (ret == QUICKSCREEN_IN_USB)
|
|
|
|
return GO_TO_ROOT;
|
|
|
|
else if (ret == QUICKSCREEN_GOTO_SHORTCUTS_MENU)
|
|
|
|
enter_shortcuts_menu = true;
|
|
|
|
else
|
|
|
|
restore = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enter_shortcuts_menu)
|
|
|
|
{
|
|
|
|
global_status.last_screen = GO_TO_SHORTCUTMENU;
|
|
|
|
int ret = do_shortcut_menu(NULL);
|
2021-03-09 13:21:20 +00:00
|
|
|
return (ret == GO_TO_PREVIOUS ? GO_TO_WPS : ret);
|
2021-03-07 15:07:49 +00:00
|
|
|
}
|
2009-01-02 01:29:13 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-08-15 12:27:07 +00:00
|
|
|
#endif /* HAVE_QUICKSCREEN */
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
/* screen settings */
|
|
|
|
|
|
|
|
/* pitch screen */
|
2012-05-08 14:34:26 +00:00
|
|
|
#ifdef HAVE_PITCHCONTROL
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_PITCHSCREEN:
|
2009-01-02 01:29:13 +00:00
|
|
|
{
|
2009-03-17 01:39:20 +00:00
|
|
|
gwps_leave_wps();
|
2008-10-05 13:01:54 +00:00
|
|
|
if (1 == gui_syncpitchscreen_run())
|
2009-08-29 16:25:04 +00:00
|
|
|
return GO_TO_ROOT;
|
2005-11-17 20:20:01 +00:00
|
|
|
restore = true;
|
2009-01-02 01:29:13 +00:00
|
|
|
}
|
|
|
|
break;
|
2012-05-08 14:34:26 +00:00
|
|
|
#endif /* HAVE_PITCHCONTROL */
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
#ifdef AB_REPEAT_ENABLE
|
|
|
|
/* reset A&B markers */
|
2007-04-13 15:42:25 +00:00
|
|
|
case ACTION_WPS_ABRESET:
|
2005-11-17 20:20:01 +00:00
|
|
|
if (ab_repeat_mode_enabled())
|
|
|
|
{
|
|
|
|
ab_reset_markers();
|
2009-04-08 17:11:50 +00:00
|
|
|
update = true;
|
2005-11-17 20:20:01 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif /* AB_REPEAT_ENABLE */
|
|
|
|
|
|
|
|
/* stop and exit wps */
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_STOP:
|
2006-03-19 08:40:31 +00:00
|
|
|
if (global_settings.party_mode)
|
|
|
|
break;
|
2007-08-22 16:33:34 +00:00
|
|
|
bookmark = true;
|
2005-11-17 20:20:01 +00:00
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
|
2012-03-03 05:15:31 +00:00
|
|
|
case ACTION_WPS_LIST_BOOKMARKS:
|
|
|
|
gwps_leave_wps();
|
|
|
|
if (bookmark_load_menu() == BOOKMARK_USB_CONNECTED)
|
|
|
|
{
|
|
|
|
return GO_TO_ROOT;
|
|
|
|
}
|
|
|
|
restore = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ACTION_WPS_CREATE_BOOKMARK:
|
|
|
|
gwps_leave_wps();
|
|
|
|
bookmark_create_menu();
|
|
|
|
restore = true;
|
|
|
|
break;
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_ID3SCREEN:
|
2009-01-02 01:29:13 +00:00
|
|
|
{
|
2009-03-17 01:39:20 +00:00
|
|
|
gwps_leave_wps();
|
2021-12-28 07:56:16 +00:00
|
|
|
if (browse_id3(audio_current_track(),
|
|
|
|
playlist_get_display_index(),
|
|
|
|
playlist_amount()))
|
2009-08-29 16:25:04 +00:00
|
|
|
return GO_TO_ROOT;
|
2005-11-17 20:20:01 +00:00
|
|
|
restore = true;
|
2009-01-02 01:29:13 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-07-10 11:53:15 +00:00
|
|
|
/* this case is used by the softlock feature
|
|
|
|
* it requests a full update here */
|
|
|
|
case ACTION_REDRAW:
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_request_full_update(WPS);
|
2009-06-18 13:50:11 +00:00
|
|
|
break;
|
|
|
|
case ACTION_NONE: /* Timeout, do a partial update */
|
2009-04-08 17:11:50 +00:00
|
|
|
update = true;
|
2022-11-05 18:51:02 +00:00
|
|
|
ffwd_rew(button, false); /* hopefully fix the ffw/rwd bug */
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
2007-08-02 12:13:20 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
case ACTION_WPS_REC:
|
|
|
|
exit = true;
|
|
|
|
break;
|
|
|
|
#endif
|
2009-07-22 22:10:25 +00:00
|
|
|
case ACTION_WPS_VIEW_PLAYLIST:
|
|
|
|
gwps_leave_wps();
|
2010-02-20 19:06:39 +00:00
|
|
|
return GO_TO_PLAYLIST_VIEWER;
|
2009-07-22 22:10:25 +00:00
|
|
|
break;
|
2005-11-17 20:20:01 +00:00
|
|
|
default:
|
2010-10-31 15:32:57 +00:00
|
|
|
switch(default_event_handler(button))
|
|
|
|
{ /* music has been stopped by the default handler */
|
|
|
|
case SYS_USB_CONNECTED:
|
|
|
|
case SYS_CALL_INCOMING:
|
|
|
|
case BUTTON_MULTIMEDIA_STOP:
|
|
|
|
gwps_leave_wps();
|
|
|
|
return GO_TO_ROOT;
|
2009-08-29 16:25:04 +00:00
|
|
|
}
|
2009-04-08 17:11:50 +00:00
|
|
|
update = true;
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-10-31 14:55:13 +00:00
|
|
|
if (vol_changed)
|
|
|
|
{
|
|
|
|
bool res = false;
|
2009-11-04 12:46:31 +00:00
|
|
|
vol_changed = false;
|
2009-10-31 14:55:13 +00:00
|
|
|
setvol();
|
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
if(update_onvol_change(i))
|
2009-10-31 14:55:13 +00:00
|
|
|
res = true;
|
|
|
|
}
|
|
|
|
if (res) {
|
|
|
|
restore = true;
|
|
|
|
restoretimer = RESTORE_WPS_NEXT_SECOND;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-16 01:38:33 +00:00
|
|
|
|
2009-11-16 01:38:36 +00:00
|
|
|
if (restore &&
|
2009-11-16 01:38:33 +00:00
|
|
|
((restoretimer == RESTORE_WPS_INSTANTLY) ||
|
|
|
|
TIME_AFTER(current_tick, restoretimer)))
|
|
|
|
{
|
|
|
|
restore = false;
|
|
|
|
restoretimer = RESTORE_WPS_INSTANTLY;
|
|
|
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
2014-03-14 22:15:16 +00:00
|
|
|
add_event(LCD_EVENT_ACTIVATION, wps_lcd_activation_hook);
|
2009-11-16 01:38:33 +00:00
|
|
|
#endif
|
|
|
|
/* we remove the update delay since it's not very usable in the wps,
|
|
|
|
* e.g. during volume changing or ffwd/rewind */
|
|
|
|
sb_skin_set_update_delay(0);
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_request_full_update(WPS);
|
|
|
|
update = true;
|
2009-12-09 07:25:46 +00:00
|
|
|
gwps_enter_wps();
|
2009-11-16 01:38:33 +00:00
|
|
|
}
|
2010-09-14 11:56:50 +00:00
|
|
|
else
|
2005-11-17 20:20:01 +00:00
|
|
|
{
|
2009-04-14 22:13:29 +00:00
|
|
|
#if defined(HAVE_BACKLIGHT) || defined(HAVE_REMOTE_LCD)
|
2010-09-14 11:56:50 +00:00
|
|
|
gwps_caption_backlight(state);
|
2009-04-14 22:13:29 +00:00
|
|
|
#endif
|
2005-11-18 09:03:25 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
2009-04-12 00:30:28 +00:00
|
|
|
{
|
2009-04-09 08:30:05 +00:00
|
|
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
|
|
|
/* currently, all remotes are readable without backlight
|
|
|
|
* so still update those */
|
2009-10-20 21:54:59 +00:00
|
|
|
if (lcd_active() || (i != SCREEN_MAIN))
|
2009-04-09 08:30:05 +00:00
|
|
|
#endif
|
2009-04-12 00:30:28 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
bool full_update = skin_do_full_update(WPS, i);
|
|
|
|
if (update || full_update)
|
2010-08-02 14:12:44 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_update(WPS, i, full_update ?
|
2010-08-02 14:12:44 +00:00
|
|
|
SKIN_REFRESH_ALL : SKIN_REFRESH_NON_STATIC);
|
2010-09-14 11:56:50 +00:00
|
|
|
}
|
2009-04-12 00:30:28 +00:00
|
|
|
}
|
2005-11-17 20:20:01 +00:00
|
|
|
}
|
2009-04-08 17:11:50 +00:00
|
|
|
update = false;
|
2005-11-17 20:20:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (exit) {
|
2011-06-29 06:37:04 +00:00
|
|
|
audio_pause();
|
2011-08-23 01:37:59 +00:00
|
|
|
update_non_static();
|
2007-08-22 16:33:34 +00:00
|
|
|
if (bookmark)
|
2010-03-28 23:27:49 +00:00
|
|
|
bookmark_autobookmark(true);
|
2005-11-17 20:20:01 +00:00
|
|
|
audio_stop();
|
|
|
|
#ifdef AB_REPEAT_ENABLE
|
|
|
|
ab_reset_markers();
|
2007-08-02 12:13:20 +00:00
|
|
|
#endif
|
2009-03-19 14:33:22 +00:00
|
|
|
gwps_leave_wps();
|
2007-08-02 12:13:20 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
if (button == ACTION_WPS_REC)
|
|
|
|
return GO_TO_RECSCREEN;
|
2005-11-17 20:20:01 +00:00
|
|
|
#endif
|
2007-04-08 02:11:33 +00:00
|
|
|
if (global_settings.browse_current)
|
|
|
|
return GO_TO_PREVIOUS_BROWSER;
|
2007-03-01 11:14:46 +00:00
|
|
|
return GO_TO_PREVIOUS;
|
2005-11-17 20:20:01 +00:00
|
|
|
}
|
2006-03-21 07:59:23 +00:00
|
|
|
|
2009-01-01 05:12:27 +00:00
|
|
|
if (button && !IS_SYSEVENT(button) )
|
2008-11-01 16:14:28 +00:00
|
|
|
storage_spin();
|
2005-11-17 20:20:01 +00:00
|
|
|
}
|
2007-03-01 11:14:46 +00:00
|
|
|
return GO_TO_ROOT; /* unreachable - just to reduce compiler warnings */
|
2005-11-17 20:20:01 +00:00
|
|
|
}
|
|
|
|
|
2022-10-02 20:05:32 +00:00
|
|
|
struct wps_state *get_wps_state(void)
|
|
|
|
{
|
|
|
|
return &wps_state;
|
|
|
|
}
|
|
|
|
|
2009-04-06 00:39:43 +00:00
|
|
|
/* this is called from the playback thread so NO DRAWING! */
|
2014-03-14 22:15:16 +00:00
|
|
|
static void track_info_callback(unsigned short id, void *param)
|
2009-04-06 00:39:43 +00:00
|
|
|
{
|
2022-10-02 20:05:32 +00:00
|
|
|
struct wps_state *state = get_wps_state();
|
2014-03-14 22:15:16 +00:00
|
|
|
|
|
|
|
if (id == PLAYBACK_EVENT_TRACK_CHANGE || id == PLAYBACK_EVENT_CUR_TRACK_READY)
|
2009-04-06 00:39:43 +00:00
|
|
|
{
|
2014-03-14 22:15:16 +00:00
|
|
|
state->id3 = ((struct track_event *)param)->id3;
|
|
|
|
if (state->id3->cuesheet)
|
|
|
|
{
|
|
|
|
cue_find_current_track(state->id3->cuesheet, state->id3->elapsed);
|
|
|
|
}
|
2009-04-06 00:39:43 +00:00
|
|
|
}
|
2011-04-27 03:08:23 +00:00
|
|
|
#ifdef AUDIO_FAST_SKIP_PREVIEW
|
2014-03-14 22:15:16 +00:00
|
|
|
else if (id == PLAYBACK_EVENT_TRACK_SKIP)
|
|
|
|
{
|
|
|
|
state->id3 = audio_current_track();
|
|
|
|
}
|
|
|
|
#endif
|
2022-10-02 20:05:32 +00:00
|
|
|
state->nid3 = audio_next_track();
|
2011-04-27 03:08:23 +00:00
|
|
|
skin_request_full_update(WPS);
|
|
|
|
}
|
2005-11-17 20:20:01 +00:00
|
|
|
|
2006-12-13 11:52:21 +00:00
|
|
|
static void wps_state_init(void)
|
2005-11-17 20:20:01 +00:00
|
|
|
{
|
2022-10-02 20:05:32 +00:00
|
|
|
struct wps_state *state = get_wps_state();
|
2010-09-14 11:56:50 +00:00
|
|
|
state->paused = false;
|
2009-04-08 17:11:50 +00:00
|
|
|
if(audio_status() & AUDIO_STATUS_PLAY)
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
state->id3 = audio_current_track();
|
|
|
|
state->nid3 = audio_next_track();
|
2009-04-08 17:11:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
state->id3 = NULL;
|
|
|
|
state->nid3 = NULL;
|
2009-04-08 17:11:50 +00:00
|
|
|
}
|
|
|
|
/* We'll be updating due to restore initialized with true */
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_request_full_update(WPS);
|
2009-04-06 00:39:43 +00:00
|
|
|
/* add the WPS track event callbacks */
|
2014-03-14 22:15:16 +00:00
|
|
|
add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_info_callback);
|
|
|
|
add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, track_info_callback);
|
2011-05-25 08:35:31 +00:00
|
|
|
/* Use the same callback as ..._TRACK_CHANGE for when remaining handles have
|
|
|
|
finished */
|
2014-03-14 22:15:16 +00:00
|
|
|
add_event(PLAYBACK_EVENT_CUR_TRACK_READY, track_info_callback);
|
2011-04-27 03:08:23 +00:00
|
|
|
#ifdef AUDIO_FAST_SKIP_PREVIEW
|
2014-03-14 22:15:16 +00:00
|
|
|
add_event(PLAYBACK_EVENT_TRACK_SKIP, track_info_callback);
|
2011-04-27 03:08:23 +00:00
|
|
|
#endif
|
2005-11-17 20:20:01 +00:00
|
|
|
}
|