Return ENS_SPEECH_STOPPED from Synthesize when the speech callback returns >1 to stop the audio.

This commit is contained in:
Reece H. Dunn
2016-12-23 18:56:58 +00:00
parent fb5a957d6d
commit a48576a364
3 changed files with 4 additions and 3 deletions
+1
View File
@@ -55,6 +55,7 @@ typedef enum {
ENS_UNSUPPORTED_PHON_FORMAT = 0x10000BFF,
ENS_NO_SPECT_FRAMES = 0x10000CFF,
ENS_EMPTY_PHONEME_MANIFEST = 0x10000DFF,
ENS_SPEECH_STOPPED = 0x10000EFF,
} espeak_ng_STATUS;
typedef enum {
+1
View File
@@ -37,6 +37,7 @@ static espeak_ERROR status_to_espeak_error(espeak_ng_STATUS status)
switch (status)
{
case ENS_OK: return EE_OK;
case ENS_SPEECH_STOPPED: return EE_OK;
case ENS_VOICE_NOT_FOUND: return EE_NOT_FOUND;
case ENS_MBROLA_NOT_FOUND: return EE_NOT_FOUND;
case ENS_MBROLA_VOICE_NOT_FOUND: return EE_NOT_FOUND;
+2 -3
View File
@@ -410,7 +410,7 @@ static espeak_ng_STATUS Synthesize(unsigned int unique_identifier, const void *t
finished = synth_callback((short *)outbuf, length, event_list);
if (finished) {
SpeakNextClause(NULL, 0, 2); // stop
break;
return ENS_SPEECH_STOPPED;
}
if (Generate(phoneme_list, &n_phoneme_list, 1) == 0) {
@@ -428,12 +428,11 @@ static espeak_ng_STATUS Synthesize(unsigned int unique_identifier, const void *t
return ENS_AUDIO_ERROR;
} else if (synth_callback)
synth_callback(NULL, 0, event_list); // NULL buffer ptr indicates end of data
break;
return ENS_OK;
}
}
}
}
return ENS_OK;
}
void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr)