Browse Source

code cleanup: next (#1740)

Next bunch of fixes, including unused, non-consts and statics hunting.
Also improves cmake-based installation on MacOS (default data path and
rpath).
master
Alexander Epaneshnikov 2 years ago
parent
commit
c34683d5e2
No account linked to committer's email address

+ 5
- 0
src/CMakeLists.txt View File

target_link_libraries( target_link_libraries(
espeak-ng-bin PRIVATE espeak-ng espeak-ng-config 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) if (MINGW)
target_link_options(espeak-ng-bin PRIVATE "-static-libstdc++" "-static") target_link_options(espeak-ng-bin PRIVATE "-static-libstdc++" "-static")
endif() endif()

+ 7
- 0
src/libespeak-ng/CMakeLists.txt View File



espeak_api.c 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>) target_include_directories(espeak-ng BEFORE PRIVATE $<TARGET_PROPERTY:espeak-include,INTERFACE_INCLUDE_DIRECTORIES>)


target_compile_definitions(espeak-ng INTERFACE "LIBESPEAK_NG_EXPORT=1") target_compile_definitions(espeak-ng INTERFACE "LIBESPEAK_NG_EXPORT=1")
endif() endif()


target_compile_definitions(espeak-ng PRIVATE "PATH_ESPEAK_DATA=\"${CMAKE_INSTALL_PREFIX}/share/espeak-ng-data\"")

if (USE_ASYNC) if (USE_ASYNC)
target_sources(espeak-ng PRIVATE target_sources(espeak-ng PRIVATE
event.c event.c

+ 1
- 3
src/libespeak-ng/intonation.c View File

0x50, 0x5a, 0x64, 0x70, 0x7c, 0x83, 0x85, 0x88, 0x8a, 0x8c, 0x8e, 0x8f, 0x91, 0x92, 0x93, 0x93 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_fall, env_fall,
env_rise, env_rise, env_rise, env_rise,
env_frise, env_r_frise, env_frise, env_r_frise,
#define PRIMARY_LAST 7 #define PRIMARY_LAST 7


static int number_pre; static int number_pre;
static int number_body;
static int number_tail; static int number_tail;
static int last_primary; static int last_primary;
static int tone_posn; static int tone_posn;
int max_stress_posn2 = 0; // penuntimate syllable of the highest stress int max_stress_posn2 = 0; // penuntimate syllable of the highest stress


number_pre = -1; // number of vowels before 1st primary stress number_pre = -1; // number of vowels before 1st primary stress
number_body = 0;
number_tail = 0; // number between tonic syllable and next primary number_tail = 0; // number between tonic syllable and next primary
last_primary = -1; last_primary = -1;



+ 1
- 1
src/libespeak-ng/langopts.c View File

break; break;
} }
case V_TUNES: { 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]); 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; translator->langopts.intonation_group = 0;



+ 1
- 1
src/libespeak-ng/readclause.c View File

int c1 = ' '; // current character int c1 = ' '; // current character
int c2; // next character int c2; // next character
int cprev = ' '; // previous character int cprev = ' '; // previous character
int c_next;
int c_next = 0;
int parag; int parag;
int ix = 0; int ix = 0;
int j; int j;

+ 1
- 1
src/libespeak-ng/synth_mbrola.c View File

MBROLA_TAB *pr; MBROLA_TAB *pr;
PHONEME_TAB *other_ph; PHONEME_TAB *other_ph;
bool found = false; bool found = false;
static int mnem;
int mnem;


// control // control
// bit 0 skip the next phoneme // bit 0 skip the next phoneme

+ 1
- 1
src/libespeak-ng/synthesize.h View File

#define PITCHfall 0 // standard pitch envelopes #define PITCHfall 0 // standard pitch envelopes
#define PITCHrise 2 #define PITCHrise 2
#define N_ENVELOPE_DATA 20 #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 int formant_rate[]; // max rate of change of each formant
extern SPEED_FACTORS speed; extern SPEED_FACTORS speed;

+ 2
- 0
src/libespeak-ng/voices.c View File

char phonemes_name[40] = ""; char phonemes_name[40] = "";
const char *language_type; const char *language_type;
char buf[sizeof(path_home)+30]; char buf[sizeof(path_home)+30];
#if USE_MBROLA
char name1[40]; char name1[40];
char name2[80]; char name2[80];
#endif


int pitch1; int pitch1;
int pitch2; int pitch2;

+ 1
- 1
src/speechPlayer/src/frame.cpp View File



public: 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=new frameRequest_t();
oldFrameRequest->NULLFrame=true; oldFrameRequest->NULLFrame=true;
} }

+ 0
- 1
src/speechPlayer/src/speechWaveGenerator.cpp View File



unsigned int generate(const unsigned int sampleCount, sample* sampleBuf) { unsigned int generate(const unsigned int sampleCount, sample* sampleBuf) {
if(!frameManager) return 0; if(!frameManager) return 0;
double val=0;
for(unsigned int i=0;i<sampleCount;++i) { for(unsigned int i=0;i<sampleCount;++i) {
const speechPlayer_frame_t* frame=frameManager->getCurrentFrame(); const speechPlayer_frame_t* frame=frameManager->getCurrentFrame();
if(frame) { if(frame) {

Loading…
Cancel
Save