Browse Source

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

master
Reece H. Dunn 8 years ago
parent
commit
a48576a364
3 changed files with 4 additions and 3 deletions
  1. 1
    0
      src/include/espeak-ng/espeak_ng.h
  2. 1
    0
      src/libespeak-ng/espeak_api.c
  3. 2
    3
      src/libespeak-ng/speech.c

+ 1
- 0
src/include/espeak-ng/espeak_ng.h 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
- 0
src/libespeak-ng/espeak_api.c 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
src/libespeak-ng/speech.c 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)

Loading…
Cancel
Save