summaryrefslogtreecommitdiff
path: root/navit/support/espeak/espeak_command.h
blob: b2664be6ab67b248cb4377412286f5a18c3250db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#ifndef ESPEAK_COMMAND_H
#define ESPEAK_COMMAND_H

#ifndef PLATFORM_WINDOWS
#include <unistd.h>
#endif
#include "speak_lib.h"

enum t_espeak_type
  {
    ET_TEXT,
    ET_MARK,
    ET_KEY,
    ET_CHAR,
    ET_PARAMETER,
    ET_PUNCTUATION_LIST,
    ET_VOICE_NAME,
    ET_VOICE_SPEC,
    ET_TERMINATED_MSG
  };

typedef struct
{
  unsigned int unique_identifier;
  void* text;
  size_t size;
  unsigned int position;
  espeak_POSITION_TYPE position_type;
  unsigned int end_position;
  unsigned int flags;
  void* user_data;
} t_espeak_text;

typedef struct
{
  unsigned int unique_identifier;
  void* text;
  size_t size;
  const char* index_mark;
  unsigned int end_position;
  unsigned int flags;
  void* user_data;
} t_espeak_mark;

typedef struct
{
	unsigned int unique_identifier;
	void* user_data;
	wchar_t character;
} t_espeak_character;

typedef struct
{
	unsigned int unique_identifier;
	void* user_data;
	const char* key_name;
} t_espeak_key;


typedef struct
{
  unsigned int unique_identifier;
  void* user_data;
} t_espeak_terminated_msg;


typedef struct
{
  espeak_PARAMETER parameter;
  int value;
  int relative;
} t_espeak_parameter;

enum t_command_state
{
  CS_UNDEFINED, // The command has just been created
  CS_PENDING, // stored in the fifo
  CS_PROCESSED // processed
};

typedef struct
{
  enum t_espeak_type type;
  enum t_command_state state;

  union command
  {
    t_espeak_text my_text;
    t_espeak_mark my_mark;
    t_espeak_key  my_key;
    t_espeak_character my_char;
    t_espeak_parameter my_param;
    const wchar_t* my_punctuation_list;
    const char *my_voice_name;
    espeak_VOICE my_voice_spec;
    t_espeak_terminated_msg my_terminated_msg;
  } u;
} t_espeak_command;


t_espeak_command* create_espeak_text(const void *text, size_t size, unsigned int position, espeak_POSITION_TYPE position_type, unsigned int end_position, unsigned int flags, void* user_data);

t_espeak_command* create_espeak_mark(const void *text, size_t size, const char *index_mark, unsigned int end_position, unsigned int flags, void* user_data);

t_espeak_command* create_espeak_terminated_msg(unsigned int unique_identifier, void* user_data);

t_espeak_command* create_espeak_key(const char *key_name, void *user_data);

t_espeak_command* create_espeak_char(wchar_t character, void *user_data);

t_espeak_command* create_espeak_parameter(espeak_PARAMETER parameter, int value, int relative);

t_espeak_command* create_espeak_punctuation_list(const wchar_t *punctlist);

t_espeak_command* create_espeak_voice_name(const char *name);

t_espeak_command* create_espeak_voice_spec(espeak_VOICE *voice_spec);

void process_espeak_command( t_espeak_command* the_command);

int delete_espeak_command( t_espeak_command* the_command);

void display_espeak_command(t_espeak_command* the_command);


espeak_ERROR sync_espeak_Synth(unsigned int unique_identifier, const void *text, size_t size,
		      unsigned int position, espeak_POSITION_TYPE position_type,
		      unsigned int end_position, unsigned int flags, void* user_data);
espeak_ERROR sync_espeak_Synth_Mark(unsigned int unique_identifier, const void *text, size_t size,
			   const char *index_mark, unsigned int end_position,
			   unsigned int flags, void* user_data);
void sync_espeak_Key(const char *key);
void sync_espeak_Char(wchar_t character);
void sync_espeak_SetPunctuationList(const wchar_t *punctlist);
void sync_espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
int sync_espeak_SetVoiceByName(const char *name);
int sync_espeak_SetVoiceByProperties(espeak_VOICE *voice_selector);
espeak_ERROR SetVoiceByName(const char *name);
espeak_ERROR SetVoiceByProperties(espeak_VOICE *voice_selector);
void SetParameter(int parameter, int value, int relative);

int sync_espeak_terminated_msg(unsigned int unique_identifier, void* user_data);

//>
#endif