code cleanup: remove wavefile_ix, move wavefile_amp

wavefile_ix is always equal to fmt_params->wav_addr.

wavefile_amp is only used once  so it can be set right
before calling DoSample2().
This commit is contained in:
Juho Hiltunen
2021-03-20 20:29:33 +02:00
parent c315a10109
commit 8ce104a315
3 changed files with 8 additions and 16 deletions
-4
View File
@@ -55,9 +55,6 @@ int n_phoneme_tables;
PHONEME_TAB_LIST phoneme_tab_list[N_PHONEME_TABS];
int phoneme_tab_number = 0;
int wavefile_ix; // a wavefile to play along with the synthesis
int wavefile_amp;
int seq_len_adjust;
static espeak_ng_STATUS ReadPhFile(void **ptr, const char *fname, int *size, espeak_ng_ERROR_CONTEXT *context)
@@ -271,7 +268,6 @@ frameref_t *LookupSpect(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params,
}
nf++;
}
wavefile_ix = 0;
}
if (length1 > 0) {
+8 -9
View File
@@ -902,14 +902,7 @@ int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_L
if (voice->klattv[0])
wcmd_spect = WCMD_KLATT;
wavefile_ix = fmt_params->wav_addr;
if (fmt_params->wav_amp == 0)
wavefile_amp = 32;
else
wavefile_amp = (fmt_params->wav_amp * 32)/100;
if (wavefile_ix == 0) {
if (fmt_params->wav_addr == 0) {
if (wave_flag) {
// cancel any wavefile that was playing previously
wcmd_spect = WCMD_SPECT2;
@@ -976,9 +969,15 @@ int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_L
if ((fmt_params->wav_addr != 0) && ((frame1->frflags & FRFLAG_DEFER_WAV) == 0)) {
// there is a wave file to play along with this synthesis
seq_len_adjust = 0;
int wavefile_amp;
if (fmt_params->wav_amp == 0)
wavefile_amp = 32;
else
wavefile_amp = (fmt_params->wav_amp * 32)/100;
DoSample2(fmt_params->wav_addr, which+0x100, 0, fmt_params->fmt_control, 0, wavefile_amp);
wave_flag = 1;
wavefile_ix = 0;
fmt_params->wav_addr = 0;
}
-3
View File
@@ -446,9 +446,6 @@ extern unsigned char *wavefile_data;
extern int samplerate;
extern int samplerate_native;
extern int wavefile_ix;
extern int wavefile_amp;
#define N_ECHO_BUF 5500 // max of 250mS at 22050 Hz
extern int echo_head;
extern int echo_tail;