Browse Source

Add debugging information to GetVoices.

master
Reece H. Dunn 12 years ago
parent
commit
71fb7bce34
2 changed files with 18 additions and 2 deletions
  1. 4
    0
      src/debug.h
  2. 14
    2
      src/voices.cpp

+ 4
- 0
src/debug.h View File

@@ -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
src/voices.cpp View File

@@ -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 *),

Loading…
Cancel
Save