|
|
@@ -116,6 +116,9 @@ unsigned char *out_ptr; |
|
|
|
unsigned char *out_start; |
|
|
|
unsigned char *out_end; |
|
|
|
|
|
|
|
espeak_ng_OUTPUT_HOOKS* output_hooks = NULL; |
|
|
|
int const_f0 = 0; |
|
|
|
|
|
|
|
// the queue of operations passed to wavegen from sythesize |
|
|
|
intptr_t wcmdq[N_WCMDQ][4]; |
|
|
|
int wcmdq_head = 0; |
|
|
@@ -545,6 +548,8 @@ static void AdvanceParameters() |
|
|
|
if ((ix = wdata.pitch_ix>>8) > 127) ix = 127; |
|
|
|
x = wdata.pitch_env[ix] * wdata.pitch_range; |
|
|
|
wdata.pitch = (x>>8) + wdata.pitch_base; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
amp_ix += amp_inc; |
|
|
|
|
|
|
@@ -554,6 +559,10 @@ static void AdvanceParameters() |
|
|
|
x = ((int)(Flutter_tab[Flutter_ix >> 6])-0x80) * flutter_amp; |
|
|
|
Flutter_ix += Flutter_inc; |
|
|
|
wdata.pitch += x; |
|
|
|
|
|
|
|
if(const_f0) |
|
|
|
wdata.pitch = (const_f0<<12); |
|
|
|
|
|
|
|
if (wdata.pitch < 102400) |
|
|
|
wdata.pitch = 102400; // min pitch, 25 Hz (25 << 12) |
|
|
|
|
|
|
@@ -884,6 +893,7 @@ static int Wavegen() |
|
|
|
} |
|
|
|
*out_ptr++ = z; |
|
|
|
*out_ptr++ = z >> 8; |
|
|
|
if(output_hooks && output_hooks->outputVoiced) output_hooks->outputVoiced(z); |
|
|
|
|
|
|
|
echo_buf[echo_head++] = z; |
|
|
|
if (echo_head >= N_ECHO_BUF) |
|
|
@@ -917,6 +927,7 @@ static int PlaySilence(int length, bool resume) |
|
|
|
|
|
|
|
*out_ptr++ = value; |
|
|
|
*out_ptr++ = value >> 8; |
|
|
|
if(output_hooks && output_hooks->outputSilence) output_hooks->outputSilence(value); |
|
|
|
|
|
|
|
echo_buf[echo_head++] = value; |
|
|
|
if (echo_head >= N_ECHO_BUF) |
|
|
@@ -969,6 +980,7 @@ static int PlayWave(int length, bool resume, unsigned char *data, int scale, int |
|
|
|
|
|
|
|
out_ptr[0] = value; |
|
|
|
out_ptr[1] = value >> 8; |
|
|
|
if(output_hooks && output_hooks->outputUnvoiced) output_hooks->outputUnvoiced(value); |
|
|
|
out_ptr += 2; |
|
|
|
|
|
|
|
echo_buf[echo_head++] = (value*3)/4; |
|
|
@@ -1284,6 +1296,13 @@ static int WavegenFill2() |
|
|
|
case WCMD_PITCH: |
|
|
|
SetPitch(length, (unsigned char *)q[2], q[3] >> 16, q[3] & 0xffff); |
|
|
|
break; |
|
|
|
case WCMD_PHONEME_ALIGNMENT: |
|
|
|
{ |
|
|
|
char* data = (char*)q[1]; |
|
|
|
output_hooks->outputPhoSymbol(data,q[2]); |
|
|
|
free(data); |
|
|
|
} |
|
|
|
break; |
|
|
|
case WCMD_PAUSE: |
|
|
|
if (resume == false) |
|
|
|
echo_complete -= length; |
|
|
@@ -1418,3 +1437,20 @@ int WavegenFill(void) |
|
|
|
#endif |
|
|
|
return finished; |
|
|
|
} |
|
|
|
|
|
|
|
#pragma GCC visibility push(default) |
|
|
|
|
|
|
|
ESPEAK_NG_API espeak_ng_STATUS |
|
|
|
espeak_ng_SetOutputHooks(espeak_ng_OUTPUT_HOOKS* hooks) |
|
|
|
{ |
|
|
|
output_hooks = hooks; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
ESPEAK_NG_API espeak_ng_STATUS |
|
|
|
espeak_ng_SetConstF0(int f0) |
|
|
|
{ |
|
|
|
const_f0 = f0; |
|
|
|
} |
|
|
|
|
|
|
|
#pragma GCC visibility pop |