forked from len0rd/rockbox
[RFC] REPEAT_ONE manual track skip
I recently added track skipping while REPEAT_ONE was set currently by registering a track skip callback I'm not entirely happy with the additional constant overhead of the event callback Instead I went looking for a way to distinguish a pending track skip from some limited testing it appears to work just as well to compare playback's skip_pending == TRACK_SKIP_AUTO but the lack of lifetime control worries me slightly Change-Id: Ic71b4c3925e991f5a1216d16ecd3af6cc777ef1e
This commit is contained in:
parent
3dbf5a97ad
commit
e01055a287
2 changed files with 9 additions and 15 deletions
|
@ -3687,6 +3687,12 @@ void audio_resume(void)
|
||||||
audio_queue_send(Q_AUDIO_PAUSE, false);
|
audio_queue_send(Q_AUDIO_PAUSE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Internal function used by REPEAT_ONE */
|
||||||
|
bool audio_pending_track_skip_is_auto(void)
|
||||||
|
{
|
||||||
|
return (skip_pending == TRACK_SKIP_AUTO);
|
||||||
|
}
|
||||||
|
|
||||||
/* Skip the specified number of tracks forward or backward from the current */
|
/* Skip the specified number of tracks forward or backward from the current */
|
||||||
void audio_skip(int offset)
|
void audio_skip(int offset)
|
||||||
{
|
{
|
||||||
|
|
|
@ -167,22 +167,11 @@
|
||||||
#define PLAYLIST_SKIPPED 0x10000000
|
#define PLAYLIST_SKIPPED 0x10000000
|
||||||
|
|
||||||
static struct playlist_info current_playlist;
|
static struct playlist_info current_playlist;
|
||||||
/* REPEAT_ONE support functions */
|
/* REPEAT_ONE support function from playback.c */
|
||||||
static long last_manual_skip_tick = 0;
|
extern bool audio_pending_track_skip_is_auto(void);
|
||||||
|
|
||||||
static inline bool is_manual_skip(void)
|
static inline bool is_manual_skip(void)
|
||||||
{
|
{
|
||||||
return (last_manual_skip_tick + HZ/2 > current_tick);
|
return !audio_pending_track_skip_is_auto();
|
||||||
}
|
|
||||||
|
|
||||||
static void track_change_callback(unsigned short id, void *param)
|
|
||||||
{
|
|
||||||
(void)id;
|
|
||||||
unsigned int flags = ((struct track_event *)param)->flags;
|
|
||||||
if ((flags & TEF_AUTO_SKIP) != TEF_AUTO_SKIP)
|
|
||||||
{
|
|
||||||
last_manual_skip_tick = current_tick;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Directory Cache*/
|
/* Directory Cache*/
|
||||||
|
@ -1985,7 +1974,6 @@ void playlist_init(void)
|
||||||
|
|
||||||
dc_thread_start(¤t_playlist, false);
|
dc_thread_start(¤t_playlist, false);
|
||||||
#endif /* HAVE_DIRCACHE */
|
#endif /* HAVE_DIRCACHE */
|
||||||
add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_change_callback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue