1 |
#ifndef EVENT_H
|
2 |
#define EVENT_H
|
3 |
|
4 |
/*
|
5 |
Manage events (sentence, word, mark, end,...), is responsible of calling the external
|
6 |
callback as soon as the relevant audio sample is played.
|
7 |
|
8 |
|
9 |
The audio stream is composed of samples from synthetised messages or audio icons.
|
10 |
Each event is associated to a sample.
|
11 |
|
12 |
Scenario:
|
13 |
|
14 |
- event_declare is called for each expected event.
|
15 |
|
16 |
- A timeout is started for the first pending event.
|
17 |
|
18 |
- When the timeout happens, the synth_callback is called.
|
19 |
|
20 |
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.
|
21 |
|
22 |
*/
|
23 |
|
24 |
#include "speak_lib.h"
|
25 |
|
26 |
// Initialize the event component.
|
27 |
// First function to be called.
|
28 |
// the callback will be called when the event actually occurs.
|
29 |
// The callback is detailled in speak_lib.h .
|
30 |
void event_init(void);
|
31 |
void event_set_callback(t_espeak_callback* cb);
|
32 |
|
33 |
// Clear any pending event.
|
34 |
//
|
35 |
// Return: EE_OK: operation achieved
|
36 |
// EE_INTERNAL_ERROR.
|
37 |
espeak_ERROR event_clear_all ();
|
38 |
|
39 |
// Declare a future event
|
40 |
//
|
41 |
// Return: EE_OK: operation achieved
|
42 |
// EE_BUFFER_FULL: the event can not be buffered;
|
43 |
// you may try after a while to call the function again.
|
44 |
// EE_INTERNAL_ERROR.
|
45 |
espeak_ERROR event_declare (espeak_EVENT* event);
|
46 |
|
47 |
// Terminate the event component.
|
48 |
// Last function to be called.
|
49 |
void event_terminate();
|
50 |
|
51 |
#endif
|