FS#7682 by Daniel Dalton - Enable voice in the wakeup alarm screen

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14977 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2007-10-04 08:56:49 +00:00
parent 940e8990b5
commit b0a373681b
2 changed files with 48 additions and 10 deletions

View file

@ -33,16 +33,27 @@
#include "rtc.h" #include "rtc.h"
#include "misc.h" #include "misc.h"
#include "screens.h" #include "screens.h"
#include"talk.h"
#include "lang.h" #include "lang.h"
#include "power.h" #include "power.h"
#include "alarm_menu.h" #include "alarm_menu.h"
#include "backlight.h" #include "backlight.h"
#include "splash.h" #include "splash.h"
#include "statusbar.h" #include "statusbar.h"
#include "textarea.h" #include "textarea.h"
static void speak_time(int hours, int minutes, bool speak_hours)
{
if (talk_menus_enabled()){
if(speak_hours) {
talk_value(hours, UNIT_HOUR, false);
talk_value(minutes, UNIT_MIN, true);
} else {
talk_value(minutes, UNIT_MIN, false);
}
}
}
bool alarm_screen(void) bool alarm_screen(void)
{ {
int h, m; int h, m;
@ -53,7 +64,7 @@ bool alarm_screen(void)
int button; int button;
int i; int i;
bool update = true; bool update = true;
bool hour_wrapped = false;
rtc_get_alarm(&h, &m); rtc_get_alarm(&h, &m);
@ -74,6 +85,12 @@ bool alarm_screen(void)
gui_textarea_clear(&screens[i]); gui_textarea_clear(&screens[i]);
screens[i].puts(0, 3, str(LANG_ALARM_MOD_KEYS)); screens[i].puts(0, 3, str(LANG_ALARM_MOD_KEYS));
} }
/* Talk when entering the wakeup screen */
if (talk_menus_enabled())
{
talk_value(h, UNIT_HOUR, true);
talk_value(m, UNIT_MIN, true);
}
update = false; update = false;
} }
@ -91,15 +108,23 @@ bool alarm_screen(void)
/* accept alarms only if they are in 2 minutes or more */ /* accept alarms only if they are in 2 minutes or more */
tm = get_time(); tm = get_time();
togo = (m + h * 60 - tm->tm_min - tm->tm_hour * 60 + 1440) % 1440; togo = (m + h * 60 - tm->tm_min - tm->tm_hour * 60 + 1440) % 1440;
if (togo > 1) { if (togo > 1) {
rtc_init(); rtc_init();
rtc_set_alarm(h,m); rtc_set_alarm(h,m);
rtc_enable_alarm(true); rtc_enable_alarm(true);
if (talk_menus_enabled())
{
talk_id(LANG_ALARM_MOD_TIME_TO_GO, true);
talk_value(togo / 60, UNIT_HOUR, true);
talk_value(togo % 60, UNIT_MIN, true);
talk_force_enqueue_next();
}
gui_syncsplash(HZ*2, str(LANG_ALARM_MOD_TIME_TO_GO), gui_syncsplash(HZ*2, str(LANG_ALARM_MOD_TIME_TO_GO),
togo / 60, togo % 60); togo / 60, togo % 60);
done = true; done = true;
} else { } else {
gui_syncsplash(HZ, str(LANG_ALARM_MOD_ERROR)); gui_syncsplash(HZ, ID2P(LANG_ALARM_MOD_ERROR));
update = true; update = true;
} }
break; break;
@ -111,9 +136,12 @@ bool alarm_screen(void)
if (m == 60) { if (m == 60) {
h += 1; h += 1;
m = 0; m = 0;
hour_wrapped = true;
} }
if (h == 24) if (h == 24)
h = 0; h = 0;
speak_time(h, m, hour_wrapped);
break; break;
/* dec(m) */ /* dec(m) */
@ -123,31 +151,41 @@ bool alarm_screen(void)
if (m == -5) { if (m == -5) {
h -= 1; h -= 1;
m = 55; m = 55;
hour_wrapped = true;
} }
if (h == -1) if (h == -1)
h = 23; h = 23;
speak_time(h, m, hour_wrapped);
break; break;
/* inc(h) */ /* inc(h) */
case ACTION_STD_NEXT: case ACTION_STD_NEXT:
case ACTION_STD_NEXTREPEAT: case ACTION_STD_NEXTREPEAT:
h = (h+1) % 24; h = (h+1) % 24;
if (talk_menus_enabled())
talk_value(h, UNIT_HOUR, false);
break; break;
/* dec(h) */ /* dec(h) */
case ACTION_STD_PREV: case ACTION_STD_PREV:
case ACTION_STD_PREVREPEAT: case ACTION_STD_PREVREPEAT:
h = (h+23) % 24; h = (h+23) % 24;
if (talk_menus_enabled())
talk_value(h, UNIT_HOUR, false);
break; break;
case ACTION_STD_CANCEL: case ACTION_STD_CANCEL:
rtc_enable_alarm(false); rtc_enable_alarm(false);
gui_syncsplash(HZ*2, str(LANG_ALARM_MOD_DISABLE)); gui_syncsplash(HZ*2, ID2P(LANG_ALARM_MOD_DISABLE));
done = true; done = true;
break; break;
case ACTION_NONE: case ACTION_NONE:
gui_syncstatusbar_draw(&statusbars, false); gui_syncstatusbar_draw(&statusbars, false);
hour_wrapped = false;
break; break;
default: default:

View file

@ -4695,7 +4695,7 @@
</dest> </dest>
<voice> <voice>
*: none *: none
alarm: "" alarm: "Waking up in"
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
@ -4712,7 +4712,7 @@
</dest> </dest>
<voice> <voice>
*: none *: none
alarm: "" alarm: "Alarm set"
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
@ -4729,7 +4729,7 @@
</dest> </dest>
<voice> <voice>
*: none *: none
alarm: "" alarm: "Alarm Time Is Too Soon!"
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>
@ -4765,7 +4765,7 @@
</dest> </dest>
<voice> <voice>
*: none *: none
alarm: "" alarm: "Alarm Disabled"
</voice> </voice>
</phrase> </phrase>
<phrase> <phrase>