From cd0670616fcc149113e5d5e6c91cd054ad5b1502 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 28 Dec 2007 18:02:44 +0200 Subject: [PATCH] Add macro to check if speech is enabled. --- src/announcements.c | 25 +++++++++++++++---------- src/announcements.h | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/announcements.c b/src/announcements.c index ff2ee87..625c4b5 100644 --- a/src/announcements.c +++ b/src/announcements.c @@ -35,6 +35,8 @@ static gboolean enable_speach=TRUE; static gboolean enable_gui=TRUE; +#define SPEAK(s) { if (enable_speach) speak_text(s); } + void announce_distance_to_destination(gdouble distance, gchar *unit, gdouble climit) { @@ -44,22 +46,19 @@ if (distance>climit) { } else { g_snprintf(buffer, sizeof(buffer), _("Distance to destination: %.02f %s"), distance, unit); } -if (enable_speach) - speak_text(buffer); +SPEAK(buffer); } void announce_destination_reached(void) { -if (enable_speach) - speak_text(_("You have reached your destination.")); +SPEAK(_("You have reached your destination.")); } void -announce_speed_limit(guint limit) +announce_over_speed_limit(guint limit) { -if (enable_speach) - speak_text("Warning, you are over speed limit!"); +SPEAK(_("Warning, you are over speed limit!")); } #if 0 @@ -67,17 +66,23 @@ if (enable_speach) void announce_continue(gchar *to_name, gchar *to_ref) { +gchar buffer[64]; + } void announce_turn(gdouble direction, gchar *to_name, gchar *to_ref, gdouble next_wpt_dist, gchar unit) { -gchar buffer[64]; +gchar buffer[128]; gchar *turn, *amount; turn=(direction > 0) ? _("left") : _("right"); -amount= (fabs(direction)<25) -g_snprintf(buffer, sizeof(buffer), "Turn %s to %s", ); +/* amount=(fabs(direction)<25) ? */ +g_snprintf(buffer, sizeof(buffer), "Turn %s to %s, %s. Continue on %s ", + turn, + to_name ? to_name : "", + to_ref ? to_ref : "", + to_ref ? to_ref : to_name ? ); } #endif diff --git a/src/announcements.h b/src/announcements.h index 58b3251..537d2e5 100644 --- a/src/announcements.h +++ b/src/announcements.h @@ -26,4 +26,4 @@ void announce_distance_to_destination(gdouble distance, gchar *unit, gdouble climit); void announce_destination_reached(void); - +void announce_over_speed_limit(guint limit); -- 2.39.5