Browse Source

Inline the call to SynthOnTimer.

master
Reece H. Dunn 9 years ago
parent
commit
c4a7ffba33
3 changed files with 12 additions and 19 deletions
  1. 12
    3
      src/libespeak-ng/speech.c
  2. 0
    15
      src/libespeak-ng/synthesize.c
  3. 0
    1
      src/libespeak-ng/synthesize.h

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

@@ -23,6 +23,7 @@
#include <ctype.h>
#include <errno.h>
#include <locale.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -382,7 +383,8 @@ static espeak_ng_STATUS Synthesize(unsigned int unique_identifier, const void *t
SpeakNextClause(NULL, text, 0);

if (my_mode == (ENOUTPUT_MODE_SYNCHRONOUS | ENOUTPUT_MODE_SPEAK_AUDIO)) {
for (;;) {
bool continue_speaking = true;
while (continue_speaking) {
#ifdef PLATFORM_WINDOWS
Sleep(300); // 0.3s
#else
@@ -396,8 +398,15 @@ static espeak_ng_STATUS Synthesize(unsigned int unique_identifier, const void *t
sleep(1);
#endif
#endif
if (SynthOnTimer() != 0)
break;
do {
if (WcmdqUsed() > 0)
WavegenOpenSound();

if (Generate(phoneme_list, &n_phoneme_list, 1) == 0) {
if (SpeakNextClause(NULL, NULL, 1) == 0)
continue_speaking = WavegenCloseSound() == 0;
}
} while (skipping_text);
}
return ENS_OK;
}

+ 0
- 15
src/libespeak-ng/synthesize.c View File

@@ -1530,21 +1530,6 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
return 0; // finished the phoneme list
}

int SynthOnTimer()
{
do {
if (WcmdqUsed() > 0)
WavegenOpenSound();

if (Generate(phoneme_list, &n_phoneme_list, 1) == 0) {
if (SpeakNextClause(NULL, NULL, 1) == 0)
return WavegenCloseSound();
}
} while (skipping_text);

return 0;
}

int SpeakNextClause(FILE *f_in, const void *text_in, int control)
{
// Speak text from file (f_in) or memory (text_in)

+ 0
- 1
src/libespeak-ng/synthesize.h View File

@@ -502,7 +502,6 @@ espeak_ng_STATUS LoadPhData(int *srate, espeak_ng_ERROR_CONTEXT *context);
void SynthesizeInit(void);
int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume);
void MakeWave2(PHONEME_LIST *p, int n_ph);
int SynthOnTimer(void);
int SpeakNextClause(FILE *f_text, const void *text_in, int control);
void SetSpeed(int control);
void SetEmbedded(int control, int value);

Loading…
Cancel
Save