Browse Source

code cleanup: remove static from WordToString

master
Yury Popov 2 years ago
parent
commit
89b2a55ea4
No account linked to committer's email address

+ 2
- 1
src/libespeak-ng/compiledata.c View File

static void EndPhonemeTable(CompileContext *ctx) static void EndPhonemeTable(CompileContext *ctx)
{ {
int ix; int ix;
char buf[5];


if (ctx->n_phoneme_tabs == 0) if (ctx->n_phoneme_tabs == 0)
return; return;
for (ix = 0; ix < ctx->n_phcodes; ix++) { for (ix = 0; ix < ctx->n_phcodes; ix++) {
if (ctx->phoneme_tab2[ix].type == phINVALID) { if (ctx->phoneme_tab2[ix].type == phINVALID) {
error(ctx, "Phoneme [%s] not declared, referenced at line %d", error(ctx, "Phoneme [%s] not declared, referenced at line %d",
WordToString(ctx->phoneme_tab2[ix].mnemonic), (int)(ctx->phoneme_tab2[ix].program));
WordToString(buf, ctx->phoneme_tab2[ix].mnemonic), (int)(ctx->phoneme_tab2[ix].program));
ctx->error_count++; ctx->error_count++;
ctx->phoneme_tab2[ix].type = 0; // prevent the error message repeating ctx->phoneme_tab2[ix].type = 0; // prevent the error message repeating
} }

+ 4
- 3
src/libespeak-ng/synth_mbrola.c View File

const char *final_pitch; const char *final_pitch;
char *ptr; char *ptr;
char mbr_buf[120]; char mbr_buf[120];
char phbuf[5];


static int phix; static int phix;
static int embedded_ix; static int embedded_ix;
DoPhonemeMarker(espeakEVENT_PHONEME, (p->sourceix & 0x7ff) + clause_start_char, 0, phoneme_name); DoPhonemeMarker(espeakEVENT_PHONEME, (p->sourceix & 0x7ff) + clause_start_char, 0, phoneme_name);
} }


ptr += sprintf(ptr, "%s\t", WordToString(name));
ptr += sprintf(ptr, "%s\t", WordToString(phbuf, name));


if (name2 == '_') { if (name2 == '_') {
// add a pause after this phoneme // add a pause after this phoneme
ptr += sprintf(ptr, "%d\t%s", len1, pitch); ptr += sprintf(ptr, "%d\t%s", len1, pitch);


pitch = WritePitch(p->env, p->pitch1, p->pitch2, -len_percent, 0); pitch = WritePitch(p->env, p->pitch1, p->pitch2, -len_percent, 0);
ptr += sprintf(ptr, "%s\t%d\t%s", WordToString(name2), len-len1, pitch);
ptr += sprintf(ptr, "%s\t%d\t%s", WordToString(phbuf, name2), len-len1, pitch);
} }
done = true; done = true;
break; break;
if (!done) { if (!done) {
if (name2 != 0) { if (name2 != 0) {
len1 = (len * len_percent)/100; len1 = (len * len_percent)/100;
ptr += sprintf(ptr, "%d\n%s\t", len1, WordToString(name2));
ptr += sprintf(ptr, "%d\n%s\t", len1, WordToString(phbuf, name2));
len -= len1; len -= len1;
} }
ptr += sprintf(ptr, "%d%s\n", len, final_pitch); ptr += sprintf(ptr, "%d%s\n", len, final_pitch);

+ 2
- 1
src/libespeak-ng/synthdata.c View File



static void InvalidInstn(PHONEME_TAB *ph, int instn) static void InvalidInstn(PHONEME_TAB *ph, int instn)
{ {
fprintf(stderr, "Invalid instruction %.4x for phoneme '%s'\n", instn, WordToString(ph->mnemonic));
char buf[5];
fprintf(stderr, "Invalid instruction %.4x for phoneme '%s'\n", instn, WordToString(buf, ph->mnemonic));
} }


static bool StressCondition(Translator *tr, PHONEME_LIST *plist, int condition, int control) static bool StressCondition(Translator *tr, PHONEME_LIST *plist, int condition, int control)

+ 1
- 4
src/libespeak-ng/synthesize.c View File

#define RMS_START 28 // 28 #define RMS_START 28 // 28
#define VOWEL_FRONT_LENGTH 50 #define VOWEL_FRONT_LENGTH 50


const char *WordToString(unsigned int word)
const char *WordToString(char buf[5], unsigned int word)
{ {
// Convert a phoneme mnemonic word into a string // Convert a phoneme mnemonic word into a string
int ix; int ix;
static char buf[5];

MAKE_MEM_UNDEFINED(&buf, sizeof(buf));


for (ix = 0; ix < 4; ix++) for (ix = 0; ix < 4; ix++)
buf[ix] = word >> (ix*8); buf[ix] = word >> (ix*8);

+ 1
- 1
src/libespeak-ng/synthesize.h View File

int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp); int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp);
int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation); int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation);
int PauseLength(int pause, int control); int PauseLength(int pause, int control);
const char *WordToString(unsigned int word);
const char *WordToString(char buf[5], unsigned int word);


#ifdef __cplusplus #ifdef __cplusplus
} }

Loading…
Cancel
Save