eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

event.h 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. Manage events (sentence, word, mark, end,...), is responsible of calling the external
  20. callback as soon as the relevant audio sample is played.
  21. The audio stream is composed of samples from synthetised messages or audio icons.
  22. Each event is associated to a sample.
  23. Scenario:
  24. - event_declare is called for each expected event.
  25. - A timeout is started for the first pending event.
  26. - When the timeout happens, the synth_callback is called.
  27. 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.
  28. */
  29. #ifndef ESPEAK_NG_EVENT_H
  30. #define ESPEAK_NG_EVENT_H
  31. #include <espeak-ng/espeak_ng.h>
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. // Initialize the event component.
  37. // First function to be called.
  38. // the callback will be called when the event actually occurs.
  39. // The callback is detailed in speak_lib.h .
  40. void event_init(void);
  41. void event_set_callback(t_espeak_callback *cb);
  42. // Clear any pending event.
  43. espeak_ng_STATUS event_clear_all(void);
  44. // Declare a future event
  45. espeak_ng_STATUS event_declare(espeak_EVENT *event);
  46. // Terminate the event component.
  47. // Last function to be called.
  48. void event_terminate(void);
  49. // general functions
  50. struct timespec;
  51. void clock_gettime2(struct timespec *ts);
  52. void add_time_in_ms(struct timespec *ts, int time_in_ms);
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif