diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2011-07-08 22:31:15 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2011-07-08 22:31:15 +0000 |
commit | 5663e1cd0afc62e212c43c8fb374c791d554fb1b (patch) | |
tree | 488e7cc83aaf2ee61184fad46a3b4891a95b0f13 /apps/plugins/mpegplayer/mpegplayer.c | |
parent | f1a5a25dac4c61bf178ee5361998d205bb71b2d1 (diff) | |
download | rockbox-5663e1cd0afc62e212c43c8fb374c791d554fb1b.tar.gz rockbox-5663e1cd0afc62e212c43c8fb374c791d554fb1b.zip |
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
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 41f6b2e868..c6e1f4dded 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -386,6 +386,7 @@ enum video_action | |||
386 | VIDEO_STOP = 0, | 386 | VIDEO_STOP = 0, |
387 | VIDEO_PREV, | 387 | VIDEO_PREV, |
388 | VIDEO_NEXT, | 388 | VIDEO_NEXT, |
389 | VIDEO_ACTION_MANUAL = 0x8000, /* Flag that says user did it */ | ||
389 | }; | 390 | }; |
390 | 391 | ||
391 | /* OSD status - same order as icon array */ | 392 | /* OSD status - same order as icon array */ |
@@ -2139,7 +2140,7 @@ static int button_loop(void) | |||
2139 | /* Release within 3 seconds of start: skip to previous | 2140 | /* Release within 3 seconds of start: skip to previous |
2140 | * file */ | 2141 | * file */ |
2141 | osd_stop(); | 2142 | osd_stop(); |
2142 | next_action = VIDEO_PREV; | 2143 | next_action = VIDEO_PREV | VIDEO_ACTION_MANUAL; |
2143 | } | 2144 | } |
2144 | } | 2145 | } |
2145 | else if ((button & ~BUTTON_REPEAT) == old_button) { | 2146 | else if ((button & ~BUTTON_REPEAT) == old_button) { |
@@ -2169,7 +2170,7 @@ static int button_loop(void) | |||
2169 | if ((old_button | BUTTON_REL) == button) { | 2170 | if ((old_button | BUTTON_REL) == button) { |
2170 | /* If button has been released: skip to next file */ | 2171 | /* If button has been released: skip to next file */ |
2171 | osd_stop(); | 2172 | osd_stop(); |
2172 | next_action = VIDEO_NEXT; | 2173 | next_action = VIDEO_NEXT | VIDEO_ACTION_MANUAL; |
2173 | } | 2174 | } |
2174 | else if ((button & ~BUTTON_REPEAT) == old_button) { | 2175 | else if ((button & ~BUTTON_REPEAT) == old_button) { |
2175 | button = osd_seek_btn(old_button); | 2176 | button = osd_seek_btn(old_button); |
@@ -2251,11 +2252,10 @@ enum plugin_status plugin_start(const void* parameter) | |||
2251 | 2252 | ||
2252 | while (!quit) | 2253 | while (!quit) |
2253 | { | 2254 | { |
2254 | int result; | ||
2255 | |||
2256 | init_settings(videofile); | 2255 | init_settings(videofile); |
2257 | 2256 | ||
2258 | result = stream_open(videofile); | 2257 | int result = stream_open(videofile); |
2258 | bool manual_skip = false; | ||
2259 | 2259 | ||
2260 | if (result >= STREAM_OK) { | 2260 | if (result >= STREAM_OK) { |
2261 | /* start menu */ | 2261 | /* start menu */ |
@@ -2267,6 +2267,8 @@ enum plugin_status plugin_start(const void* parameter) | |||
2267 | if (result != MPEG_START_QUIT) { | 2267 | if (result != MPEG_START_QUIT) { |
2268 | /* Enter button loop and process UI */ | 2268 | /* Enter button loop and process UI */ |
2269 | next_action = button_loop(); | 2269 | next_action = button_loop(); |
2270 | manual_skip = next_action & VIDEO_ACTION_MANUAL; | ||
2271 | next_action &= ~VIDEO_ACTION_MANUAL; | ||
2270 | } | 2272 | } |
2271 | 2273 | ||
2272 | stream_close(); | 2274 | stream_close(); |
@@ -2341,6 +2343,13 @@ enum plugin_status plugin_start(const void* parameter) | |||
2341 | sizeof(videofile)); | 2343 | sizeof(videofile)); |
2342 | /* quit after finished the last videofile */ | 2344 | /* quit after finished the last videofile */ |
2343 | quit = !get_videofile_says; | 2345 | quit = !get_videofile_says; |
2346 | |||
2347 | if (manual_skip) | ||
2348 | { | ||
2349 | rb->system_sound_play(get_videofile_says ? | ||
2350 | SOUND_TRACK_SKIP : SOUND_TRACK_NO_MORE); | ||
2351 | } | ||
2352 | |||
2344 | break; | 2353 | break; |
2345 | } | 2354 | } |
2346 | case VIDEO_PREV: | 2355 | case VIDEO_PREV: |
@@ -2348,6 +2357,13 @@ enum plugin_status plugin_start(const void* parameter) | |||
2348 | get_videofile_says = get_videofile(VIDEO_PREV, videofile, | 2357 | get_videofile_says = get_videofile(VIDEO_PREV, videofile, |
2349 | sizeof(videofile)); | 2358 | sizeof(videofile)); |
2350 | /* if there is no previous file, play the same videofile */ | 2359 | /* if there is no previous file, play the same videofile */ |
2360 | |||
2361 | if (manual_skip) | ||
2362 | { | ||
2363 | rb->system_sound_play(get_videofile_says ? | ||
2364 | SOUND_TRACK_SKIP : SOUND_TRACK_NO_MORE); | ||
2365 | } | ||
2366 | |||
2351 | break; | 2367 | break; |
2352 | } | 2368 | } |
2353 | case VIDEO_STOP: | 2369 | case VIDEO_STOP: |