navit  0.5.1-trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups
speech.c File Reference
#include <glib.h>
#include <string.h>
#include "debug.h"
#include "item.h"
#include "speech.h"
#include "plugin.h"
#include "xmlconfig.h"

Data Structures

struct  speech
 

Functions

struct speechspeech_new (struct attr *parent, struct attr **attrs)
 
void speech_destroy (struct speech *this_)
 
int speech_say (struct speech *this_, const char *text)
 
int speech_get_attr (struct speech *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
 Gets an attribute from a speech plugin. More...
 
int speech_estimate_duration (struct speech *this_, char *str)
 Tries to estimate how long it will take to speak a certain string. More...
 
int speech_set_attr (struct speech *this_, struct attr *attr)
 Sets an attribute from an speech plugin. More...
 

Variables

struct attr active =ATTR_INT(active, 1)
 
struct attrspeech_default_attrs []
 
struct object_func speech_func
 

Function Documentation

void speech_destroy ( struct speech this_)
int speech_estimate_duration ( struct speech this_,
char *  str 
)

Tries to estimate how long it will take to speak a certain string.

This function tries to estimate how long it will take to speak a certain string passed in str. It relies on the "characters per second"-value passed from the configuration.

Parameters
this_The speech whose speed should be used
strThe string that should be estimated
Returns
Time in tenth of seconds or -1 on error

References attr::num, speech_get_attr(), and attr::u.

int speech_get_attr ( struct speech this_,
enum attr_type  type,
struct attr attr,
struct attr_iter iter 
)

Gets an attribute from a speech plugin.

Parameters
this_The speech plugin the attribute should be read from
typeThe type of the attribute to be read
attrPointer to an attrib-structure where the attribute should be written to
iter(NOT IMPLEMENTED) Used to iterate through all attributes of a type. Set this to NULL to get the first attribute, set this to an attr_iter to get the next attribute
Returns
True if the attribute type was found, false if not

References attr_generic_get_attr().

Referenced by get_distance_str(), navigation_item_destination(), navit_cmd_announcer_toggle(), navit_say(), navit_speak(), osd_nav_toggle_announcer_draw(), and speech_estimate_duration().

struct speech* speech_new ( struct attr parent,
struct attr **  attrs 
)
int speech_say ( struct speech this_,
const char *  text 
)
int speech_set_attr ( struct speech this_,
struct attr attr 
)

Sets an attribute from an speech plugin.

This sets an attribute of a speech plugin, overwriting an attribute of the same type if it already exists. This function also calls all the callbacks that are registred to be called when attributes change.

Parameters
this_The speech plugin to set the attribute of
attrThe attribute to set
Returns
True if the attr could be set, false otherwise

References attr_generic_set_attr().

Referenced by navit_cmd_announcer_toggle().

Variable Documentation

struct attr* speech_default_attrs[]
Initial value:
= {
NULL,
}
struct attr active
Definition: speech.c:77
struct object_func speech_func
Initial value:
= {
attr_speech,
}
struct speech * speech_new(struct attr *parent, struct attr **attrs)
Definition: speech.c:36
void(* object_func_destroy)(void *)
Definition: xmlconfig.h:62
int navit_object_remove_attr(struct navit_object *obj, struct attr *attr)
Definition: xmlconfig.c:1298
void *(* object_func_dup)(void *)
Definition: xmlconfig.h:63
void(* object_func_iter_destroy)(struct attr_iter *)
Definition: xmlconfig.h:57
void navit_object_attr_iter_destroy(struct attr_iter *iter)
Definition: xmlconfig.c:1231
void navit_object_unref(struct navit_object *obj)
Definition: xmlconfig.c:1213
int(* object_func_init)(void *)
Definition: xmlconfig.h:61
void *(* object_func_ref)(void *)
Definition: xmlconfig.h:64
struct attr_iter *(* object_func_iter_new)(void *)
Definition: xmlconfig.h:56
int speech_set_attr(struct speech *this_, struct attr *attr)
Sets an attribute from an speech plugin.
Definition: speech.c:133
void *(* object_func_unref)(void *)
Definition: xmlconfig.h:65
int(* object_func_remove_attr)(void *, struct attr *attr)
Definition: xmlconfig.h:60
void *(* object_func_new)(struct attr *parent, struct attr **attrs)
Definition: xmlconfig.h:54
int(* object_func_set_attr)(void *, struct attr *attr)
Definition: xmlconfig.h:58
int navit_object_add_attr(struct navit_object *obj, struct attr *attr)
Definition: xmlconfig.c:1276
int speech_get_attr(struct speech *this_, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Gets an attribute from a speech plugin.
Definition: speech.c:93
struct attr_iter * navit_object_attr_iter_new(void)
Definition: xmlconfig.c:1227
int(* object_func_get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Definition: xmlconfig.h:55
struct navit_object * navit_object_ref(struct navit_object *obj)
Definition: xmlconfig.c:1207
void speech_destroy(struct speech *this_)
Definition: speech.c:66
int(* object_func_add_attr)(void *, struct attr *attr)
Definition: xmlconfig.h:59

Referenced by object_func_lookup(), and speech_new().