mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-04 14:33:31 +00:00
Add debugging information to GetVoices.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#define SHOW(format,...)
|
||||
#endif
|
||||
|
||||
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
|
||||
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
||||
#define SHOW_TIME(text)
|
||||
|
||||
@@ -25,6 +26,7 @@
|
||||
|
||||
#define ENTER(text) debug_enter(text)
|
||||
#define SHOW(format,...) debug_show(format,__VA_ARGS__);
|
||||
#define LOGI(format,...) debug_show(format,__VA_ARGS__);
|
||||
#define LOGE(format,...) debug_show(format,__VA_ARGS__);
|
||||
#define SHOW_TIME(text) debug_time(text);
|
||||
|
||||
@@ -36,9 +38,11 @@ extern void debug_time(const char* text);
|
||||
|
||||
#ifdef NO_VARIADIC_MACROS
|
||||
#define SHOW(format) // VC6 doesn't allow "..."
|
||||
#define LOGI(format) // VC6 doesn't allow "..."
|
||||
#define LOGE(format) // VC6 doesn't allow "..."
|
||||
#else
|
||||
#define SHOW(format,...)
|
||||
#define LOGI(format,...)
|
||||
#define LOGE(format,...)
|
||||
#endif
|
||||
|
||||
|
||||
+14
-2
@@ -25,6 +25,7 @@
|
||||
#include "string.h"
|
||||
#include "stdlib.h"
|
||||
#include "speech.h"
|
||||
#include "errno.h"
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#include "windows.h"
|
||||
@@ -41,7 +42,7 @@
|
||||
#include "synthesize.h"
|
||||
#include "voice.h"
|
||||
#include "translate.h"
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
MNEM_TAB genders [] = {
|
||||
{"unknown", 0},
|
||||
@@ -1641,7 +1642,10 @@ static void GetVoices(const char *path)
|
||||
while((ent = readdir(dir)) != NULL)
|
||||
{
|
||||
if(n_voices_list >= (N_VOICES_LIST-2))
|
||||
{
|
||||
LOGE("The voice list is full.");
|
||||
break; // voices list is full
|
||||
}
|
||||
|
||||
sprintf(fname,"%s%c%s",path,PATHSEP,ent->d_name);
|
||||
|
||||
@@ -1657,8 +1661,11 @@ static void GetVoices(const char *path)
|
||||
{
|
||||
// a regular line, add it to the voices list
|
||||
if((f_voice = fopen(fname,"r")) == NULL)
|
||||
{
|
||||
LOGE("Unble to load voice file '%s': %s", fname, strerror(errno));
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
// pass voice file name within the voices directory
|
||||
voice_data = ReadVoiceFile(f_voice, fname+len_path_voices, ent->d_name);
|
||||
fclose(f_voice);
|
||||
@@ -1668,6 +1675,10 @@ static void GetVoices(const char *path)
|
||||
voices_list[n_voices_list++] = voice_data;
|
||||
}
|
||||
}
|
||||
else if (ftype == 0)
|
||||
{
|
||||
LOGE("Unble to load voice file '%s': %s", fname, strerror(errno));
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
#endif
|
||||
@@ -1781,6 +1792,7 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
|
||||
|
||||
GetVoices(path_voices);
|
||||
voices_list[n_voices_list] = NULL; // voices list terminator
|
||||
LOGI("GetVoices found %d voices.", n_voices_list);
|
||||
|
||||
// sort the voices list
|
||||
qsort(voices_list,n_voices_list,sizeof(espeak_VOICE *),
|
||||
|
||||
Reference in New Issue
Block a user