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.

espeak_command.h 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Copyright (C) 2007, Gilles Casse <[email protected]>
  3. * Copyright (C) 2015 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. #ifndef ESPEAK_NG_COMMAND_H
  19. #define ESPEAK_NG_COMMAND_H
  20. #include <espeak-ng/espeak_ng.h>
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. typedef enum {
  26. ET_TEXT,
  27. ET_MARK,
  28. ET_KEY,
  29. ET_CHAR,
  30. ET_PARAMETER,
  31. ET_PUNCTUATION_LIST,
  32. ET_VOICE_NAME,
  33. ET_VOICE_SPEC,
  34. ET_TERMINATED_MSG
  35. } t_espeak_type;
  36. typedef struct {
  37. unsigned int unique_identifier;
  38. void *text;
  39. unsigned int position;
  40. espeak_POSITION_TYPE position_type;
  41. unsigned int end_position;
  42. unsigned int flags;
  43. void *user_data;
  44. } t_espeak_text;
  45. typedef struct {
  46. unsigned int unique_identifier;
  47. void *text;
  48. const char *index_mark;
  49. unsigned int end_position;
  50. unsigned int flags;
  51. void *user_data;
  52. } t_espeak_mark;
  53. typedef struct {
  54. unsigned int unique_identifier;
  55. void *user_data;
  56. wchar_t character;
  57. } t_espeak_character;
  58. typedef struct {
  59. unsigned int unique_identifier;
  60. void *user_data;
  61. const char *key_name;
  62. } t_espeak_key;
  63. typedef struct {
  64. unsigned int unique_identifier;
  65. void *user_data;
  66. } t_espeak_terminated_msg;
  67. typedef struct {
  68. espeak_PARAMETER parameter;
  69. int value;
  70. int relative;
  71. } t_espeak_parameter;
  72. typedef enum {
  73. CS_UNDEFINED, // The command has just been created
  74. CS_PENDING, // stored in the fifo
  75. CS_PROCESSED // processed
  76. } t_command_state;
  77. typedef struct {
  78. t_espeak_type type;
  79. t_command_state state;
  80. union command {
  81. t_espeak_text my_text;
  82. t_espeak_mark my_mark;
  83. t_espeak_key my_key;
  84. t_espeak_character my_char;
  85. t_espeak_parameter my_param;
  86. const wchar_t *my_punctuation_list;
  87. const char *my_voice_name;
  88. espeak_VOICE my_voice_spec;
  89. t_espeak_terminated_msg my_terminated_msg;
  90. } u;
  91. } t_espeak_command;
  92. 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);
  93. 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);
  94. t_espeak_command *create_espeak_terminated_msg(unsigned int unique_identifier, void *user_data);
  95. t_espeak_command *create_espeak_key(const char *key_name, void *user_data);
  96. t_espeak_command *create_espeak_char(wchar_t character, void *user_data);
  97. t_espeak_command *create_espeak_parameter(espeak_PARAMETER parameter, int value, int relative);
  98. t_espeak_command *create_espeak_punctuation_list(const wchar_t *punctlist);
  99. t_espeak_command *create_espeak_voice_name(const char *name);
  100. t_espeak_command *create_espeak_voice_spec(espeak_VOICE *voice_spec);
  101. void process_espeak_command(t_espeak_command *the_command);
  102. int delete_espeak_command(t_espeak_command *the_command);
  103. espeak_ng_STATUS sync_espeak_Synth(unsigned int unique_identifier, const void *text,
  104. unsigned int position, espeak_POSITION_TYPE position_type,
  105. unsigned int end_position, unsigned int flags, void *user_data);
  106. espeak_ng_STATUS sync_espeak_Synth_Mark(unsigned int unique_identifier, const void *text,
  107. const char *index_mark, unsigned int end_position,
  108. unsigned int flags, void *user_data);
  109. espeak_ng_STATUS sync_espeak_Key(const char *key);
  110. espeak_ng_STATUS sync_espeak_Char(wchar_t character);
  111. void sync_espeak_SetPunctuationList(const wchar_t *punctlist);
  112. void sync_espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
  113. espeak_ng_STATUS SetParameter(int parameter, int value, int relative);
  114. int sync_espeak_terminated_msg(unsigned int unique_identifier, void *user_data);
  115. #ifdef __cplusplus
  116. }
  117. #endif
  118. // >
  119. #endif