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"
|
2009-07-27 07:21:05 +00:00
|
|
|
#include "mp3_playback.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"
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
#include "icons.h"
|
|
|
|
#include "peakmeter.h"
|
|
|
|
#endif
|
|
|
|
#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"
|
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"
|
|
|
|
#include "dsp.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"
|
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
|
|
|
|
|
|
|
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
|
|
|
|
/* 3% of 30min file == 54s step size */
|
|
|
|
#define MIN_FF_REWIND_STEP 500
|
|
|
|
|
2006-12-13 11:52:21 +00:00
|
|
|
/* initial setup of wps_data */
|
|
|
|
static void wps_state_init(void);
|
2009-04-06 00:39:43 +00:00
|
|
|
static void track_changed_callback(void *param);
|
|
|
|
static void nextid3available_callback(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] = {
|
2009-08-03 22:39:27 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
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",
|
|
|
|
#else
|
2010-06-07 03:44:11 +00:00
|
|
|
"%s%pp/%pe: %?it<%it|%fn> - %?ia<%ia|%d(2)> - %?id<%id|%d(1)>\n"
|
2009-08-03 22:39:27 +00:00
|
|
|
"%pc%?ps<*|/>%pt\n",
|
|
|
|
#endif
|
|
|
|
#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
|
|
|
}
|
|
|
|
|
2009-07-27 07:21:05 +00:00
|
|
|
void fade(bool fade_in, bool updatewps)
|
|
|
|
{
|
|
|
|
int fp_global_vol = global_settings.volume << 8;
|
|
|
|
int fp_min_vol = sound_min(SOUND_VOLUME) << 8;
|
|
|
|
int fp_step = (fp_global_vol - fp_min_vol) / 30;
|
|
|
|
int i;
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_global_state()->is_fading = !fade_in;
|
2009-07-27 07:21:05 +00:00
|
|
|
if (fade_in) {
|
|
|
|
/* fade in */
|
|
|
|
int fp_volume = fp_min_vol;
|
|
|
|
|
|
|
|
/* zero out the sound */
|
|
|
|
sound_set_volume(fp_min_vol >> 8);
|
|
|
|
|
|
|
|
sleep(HZ/10); /* let audio thread run */
|
|
|
|
audio_resume();
|
|
|
|
|
|
|
|
while (fp_volume < fp_global_vol - fp_step) {
|
|
|
|
fp_volume += fp_step;
|
|
|
|
sound_set_volume(fp_volume >> 8);
|
|
|
|
if (updatewps)
|
|
|
|
{
|
|
|
|
FOR_NB_SCREENS(i)
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_update(WPS, i, SKIN_REFRESH_NON_STATIC);
|
2009-07-27 07:21:05 +00:00
|
|
|
}
|
|
|
|
sleep(1);
|
|
|
|
}
|
|
|
|
sound_set_volume(global_settings.volume);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* fade out */
|
|
|
|
int fp_volume = fp_global_vol;
|
|
|
|
|
|
|
|
while (fp_volume > fp_min_vol + fp_step) {
|
|
|
|
fp_volume -= fp_step;
|
|
|
|
sound_set_volume(fp_volume >> 8);
|
|
|
|
if (updatewps)
|
|
|
|
{
|
|
|
|
FOR_NB_SCREENS(i)
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_update(WPS, i, SKIN_REFRESH_NON_STATIC);
|
2009-07-27 07:21:05 +00:00
|
|
|
}
|
|
|
|
sleep(1);
|
|
|
|
}
|
|
|
|
audio_pause();
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_global_state()->is_fading = false;
|
2009-07-27 07:21:05 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
|
|
|
#ifndef SIMULATOR
|
|
|
|
/* let audio thread run and wait for the mas to run out of data */
|
|
|
|
while (!mp3_pause_done())
|
|
|
|
#endif
|
|
|
|
sleep(HZ/10);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* reset volume to what it was before the fade */
|
|
|
|
sound_set_volume(global_settings.volume);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
splashf(0, "Vol: %3d dB",
|
|
|
|
sound_val2phys(SOUND_VOLUME, global_settings.volume));
|
|
|
|
return true;
|
|
|
|
#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-08-03 15:06:30 +00:00
|
|
|
|
2010-06-21 06:04:19 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2010-07-31 13:41:06 +00:00
|
|
|
static int skintouch_to_wps(struct wps_data *data)
|
2010-06-21 06:04:19 +00:00
|
|
|
{
|
|
|
|
int offset = 0;
|
2010-09-06 13:33:49 +00:00
|
|
|
struct touchregion *region;
|
|
|
|
int button = skin_get_touchaction(data, &offset, ®ion);
|
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
|
2010-06-21 06:04:19 +00:00
|
|
|
case WPS_TOUCHREGION_SCROLLBAR:
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->length*offset/100;
|
|
|
|
if (!skin_get_global_state()->paused)
|
2010-06-21 06:04:19 +00:00
|
|
|
#if (CONFIG_CODEC == SWCODEC)
|
|
|
|
audio_pre_ff_rewind();
|
|
|
|
#else
|
|
|
|
audio_pause();
|
|
|
|
#endif
|
2010-09-14 11:56:50 +00:00
|
|
|
audio_ff_rewind(skin_get_global_state()->id3->elapsed);
|
2010-06-21 06:04:19 +00:00
|
|
|
#if (CONFIG_CODEC != SWCODEC)
|
2010-09-14 11:56:50 +00:00
|
|
|
if (!skin_get_global_state()->paused)
|
2010-06-21 06:04:19 +00:00
|
|
|
audio_resume();
|
|
|
|
#endif
|
|
|
|
return ACTION_TOUCHSCREEN;
|
|
|
|
case WPS_TOUCHREGION_VOLUME:
|
|
|
|
{
|
|
|
|
const int min_vol = sound_min(SOUND_VOLUME);
|
|
|
|
const int max_vol = sound_max(SOUND_VOLUME);
|
|
|
|
global_settings.volume = (offset * (max_vol - min_vol)) / 100;
|
|
|
|
global_settings.volume += min_vol;
|
|
|
|
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
|
|
|
|
2009-07-27 07:21:05 +00:00
|
|
|
bool ffwd_rew(int button)
|
|
|
|
{
|
|
|
|
unsigned int step = 0; /* current ff/rewind step */
|
|
|
|
unsigned int max_step = 0; /* maximum ff/rewind step */
|
|
|
|
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;
|
|
|
|
int i = 0;
|
|
|
|
const long ff_rw_accel = (global_settings.ff_rewind_accel + 3);
|
|
|
|
|
|
|
|
if (button == ACTION_NONE)
|
|
|
|
{
|
|
|
|
status_set_ffmode(0);
|
|
|
|
return usb;
|
|
|
|
}
|
|
|
|
while (!exit)
|
|
|
|
{
|
|
|
|
switch ( button )
|
|
|
|
{
|
|
|
|
case ACTION_WPS_SEEKFWD:
|
|
|
|
direction = 1;
|
|
|
|
case ACTION_WPS_SEEKBACK:
|
2010-09-14 11:56:50 +00:00
|
|
|
if (skin_get_global_state()->ff_rewind)
|
2009-07-27 07:21:05 +00:00
|
|
|
{
|
|
|
|
if (direction == 1)
|
|
|
|
{
|
|
|
|
/* fast forwarding, calc max step relative to end */
|
2010-09-14 11:56:50 +00:00
|
|
|
max_step = (skin_get_global_state()->id3->length -
|
|
|
|
(skin_get_global_state()->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 */
|
2010-09-14 11:56:50 +00:00
|
|
|
max_step = (skin_get_global_state()->id3->elapsed + ff_rewind_count) *
|
2009-07-27 07:21:05 +00:00
|
|
|
FF_REWIND_MAX_PERCENT / 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
if ( (audio_status() & AUDIO_STATUS_PLAY) &&
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_global_state()->id3 && skin_get_global_state()->id3->length )
|
2009-07-27 07:21:05 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
if (!skin_get_global_state()->paused)
|
2009-07-27 07:21:05 +00:00
|
|
|
#if (CONFIG_CODEC == SWCODEC)
|
|
|
|
audio_pre_ff_rewind();
|
|
|
|
#else
|
|
|
|
audio_pause();
|
|
|
|
#endif
|
|
|
|
#if CONFIG_KEYPAD == PLAYER_PAD
|
|
|
|
FOR_NB_SCREENS(i)
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_gwps(WPS, i)->display->stop_scroll();
|
2009-07-27 07:21:05 +00:00
|
|
|
#endif
|
|
|
|
if (direction > 0)
|
|
|
|
status_set_ffmode(STATUS_FASTFORWARD);
|
|
|
|
else
|
|
|
|
status_set_ffmode(STATUS_FASTBACKWARD);
|
|
|
|
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_global_state()->ff_rewind = true;
|
2009-07-27 07:21:05 +00:00
|
|
|
|
|
|
|
step = 1000 * global_settings.ff_rewind_min_step;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (direction > 0) {
|
2010-09-14 11:56:50 +00:00
|
|
|
if ((skin_get_global_state()->id3->elapsed + ff_rewind_count) >
|
|
|
|
skin_get_global_state()->id3->length)
|
|
|
|
ff_rewind_count = skin_get_global_state()->id3->length -
|
|
|
|
skin_get_global_state()->id3->elapsed;
|
2009-07-27 07:21:05 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-09-14 11:56:50 +00:00
|
|
|
if ((int)(skin_get_global_state()->id3->elapsed + ff_rewind_count) < 0)
|
|
|
|
ff_rewind_count = -skin_get_global_state()->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 */
|
2011-01-25 21:40:55 +00:00
|
|
|
skin_get_global_state()->ff_rewind_count = ff_rewind_count;
|
|
|
|
|
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:
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->elapsed+ff_rewind_count;
|
|
|
|
audio_ff_rewind(skin_get_global_state()->id3->elapsed);
|
|
|
|
skin_get_global_state()->ff_rewind_count = 0;
|
|
|
|
skin_get_global_state()->ff_rewind = false;
|
2009-07-27 07:21:05 +00:00
|
|
|
status_set_ffmode(0);
|
|
|
|
#if (CONFIG_CODEC != SWCODEC)
|
2010-09-14 11:56:50 +00:00
|
|
|
if (!skin_get_global_state()->paused)
|
2009-07-27 07:21:05 +00:00
|
|
|
audio_resume();
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
FOR_NB_SCREENS(i)
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_update(WPS, i, SKIN_REFRESH_ALL);
|
2009-07-27 07:21:05 +00:00
|
|
|
#endif
|
|
|
|
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)
|
2010-09-14 11:56:50 +00:00
|
|
|
button = skintouch_to_wps(skin_get_gwps(WPS, SCREEN_MAIN)->data);
|
2010-06-20 13:17:24 +00:00
|
|
|
if (button != ACTION_WPS_SEEKFWD &&
|
|
|
|
button != ACTION_WPS_SEEKBACK)
|
|
|
|
button = ACTION_WPS_STOPSEEK;
|
2009-07-27 07:21:05 +00:00
|
|
|
#endif
|
2009-08-29 16:25:04 +00:00
|
|
|
}
|
2009-07-27 07:21:05 +00:00
|
|
|
}
|
|
|
|
return usb;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void display_keylock_text(bool locked)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
FOR_NB_SCREENS(i)
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_gwps(WPS, i)->display->stop_scroll();
|
2009-07-27 07:21:05 +00:00
|
|
|
|
|
|
|
splash(HZ, locked ? ID2P(LANG_KEYLOCK_ON) : ID2P(LANG_KEYLOCK_OFF));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if (state && state->id3)
|
|
|
|
{
|
|
|
|
#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();
|
2009-07-03 05:08:33 +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
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
struct wps_state *state = skin_get_global_state();
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-09-14 11:56:50 +00:00
|
|
|
if (!state->paused)
|
2008-05-04 13:47:58 +00:00
|
|
|
#if (CONFIG_CODEC == SWCODEC)
|
|
|
|
audio_pre_ff_rewind();
|
|
|
|
#else
|
2011-01-18 00:37:17 +00:00
|
|
|
audio_pause();
|
2008-05-04 13:47:58 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
audio_ff_rewind(0);
|
|
|
|
|
|
|
|
#if (CONFIG_CODEC != SWCODEC)
|
2010-09-14 11:56:50 +00:00
|
|
|
if (!state->paused)
|
2008-05-04 13:47:58 +00:00
|
|
|
audio_resume();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-08 20:37:26 +00:00
|
|
|
static void next_track(void)
|
2008-05-04 13:47:58 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
struct wps_state *state = skin_get_global_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)
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
struct wps_state *state = skin_get_global_state();
|
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
|
|
|
|
2009-10-17 16:05:23 +00:00
|
|
|
if (step < 0)
|
|
|
|
{
|
|
|
|
if (direction < 0)
|
|
|
|
{
|
|
|
|
prev_track(DEFAULT_SKIP_TRESH);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (remaining < DEFAULT_SKIP_TRESH*2)
|
|
|
|
{
|
|
|
|
next_track();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
elapsed += (remaining - DEFAULT_SKIP_TRESH*2);
|
|
|
|
}
|
|
|
|
else if (!global_settings.prevent_skip &&
|
2009-04-05 19:29:21 +00:00
|
|
|
(!step ||
|
|
|
|
(direction > 0 && step >= remaining) ||
|
|
|
|
(direction < 0 && elapsed < DEFAULT_SKIP_TRESH)))
|
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)
|
|
|
|
prev_track(DEFAULT_SKIP_TRESH);
|
|
|
|
return;
|
|
|
|
}
|
2009-10-17 16:05:23 +00:00
|
|
|
else if (direction == 1 && step >= remaining)
|
2009-04-04 20:33:38 +00:00
|
|
|
{
|
2009-03-12 18:50:24 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2009-04-04 20:33:38 +00:00
|
|
|
if(global_settings.beep)
|
|
|
|
pcmbuf_beep(1000, 150, 1500*global_settings.beep);
|
2009-03-12 18:50:24 +00:00
|
|
|
#endif
|
|
|
|
return;
|
2009-03-27 13:53:29 +00:00
|
|
|
}
|
2009-04-04 20:33:38 +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
|
|
|
}
|
2010-09-14 11:56:50 +00:00
|
|
|
if((audio_status() & AUDIO_STATUS_PLAY) && !state->paused)
|
2009-03-27 13:53:29 +00:00
|
|
|
{
|
2009-03-12 18:50:24 +00:00
|
|
|
#if (CONFIG_CODEC == SWCODEC)
|
|
|
|
audio_pre_ff_rewind();
|
|
|
|
#else
|
|
|
|
audio_pause();
|
|
|
|
#endif
|
|
|
|
}
|
2010-09-14 11:56:50 +00:00
|
|
|
audio_ff_rewind(state->id3->elapsed = elapsed);
|
2009-03-12 18:50:24 +00:00
|
|
|
#if (CONFIG_CODEC != SWCODEC)
|
2010-09-14 11:56:50 +00:00
|
|
|
if (!state->paused)
|
2009-03-12 18:50:24 +00:00
|
|
|
audio_resume();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
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
|
|
|
* */
|
2009-10-20 21:54:59 +00:00
|
|
|
static void wps_lcd_activation_hook(void *param)
|
2009-04-09 08:30:05 +00:00
|
|
|
{
|
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-12-09 07:25:46 +00:00
|
|
|
int i;
|
2009-03-17 01:56:20 +00:00
|
|
|
|
2009-03-19 23:04:39 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
2009-08-06 00:14:40 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_gwps(WPS, i)->display->stop_scroll();
|
2010-02-08 09:47:08 +00:00
|
|
|
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_backdrop_show(sb_get_backdrop(i));
|
2010-02-08 09:47:08 +00:00
|
|
|
#endif
|
2010-09-14 11:56:50 +00:00
|
|
|
viewportmanager_theme_undo(i, skin_has_sbs(i, skin_get_gwps(WPS, i)->data));
|
2009-12-21 05:19:12 +00:00
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
int i;
|
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;
|
2010-02-08 09:38:03 +00:00
|
|
|
display->stop_scroll();
|
2010-09-14 11:56:50 +00:00
|
|
|
viewportmanager_theme_enable(i, skin_has_sbs(i, skin_get_gwps(WPS, i)->data), 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)
|
|
|
|
{
|
2011-03-07 12:45:45 +00:00
|
|
|
struct skin_viewport *svp = skin_find_item(VP_DEFAULT_LABEL,
|
|
|
|
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 */
|
2010-02-08 22:34:04 +00:00
|
|
|
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
|
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);
|
|
|
|
skin_disarm_touchregions(gwps->data);
|
|
|
|
if (!gwps->data->touchregions)
|
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
|
|
|
}
|
|
|
|
|
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;
|
2005-11-17 20:20:01 +00:00
|
|
|
int i;
|
2006-08-22 07:57:40 +00:00
|
|
|
long last_left = 0, last_right = 0;
|
2010-09-14 11:56:50 +00:00
|
|
|
struct wps_state *state = skin_get_global_state();
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
status_set_audio(true);
|
|
|
|
status_set_param(false);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef AB_REPEAT_ENABLE
|
|
|
|
ab_repeat_init();
|
|
|
|
ab_reset_markers();
|
|
|
|
#endif
|
2009-04-08 17:11:50 +00:00
|
|
|
wps_state_init();
|
2009-12-09 07:25:46 +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();
|
2005-12-04 13:05:56 +00:00
|
|
|
#if !defined(HAVE_RTC_RAM) && !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
|
|
|
|
}
|
|
|
|
}
|
2010-09-14 11:56:50 +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)
|
2010-09-14 11:56:50 +00:00
|
|
|
button = skintouch_to_wps(skin_get_gwps(WPS, SCREEN_MAIN)->data);
|
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();
|
2010-09-14 11:56:50 +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 */
|
2010-02-20 19:06:39 +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;
|
2010-06-09 08:51:29 +00:00
|
|
|
#ifdef HAVE_PICTUREFLOW_INTEGRATION
|
2010-06-09 04:25:41 +00:00
|
|
|
else if (retval == ONPLAY_PICTUREFLOW)
|
|
|
|
return GO_TO_PICTUREFLOW;
|
2010-06-09 08:14:41 +00:00
|
|
|
#endif
|
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:
|
2005-11-17 20:20:01 +00:00
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
2008-11-16 09:56:38 +00:00
|
|
|
status_set_record(false);
|
|
|
|
status_set_audio(false);
|
2005-11-17 20:20:01 +00:00
|
|
|
#endif
|
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;
|
2010-09-14 11:56:50 +00:00
|
|
|
if ( state->paused )
|
2005-11-17 20:20:01 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
state->paused = false;
|
2005-11-17 20:20:01 +00:00
|
|
|
if ( global_settings.fade_on_stop )
|
2008-06-23 02:45:55 +00:00
|
|
|
fade(true, true);
|
2005-11-17 20:20:01 +00:00
|
|
|
else
|
|
|
|
audio_resume();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
state->paused = true;
|
2005-11-17 20:20:01 +00:00
|
|
|
if ( global_settings.fade_on_stop )
|
2008-06-23 02:45:55 +00:00
|
|
|
fade(false, true);
|
2005-11-17 20:20:01 +00:00
|
|
|
else
|
|
|
|
audio_pause();
|
|
|
|
settings_save();
|
2005-12-04 13:05:56 +00:00
|
|
|
#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF)
|
2008-11-01 16:14:28 +00:00
|
|
|
call_storage_idle_notifys(true); /* make sure resume info is saved */
|
2005-11-17 20:20:01 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-08-15 12:27:07 +00:00
|
|
|
case ACTION_WPS_VOLUP:
|
2005-11-17 20:20:01 +00:00
|
|
|
global_settings.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:
|
2005-11-17 20:20:01 +00:00
|
|
|
global_settings.volume--;
|
2009-10-31 14:55:13 +00:00
|
|
|
vol_changed = true;
|
2005-11-17 20:20:01 +00:00
|
|
|
break;
|
2006-08-22 07:57:40 +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
|
|
|
|
ffwd_rew(ACTION_WPS_SEEKFWD);
|
2008-05-04 13:47:58 +00:00
|
|
|
last_right = last_left = 0;
|
2006-08-22 07:57:40 +00:00
|
|
|
break;
|
|
|
|
/* 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
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
if (!state->paused)
|
2007-02-14 14:40:24 +00:00
|
|
|
#if (CONFIG_CODEC == SWCODEC)
|
|
|
|
audio_pre_ff_rewind();
|
|
|
|
#else
|
|
|
|
audio_pause();
|
|
|
|
#endif
|
|
|
|
audio_ff_rewind(0);
|
|
|
|
}
|
|
|
|
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
|
|
|
|
ffwd_rew(ACTION_WPS_SEEKBACK);
|
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... */
|
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_after_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;
|
|
|
|
|
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();
|
2005-11-22 21:55:05 +00:00
|
|
|
if (quick_screen_quick(button))
|
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;
|
2006-08-15 12:27:07 +00:00
|
|
|
#endif /* HAVE_QUICKSCREEN */
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
/* screen settings */
|
|
|
|
#ifdef BUTTON_F3
|
2006-08-22 08:23:24 +00:00
|
|
|
case ACTION_F3:
|
2009-01-02 01:29:13 +00:00
|
|
|
{
|
2009-03-17 01:39:20 +00:00
|
|
|
gwps_leave_wps();
|
2006-08-22 08:23:24 +00:00
|
|
|
if (quick_screen_f3(BUTTON_F3))
|
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;
|
2006-08-16 13:25:45 +00:00
|
|
|
#endif /* BUTTON_F3 */
|
2005-11-17 20:20:01 +00:00
|
|
|
|
|
|
|
/* pitch screen */
|
2006-08-15 12:27:07 +00:00
|
|
|
#ifdef HAVE_PITCHSCREEN
|
|
|
|
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;
|
2006-08-15 12:27:07 +00:00
|
|
|
#endif /* HAVE_PITCHSCREEN */
|
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;
|
|
|
|
|
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();
|
2009-08-29 16:25:04 +00:00
|
|
|
if (browse_id3())
|
|
|
|
return GO_TO_ROOT;
|
2005-11-17 20:20:01 +00:00
|
|
|
restore = true;
|
2009-01-02 01:29:13 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-05-15 05:36:16 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
case ACTION_TOUCH_SHUFFLE: /* toggle shuffle mode */
|
|
|
|
{
|
|
|
|
global_settings.playlist_shuffle =
|
|
|
|
!global_settings.playlist_shuffle;
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
dsp_set_replaygain();
|
|
|
|
#endif
|
|
|
|
if (global_settings.playlist_shuffle)
|
|
|
|
playlist_randomise(NULL, current_tick, true);
|
|
|
|
else
|
|
|
|
playlist_sort(NULL, true);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ACTION_TOUCH_REPMODE: /* cycle the repeat mode setting */
|
|
|
|
{
|
|
|
|
const struct settings_list *rep_setting =
|
|
|
|
find_setting(&global_settings.repeat_mode, NULL);
|
|
|
|
option_select_next_val(rep_setting, false, true);
|
|
|
|
audio_flush_and_reload_tracks();
|
|
|
|
}
|
|
|
|
break;
|
2009-07-10 11:53:15 +00:00
|
|
|
#endif /* HAVE_TOUCHSCREEN */
|
|
|
|
/* 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;
|
2006-08-15 12:27:07 +00:00
|
|
|
ffwd_rew(button); /* 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)
|
|
|
|
add_event(LCD_EVENT_ACTIVATION, false, wps_lcd_activation_hook);
|
|
|
|
#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) {
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
status_set_record(false);
|
|
|
|
status_set_audio(false);
|
|
|
|
#endif
|
|
|
|
if (global_settings.fade_on_stop)
|
2008-06-23 02:45:55 +00:00
|
|
|
fade(false, true);
|
2006-03-21 07:59:23 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2009-04-06 00:39:43 +00:00
|
|
|
/* this is called from the playback thread so NO DRAWING! */
|
|
|
|
static void track_changed_callback(void *param)
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
struct wps_state *state = skin_get_global_state();
|
|
|
|
state->id3 = (struct mp3entry*)param;
|
|
|
|
state->nid3 = audio_next_track();
|
|
|
|
if (state->id3->cuesheet)
|
2009-04-06 00:39:43 +00:00
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
cue_find_current_track(state->id3->cuesheet, state->id3->elapsed);
|
2009-04-06 00:39:43 +00:00
|
|
|
}
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_request_full_update(WPS);
|
2009-04-06 00:39:43 +00:00
|
|
|
}
|
|
|
|
static void nextid3available_callback(void* param)
|
|
|
|
{
|
|
|
|
(void)param;
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_global_state()->nid3 = audio_next_track();
|
|
|
|
skin_request_full_update(WPS);
|
2009-04-06 00:39:43 +00:00
|
|
|
}
|
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
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
struct wps_state *state = skin_get_global_state();
|
|
|
|
state->ff_rewind = false;
|
|
|
|
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 */
|
|
|
|
add_event(PLAYBACK_EVENT_TRACK_CHANGE, false, track_changed_callback);
|
|
|
|
add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, false, nextid3available_callback);
|
2005-11-17 20:20:01 +00:00
|
|
|
}
|
2005-11-18 09:03:25 +00:00
|
|
|
|
2005-11-17 20:20:01 +00:00
|
|
|
|
2009-08-03 15:46:21 +00:00
|
|
|
#ifdef IPOD_ACCESSORY_PROTOCOL
|
2009-11-01 13:36:52 +00:00
|
|
|
bool is_wps_fading(void)
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
return skin_get_global_state()->is_fading;
|
2009-11-01 13:36:52 +00:00
|
|
|
}
|
|
|
|
|
2009-08-03 15:46:21 +00:00
|
|
|
int wps_get_ff_rewind_count(void)
|
|
|
|
{
|
2010-09-14 11:56:50 +00:00
|
|
|
return skin_get_global_state()->ff_rewind_count;
|
2009-08-03 15:46:21 +00:00
|
|
|
}
|
|
|
|
#endif
|