Debian Codegraph @

external/espeak/event.h

raw
1 /*
2 * Copyright (C) 2007, Gilles Casse <[email protected]>
3 * Copyright (C) 2015-2016 Reece H. Dunn
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see: <http://www.gnu.org/licenses/>.
17 */
18
19 /*
20 Manage events (sentence, word, mark, end,...), is responsible of calling the external
21 callback as soon as the relevant audio sample is played.
22
23
24 The audio stream is composed of samples from synthetised messages or audio icons.
25 Each event is associated to a sample.
26
27 Scenario:
28
29 - event_declare is called for each expected event.
30
31 - A timeout is started for the first pending event.
32
33 - When the timeout happens, the synth_callback is called.
34
35 Note: the timeout is checked against the real progress of the audio stream, which depends on pauses or underruns. If the real progress is lower than the expected one, a new timeout starts.
36
37 */
38
39 #ifndef ESPEAK_NG_EVENT_H
40 #define ESPEAK_NG_EVENT_H
41
42 #include "espeak_ng.h"
43
44 #ifdef __cplusplus
45 extern "C"
46 {
47 #endif
48
49 // Initialize the event component.
50 // First function to be called.
51 // the callback will be called when the event actually occurs.
52 // The callback is detailed in speak_lib.h .
53 void event_init(void);
54 void event_set_callback(t_espeak_callback *cb);
55
56 // Clear any pending event.
57 espeak_ng_STATUS event_clear_all(void);
58
59 // Declare a future event
60 espeak_ng_STATUS event_declare(espeak_EVENT *event);
61
62 // Terminate the event component.
63 // Last function to be called.
64 void event_terminate(void);
65
66 // general functions
67 struct timespec;
68 void clock_gettime2(struct timespec *ts);
69 void add_time_in_ms(struct timespec *ts, int time_in_ms);
70
71 #ifdef __cplusplus
72 }
73 #endif
74
75 #endif