navit 0.5.3-trunk
Loading...
Searching...
No Matches
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.
 
int speech_estimate_duration (struct speech *this_, char *str)
 Tries to estimate how long it will take to speak a certain string.
 
int speech_set_attr (struct speech *this_, struct attr *attr)
 Sets an attribute from an speech plugin.
 

Variables

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

Function Documentation

◆ speech_destroy()

void speech_destroy ( struct speech this_)

◆ speech_estimate_duration()

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(), attr::str, and attr::u.

◆ speech_get_attr()

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(), speech_default_attrs, and type.

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().

◆ speech_new()

struct speech * speech_new ( struct attr parent,
struct attr **  attrs 
)

◆ speech_say()

int speech_say ( struct speech this_,
const char *  text 
)

◆ speech_set_attr()

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

◆ active

◆ speech_default_attrs

struct attr* speech_default_attrs[]
Initial value:
= {
NULL,
}
struct attr active
Definition speech.c:77

Referenced by speech_get_attr().

◆ speech_func

struct object_func speech_func
Initial value:
= {
attr_speech,
}
int speech_set_attr(struct speech *this_, struct attr *attr)
Sets an attribute from an speech plugin.
Definition speech.c:133
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
void speech_destroy(struct speech *this_)
Definition speech.c:66
struct speech * speech_new(struct attr *parent, struct attr **attrs)
Definition speech.c:36
int navit_object_remove_attr(struct navit_object *obj, struct attr *attr)
Definition xmlconfig.c:1399
void navit_object_attr_iter_destroy(struct attr_iter *iter)
Definition xmlconfig.c:1332
struct attr_iter * navit_object_attr_iter_new(void *unused)
Definition xmlconfig.c:1328
void * navit_object_unref(struct navit_object *obj)
Definition xmlconfig.c:1313
int navit_object_add_attr(struct navit_object *obj, struct attr *attr)
Definition xmlconfig.c:1377
struct navit_object * navit_object_ref(struct navit_object *obj)
Definition xmlconfig.c:1307
struct attr_iter *(* object_func_iter_new)(void *)
Definition xmlconfig.h:60
void(* object_func_iter_destroy)(struct attr_iter *)
Definition xmlconfig.h:61
int(* object_func_remove_attr)(void *, struct attr *attr)
Definition xmlconfig.h:64
int(* object_func_init)(void *)
Definition xmlconfig.h:65
void *(* object_func_dup)(void *)
Definition xmlconfig.h:67
int(* object_func_add_attr)(void *, struct attr *attr)
Definition xmlconfig.h:63
void *(* object_func_unref)(void *)
Definition xmlconfig.h:69
void *(* object_func_new)(struct attr *parent, struct attr **attrs)
Definition xmlconfig.h:58
void(* object_func_destroy)(void *)
Definition xmlconfig.h:66
void *(* object_func_ref)(void *)
Definition xmlconfig.h:68
int(* object_func_set_attr)(void *, struct attr *attr)
Definition xmlconfig.h:62
int(* object_func_get_attr)(void *, enum attr_type type, struct attr *attr, struct attr_iter *iter)
Definition xmlconfig.h:59

Referenced by object_func_lookup(), and speech_new().