Browse Source

Propagate the Synthesize status return code through sync_espeak_(Key|Char).

master
Reece H. Dunn 9 years ago
parent
commit
21d29154ce
3 changed files with 16 additions and 23 deletions
  1. 2
    0
      src/libespeak-ng/espeak_command.c
  2. 2
    2
      src/libespeak-ng/espeak_command.h
  3. 12
    21
      src/libespeak-ng/speech.c

+ 2
- 0
src/libespeak-ng/espeak_command.c View File



#include "config.h" #include "config.h"


#include "espeak_ng.h"

#include "speech.h" #include "speech.h"
#include "espeak_command.h" #include "espeak_command.h"
#include <stdlib.h> #include <stdlib.h>

+ 2
- 2
src/libespeak-ng/espeak_command.h View File

espeak_ERROR sync_espeak_Synth_Mark(unsigned int unique_identifier, const void *text, espeak_ERROR sync_espeak_Synth_Mark(unsigned int unique_identifier, const void *text,
const char *index_mark, unsigned int end_position, const char *index_mark, unsigned int end_position,
unsigned int flags, void *user_data); unsigned int flags, void *user_data);
void sync_espeak_Key(const char *key);
void sync_espeak_Char(wchar_t character);
espeak_ng_STATUS sync_espeak_Key(const char *key);
espeak_ng_STATUS sync_espeak_Char(wchar_t character);
void sync_espeak_SetPunctuationList(const wchar_t *punctlist); void sync_espeak_SetPunctuationList(const wchar_t *punctlist);
void sync_espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative); void sync_espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative);
int sync_espeak_SetVoiceByName(const char *name); int sync_espeak_SetVoiceByName(const char *name);

+ 12
- 21
src/libespeak-ng/speech.c View File

return status_to_espeak_error(Synthesize(unique_identifier, text, flags | espeakSSML)); return status_to_espeak_error(Synthesize(unique_identifier, text, flags | espeakSSML));
} }


void sync_espeak_Key(const char *key)
espeak_ng_STATUS sync_espeak_Key(const char *key)
{ {
// symbolic name, symbolicname_character - is there a system resource of symbolic names per language? // symbolic name, symbolicname_character - is there a system resource of symbolic names per language?
int letter; int letter;
int ix; int ix;


ix = utf8_in(&letter, key); ix = utf8_in(&letter, key);
if (key[ix] == 0) {
// a single character
sync_espeak_Char(letter);
return;
}
if (key[ix] == 0) // a single character
return sync_espeak_Char(letter);


my_unique_identifier = 0; my_unique_identifier = 0;
my_user_data = NULL; my_user_data = NULL;
Synthesize(0, key, 0); // speak key as a text string
return Synthesize(0, key, 0); // speak key as a text string
} }


void sync_espeak_Char(wchar_t character)
espeak_ng_STATUS sync_espeak_Char(wchar_t character)
{ {
// is there a system resource of character names per language? // is there a system resource of character names per language?
char buf[80]; char buf[80];
my_user_data = NULL; my_user_data = NULL;


sprintf(buf, "<say-as interpret-as=\"tts:char\">&#%d;</say-as>", character); sprintf(buf, "<say-as interpret-as=\"tts:char\">&#%d;</say-as>", character);
Synthesize(0, buf, espeakSSML);
return Synthesize(0, buf, espeakSSML);
} }


void sync_espeak_SetPunctuationList(const wchar_t *punctlist) void sync_espeak_SetPunctuationList(const wchar_t *punctlist)
{ {
// symbolic name, symbolicname_character - is there a system resource of symbolicnames per language // symbolic name, symbolicname_character - is there a system resource of symbolicnames per language


if (my_mode & ENOUTPUT_MODE_SYNCHRONOUS) {
sync_espeak_Key(key_name);
return ENS_OK;
}
if (my_mode & ENOUTPUT_MODE_SYNCHRONOUS)
return sync_espeak_Key(key_name);


#ifdef USE_ASYNC #ifdef USE_ASYNC
t_espeak_command *c = create_espeak_key(key_name, NULL); t_espeak_command *c = create_espeak_key(key_name, NULL);
delete_espeak_command(c); delete_espeak_command(c);
return status; return status;
#else #else
sync_espeak_Key(key_name);
return ENS_OK;
return sync_espeak_Key(key_name);
#endif #endif
} }


// is there a system resource of character names per language? // is there a system resource of character names per language?


#ifdef USE_ASYNC #ifdef USE_ASYNC
if (my_mode & ENOUTPUT_MODE_SYNCHRONOUS) {
sync_espeak_Char(character);
return ENS_OK;
}
if (my_mode & ENOUTPUT_MODE_SYNCHRONOUS)
return sync_espeak_Char(character);


t_espeak_command *c = create_espeak_char(character, NULL); t_espeak_command *c = create_espeak_char(character, NULL);
espeak_ng_STATUS status = fifo_add_command(c); espeak_ng_STATUS status = fifo_add_command(c);
delete_espeak_command(c); delete_espeak_command(c);
return status; return status;
#else #else
sync_espeak_Char(character);
return ENS_OK;
return sync_espeak_Char(character);
#endif #endif
} }



Loading…
Cancel
Save