summaryrefslogtreecommitdiff
path: root/apps/playback.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/playback.c')
-rw-r--r--apps/playback.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/apps/playback.c b/apps/playback.c
index caaee8c5f5..8d869ceda3 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -92,6 +92,8 @@ static volatile bool paused;
92#define AUDIO_CODEC_DONE 9 92#define AUDIO_CODEC_DONE 9
93#define AUDIO_FLUSH 10 93#define AUDIO_FLUSH 10
94#define AUDIO_TRACK_CHANGED 11 94#define AUDIO_TRACK_CHANGED 11
95#define AUDIO_DIR_NEXT 12
96#define AUDIO_DIR_PREV 13
95 97
96#define CODEC_LOAD 1 98#define CODEC_LOAD 1
97#define CODEC_LOAD_DISK 2 99#define CODEC_LOAD_DISK 2
@@ -1653,6 +1655,24 @@ static void initiate_track_change(int peek_index)
1653 codec_track_changed(); 1655 codec_track_changed();
1654} 1656}
1655 1657
1658static void initiate_dir_change(int direction)
1659{
1660 if(!playlist_next_dir(direction))
1661 return;
1662
1663 /* Detect if disk is spinning.. */
1664 if (filling) {
1665 queue_post(&audio_queue, AUDIO_PLAY, 0);
1666 } else {
1667 new_track = 0;
1668 ci.reload_codec = true;
1669 if (!pcmbuf_is_crossfade_enabled())
1670 pcmbuf_flush_audio();
1671 }
1672
1673 codec_track_changed();
1674}
1675
1656void audio_thread(void) 1676void audio_thread(void)
1657{ 1677{
1658 struct event ev; 1678 struct event ev;
@@ -1735,6 +1755,21 @@ void audio_thread(void)
1735 initiate_track_change(-1); 1755 initiate_track_change(-1);
1736 break; 1756 break;
1737 1757
1758
1759 case AUDIO_DIR_NEXT:
1760 logf("audio_dir_next");
1761 if (global_settings.beep)
1762 pcmbuf_beep(5000, 100, 2500*global_settings.beep);
1763 initiate_dir_change(1);
1764 break;
1765
1766 case AUDIO_DIR_PREV:
1767 logf("audio_dir_prev");
1768 if (global_settings.beep)
1769 pcmbuf_beep(5000, 100, 2500*global_settings.beep);
1770 initiate_dir_change(-1);
1771 break;
1772
1738 case AUDIO_FLUSH: 1773 case AUDIO_FLUSH:
1739 audio_invalidate_tracks(); 1774 audio_invalidate_tracks();
1740 break ; 1775 break ;
@@ -2008,6 +2043,16 @@ void audio_prev(void)
2008 queue_post(&audio_queue, AUDIO_PREV, 0); 2043 queue_post(&audio_queue, AUDIO_PREV, 0);
2009} 2044}
2010 2045
2046void audio_next_dir(void)
2047{
2048 queue_post(&audio_queue, AUDIO_DIR_NEXT, 0);
2049}
2050
2051void audio_prev_dir(void)
2052{
2053 queue_post(&audio_queue, AUDIO_DIR_PREV, 0);
2054}
2055
2011void audio_ff_rewind(int newpos) 2056void audio_ff_rewind(int newpos)
2012{ 2057{
2013 logf("rewind: %d", newpos); 2058 logf("rewind: %d", newpos);