diff --git a/src/libespeak-ng/klatt.c b/src/libespeak-ng/klatt.c index 4be4874f..ec191d22 100644 --- a/src/libespeak-ng/klatt.c +++ b/src/libespeak-ng/klatt.c @@ -838,14 +838,13 @@ static double DBtoLIN(long dB) return (double)(amptable[dB]) * 0.001; } -extern voice_t *wvoice; static klatt_peaks_t peaks[N_PEAKS]; static int end_wave; static int klattp[N_KLATTP]; static double klattp1[N_KLATTP]; static double klattp_inc[N_KLATTP]; -int Wavegen_Klatt(int length, int resume, frame_t *fr1, frame_t *fr2, WGEN_DATA *wdata) +int Wavegen_Klatt(int length, int resume, frame_t *fr1, frame_t *fr2, WGEN_DATA *wdata, voice_t *wvoice) { if (resume == 0) SetSynth_Klatt(length, fr1, fr2, wvoice, 1); @@ -937,7 +936,7 @@ int Wavegen_Klatt(int length, int resume, frame_t *fr1, frame_t *fr2, WGEN_DATA return 0; } -static void SetSynth_Klatt(int length, frame_t *fr1, frame_t *fr2, voice_t *v, int control) +static void SetSynth_Klatt(int length, frame_t *fr1, frame_t *fr2, voice_t *wvoice, int control) { int ix; double next; @@ -1007,9 +1006,9 @@ static void SetSynth_Klatt(int length, frame_t *fr1, frame_t *fr2, voice_t *v, i nsamples = length; for (ix = 1; ix < 6; ix++) { - peaks[ix].freq1 = (fr1->ffreq[ix] * v->freq[ix] / 256.0) + v->freqadd[ix]; + peaks[ix].freq1 = (fr1->ffreq[ix] * wvoice->freq[ix] / 256.0) + wvoice->freqadd[ix]; peaks[ix].freq = (int)peaks[ix].freq1; - next = (fr2->ffreq[ix] * v->freq[ix] / 256.0) + v->freqadd[ix]; + next = (fr2->ffreq[ix] * wvoice->freq[ix] / 256.0) + wvoice->freqadd[ix]; peaks[ix].freq_inc = ((next - peaks[ix].freq1) * STEPSIZE) / length; if (ix < 4) { diff --git a/src/libespeak-ng/klatt.h b/src/libespeak-ng/klatt.h index 242d4bdb..4c7a4406 100644 --- a/src/libespeak-ng/klatt.h +++ b/src/libespeak-ng/klatt.h @@ -179,7 +179,7 @@ typedef struct { void KlattInit(void); void KlattReset(int control); -int Wavegen_Klatt(int length, int resume, frame_t *fr1, frame_t *fr2, WGEN_DATA *wdata); +int Wavegen_Klatt(int length, int resume, frame_t *fr1, frame_t *fr2, WGEN_DATA *wdata, voice_t *wvoice); #ifdef __cplusplus } diff --git a/src/libespeak-ng/wavegen.c b/src/libespeak-ng/wavegen.c index c800ba87..142f5fdd 100644 --- a/src/libespeak-ng/wavegen.c +++ b/src/libespeak-ng/wavegen.c @@ -1346,7 +1346,7 @@ static int WavegenFill2() wdata.n_mix_wavefile = 0; // ... and drop through to WCMD_SPECT case case WCMD_KLATT: echo_complete = echo_length; - result = Wavegen_Klatt(length & 0xffff, resume, (frame_t *)q[2], (frame_t *)q[3], &wdata); + result = Wavegen_Klatt(length & 0xffff, resume, (frame_t *)q[2], (frame_t *)q[3], &wdata, wvoice); break; #endif case WCMD_MARKER: