summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/talk.c40
-rw-r--r--apps/talk.h3
2 files changed, 29 insertions, 14 deletions
diff --git a/apps/talk.c b/apps/talk.c
index 21c6f4bb1a..1da24153d2 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -717,19 +717,33 @@ int talk_value(long n, int unit, bool enqueue)
717 int unit_id; 717 int unit_id;
718 static const int unit_voiced[] = 718 static const int unit_voiced[] =
719 { /* lookup table for the voice ID of the units */ 719 { /* lookup table for the voice ID of the units */
720 -1, -1, -1, /* regular ID, int, signed */ 720 [0 ... UNIT_LAST-1] = -1, /* regular ID, int, signed */
721 VOICE_MILLISECONDS, /* here come the "real" units */ 721 [UNIT_MS]
722 VOICE_SECONDS, 722 = VOICE_MILLISECONDS, /* here come the "real" units */
723 VOICE_MINUTES, 723 [UNIT_SEC]
724 VOICE_HOURS, 724 = VOICE_SECONDS,
725 VOICE_KHZ, 725 [UNIT_MIN]
726 VOICE_DB, 726 = VOICE_MINUTES,
727 VOICE_PERCENT, 727 [UNIT_HOUR]
728 VOICE_MILLIAMPHOURS, 728 = VOICE_HOURS,
729 VOICE_PIXEL, 729 [UNIT_KHZ]
730 VOICE_PER_SEC, 730 = VOICE_KHZ,
731 VOICE_HERTZ, 731 [UNIT_DB]
732 VOICE_KBIT_PER_SEC, 732 = VOICE_DB,
733 [UNIT_PERCENT]
734 = VOICE_PERCENT,
735 [UNIT_MAH]
736 = VOICE_MILLIAMPHOURS,
737 [UNIT_PIXEL]
738 = VOICE_PIXEL,
739 [UNIT_PER_SEC]
740 = VOICE_PER_SEC,
741 [UNIT_HERTZ]
742 = VOICE_HERTZ,
743 [UNIT_MB]
744 = LANG_MEGABYTE,
745 [UNIT_KBIT]
746 = VOICE_KBIT_PER_SEC,
733 }; 747 };
734 748
735#if CONFIG_CODEC != SWCODEC 749#if CONFIG_CODEC != SWCODEC
diff --git a/apps/talk.h b/apps/talk.h
index 2f2099a8c4..bfd08354aa 100644
--- a/apps/talk.h
+++ b/apps/talk.h
@@ -27,6 +27,7 @@
27#include <stdbool.h> 27#include <stdbool.h>
28 28
29enum { 29enum {
30 /* See array "unit_voiced" in talk.c function "talk_value" */
30 UNIT_INT = 1, /* plain number */ 31 UNIT_INT = 1, /* plain number */
31 UNIT_SIGNED, /* number with mandatory sign (even if positive) */ 32 UNIT_SIGNED, /* number with mandatory sign (even if positive) */
32 UNIT_MS, /* milliseconds */ 33 UNIT_MS, /* milliseconds */
@@ -45,7 +46,7 @@ enum {
45 UNIT_LAST /* END MARKER */ 46 UNIT_LAST /* END MARKER */
46}; 47};
47 48
48#define UNIT_SHIFT (32-4) /* this many bits left from UNIT_xx enum */ 49#define UNIT_SHIFT (32-5) /* this many bits left from UNIT_xx enum */
49 50
50/* make a "talkable" ID from number + unit 51/* make a "talkable" ID from number + unit
51 unit is upper 4 bits, number the remaining (in regular 2's complement) */ 52 unit is upper 4 bits, number the remaining (in regular 2's complement) */