From 5663e1cd0afc62e212c43c8fb374c791d554fb1b Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Fri, 8 Jul 2011 22:31:15 +0000 Subject: Have mpegplayer use the mixer (the playback channel, since it's mutually exclusive to audio playback) so the clicks and skip beep can be used according to user settings. Introduce some system sound functions to make easier playing event sounds from various places and convert files calling 'beep_play' to use 'system_sound_play' and 'keyclick_click'. Event sound could be become themeable. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30130 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/mpegplayer/mpegplayer.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'apps/plugins/mpegplayer/mpegplayer.c') diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 41f6b2e..c6e1f4d 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c @@ -386,6 +386,7 @@ enum video_action VIDEO_STOP = 0, VIDEO_PREV, VIDEO_NEXT, + VIDEO_ACTION_MANUAL = 0x8000, /* Flag that says user did it */ }; /* OSD status - same order as icon array */ @@ -2139,7 +2140,7 @@ static int button_loop(void) /* Release within 3 seconds of start: skip to previous * file */ osd_stop(); - next_action = VIDEO_PREV; + next_action = VIDEO_PREV | VIDEO_ACTION_MANUAL; } } else if ((button & ~BUTTON_REPEAT) == old_button) { @@ -2169,7 +2170,7 @@ static int button_loop(void) if ((old_button | BUTTON_REL) == button) { /* If button has been released: skip to next file */ osd_stop(); - next_action = VIDEO_NEXT; + next_action = VIDEO_NEXT | VIDEO_ACTION_MANUAL; } else if ((button & ~BUTTON_REPEAT) == old_button) { button = osd_seek_btn(old_button); @@ -2251,11 +2252,10 @@ enum plugin_status plugin_start(const void* parameter) while (!quit) { - int result; - init_settings(videofile); - result = stream_open(videofile); + int result = stream_open(videofile); + bool manual_skip = false; if (result >= STREAM_OK) { /* start menu */ @@ -2267,6 +2267,8 @@ enum plugin_status plugin_start(const void* parameter) if (result != MPEG_START_QUIT) { /* Enter button loop and process UI */ next_action = button_loop(); + manual_skip = next_action & VIDEO_ACTION_MANUAL; + next_action &= ~VIDEO_ACTION_MANUAL; } stream_close(); @@ -2341,6 +2343,13 @@ enum plugin_status plugin_start(const void* parameter) sizeof(videofile)); /* quit after finished the last videofile */ quit = !get_videofile_says; + + if (manual_skip) + { + rb->system_sound_play(get_videofile_says ? + SOUND_TRACK_SKIP : SOUND_TRACK_NO_MORE); + } + break; } case VIDEO_PREV: @@ -2348,6 +2357,13 @@ enum plugin_status plugin_start(const void* parameter) get_videofile_says = get_videofile(VIDEO_PREV, videofile, sizeof(videofile)); /* if there is no previous file, play the same videofile */ + + if (manual_skip) + { + rb->system_sound_play(get_videofile_says ? + SOUND_TRACK_SKIP : SOUND_TRACK_NO_MORE); + } + break; } case VIDEO_STOP: -- cgit v1.1