Browse Source

Make len_path_voices a parameter to GetVoices.

master
Reece H. Dunn 8 years ago
parent
commit
bb7630e4c1
1 changed files with 5 additions and 7 deletions
  1. 5
    7
      src/libespeak-ng/voices.c

+ 5
- 7
src/libespeak-ng/voices.c View File

/* /*
* Copyright (C) 2005 to 2015 by Jonathan Duddington * Copyright (C) 2005 to 2015 by Jonathan Duddington
* email: [email protected] * email: [email protected]
* Copyright (C) 2015-2016 Reece H. Dunn
* Copyright (C) 2015-2017 Reece H. Dunn
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
#define N_VOICES_LIST 250 #define N_VOICES_LIST 250
static int n_voices_list = 0; static int n_voices_list = 0;
static espeak_VOICE *voices_list[N_VOICES_LIST]; static espeak_VOICE *voices_list[N_VOICES_LIST];
static int len_path_voices;


espeak_VOICE current_voice_selected; espeak_VOICE current_voice_selected;


return vp->identifier; return vp->identifier;
} }


static void GetVoices(const char *path)
static void GetVoices(const char *path, int len_path_voices)
{ {
FILE *f_voice; FILE *f_voice;
espeak_VOICE *voice_data; espeak_VOICE *voice_data;


if (ftype == -EISDIR) { if (ftype == -EISDIR) {
// a sub-directory // a sub-directory
GetVoices(fname);
GetVoices(fname, len_path_voices);
} else if (ftype > 0) { } else if (ftype > 0) {
// a regular file, add it to the voices list // a regular file, add it to the voices list
if ((f_voice = fopen(fname, "r")) == NULL) if ((f_voice = fopen(fname, "r")) == NULL)


if (ftype == -EISDIR) { if (ftype == -EISDIR) {
// a sub-directory // a sub-directory
GetVoices(fname);
GetVoices(fname, len_path_voices);
} else if (ftype > 0) { } else if (ftype > 0) {
// a regular file, add it to the voices list // a regular file, add it to the voices list
if ((f_voice = fopen(fname, "r")) == NULL) if ((f_voice = fopen(fname, "r")) == NULL)
FreeVoiceList(); FreeVoiceList();


sprintf(path_voices, "%s%cvoices", path_home, PATHSEP); sprintf(path_voices, "%s%cvoices", path_home, PATHSEP);
len_path_voices = strlen(path_voices)+1;
GetVoices(path_voices, strlen(path_voices)+1);


GetVoices(path_voices);
voices_list[n_voices_list] = NULL; // voices list terminator voices_list[n_voices_list] = NULL; // voices list terminator
espeak_VOICE **new_voices = (espeak_VOICE **)realloc(voices, sizeof(espeak_VOICE *)*(n_voices_list+1)); espeak_VOICE **new_voices = (espeak_VOICE **)realloc(voices, sizeof(espeak_VOICE *)*(n_voices_list+1));
if (new_voices == NULL) if (new_voices == NULL)

Loading…
Cancel
Save