Next bunch of fixes, including unused, non-consts and statics hunting. Also improves cmake-based installation on MacOS (default data path and rpath).master
| @@ -10,6 +10,11 @@ set_target_properties(espeak-ng-bin PROPERTIES OUTPUT_NAME espeak-ng) | |||
| target_link_libraries( | |||
| espeak-ng-bin PRIVATE espeak-ng espeak-ng-config | |||
| ) | |||
| set_target_properties( | |||
| espeak-ng-bin PROPERTIES | |||
| MACOSX_RPATH ON | |||
| INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" | |||
| ) | |||
| if (MINGW) | |||
| target_link_options(espeak-ng-bin PRIVATE "-static-libstdc++" "-static") | |||
| endif() | |||
| @@ -37,6 +37,11 @@ add_library(espeak-ng | |||
| espeak_api.c | |||
| ) | |||
| set_target_properties( | |||
| espeak-ng PROPERTIES | |||
| MACOSX_RPATH ON | |||
| INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" | |||
| ) | |||
| target_include_directories(espeak-ng BEFORE PRIVATE $<TARGET_PROPERTY:espeak-include,INTERFACE_INCLUDE_DIRECTORIES>) | |||
| @@ -64,6 +69,8 @@ if (NOT BUILD_SHARED_LIBS) | |||
| target_compile_definitions(espeak-ng INTERFACE "LIBESPEAK_NG_EXPORT=1") | |||
| endif() | |||
| target_compile_definitions(espeak-ng PRIVATE "PATH_ESPEAK_DATA=\"${CMAKE_INSTALL_PREFIX}/share/espeak-ng-data\"") | |||
| if (USE_ASYNC) | |||
| target_sources(espeak-ng PRIVATE | |||
| event.c | |||
| @@ -194,7 +194,7 @@ static const unsigned char env_risefallrise[128] = { | |||
| 0x50, 0x5a, 0x64, 0x70, 0x7c, 0x83, 0x85, 0x88, 0x8a, 0x8c, 0x8e, 0x8f, 0x91, 0x92, 0x93, 0x93 | |||
| }; | |||
| const unsigned char *envelope_data[N_ENVELOPE_DATA] = { | |||
| const unsigned char *const envelope_data[N_ENVELOPE_DATA] = { | |||
| env_fall, env_fall, | |||
| env_rise, env_rise, | |||
| env_frise, env_r_frise, | |||
| @@ -293,7 +293,6 @@ static const TONE_NUCLEUS tone_nucleus_table[N_TONE_NUCLEUS_TABLE] = { | |||
| #define PRIMARY_LAST 7 | |||
| static int number_pre; | |||
| static int number_body; | |||
| static int number_tail; | |||
| static int last_primary; | |||
| static int tone_posn; | |||
| @@ -309,7 +308,6 @@ static void count_pitch_vowels(SYLLABLE *syllable_tab, int start, int end, int c | |||
| int max_stress_posn2 = 0; // penuntimate syllable of the highest stress | |||
| number_pre = -1; // number of vowels before 1st primary stress | |||
| number_body = 0; | |||
| number_tail = 0; // number between tonic syllable and next primary | |||
| last_primary = -1; | |||
| @@ -147,7 +147,7 @@ if (CheckTranslator(translator, langopts_tab, key) != 0) { | |||
| break; | |||
| } | |||
| case V_TUNES: { | |||
| char names[6][40] = { 0, 0, 0, 0, 0, 0 }; | |||
| char names[6][40] = { {0}, {0}, {0}, {0}, {0}, {0} }; | |||
| n = sscanf(keyValue, "%s %s %s %s %s %s", names[0], names[1], names[2], names[3], names[4], names[5]); | |||
| translator->langopts.intonation_group = 0; | |||
| @@ -480,7 +480,7 @@ int ReadClause(Translator *tr, char *buf, short *charix, int *charix_top, int n_ | |||
| int c1 = ' '; // current character | |||
| int c2; // next character | |||
| int cprev = ' '; // previous character | |||
| int c_next; | |||
| int c_next = 0; | |||
| int parag; | |||
| int ix = 0; | |||
| int j; | |||
| @@ -164,7 +164,7 @@ static int GetMbrName(PHONEME_LIST *plist, PHONEME_TAB *ph, PHONEME_TAB *ph_prev | |||
| MBROLA_TAB *pr; | |||
| PHONEME_TAB *other_ph; | |||
| bool found = false; | |||
| static int mnem; | |||
| int mnem; | |||
| // control | |||
| // bit 0 skip the next phoneme | |||
| @@ -447,7 +447,7 @@ void DoSonicSpeed(int value); | |||
| #define PITCHfall 0 // standard pitch envelopes | |||
| #define PITCHrise 2 | |||
| #define N_ENVELOPE_DATA 20 | |||
| extern const unsigned char *envelope_data[N_ENVELOPE_DATA]; | |||
| extern const unsigned char *const envelope_data[N_ENVELOPE_DATA]; | |||
| extern int formant_rate[]; // max rate of change of each formant | |||
| extern SPEED_FACTORS speed; | |||
| @@ -424,8 +424,10 @@ voice_t *LoadVoice(const char *vname, int control) | |||
| char phonemes_name[40] = ""; | |||
| const char *language_type; | |||
| char buf[sizeof(path_home)+30]; | |||
| #if USE_MBROLA | |||
| char name1[40]; | |||
| char name2[80]; | |||
| #endif | |||
| int pitch1; | |||
| int pitch2; | |||
| @@ -83,7 +83,7 @@ class FrameManagerImpl: public FrameManager { | |||
| public: | |||
| FrameManagerImpl(): curFrame(), curFrameIsNULL(true), sampleCounter(0), newFrameRequest(NULL), lastUserIndex(-1) { | |||
| FrameManagerImpl(): newFrameRequest(NULL), curFrame(), curFrameIsNULL(true), sampleCounter(0), lastUserIndex(-1) { | |||
| oldFrameRequest=new frameRequest_t(); | |||
| oldFrameRequest->NULLFrame=true; | |||
| } | |||
| @@ -196,7 +196,6 @@ class SpeechWaveGeneratorImpl: public SpeechWaveGenerator { | |||
| unsigned int generate(const unsigned int sampleCount, sample* sampleBuf) { | |||
| if(!frameManager) return 0; | |||
| double val=0; | |||
| for(unsigned int i=0;i<sampleCount;++i) { | |||
| const speechPlayer_frame_t* frame=frameManager->getCurrentFrame(); | |||
| if(frame) { | |||