espeak_command.h 4.2 KB

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