diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2019-07-20 17:32:49 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2019-08-04 22:47:00 +0200 |
commit | 4ad76652ef19daf6404e8a97eb73aeadfe1e66fb (patch) | |
tree | b54be971440fcd96879973f088bd20e00e687c7f /apps/plugins/mpegplayer/mpegplayer.c | |
parent | 7234de58ae69b4ecbd97efd77a61bf0cfc1737bf (diff) | |
download | rockbox-4ad76652ef19daf6404e8a97eb73aeadfe1e66fb.tar.gz rockbox-4ad76652ef19daf6404e8a97eb73aeadfe1e66fb.zip |
Speech feedback in mpegplayer menus
Patch by Igor Poretsky
Change-Id: Idc6920e17be6537557f2b1cf00f7e559e30b45e8
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 6a33a544db..39ea484ff2 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -634,6 +634,54 @@ static unsigned draw_blendcolor(unsigned c1, unsigned c2, unsigned char amount) | |||
634 | } | 634 | } |
635 | #endif | 635 | #endif |
636 | 636 | ||
637 | #ifdef PLUGIN_USE_IRAM | ||
638 | /* IRAM preserving mechanism to enable talking menus */ | ||
639 | static char *iram_saved_copy; | ||
640 | extern char iramstart[], iramend[]; | ||
641 | |||
642 | static void iram_saving_init(void) | ||
643 | { | ||
644 | #ifndef SIMULATOR | ||
645 | size_t size; | ||
646 | iram_saved_copy = (char *)rb->plugin_get_buffer(&size); | ||
647 | |||
648 | if (size >= (size_t)(iramend-iramstart)) | ||
649 | iram_saved_copy += size - (size_t)(iramend - iramstart); | ||
650 | else | ||
651 | #endif | ||
652 | iram_saved_copy = NULL; | ||
653 | |||
654 | return; | ||
655 | } | ||
656 | |||
657 | void mpegplayer_iram_preserve(void) | ||
658 | { | ||
659 | if (iram_saved_copy) | ||
660 | { | ||
661 | rb->memcpy(iram_saved_copy, iramstart, iramend-iramstart); | ||
662 | #ifdef HAVE_CPUCACHE_INVALIDATE | ||
663 | /* make the icache (if it exists) up to date with the new code */ | ||
664 | rb->cpucache_invalidate(); | ||
665 | #endif /* HAVE_CPUCACHE_INVALIDATE */ | ||
666 | } | ||
667 | return; | ||
668 | } | ||
669 | |||
670 | void mpegplayer_iram_restore(void) | ||
671 | { | ||
672 | if (iram_saved_copy) | ||
673 | { | ||
674 | rb->audio_hard_stop(); | ||
675 | rb->memcpy(iramstart, iram_saved_copy, iramend-iramstart); | ||
676 | #ifdef HAVE_CPUCACHE_INVALIDATE | ||
677 | /* make the icache (if it exists) up to date with the new code */ | ||
678 | rb->cpucache_invalidate(); | ||
679 | #endif /* HAVE_CPUCACHE_INVALIDATE */ | ||
680 | } | ||
681 | return; | ||
682 | } | ||
683 | #endif | ||
684 | |||
637 | /* Drawing functions that operate rotated on LCD_PORTRAIT displays - | 685 | /* Drawing functions that operate rotated on LCD_PORTRAIT displays - |
638 | * most are just wrappers of lcd_* functions with transforms applied. | 686 | * most are just wrappers of lcd_* functions with transforms applied. |
639 | * The origin is the upper-left corner of the OSD area */ | 687 | * The origin is the upper-left corner of the OSD area */ |
@@ -2369,6 +2417,10 @@ enum plugin_status plugin_start(const void* parameter) | |||
2369 | int status = PLUGIN_OK; /* assume success */ | 2417 | int status = PLUGIN_OK; /* assume success */ |
2370 | bool quit = false; | 2418 | bool quit = false; |
2371 | 2419 | ||
2420 | #if defined(PLUGIN_USE_IRAM) && !defined(SIMULATOR) | ||
2421 | bool preserved_talk_state; | ||
2422 | #endif | ||
2423 | |||
2372 | if (parameter == NULL) { | 2424 | if (parameter == NULL) { |
2373 | /* No file = GTFO */ | 2425 | /* No file = GTFO */ |
2374 | rb->splash(HZ*2, "No File"); | 2426 | rb->splash(HZ*2, "No File"); |
@@ -2378,6 +2430,16 @@ enum plugin_status plugin_start(const void* parameter) | |||
2378 | /* Disable all talking before initializing IRAM */ | 2430 | /* Disable all talking before initializing IRAM */ |
2379 | rb->talk_disable(true); | 2431 | rb->talk_disable(true); |
2380 | 2432 | ||
2433 | #ifdef PLUGIN_USE_IRAM | ||
2434 | iram_saving_init(); | ||
2435 | |||
2436 | #ifndef SIMULATOR | ||
2437 | preserved_talk_state = rb->global_settings->talk_menu; | ||
2438 | if (!iram_saved_copy) | ||
2439 | rb->global_settings->talk_menu = false; | ||
2440 | #endif | ||
2441 | #endif | ||
2442 | |||
2381 | #ifdef HAVE_LCD_COLOR | 2443 | #ifdef HAVE_LCD_COLOR |
2382 | rb->lcd_set_backdrop(NULL); | 2444 | rb->lcd_set_backdrop(NULL); |
2383 | rb->lcd_set_foreground(LCD_WHITE); | 2445 | rb->lcd_set_foreground(LCD_WHITE); |
@@ -2528,6 +2590,11 @@ enum plugin_status plugin_start(const void* parameter) | |||
2528 | 2590 | ||
2529 | stream_exit(); | 2591 | stream_exit(); |
2530 | 2592 | ||
2593 | #if defined(PLUGIN_USE_IRAM) && !defined(SIMULATOR) | ||
2594 | if (!iram_saved_copy) | ||
2595 | rb->global_settings->talk_menu = preserved_talk_state; | ||
2596 | #endif | ||
2597 | |||
2531 | rb->talk_disable(false); | 2598 | rb->talk_disable(false); |
2532 | 2599 | ||
2533 | /* Actually handle delayed processing of system events of interest | 2600 | /* Actually handle delayed processing of system events of interest |