summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2021-08-18 01:23:26 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2021-08-19 01:17:29 +0000
commit24e8fa317e9905ee30d195c4beedd7b8939ed6e1 (patch)
treeb1dbca81e43d045c2df6fa9848e3a5bb4e9d91e8
parent4cbb5b42010309677f3590e3a716c69c12e8adf2 (diff)
downloadrockbox-24e8fa317e9905ee30d195c4beedd7b8939ed6e1.tar.gz
rockbox-24e8fa317e9905ee30d195c4beedd7b8939ed6e1.zip
plugins trade talk_value for talk_value_decimal
talk_value is just talk_value_decimal with 0 decimals lets add the extended function instead static inline int talk_val(long n, int unit, bool enqueue) { #define NODECIMALS 0 return rb->talk_value_decimal(n, unit, NODECIMALS, enqueue); } Change-Id: Iaba3d2f95785f2e1855e294ccf099a977bb6cb20
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h2
-rw-r--r--apps/plugins/announce_status.c19
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.c10
-rw-r--r--apps/plugins/properties.c2
-rw-r--r--apps/plugins/vbrfix.c2
6 files changed, 24 insertions, 13 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index a3970a88a7..4877c3d255 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -439,7 +439,7 @@ static const struct plugin_api rockbox_api = {
439 talk_file_or_spell, 439 talk_file_or_spell,
440 talk_dir_or_spell, 440 talk_dir_or_spell,
441 talk_number, 441 talk_number,
442 talk_value, 442 talk_value_decimal,
443 talk_spell, 443 talk_spell,
444 talk_time, 444 talk_time,
445 talk_date, 445 talk_date,
diff --git a/apps/plugin.h b/apps/plugin.h
index 64ced00bfa..bd467bcade 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -495,7 +495,7 @@ struct plugin_api {
495 int (*talk_dir_or_spell)(const char* filename, 495 int (*talk_dir_or_spell)(const char* filename,
496 const long *prefix_ids, bool enqueue); 496 const long *prefix_ids, bool enqueue);
497 int (*talk_number)(long n, bool enqueue); 497 int (*talk_number)(long n, bool enqueue);
498 int (*talk_value)(long n, int unit, bool enqueue); 498 int (*talk_value_decimal)(long n, int unit, int decimals, bool enqueue);
499 int (*talk_spell)(const char* spell, bool enqueue); 499 int (*talk_spell)(const char* spell, bool enqueue);
500 void (*talk_time)(const struct tm *tm, bool enqueue); 500 void (*talk_time)(const struct tm *tm, bool enqueue);
501 void (*talk_date)(const struct tm *tm, bool enqueue); 501 void (*talk_date)(const struct tm *tm, bool enqueue);
diff --git a/apps/plugins/announce_status.c b/apps/plugins/announce_status.c
index 84a44556ef..5a112ed6df 100644
--- a/apps/plugins/announce_status.c
+++ b/apps/plugins/announce_status.c
@@ -185,6 +185,11 @@ static void config_reset_voice(void)
185} 185}
186 186
187/****************** helper fuctions ******************/ 187/****************** helper fuctions ******************/
188static inline int talk_val(long n, int unit, bool enqueue)
189{
190 #define NODECIMALS 0
191 return rb->talk_value_decimal(n, unit, NODECIMALS, enqueue);
192}
188 193
189void announce(void) 194void announce(void)
190{ 195{
@@ -658,7 +663,7 @@ static unsigned char* voice_info_group(unsigned char* current_token, bool testin
658 if (current_char == 'T') 663 if (current_char == 'T')
659 { 664 {
660 runtime = rb->global_status->runtime; 665 runtime = rb->global_status->runtime;
661 rb->talk_value(runtime, UNIT_TIME, true); 666 talk_val(runtime, UNIT_TIME, true);
662 } 667 }
663 /* prefix suffix connectives */ 668 /* prefix suffix connectives */
664 else if (current_char == '1') 669 else if (current_char == '1')
@@ -669,7 +674,7 @@ static unsigned char* voice_info_group(unsigned char* current_token, bool testin
669 { 674 {
670 if (current_char == 'S') 675 if (current_char == 'S')
671 { 676 {
672 rb->talk_value(sleep_remaining, UNIT_TIME, true); 677 talk_val(sleep_remaining, UNIT_TIME, true);
673 } 678 }
674 /* prefix suffix connectives */ 679 /* prefix suffix connectives */
675 else if (current_char == '2') 680 else if (current_char == '2')
@@ -704,15 +709,15 @@ static unsigned char* voice_info_group(unsigned char* current_token, bool testin
704 709
705 if (current_char == 'E') 710 if (current_char == 'E')
706 { 711 {
707 rb->talk_value(elapsed_length, UNIT_TIME, true); 712 talk_val(elapsed_length, UNIT_TIME, true);
708 } 713 }
709 else if (current_char == 'L') 714 else if (current_char == 'L')
710 { 715 {
711 rb->talk_value(track_length, UNIT_TIME, true); 716 talk_val(track_length, UNIT_TIME, true);
712 } 717 }
713 else if (current_char == 'R') 718 else if (current_char == 'R')
714 { 719 {
715 rb->talk_value(track_remaining, UNIT_TIME, true); 720 talk_val(track_remaining, UNIT_TIME, true);
716 } 721 }
717 else if (current_char == 'T' && id3->title) 722 else if (current_char == 'T' && id3->title)
718 { 723 {
@@ -797,11 +802,11 @@ static unsigned char* voice_info_group(unsigned char* current_token, bool testin
797 802
798 if (current_char == 'P') 803 if (current_char == 'P')
799 { 804 {
800 rb->talk_value(rb->battery_level(), UNIT_PERCENT, true); 805 talk_val(rb->battery_level(), UNIT_PERCENT, true);
801 } 806 }
802 else if (current_char == 'M') 807 else if (current_char == 'M')
803 { 808 {
804 rb->talk_value(rb->battery_time() * 60, UNIT_TIME, true); 809 talk_val(rb->battery_time() * 60, UNIT_TIME, true);
805 } 810 }
806 /* prefix suffix connectives */ 811 /* prefix suffix connectives */
807 else if (current_char == '1') 812 else if (current_char == '1')
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c
index b1445781d0..4c9fc16804 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.c
+++ b/apps/plugins/mpegplayer/mpeg_settings.c
@@ -470,6 +470,12 @@ static bool mpeg_set_int(const char *string, const char *unit,
470 return usb; 470 return usb;
471} 471}
472 472
473static inline int talk_val(long n, int unit, bool enqueue)
474{
475 #define NODECIMALS 0
476 return rb->talk_value_decimal(n, unit, NODECIMALS, enqueue);
477}
478
473static int32_t backlight_brightness_getlang(int value, int unit) 479static int32_t backlight_brightness_getlang(int value, int unit)
474{ 480{
475 if (value < 0) 481 if (value < 0)
@@ -988,8 +994,8 @@ static int get_start_time(uint32_t duration)
988 mpegplayer_iram_preserve(); 994 mpegplayer_iram_preserve();
989#endif 995#endif
990 rb->talk_disable(false); 996 rb->talk_disable(false);
991 rb->talk_value(resume_time / TS_SECOND, UNIT_TIME, false); 997 talk_val(resume_time / TS_SECOND, UNIT_TIME, false);
992 rb->talk_value(resume_time * 100 / duration, UNIT_PERCENT, true); 998 talk_val(resume_time * 100 / duration, UNIT_PERCENT, true);
993 } 999 }
994 sliding = false; 1000 sliding = false;
995 } 1001 }
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c
index 28f539f49f..0fa83c0b56 100644
--- a/apps/plugins/properties.c
+++ b/apps/plugins/properties.c
@@ -334,7 +334,7 @@ static int speak_property_selection(int selected_item, void *data)
334 rb->talk_time(&tm, true); 334 rb->talk_time(&tm, true);
335 break; 335 break;
336 case LANG_PROPERTIES_DURATION: 336 case LANG_PROPERTIES_DURATION:
337 rb->talk_value(nseconds, UNIT_TIME, true); 337 rb->talk_value_decimal(nseconds, UNIT_TIME, 0, true);
338 break; 338 break;
339 case LANG_PROPERTIES_SUBDIRS: 339 case LANG_PROPERTIES_SUBDIRS:
340 rb->talk_number(dps->dc, true); 340 rb->talk_number(dps->dc, true);
diff --git a/apps/plugins/vbrfix.c b/apps/plugins/vbrfix.c
index 768ec9d99f..88f0a6579e 100644
--- a/apps/plugins/vbrfix.c
+++ b/apps/plugins/vbrfix.c
@@ -37,7 +37,7 @@ static void xingupdate(int percent)
37 long now = *(rb->current_tick) / HZ; 37 long now = *(rb->current_tick) / HZ;
38 if (now - last_talk >= 5) 38 if (now - last_talk >= 5)
39 { 39 {
40 rb->talk_value(percent, UNIT_PERCENT, false); 40 rb->talk_value_decimal(percent, UNIT_PERCENT, 0, false);
41 last_talk = now; 41 last_talk = now;
42 } 42 }
43 } 43 }