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

#define SHOW(format,...) #define SHOW(format,...)
#endif #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 LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#define SHOW_TIME(text) #define SHOW_TIME(text)




#define ENTER(text) debug_enter(text) #define ENTER(text) debug_enter(text)
#define SHOW(format,...) debug_show(format,__VA_ARGS__); #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 LOGE(format,...) debug_show(format,__VA_ARGS__);
#define SHOW_TIME(text) debug_time(text); #define SHOW_TIME(text) debug_time(text);




#ifdef NO_VARIADIC_MACROS #ifdef NO_VARIADIC_MACROS
#define SHOW(format) // VC6 doesn't allow "..." #define SHOW(format) // VC6 doesn't allow "..."
#define LOGI(format) // VC6 doesn't allow "..."
#define LOGE(format) // VC6 doesn't allow "..." #define LOGE(format) // VC6 doesn't allow "..."
#else #else
#define SHOW(format,...) #define SHOW(format,...)
#define LOGI(format,...)
#define LOGE(format,...) #define LOGE(format,...)
#endif #endif



+ 14
- 2
src/voices.cpp View File

#include "string.h" #include "string.h"
#include "stdlib.h" #include "stdlib.h"
#include "speech.h" #include "speech.h"
#include "errno.h"


#ifdef PLATFORM_WINDOWS #ifdef PLATFORM_WINDOWS
#include "windows.h" #include "windows.h"
#include "synthesize.h" #include "synthesize.h"
#include "voice.h" #include "voice.h"
#include "translate.h" #include "translate.h"
#include "debug.h"


MNEM_TAB genders [] = { MNEM_TAB genders [] = {
{"unknown", 0}, {"unknown", 0},
while((ent = readdir(dir)) != NULL) while((ent = readdir(dir)) != NULL)
{ {
if(n_voices_list >= (N_VOICES_LIST-2)) if(n_voices_list >= (N_VOICES_LIST-2))
{
LOGE("The voice list is full.");
break; // voices list is full break; // voices list is full
}


sprintf(fname,"%s%c%s",path,PATHSEP,ent->d_name); sprintf(fname,"%s%c%s",path,PATHSEP,ent->d_name);


{ {
// a regular line, add it to the voices list // a regular line, add it to the voices list
if((f_voice = fopen(fname,"r")) == NULL) if((f_voice = fopen(fname,"r")) == NULL)
{
LOGE("Unble to load voice file '%s': %s", fname, strerror(errno));
continue; continue;
}

// pass voice file name within the voices directory // pass voice file name within the voices directory
voice_data = ReadVoiceFile(f_voice, fname+len_path_voices, ent->d_name); voice_data = ReadVoiceFile(f_voice, fname+len_path_voices, ent->d_name);
fclose(f_voice); fclose(f_voice);
voices_list[n_voices_list++] = voice_data; voices_list[n_voices_list++] = voice_data;
} }
} }
else if (ftype == 0)
{
LOGE("Unble to load voice file '%s': %s", fname, strerror(errno));
}
} }
closedir(dir); closedir(dir);
#endif #endif


GetVoices(path_voices); GetVoices(path_voices);
voices_list[n_voices_list] = NULL; // voices list terminator voices_list[n_voices_list] = NULL; // voices list terminator
LOGI("GetVoices found %d voices.", n_voices_list);


// sort the voices list // sort the voices list
qsort(voices_list,n_voices_list,sizeof(espeak_VOICE *), qsort(voices_list,n_voices_list,sizeof(espeak_VOICE *),

Loading…
Cancel
Save