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.

fifo.h 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. // Helps to add espeak commands in a first-in first-out queue
  19. // and run them asynchronously.
  20. #ifndef ESPEAK_NG_FIFO_H
  21. #define ESPEAK_NG_FIFO_H
  22. #include <espeak-ng/espeak_ng.h>
  23. #include "espeak_command.h"
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. // Initialize the fifo component.
  29. // First function to be called.
  30. void fifo_init(void);
  31. // Add an espeak command.
  32. //
  33. // Note: this function fails if too many commands are already buffered.
  34. // In such a case, the calling function could wait and then add again its command.
  35. espeak_ng_STATUS fifo_add_command(t_espeak_command *c);
  36. // Add two espeak commands in a single transaction.
  37. //
  38. // Note: this function fails if too many commands are already buffered.
  39. // In such a case, the calling function could wait and then add again these commands.
  40. espeak_ng_STATUS fifo_add_commands(t_espeak_command *c1, t_espeak_command *c2);
  41. // The current running command must be stopped and the awaiting commands are cleared.
  42. espeak_ng_STATUS fifo_stop(void);
  43. // Is there a running command?
  44. // Returns 1 if yes; 0 otherwise.
  45. int fifo_is_busy(void);
  46. // Terminate the fifo component.
  47. // Last function to be called.
  48. void fifo_terminate(void);
  49. // Indicates if the running command is still enabled.
  50. //
  51. // Note: this function is mainly called by the SynthCallback (speak_lib.cpp)
  52. // It indicates if the actual wave sample can still be played. It is helpful for
  53. // stopping speech as soon as a cancel command is applied.
  54. //
  55. // Returns 1 if yes, or 0 otherwise.
  56. int fifo_is_command_enabled(void);
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif