Browse Source

cleanup: reduce variable scopes in wavegen.c

master
Juho Hiltunen 2 years ago
parent
commit
54265990b5
1 changed files with 5 additions and 6 deletions
  1. 5
    6
      src/libespeak-ng/wavegen.c

+ 5
- 6
src/libespeak-ng/wavegen.c View File

int hmax; int hmax;
int hmax_samplerate; // highest harmonic allowed for the samplerate int hmax_samplerate; // highest harmonic allowed for the samplerate
int x; int x;
int ix;
int h1; int h1;


// initialise as much of *out as we will need // initialise as much of *out as we will need
x = htab[h] >> 15; x = htab[h] >> 15;
htab[h] = (x * x) >> 8; htab[h] = (x * x) >> 8;


int ix;
if ((ix = (f >> 19)) < N_TONE_ADJUST) if ((ix = (f >> 19)) < N_TONE_ADJUST)
htab[h] = (htab[h] * wvoice->tone_adjust[ix]) >> 13; // index tone_adjust with Hz/8 htab[h] = (htab[h] * wvoice->tone_adjust[ix]) >> 13; // index tone_adjust with Hz/8
} }
int value = 0; int value = 0;
int noise; int noise;
int ix; int ix;
int amp;


// use two random numbers, for alternate formants // use two random numbers, for alternate formants
noise = (rand() & 0x3fff) - 0x2000; noise = (rand() & 0x3fff) - 0x2000;


for (ix = 1; ix < N_PEAKS; ix++) { for (ix = 1; ix < N_PEAKS; ix++) {
int amp;
if ((amp = wvoice->breath[ix]) != 0) { if ((amp = wvoice->breath[ix]) != 0) {
amp *= (peaks[ix].height >> 14); amp *= (peaks[ix].height >> 14);
value += (int)resonator(&rbreath[ix], noise) * amp; value += (int)resonator(&rbreath[ix], noise) * amp;
static int PlaySilence(int length, bool resume) static int PlaySilence(int length, bool resume)
{ {
static int n_samples; static int n_samples;
int value = 0;


nsamples = 0; nsamples = 0;
samplecount = 0; samplecount = 0;
if (resume == false) if (resume == false)
n_samples = length; n_samples = length;


int value = 0;
while (n_samples-- > 0) { while (n_samples-- > 0) {
value = (echo_buf[echo_tail++] * echo_amp) >> 8; value = (echo_buf[echo_tail++] * echo_amp) >> 8;




void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range) void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range)
{ {
int x;
int base; int base;
int range; int range;
int pitch_value; int pitch_value;


if (pitch1 > pitch2) { if (pitch1 > pitch2) {
int x;
x = pitch1; // swap values x = pitch1; // swap values
pitch1 = pitch2; pitch1 = pitch2;
pitch2 = x; pitch2 = x;
int length2; int length2;
int length4; int length4;
int qix; int qix;
int cmd;
static const int glottal_reduce_tab1[4] = { 0x30, 0x30, 0x40, 0x50 }; // vowel before [?], amp * 1/256 static const int glottal_reduce_tab1[4] = { 0x30, 0x30, 0x40, 0x50 }; // vowel before [?], amp * 1/256
static const int glottal_reduce_tab2[4] = { 0x90, 0xa0, 0xb0, 0xc0 }; // vowel after [?], amp * 1/256 static const int glottal_reduce_tab2[4] = { 0x90, 0xa0, 0xb0, 0xc0 }; // vowel after [?], amp * 1/256


if (qix >= N_WCMDQ) qix = 0; if (qix >= N_WCMDQ) qix = 0;
if (qix == wcmdq_tail) break; if (qix == wcmdq_tail) break;


cmd = wcmdq[qix][0];
int cmd = wcmdq[qix][0];
if (cmd == WCMD_SPECT) { if (cmd == WCMD_SPECT) {
end_wave = 0; // next wave generation is from another spectrum end_wave = 0; // next wave generation is from another spectrum
break; break;

Loading…
Cancel
Save