Make the Play / Pause option restart playback if its stopped also

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12738 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2007-03-12 13:41:52 +00:00
parent 6f2bb422c0
commit 6e44209a4c
3 changed files with 17 additions and 2 deletions

View file

@ -484,6 +484,9 @@ static const struct plugin_api rockbox_api = {
detect_flashed_ramimage, detect_flashed_ramimage,
detect_flashed_romimage, detect_flashed_romimage,
#endif #endif
playlist_resume,
playlist_start,
&global_status,
}; };
int plugin_load(const char* plugin, void* parameter) int plugin_load(const char* plugin, void* parameter)

View file

@ -110,7 +110,7 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */ #define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */ /* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 47 #define PLUGIN_API_VERSION 48
/* update this to latest version if a change to the api struct breaks /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
@ -598,6 +598,9 @@ struct plugin_api {
bool (*detect_flashed_ramimage)(void); bool (*detect_flashed_ramimage)(void);
bool (*detect_flashed_romimage)(void); bool (*detect_flashed_romimage)(void);
#endif #endif
int (*playlist_resume)(void);
int (*playlist_start)(int start_index, int offset);
struct system_status *global_status;
}; };
/* plugin header */ /* plugin header */

View file

@ -29,7 +29,16 @@ bool prevtrack(void)
bool play(void) bool play(void)
{ {
if (api->audio_status() & AUDIO_STATUS_PAUSE) int audio_status = api->audio_status();
if (!audio_status && api->global_status->resume_index != -1)
{
if (api->playlist_resume() != -1)
{
api->playlist_start(api->global_status->resume_index,
api->global_status->resume_offset);
}
}
else if (audio_status & AUDIO_STATUS_PAUSE)
api->audio_resume(); api->audio_resume();
else else
api->audio_pause(); api->audio_pause();