diff --git a/src/libespeak-ng/event.c b/src/libespeak-ng/event.c index fe2ad2ab..488b47b7 100644 --- a/src/libespeak-ng/event.c +++ b/src/libespeak-ng/event.c @@ -307,6 +307,8 @@ static int get_remaining_time(uint32_t sample, uint32_t *time_in_ms, int *stop_i static void *polling_thread(void *p) { + (void)p; // unused + while (1) { int a_stop_is_required = 0; diff --git a/src/libespeak-ng/fifo.c b/src/libespeak-ng/fifo.c index f214119a..e58cc1c8 100644 --- a/src/libespeak-ng/fifo.c +++ b/src/libespeak-ng/fifo.c @@ -246,6 +246,8 @@ static void close_stream() static void *say_thread(void *p) { + (void)p; // unused + // announce that thread is started sem_post(&my_sem_stop_is_acknowledged); diff --git a/src/libespeak-ng/intonation.c b/src/libespeak-ng/intonation.c index d7f08f0c..b1c1ca65 100644 --- a/src/libespeak-ng/intonation.c +++ b/src/libespeak-ng/intonation.c @@ -423,7 +423,7 @@ static int CountUnstressed(int start, int end, int limit) return ix - start; } -static int SetHeadIntonation(TUNE *tune, int syl_ix, int end_ix, int control) +static int SetHeadIntonation(TUNE *tune, int syl_ix, int end_ix) { int stress; SYLLABLE *syl; @@ -697,7 +697,7 @@ static int calc_pitches2(int start, int end, int tune_number) if (option_tone_flags & OPTION_EMPHASIZE_PENULTIMATE) tone_posn = tone_posn2; // put tone on the penultimate stressed word - ix = SetHeadIntonation(tune, ix, tone_posn, 0); + ix = SetHeadIntonation(tune, ix, tone_posn); if (no_tonic) return 0; @@ -784,10 +784,8 @@ static int calc_pitches(int control, int start, int end, int tune_number) return tone_pitch_env; } -static void CalcPitches_Tone(Translator *tr, int clause_tone) +static void CalcPitches_Tone(Translator *tr) { - // clause_tone: 0=. 1=, 2=?, 3=! 4=none - PHONEME_LIST *p; int ix; int count_stressed = 0; @@ -973,7 +971,7 @@ void CalcPitches(Translator *tr, int clause_type) return; // nothing to do if (tr->langopts.tone_language == 1) { - CalcPitches_Tone(tr, clause_type); + CalcPitches_Tone(tr); return; } diff --git a/src/libespeak-ng/mbrowrap.h b/src/libespeak-ng/mbrowrap.h index 0980ce6a..b319e945 100644 --- a/src/libespeak-ng/mbrowrap.h +++ b/src/libespeak-ng/mbrowrap.h @@ -99,7 +99,9 @@ void resetError_MBR(void); /* * Tolerance to missing diphones (always active so this is ignored) */ -static inline void setNoError_MBR(int no_error) { +static inline void setNoError_MBR(int no_error) +{ + (void)no_error; // unused } #ifdef __cplusplus diff --git a/src/libespeak-ng/phonemelist.c b/src/libespeak-ng/phonemelist.c index 9fae47b9..c9fc3f38 100644 --- a/src/libespeak-ng/phonemelist.c +++ b/src/libespeak-ng/phonemelist.c @@ -39,7 +39,7 @@ const unsigned char pause_phonemes[8] = { extern int n_ph_list2; extern PHONEME_LIST2 ph_list2[N_PHONEME_LIST]; // first stage of text->phonemes -static int SubstitutePhonemes(Translator *tr, PHONEME_LIST *plist_out) +static int SubstitutePhonemes(PHONEME_LIST *plist_out) { // Copy the phonemes list and perform any substitutions that are required for the // current voice @@ -250,7 +250,7 @@ void MakePhonemeList(Translator *tr, int post_pause, int start_sentence) } } - n_ph_list3 = SubstitutePhonemes(tr, ph_list3) - 2; + n_ph_list3 = SubstitutePhonemes(ph_list3) - 2; for (j = 0; (j < n_ph_list3) && (ix < N_PHONEME_LIST-3);) { if (ph_list3[j].sourceix) { diff --git a/src/libespeak-ng/speak_lib.c b/src/libespeak-ng/speak_lib.c index 6ff5fd60..46dccad5 100644 --- a/src/libespeak-ng/speak_lib.c +++ b/src/libespeak-ng/speak_lib.c @@ -113,7 +113,7 @@ static int dispatch_audio(short *outbuf, int length, espeak_EVENT *event) return -1; } wave_set_callback_is_output_enabled(fifo_is_command_enabled); - my_audio = wave_open("alsa"); + my_audio = wave_open(); event_init(); } } @@ -150,7 +150,7 @@ static int dispatch_audio(short *outbuf, int length, espeak_EVENT *event) return a_wave_can_be_played == 0; // 1 = stop synthesis, -1 = error } -static int create_events(short *outbuf, int length, espeak_EVENT *event, uint32_t the_write_pos) +static int create_events(short *outbuf, int length, espeak_EVENT *event_list, uint32_t the_write_pos) { int finished; int i = 0; @@ -398,7 +398,7 @@ static espeak_ERROR Synthesize(unsigned int unique_identifier, const void *text, length = (out_ptr - outbuf)/2; count_samples += length; event_list[event_list_ix].type = espeakEVENT_LIST_TERMINATED; // indicates end of event list - event_list[event_list_ix].unique_identifier = my_unique_identifier; + event_list[event_list_ix].unique_identifier = unique_identifier; event_list[event_list_ix].user_data = my_user_data; count_buffers++; @@ -478,6 +478,8 @@ espeak_ERROR sync_espeak_Synth(unsigned int unique_identifier, const void *text, unsigned int position, espeak_POSITION_TYPE position_type, unsigned int end_position, unsigned int flags, void *user_data) { + (void)size; // unused + espeak_ERROR aStatus; InitText(flags); @@ -517,6 +519,8 @@ espeak_ERROR sync_espeak_Synth_Mark(unsigned int unique_identifier, const void * const char *index_mark, unsigned int end_position, unsigned int flags, void *user_data) { + (void)size; // unused + espeak_ERROR aStatus; InitText(flags); diff --git a/src/libespeak-ng/translate.c b/src/libespeak-ng/translate.c index a2be23b6..b20e624b 100644 --- a/src/libespeak-ng/translate.c +++ b/src/libespeak-ng/translate.c @@ -627,7 +627,7 @@ static char *SpeakIndividualLetters(Translator *tr, char *word, char *phonemes, return word; } -static int CheckDottedAbbrev(char *word1, WORD_TAB *wtab) +static int CheckDottedAbbrev(char *word1) { int wc; int count = 0; @@ -919,7 +919,7 @@ int TranslateWord(Translator *tr, char *word_start, WORD_TAB *wtab, char *word_o if ((word_length == 1) && (dictionary_skipwords == 0)) { // is this a series of single letters separated by dots? - if (CheckDottedAbbrev(word1, wtab)) { + if (CheckDottedAbbrev(word1)) { dictionary_flags[0] = 0; dictionary_flags[1] = 0; spell_word = 1; diff --git a/src/libespeak-ng/voices.c b/src/libespeak-ng/voices.c index 7a04ba25..636b66f7 100644 --- a/src/libespeak-ng/voices.c +++ b/src/libespeak-ng/voices.c @@ -267,7 +267,7 @@ void ReadTonePoints(char *string, int *tone_pts) &tone_pts[8], &tone_pts[9]); } -static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname, const char *leafname) +static espeak_VOICE *ReadVoiceFile(FILE *f_in, const char *fname) { // Read a Voice file, allocate a VOICE_DATA and set data from the // file's language, gender, name lines @@ -450,7 +450,7 @@ static void VoiceFormant(char *p) voice->freqadd[formant] = freqadd; } -static void PhonemeReplacement(int type, char *p) +static void PhonemeReplacement(char *p) { int n; int phon; @@ -785,7 +785,7 @@ voice_t *LoadVoice(const char *vname, int control) SelectPhonemeTableName(phonemes_name); phonemes_set = 1; } - PhonemeReplacement(key, p); + PhonemeReplacement(p); break; case V_WORDGAP: // words sscanf(p, "%d %d", &langopts->word_gap, &langopts->vowel_pause); @@ -1457,7 +1457,7 @@ static void GetVoices(const char *path) continue; // pass voice file name within the voices directory - voice_data = ReadVoiceFile(f_voice, fname+len_path_voices, FindFileData.cFileName); + voice_data = ReadVoiceFile(f_voice, fname+len_path_voices); fclose(f_voice); if (voice_data != NULL) @@ -1493,7 +1493,7 @@ static void GetVoices(const char *path) continue; // 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); fclose(f_voice); if (voice_data != NULL) diff --git a/src/libespeak-ng/wave.c b/src/libespeak-ng/wave.c index 11ed136b..94303cd0 100644 --- a/src/libespeak-ng/wave.c +++ b/src/libespeak-ng/wave.c @@ -70,7 +70,7 @@ static int pulse_running; // wave.cpp (this file) int wave_port_init(int); -void *wave_port_open(const char *the_api); +void *wave_port_open(); size_t wave_port_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize); int wave_port_close(void *theHandler); int wave_port_is_busy(void *theHandler); @@ -85,7 +85,7 @@ int wave_port_get_remaining_time(uint32_t sample, uint32_t *time); // wave_pulse.cpp int is_pulse_running(); int wave_pulse_init(int); -void *wave_pulse_open(const char *the_api); +void *wave_pulse_open(); size_t wave_pulse_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize); int wave_pulse_close(void *theHandler); int wave_pulse_is_busy(void *theHandler); @@ -108,12 +108,12 @@ int wave_init(int srate) return wave_port_init(srate); } -void *wave_open(const char *the_api) +void *wave_open() { if (pulse_running) - return wave_pulse_open(the_api); + return wave_pulse_open(); else - return wave_port_open(the_api); + return wave_port_open(); } size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize) @@ -307,6 +307,10 @@ static int pa_callback(const void *inputBuffer, void *outputBuffer, PaStreamCallbackFlags flags, void *userData) #endif { + (void)inputBuffer; // unused + (void)outTime; // unused + (void)userData; // unused + int aResult = 0; // paContinue char *aWrite = myWrite; size_t n = out_channels*sizeof(uint16_t)*framesPerBuffer; @@ -383,6 +387,8 @@ static int pa_callback(const void *inputBuffer, void *outputBuffer, void wave_flush(void *theHandler) { + (void)theHandler; // unused + if (my_stream_could_start) start_stream(); } @@ -506,7 +512,7 @@ static void update_output_parameters(int selectedDevice, const PaDeviceInfo *dev } #endif -static void select_device(const char *the_api) +static void select_device() { #if (USE_PORTAUDIO == 19) int numDevices = Pa_GetDeviceCount(); @@ -590,12 +596,12 @@ int wave_init(int srate) return err == paNoError; } -void *wave_open(const char *the_api) +void *wave_open() { static int once = 0; if (!once) { - select_device("alsa"); + select_device(); once = 1; } return (void *)1; @@ -631,6 +637,8 @@ static size_t copyBuffer(char *dest, char *src, const size_t theSizeInBytes) size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize) { + (void)theHandler; // unused + size_t bytes_written = 0; // space in ringbuffer for the sample needed: 1x mono channel but 2x for 1 stereo channel size_t bytes_to_write = (out_channels == 1) ? theSize : theSize*2; @@ -712,6 +720,8 @@ size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSiz int wave_close(void *theHandler) { + (void)theHandler; // unused + static int aStopStreamCount = 0; #if (USE_PORTAUDIO == 19) @@ -790,6 +800,8 @@ int wave_close(void *theHandler) int wave_is_busy(void *theHandler) { + (void)theHandler; // unused + PaError active = 0; if (pa_stream) { @@ -812,11 +824,15 @@ void wave_terminate() uint32_t wave_get_read_position(void *theHandler) { + (void)theHandler; // unused + return myReadPosition; } uint32_t wave_get_write_position(void *theHandler) { + (void)theHandler; // unused + return myWritePosition; } @@ -848,26 +864,35 @@ void *wave_test_get_write_buffer() int wave_init(int srate) { + (void)srate; // unused + return 1; } -void *wave_open(const char *the_api) +void *wave_open() { return (void *)1; } size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize) { + (void)theHandler; // unused + (void)theMono16BitsWaveBuffer; // unused + return theSize; } int wave_close(void *theHandler) { + (void)theHandler; // unused + return 0; } int wave_is_busy(void *theHandler) { + (void)theHandler; // unused + return 0; } @@ -877,22 +902,28 @@ void wave_terminate() uint32_t wave_get_read_position(void *theHandler) { + (void)theHandler; // unused + return 0; } uint32_t wave_get_write_position(void *theHandler) { + (void)theHandler; // unused + return 0; } void wave_flush(void *theHandler) { + (void)theHandler; // unused } typedef int (t_wave_callback)(void); void wave_set_callback_is_output_enabled(t_wave_callback *cb) { + (void)cb; // unused } extern void *wave_test_get_write_buffer() @@ -902,6 +933,8 @@ extern void *wave_test_get_write_buffer() int wave_get_remaining_time(uint32_t sample, uint32_t *time) { + (void)sample; // unused + if (!time) return -1; *time = (uint32_t)0; return 0; diff --git a/src/libespeak-ng/wave.h b/src/libespeak-ng/wave.h index 7594d82c..47046658 100644 --- a/src/libespeak-ng/wave.h +++ b/src/libespeak-ng/wave.h @@ -32,7 +32,7 @@ extern "C" extern int option_device_number; extern int wave_init(int samplerate); -extern void *wave_open(const char *the_api); +extern void *wave_open(); extern size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize); extern int wave_close(void *theHandler); diff --git a/src/libespeak-ng/wave_pulse.c b/src/libespeak-ng/wave_pulse.c index 33143f4f..8f2a4571 100644 --- a/src/libespeak-ng/wave_pulse.c +++ b/src/libespeak-ng/wave_pulse.c @@ -140,6 +140,8 @@ static int wave_samplerate; static void subscribe_cb(struct pa_context *c, enum pa_subscription_event_type t, uint32_t index, void *userdata) { + (void)userdata; // unused + assert(c); if (!stream || @@ -151,6 +153,8 @@ static void subscribe_cb(struct pa_context *c, enum pa_subscription_event_type t static void context_state_cb(pa_context *c, void *userdata) { + (void)userdata; // unused + assert(c); switch (pa_context_get_state(c)) @@ -170,6 +174,8 @@ static void context_state_cb(pa_context *c, void *userdata) static void stream_state_cb(pa_stream *s, void *userdata) { + (void)userdata; // unused + assert(s); switch (pa_stream_get_state(s)) @@ -207,6 +213,9 @@ static void context_success_cb(pa_context *c, int success, void *userdata) static void stream_request_cb(pa_stream *s, size_t length, void *userdata) { + (void)length; // unused + (void)userdata; // unused + assert(s); pa_threaded_mainloop_signal(mainloop, 0); @@ -214,6 +223,8 @@ static void stream_request_cb(pa_stream *s, size_t length, void *userdata) static void stream_latency_update_cb(pa_stream *s, void *userdata) { + (void)userdata; // unused + assert(s); pa_threaded_mainloop_signal(mainloop, 0); @@ -507,6 +518,7 @@ fail: void wave_flush(void *theHandler) { + (void)theHandler; // unused } void wave_set_callback_is_output_enabled(t_wave_callback *cb) @@ -522,13 +534,15 @@ int wave_init(int srate) return pulse_open() == PULSE_OK; } -void *wave_open(const char *the_api) +void *wave_open() { return (void *)1; } size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize) { + (void)theHandler; // unused + size_t bytes_to_write = theSize; char *aBuffer = theMono16BitsWaveBuffer; @@ -571,6 +585,8 @@ terminate: int wave_close(void *theHandler) { + (void)theHandler; // unused + static int aStopStreamCount = 0; // Avoid race condition by making sure this function only @@ -595,6 +611,8 @@ int wave_close(void *theHandler) int wave_is_busy(void *theHandler) { + (void)theHandler; // unused + pa_timing_info a_timing_info; int active = pulse_playing(&a_timing_info); return active; @@ -614,6 +632,8 @@ void wave_terminate() uint32_t wave_get_read_position(void *theHandler) { + (void)theHandler; // unused + pa_timing_info a_timing_info; pulse_playing(&a_timing_info); return a_timing_info.read_index; @@ -621,6 +641,8 @@ uint32_t wave_get_read_position(void *theHandler) uint32_t wave_get_write_position(void *theHandler) { + (void)theHandler; // unused + pa_timing_info a_timing_info; pulse_playing(&a_timing_info); return a_timing_info.write_index; @@ -657,26 +679,35 @@ void *wave_test_get_write_buffer() int wave_init(int srate) { + (void)srate; // unused + return 1; } -void *wave_open(const char *the_api) +void *wave_open() { return (void *)1; } size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize) { + (void)theHandler; // unused + (void)theMono16BitsWaveBuffer; // unused + return theSize; } int wave_close(void *theHandler) { + (void)theHandler; // unused + return 0; } int wave_is_busy(void *theHandler) { + (void)theHandler; // unused + return 0; } @@ -686,22 +717,28 @@ void wave_terminate() uint32_t wave_get_read_position(void *theHandler) { + (void)theHandler; // unused + return 0; } uint32_t wave_get_write_position(void *theHandler) { + (void)theHandler; // unused + return 0; } void wave_flush(void *theHandler) { + (void)theHandler; // unused } typedef int (t_wave_callback)(void); void wave_set_callback_is_output_enabled(t_wave_callback *cb) { + (void)cb; // unused } extern void *wave_test_get_write_buffer() @@ -711,6 +748,8 @@ extern void *wave_test_get_write_buffer() int wave_get_remaining_time(uint32_t sample, uint32_t *time) { + (void)sample; // unused + if (!time) return -1; *time = (uint32_t)0; return 0; diff --git a/src/libespeak-ng/wave_sada.c b/src/libespeak-ng/wave_sada.c index 903c869a..ba36b815 100644 --- a/src/libespeak-ng/wave_sada.c +++ b/src/libespeak-ng/wave_sada.c @@ -117,15 +117,10 @@ int wave_init(int srate) // // DESCRIPTION: // -// opens the audio subsystem given a specific API (e.g., "alsa", -// "oss", ...). We ignore the_api and just return the sun_audio_fd we +// opens the audio subsystem. We just return the sun_audio_fd we // opened in wave_init. This return value will be passed in as the // theHandler parameter in all other methods. // -// PARAMETERS: -// -// the_api: "alsa", "oss" (ignored) -// // GLOBALS USED/MODIFIED: // // sun_audio_fd: used as return value @@ -135,7 +130,7 @@ int wave_init(int srate) // sun_audio_fd opened in wave_init, which is passed in as theHandler // parameter in all other methods // -void *wave_open(const char *the_api) +void *wave_open() { return (void *)sun_audio_fd; } @@ -271,6 +266,8 @@ int wave_close(void *theHandler) // int wave_is_busy(void *theHandler) { + (void)theHandler; // unused + uint32_t time; if (total_samples_sent >= 1) wave_get_remaining_time(total_samples_sent - 1, &time); @@ -312,6 +309,7 @@ void wave_terminate() // void wave_flush(void *theHandler) { + (void)theHandler; // unused } // wave_set_callback_is_output_enabled @@ -401,6 +399,8 @@ uint32_t wave_get_read_position(void *theHandler) // uint32_t wave_get_write_position(void *theHandler) { + (void)theHandler; // unused + return total_samples_sent; } @@ -460,26 +460,35 @@ int wave_get_remaining_time(uint32_t sample, uint32_t *time) int wave_init(int srate) { + (void)srate; // unused + return 1; } -void *wave_open(const char *the_api) +void *wave_open() { return (void *)1; } size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize) { + (void)theHandler; // unused + (void)theMono16BitsWaveBuffer; // unused + return theSize; } int wave_close(void *theHandler) { + (void)theHandler; // unused + return 0; } int wave_is_busy(void *theHandler) { + (void)theHandler; // unused + return 0; } @@ -489,22 +498,28 @@ void wave_terminate() uint32_t wave_get_read_position(void *theHandler) { + (void)theHandler; // unused + return 0; } uint32_t wave_get_write_position(void *theHandler) { + (void)theHandler; // unused + return 0; } void wave_flush(void *theHandler) { + (void)theHandler; // unused } typedef int (t_wave_callback)(void); void wave_set_callback_is_output_enabled(t_wave_callback *cb) { + (void)cb; // unused } extern void *wave_test_get_write_buffer() @@ -514,6 +529,8 @@ extern void *wave_test_get_write_buffer() int wave_get_remaining_time(uint32_t sample, uint32_t *time) { + (void)sample; // unused + if (!time) return -1; *time = (uint32_t)0; return 0; diff --git a/src/libespeak-ng/wavegen.c b/src/libespeak-ng/wavegen.c index f3481461..1d053c1e 100644 --- a/src/libespeak-ng/wavegen.c +++ b/src/libespeak-ng/wavegen.c @@ -366,6 +366,10 @@ static int WaveCallback(const void *inputBuffer, void *outputBuffer, PaStreamCallbackFlags flags, void *userData) #endif { + (void)inputBuffer; // unused + (void)outTime; // unused + (void)userData; // unused + int ix; int result; unsigned char *p; diff --git a/src/speak-ng.c b/src/speak-ng.c index 09982d19..605203e1 100644 --- a/src/speak-ng.c +++ b/src/speak-ng.c @@ -286,6 +286,8 @@ static int WavegenFile(void) static void init_path(char *argv0, char *path_specified) { + (void)argv0; // unused (except with PLATFORM_WINDOWS) + if (path_specified) { sprintf(path_home, "%s/espeak-data", path_specified); return;