1
0
Fork 0
forked from len0rd/rockbox

Add some playback controls to the SBS. 2 new touch regions wps_next/wps_prev needed to make it work. 'next' in the sbs changes list selection, 'wps_next' in sbs changes audio tracks. no difference in the wps

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29631 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2011-03-22 09:31:45 +00:00
parent d3c796d20e
commit 98881fd822
5 changed files with 85 additions and 23 deletions

View file

@ -965,6 +965,7 @@ static const struct touchaction touchactions[] = {
{"setting_set", ACTION_SETTINGS_SET},
/* WPS specific actions */
{"wps_prev", ACTION_WPS_SKIPPREV }, {"wps_next", ACTION_WPS_SKIPNEXT },
{"browse", ACTION_WPS_BROWSE },
{"play", ACTION_WPS_PLAY }, {"stop", ACTION_WPS_STOP },
{"shuffle", ACTION_TOUCH_SHUFFLE }, {"repmode", ACTION_TOUCH_REPMODE },

View file

@ -28,7 +28,10 @@
#include "option_select.h"
#include "sound.h"
#include "settings_list.h"
#include "wps.h"
#include "lang.h"
#include "splash.h"
#include "playlist.h"
/** Disarms all touchregions. */
void skin_disarm_touchregions(struct wps_data *data)
@ -125,8 +128,56 @@ int skin_get_touchaction(struct wps_data *data, int* edge_offset,
if (returncode != ACTION_NONE)
{
if (global_settings.party_mode)
{
switch (returncode)
{
case ACTION_WPS_PLAY:
case ACTION_WPS_SKIPPREV:
case ACTION_WPS_SKIPNEXT:
case ACTION_WPS_STOP:
returncode = ACTION_NONE;
break;
default:
break;
}
}
switch (returncode)
{
case ACTION_WPS_PLAY:
if (!audio_status())
{
if ( global_status.resume_index != -1 )
{
if (playlist_resume() != -1)
{
playlist_start(global_status.resume_index,
global_status.resume_offset);
}
}
else
{
splash(HZ*2, ID2P(LANG_NOTHING_TO_RESUME));
}
}
else
{
wps_do_playpause(false);
}
returncode = ACTION_REDRAW;
break;
case ACTION_WPS_SKIPPREV:
audio_prev();
returncode = ACTION_REDRAW;
break;
case ACTION_WPS_SKIPNEXT:
audio_next();
returncode = ACTION_REDRAW;
break;
case ACTION_WPS_STOP:
audio_stop();
returncode = ACTION_REDRAW;
break;
case ACTION_SETTINGS_INC:
case ACTION_SETTINGS_DEC:
{

View file

@ -657,6 +657,32 @@ static void gwps_enter_wps(void)
send_event(GUI_EVENT_ACTIONUPDATE, (void*)1);
}
void wps_do_playpause(bool updatewps)
{
struct wps_state *state = skin_get_global_state();
if ( state->paused )
{
state->paused = false;
if ( global_settings.fade_on_stop )
fade(true, updatewps);
else
audio_resume();
}
else
{
state->paused = true;
if ( global_settings.fade_on_stop )
fade(false, updatewps);
else
audio_pause();
settings_save();
#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF)
call_storage_idle_notifys(true); /* make sure resume info is saved */
#endif
}
}
/* 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)
@ -783,26 +809,7 @@ long gui_wps_show(void)
case ACTION_WPS_PLAY:
if (global_settings.party_mode)
break;
if ( state->paused )
{
state->paused = false;
if ( global_settings.fade_on_stop )
fade(true, true);
else
audio_resume();
}
else
{
state->paused = true;
if ( global_settings.fade_on_stop )
fade(false, true);
else
audio_pause();
settings_save();
#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF)
call_storage_idle_notifys(true); /* make sure resume info is saved */
#endif
}
wps_do_playpause(true);
break;
case ACTION_WPS_VOLUP:

View file

@ -35,6 +35,7 @@ void fade(bool fade_in, bool updatewps);
bool ffwd_rew(int button);
void display_keylock_text(bool locked);
void wps_do_playpause(bool updatewps);
#ifdef IPOD_ACCESSORY_PROTOCOL
/* whether the wps is fading the volume due to pausing/stopping */

View file

@ -607,8 +607,10 @@ display cycling round the defined sublines. See
\begin{description}
\item[play] -- Play/pause playback.
\item[stop] -- Stop playback and exit the WPS.
\item[prev] -- Previous track.
\item[next] -- Next track.
\item[prev] -- Previous track/item.
\item[next] -- Next track/item.
\item[wps_prev] -- Previous track.
\item[wps_next] -- Next track.
\item[ffwd] -- Seek forwards in the track.
\item[rwd] -- Seek backwards in the track.
\item[menu] -- Go to the main menu.