Browse Source

Fix issue #772: setting buffer size to 50ms leads to truncated mbrola-fr4 output

master
Valdis Vitolins 5 years ago
parent
commit
238427184a
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      src/libespeak-ng/speech.c

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

static espeak_ng_OUTPUT_MODE my_mode = ENOUTPUT_MODE_SYNCHRONOUS; static espeak_ng_OUTPUT_MODE my_mode = ENOUTPUT_MODE_SYNCHRONOUS;
static int out_samplerate = 0; static int out_samplerate = 0;
static int voice_samplerate = 22050; static int voice_samplerate = 22050;
static int min_buffer_length = 60; // minimum buffer length in ms
static espeak_ng_STATUS err = ENS_OK; static espeak_ng_STATUS err = ENS_OK;


t_espeak_callback *synth_callback = NULL; t_espeak_callback *synth_callback = NULL;
my_audio = create_audio_device_object(device, "eSpeak", "Text-to-Speech"); my_audio = create_audio_device_object(device, "eSpeak", "Text-to-Speech");
#endif #endif


// buffer_length is in mS, allocate 2 bytes per sample
if (buffer_length == 0)
buffer_length = 60;


// Don't allow buffer be smaller than safe minimum
if (buffer_length < min_buffer_length)
buffer_length = min_buffer_length;

// allocate 2 bytes per sample
outbuf_size = (buffer_length * samplerate)/500; outbuf_size = (buffer_length * samplerate)/500;
out_start = (unsigned char *)realloc(outbuf, outbuf_size); out_start = (unsigned char *)realloc(outbuf, outbuf_size);
if (out_start == NULL) if (out_start == NULL)

Loading…
Cancel
Save