Browse Source

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().
master
Juho Hiltunen 4 years ago
parent
commit
8ce104a315
3 changed files with 8 additions and 16 deletions
  1. 0
    4
      src/libespeak-ng/synthdata.c
  2. 8
    9
      src/libespeak-ng/synthesize.c
  3. 0
    3
      src/libespeak-ng/synthesize.h

+ 0
- 4
src/libespeak-ng/synthdata.c View File

PHONEME_TAB_LIST phoneme_tab_list[N_PHONEME_TABS]; PHONEME_TAB_LIST phoneme_tab_list[N_PHONEME_TABS];
int phoneme_tab_number = 0; int phoneme_tab_number = 0;


int wavefile_ix; // a wavefile to play along with the synthesis
int wavefile_amp;

int seq_len_adjust; int seq_len_adjust;


static espeak_ng_STATUS ReadPhFile(void **ptr, const char *fname, int *size, espeak_ng_ERROR_CONTEXT *context) static espeak_ng_STATUS ReadPhFile(void **ptr, const char *fname, int *size, espeak_ng_ERROR_CONTEXT *context)
} }
nf++; nf++;
} }
wavefile_ix = 0;
} }


if (length1 > 0) { if (length1 > 0) {

+ 8
- 9
src/libespeak-ng/synthesize.c View File

if (voice->klattv[0]) if (voice->klattv[0])
wcmd_spect = WCMD_KLATT; 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) { if (wave_flag) {
// cancel any wavefile that was playing previously // cancel any wavefile that was playing previously
wcmd_spect = WCMD_SPECT2; wcmd_spect = WCMD_SPECT2;
if ((fmt_params->wav_addr != 0) && ((frame1->frflags & FRFLAG_DEFER_WAV) == 0)) { if ((fmt_params->wav_addr != 0) && ((frame1->frflags & FRFLAG_DEFER_WAV) == 0)) {
// there is a wave file to play along with this synthesis // there is a wave file to play along with this synthesis
seq_len_adjust = 0; 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); DoSample2(fmt_params->wav_addr, which+0x100, 0, fmt_params->fmt_control, 0, wavefile_amp);
wave_flag = 1; wave_flag = 1;
wavefile_ix = 0;
fmt_params->wav_addr = 0; fmt_params->wav_addr = 0;
} }



+ 0
- 3
src/libespeak-ng/synthesize.h View File

extern int samplerate; extern int samplerate;
extern int samplerate_native; extern int samplerate_native;


extern int wavefile_ix;
extern int wavefile_amp;

#define N_ECHO_BUF 5500 // max of 250mS at 22050 Hz #define N_ECHO_BUF 5500 // max of 250mS at 22050 Hz
extern int echo_head; extern int echo_head;
extern int echo_tail; extern int echo_tail;

Loading…
Cancel
Save