diff options
author | Joseph Herlant <aerostitch@users.noreply.github.com> | 2018-04-26 10:12:26 -0700 |
---|---|---|
committer | jkoan <jkoan@users.noreply.github.com> | 2018-04-26 19:12:26 +0200 |
commit | 221f783ea1caaaab2f5ceadc6b0fb3e720aac3df (patch) | |
tree | 1ecf89faa1dfa550477669b05ef5c36e9864f68a /navit/speech | |
parent | 011bb15468b4cb626e9facecba924b04bd494d7f (diff) | |
download | navit-221f783ea1caaaab2f5ceadc6b0fb3e720aac3df.tar.gz |
Fix:debug:Change line separators for dbg to work also on win* platform (#546)
* Fix:debug:Change line separators for dbg to work also on win* platform
* Fix:debug:Break multiline dbg statements to use the new model
* Fix:debug:Move the EOL into debug_vprintf
Diffstat (limited to 'navit/speech')
-rw-r--r-- | navit/speech/android/speech_android.c | 14 | ||||
-rw-r--r-- | navit/speech/cmdline/speech_cmdline.c | 14 | ||||
-rw-r--r-- | navit/speech/espeak/speak.c | 30 | ||||
-rw-r--r-- | navit/speech/iphone/speech_iphone.m | 8 | ||||
-rw-r--r-- | navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp | 14 | ||||
-rwxr-xr-x | navit/speech/qt5_espeak/qt5_espeak.cpp | 32 |
6 files changed, 56 insertions, 56 deletions
diff --git a/navit/speech/android/speech_android.c b/navit/speech/android/speech_android.c index e9a206ebf..901abbc26 100644 --- a/navit/speech/android/speech_android.c +++ b/navit/speech/android/speech_android.c @@ -41,7 +41,7 @@ speech_android_say(struct speech_priv *this, const char *text) int i; string = (*jnienv)->NewStringUTF(jnienv, str); - dbg(lvl_debug,"enter %s\n",str); + dbg(lvl_debug,"enter %s",str); (*jnienv)->CallVoidMethod(jnienv, this->NavitSpeech, this->NavitSpeech_say, string); (*jnienv)->DeleteLocalRef(jnienv, string); g_free(str); @@ -66,20 +66,20 @@ speech_android_init(struct speech_priv *ret) char *class="org/navitproject/navit/NavitSpeech2"; if (!android_find_class_global(class, &ret->NavitSpeechClass)) { - dbg(lvl_error,"No class found\n"); + dbg(lvl_error,"No class found"); return 0; } - dbg(lvl_debug,"at 3\n"); + dbg(lvl_debug,"at 3"); cid = (*jnienv)->GetMethodID(jnienv, ret->NavitSpeechClass, "<init>", "(Lorg/navitproject/navit/Navit;)V"); if (cid == NULL) { - dbg(lvl_error,"no method found\n"); + dbg(lvl_error,"no method found"); return 0; /* exception thrown */ } if (!android_find_method(ret->NavitSpeechClass, "say", "(Ljava/lang/String;)V", &ret->NavitSpeech_say)) return 0; - dbg(lvl_debug,"at 4 android_activity=%p\n",android_activity); + dbg(lvl_debug,"at 4 android_activity=%p",android_activity); ret->NavitSpeech=(*jnienv)->NewObject(jnienv, ret->NavitSpeechClass, cid, android_activity); - dbg(lvl_debug,"result=%p\n",ret->NavitSpeech); + dbg(lvl_debug,"result=%p",ret->NavitSpeech); if (!ret->NavitSpeech) return 0; if (ret->NavitSpeech) @@ -96,7 +96,7 @@ speech_android_new(struct speech_methods *meth, struct attr **attrs, struct attr if (android_version < 4) this->flags=3; if (!speech_android_init(this)) { - dbg(lvl_error,"Failed to init speech %p\n",this->NavitSpeechClass); + dbg(lvl_error,"Failed to init speech %p",this->NavitSpeechClass); g_free(this); this=NULL; } diff --git a/navit/speech/cmdline/speech_cmdline.c b/navit/speech/cmdline/speech_cmdline.c index 490811ce5..256fb2adf 100644 --- a/navit/speech/cmdline/speech_cmdline.c +++ b/navit/speech/cmdline/speech_cmdline.c @@ -63,7 +63,7 @@ speech_cmdline_search(GList *samples, int suffix_len, const char *text, int deco { GList *loop_samples=samples,*result=NULL,*recursion_result; int shortest_result_length=INT_MAX; - dbg(lvl_debug,"searching samples for text: '%s'\n",text); + dbg(lvl_debug,"searching samples for text: '%s'",text); while (loop_samples) { char *sample_name=loop_samples->data; int sample_name_len; @@ -77,7 +77,7 @@ speech_cmdline_search(GList *samples, int suffix_len, const char *text, int deco const char *remaining_text=text+sample_name_len; while (*remaining_text == ' ' || *remaining_text == ',') remaining_text++; - dbg(lvl_debug,"sample '%s' matched; remaining text: '%s'\n",sample_name,remaining_text); + dbg(lvl_debug,"sample '%s' matched; remaining text: '%s'",sample_name,remaining_text); if (*remaining_text) { recursion_result=speech_cmdline_search(samples, suffix_len, remaining_text, decode); if (recursion_result && g_list_length(recursion_result) < shortest_result_length) { @@ -141,15 +141,15 @@ speechd_say(struct speech_priv *this, const char *text) argl=speech_cmdline_search(this->samples, strlen(this->sample_suffix), text, !!(this->flags & 1)); samplesmode=1; listlen=g_list_length(argl); - dbg(lvl_debug,"For text: '%s', found %d samples.\n",text,listlen); + dbg(lvl_debug,"For text: '%s', found %d samples.",text,listlen); if (!listlen){ - dbg(lvl_error,"No matching samples found. Cannot speak text: '%s'\n",text); + dbg(lvl_error,"No matching samples found. Cannot speak text: '%s'",text); } } else { listlen=1; } if(listlen>0) { - dbg(lvl_debug,"Speaking text '%s'\n",text); + dbg(lvl_debug,"Speaking text '%s'",text); int argc; char**argv; int j; @@ -168,7 +168,7 @@ speechd_say(struct speech_priv *this, const char *text) while(l) { char *new_arg; new_arg=g_strdup_printf("%s/%s",this->sample_dir,(char *)l->data); - dbg(lvl_debug,"new_arg %s\n",new_arg); + dbg(lvl_debug,"new_arg %s",new_arg); argv[j++]=g_strdup_printf(cmdv[i],new_arg); g_free(new_arg); l=g_list_next(l); @@ -246,7 +246,7 @@ speechd_new(struct speech_methods *meth, struct attr **attrs, struct attr *paren int len=strlen(name); if (len > suffix_len) { if (!strcmp(name+len-suffix_len, this->sample_suffix)) { - dbg(lvl_debug,"found %s\n",name); + dbg(lvl_debug,"found %s",name); this->samples=g_list_prepend(this->samples, g_strdup(name)); } } diff --git a/navit/speech/espeak/speak.c b/navit/speech/espeak/speak.c index 329a05d01..301b4b37e 100644 --- a/navit/speech/espeak/speak.c +++ b/navit/speech/espeak/speak.c @@ -166,11 +166,11 @@ static BOOL initialise(void) { if(result == -1) { - dbg(lvl_error, "Failed to load espeak-data\n"); + dbg(lvl_error, "Failed to load espeak-data"); return FALSE; } else - dbg(lvl_error, "Wrong version of espeak-data 0x%x (expects 0x%x) at %s\n",result,version_phdata,path_home); + dbg(lvl_error, "Wrong version of espeak-data 0x%x (expects 0x%x) at %s",result,version_phdata,path_home); } LoadConfig(); SetVoiceStack(NULL); @@ -214,7 +214,7 @@ static void start_speaking(struct speech_priv* sp_priv) static LRESULT CALLBACK speech_message_handler( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { - dbg(lvl_debug, "message_handler called\n"); + dbg(lvl_debug, "message_handler called"); switch (uMsg) { @@ -234,7 +234,7 @@ static LRESULT CALLBACK speech_message_handler( HWND hwnd, UINT uMsg, WPARAM wPa { WAVEHDR *WaveHeader = (WAVEHDR *)lParam; struct speech_priv* sp_priv; - dbg(lvl_info, "Wave buffer done\n"); + dbg(lvl_info, "Wave buffer done"); sp_priv = (struct speech_priv*)WaveHeader->dwUser; sp_priv->free_buffers = g_list_append(sp_priv->free_buffers, WaveHeader); @@ -282,7 +282,7 @@ static void speech_message_dispatcher( struct speech_priv * sp_priv) { if (bRet == -1) { - dbg(lvl_error, "Error getting message from queue\n"); + dbg(lvl_error, "Error getting message from queue"); break; } else @@ -336,7 +336,7 @@ static DWORD startThread( LPVOID sp_priv) if (!RegisterClass(&wc)) { - dbg(lvl_error, "Window registration for message queue failed\n"); + dbg(lvl_error, "Window registration for message queue failed"); return 1; } @@ -361,7 +361,7 @@ static DWORD startThread( LPVOID sp_priv) if (hwnd == NULL) { - dbg(lvl_error, "Window creation failed: %d\n", GetLastError()); + dbg(lvl_error, "Window creation failed: %d", GetLastError()); return 1; } @@ -371,7 +371,7 @@ static DWORD startThread( LPVOID sp_priv) if(!waveout_open(this)) { - dbg(lvl_error, "Can't open wave output\n"); + dbg(lvl_error, "Can't open wave output"); return 1; } @@ -387,11 +387,11 @@ static int espeak_say(struct speech_priv *this, const char *text) { char *phrase = g_strdup(text); - dbg(lvl_debug, "Speak: '%s'\n", text); + dbg(lvl_debug, "Speak: '%s'", text); if (!PostMessage(this->h_queue, msg_say, (WPARAM)this, (LPARAM)phrase)) { - dbg(lvl_error, "PostThreadMessage 'say' failed\n"); + dbg(lvl_error, "PostThreadMessage 'say' failed"); } return 0; @@ -440,7 +440,7 @@ espeak_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent strcpy(path_home,path->u.str); else sprintf(path_home,"%s/espeak-data",getenv("NAVIT_SHAREDIR")); - dbg(lvl_debug,"path_home set to %s\n",path_home); + dbg(lvl_debug,"path_home set to %s",path_home); if ( !initialise() ) { @@ -467,12 +467,12 @@ espeak_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent } file1=g_strdup_printf("%s/voices/%s",path_home,lang_full); file2=g_strdup_printf("%s/voices/%s/%s",path_home,lang,lang_full); - dbg(lvl_debug,"Testing %s and %s\n",file1,file2); + dbg(lvl_debug,"Testing %s and %s",file1,file2); if (file_exists(file1) || file_exists(file2)) lang_str=g_strdup(lang_full); else lang_str=g_strdup(lang); - dbg(lvl_debug,"Language full %s lang %s result %s\n",lang_full,lang,lang_str); + dbg(lvl_debug,"Language full %s lang %s result %s",lang_full,lang,lang_str); g_free(lang_full); g_free(lang); g_free(file1); @@ -481,12 +481,12 @@ espeak_new(struct speech_methods *meth, struct attr **attrs, struct attr *parent } if(lang_str && SetVoiceByName(lang_str) != EE_OK) { - dbg(lvl_error, "Error setting language to: '%s',falling back to default\n", lang_str); + dbg(lvl_error, "Error setting language to: '%s',falling back to default", lang_str); g_free(lang_str); lang_str=NULL; } if(!lang_str && SetVoiceByName("default") != EE_OK) { - dbg(lvl_error, "Error setting language to default\n"); + dbg(lvl_error, "Error setting language to default"); } diff --git a/navit/speech/iphone/speech_iphone.m b/navit/speech/iphone/speech_iphone.m index c77b6fbc2..854ae097b 100644 --- a/navit/speech/iphone/speech_iphone.m +++ b/navit/speech/iphone/speech_iphone.m @@ -33,11 +33,11 @@ struct speech_priv { static int speech_iphone_say(struct speech_priv *this, const char *text) { - dbg(0,"enter %s\n",text); + dbg(0,"enter %s",text); NSString *s=[[NSString alloc]initWithUTF8String: text]; [this->speech startSpeakingString:s toURL:nil]; [s release]; - dbg(0,"ok\n"); + dbg(0,"ok"); return 1; } @@ -60,7 +60,7 @@ speech_iphone_new(struct speech_methods *meth, struct attr **attrs, struct attr *meth=speech_iphone_meth; this=g_new0(struct speech_priv,1); this->speech=[[NSClassFromString(@"VSSpeechSynthesizer") alloc] init]; - dbg(0,"this->speech=%p\n",this->speech); + dbg(0,"this->speech=%p",this->speech); [this->speech setRate:(float)1.0]; return this; } @@ -69,6 +69,6 @@ speech_iphone_new(struct speech_methods *meth, struct attr **attrs, struct attr void plugin_init(void) { - dbg(0,"enter\n"); + dbg(0,"enter"); plugin_register_category_speech("iphone", speech_iphone_new); } diff --git a/navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp b/navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp index da2c6b3e1..1360bdcaf 100644 --- a/navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp +++ b/navit/speech/qt5_espeak/Qt5EspeakAudioOut.cpp @@ -41,7 +41,7 @@ Qt5EspeakAudioOut::Qt5EspeakAudioOut(int samplerate, const char* category) QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); if (!info.isFormatSupported(format)) { dbg(lvl_error, - "Raw audio format not supported by backend, cannot play audio.\n"); + "Raw audio format not supported by backend, cannot play audio."); return; } @@ -54,7 +54,7 @@ Qt5EspeakAudioOut::Qt5EspeakAudioOut(int samplerate, const char* category) * systems with * really low memory.*/ audio->setBufferSize((samplerate * 1 /*ch*/ * 2 /*samplezize*/) * 5 /*seconds*/); - dbg(lvl_debug, "Buffer size is: %d\n", audio->bufferSize()); + dbg(lvl_debug, "Buffer size is: %d", audio->bufferSize()); if (category != NULL) audio->setCategory(QString(category)); @@ -76,7 +76,7 @@ Qt5EspeakAudioOut::~Qt5EspeakAudioOut() void Qt5EspeakAudioOut::handleStateChanged(QAudio::State newState) { - dbg(lvl_debug, "Enter %d\n", newState); + dbg(lvl_debug, "Enter %d", newState); switch (newState) { case QAudio::ActiveState: break; @@ -88,21 +88,21 @@ void Qt5EspeakAudioOut::handleStateChanged(QAudio::State newState) /*remove all data that was already read*/ data->remove(0, buffer->pos()); buffer->seek(0); - dbg(lvl_debug, "Size %d\n", data->size()); + dbg(lvl_debug, "Size %d", data->size()); break; } } void Qt5EspeakAudioOut::resume(int state) { - dbg(lvl_debug, "Enter %d\n", state); + dbg(lvl_debug, "Enter %d", state); if (audio->state() != QAudio::ActiveState) audio->start(buffer); } void Qt5EspeakAudioOut::addSamples(short* wav, int numsamples) { - dbg(lvl_debug, "Enter (%d samples)\n", numsamples); + dbg(lvl_debug, "Enter (%d samples)", numsamples); /*remove all data that was already read (if any)*/ data->remove(0, buffer->pos()); @@ -110,7 +110,7 @@ void Qt5EspeakAudioOut::addSamples(short* wav, int numsamples) if (numsamples > 0) { data->append((const char*)wav, numsamples * sizeof(short)); - dbg(lvl_debug, "%ld samples in buffer\n", + dbg(lvl_debug, "%ld samples in buffer", (long int)(buffer->size() / sizeof(short))); emit call_resume(numsamples); } diff --git a/navit/speech/qt5_espeak/qt5_espeak.cpp b/navit/speech/qt5_espeak/qt5_espeak.cpp index 8d108eae6..266fde624 100755 --- a/navit/speech/qt5_espeak/qt5_espeak.cpp +++ b/navit/speech/qt5_espeak/qt5_espeak.cpp @@ -59,7 +59,7 @@ struct speech_priv { int qt5_espeak_SynthCallback(short* wav, int numsamples, espeak_EVENT* events) { struct speech_priv* pr = NULL; - dbg(lvl_debug, "Callback %d samples\n", numsamples); + dbg(lvl_debug, "Callback %d samples", numsamples); if (events != NULL) pr = (struct speech_priv*)events->user_data; if ((pr != NULL) && (pr->audio != NULL)) { @@ -91,7 +91,7 @@ qt5_espeak_init_espeak(struct speech_priv* sr, struct attr** attrs) sr->path_home = NULL; #endif } - dbg(lvl_debug, "path_home set to %s\n", sr->path_home); + dbg(lvl_debug, "path_home set to %s", sr->path_home); #if INTERNAL_ESPEAK /*internal espeak is configured to support only synchronous modes */ sr->sample_rate = espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, BUFFERLENGTH, sr->path_home, 0); @@ -101,10 +101,10 @@ qt5_espeak_init_espeak(struct speech_priv* sr, struct attr** attrs) sr->sample_rate = espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, BUFFERLENGTH, sr->path_home, 0); #endif if (sr->sample_rate == EE_INTERNAL_ERROR) { - dbg(lvl_error, "Init failed %d\n", sr->sample_rate); + dbg(lvl_error, "Init failed %d", sr->sample_rate); return 1; } - dbg(lvl_error, "Sample rate is %d\n", sr->sample_rate); + dbg(lvl_error, "Sample rate is %d", sr->sample_rate); espeak_SetSynthCallback(qt5_espeak_SynthCallback); return TRUE; @@ -132,13 +132,13 @@ qt5_espeak_init_language(struct speech_priv* pr, struct attr** attrs) strtolower(lang_str, lang_env); /* extract language code from LANG environment */ - dbg(lvl_debug, "%s\n", lang_str); + dbg(lvl_debug, "%s", lang_str); country = strchr(lang_str, '_'); - dbg(lvl_debug, "%s\n", country); + dbg(lvl_debug, "%s", country); if (country) { lang_str[country - lang_str] = '\0'; } - dbg(lvl_debug, "espeak lang: %s\n", lang_str); + dbg(lvl_debug, "espeak lang: %s", lang_str); } } /*TODO (golden water tap): expose all those values as attrs */ @@ -152,7 +152,7 @@ qt5_espeak_init_language(struct speech_priv* pr, struct attr** attrs) if (lang_str != NULL) g_free(lang_str); if (error != EE_OK) { - dbg(lvl_error, "Unable to set Language\n"); + dbg(lvl_error, "Unable to set Language"); return false; } return true; @@ -179,11 +179,11 @@ static int qt5_espeak_say(struct speech_priv* sr, const char* text) { espeak_ERROR error; - dbg(lvl_debug, "Say \"%s\"\n", text); + dbg(lvl_debug, "Say \"%s\"", text); error = espeak_Synth(text, strlen(text), 0, POS_CHARACTER, 0, espeakCHARS_UTF8, NULL, sr); if (error != EE_OK) - dbg(lvl_error, "Unable to speak! error == %d\n", error); + dbg(lvl_error, "Unable to speak! error == %d", error); return 0; } @@ -192,7 +192,7 @@ qt5_espeak_say(struct speech_priv* sr, const char* text) static void qt5_espeak_destroy(struct speech_priv* sr) { - dbg(lvl_debug, "Enter\n"); + dbg(lvl_debug, "Enter"); if (sr->path_home != NULL) g_free(sr->path_home); @@ -215,7 +215,7 @@ qt5_espeak_new(struct speech_methods* meth, struct attr** attrs, struct attr* parent) { struct speech_priv* sr = NULL; - dbg(lvl_debug, "Enter\n"); + dbg(lvl_debug, "Enter"); /* allocate handle */ sr = g_new0(struct speech_priv, 1); @@ -229,17 +229,17 @@ qt5_espeak_new(struct speech_methods* meth, struct attr** attrs, /* init espeak library */ if (!(sr->espeak_ok = qt5_espeak_init_espeak(sr, attrs))) { - dbg(lvl_error, "Unable to initialize espeak library\n"); + dbg(lvl_error, "Unable to initialize espeak library"); } /* init espeak voice and language */ if (!(sr->espeak_ok = qt5_espeak_init_language(sr, attrs))) { - dbg(lvl_error, "Unable to initialize espeak language\n"); + dbg(lvl_error, "Unable to initialize espeak language"); } /* init qt5 audio using default category*/ if (!(sr->audio_ok = qt5_espeak_init_audio(sr, NULL))) { - dbg(lvl_error, "Unable to initialize audio\n"); + dbg(lvl_error, "Unable to initialize audio"); } return sr; } @@ -247,6 +247,6 @@ qt5_espeak_new(struct speech_methods* meth, struct attr** attrs, /* initialize this as plugin */ void plugin_init(void) { - dbg(lvl_debug, "Enter\n"); + dbg(lvl_debug, "Enter"); plugin_register_category_speech("qt5_espeak", qt5_espeak_new); } |