Browse Source

Use the C compiler to build C files; restructuring.

This moves the libespeak source (*.cpp) files to src/libespeak-ng
and renames the C files (libespeak, espeak, speak) so they have
a .c file extension.
master
Reece H. Dunn 9 years ago
parent
commit
f7dfc38dd7

+ 37
- 32
Makefile.am View File

libespeak_include_HEADERS = \ libespeak_include_HEADERS = \
src/speak_lib.h src/speak_lib.h


common_FLAGS =
common_FLAGS = -Isrc
common_SOURCE = \ common_SOURCE = \
src/compiledict.cpp \
src/dictionary.cpp \
src/intonation.cpp \
src/numbers.cpp \
src/readclause.cpp \
src/phonemelist.cpp \
src/setlengths.cpp \
src/synthdata.cpp \
src/synthesize.cpp \
src/synth_mbrola.cpp \
src/translate.cpp \
src/tr_languages.cpp \
src/voices.cpp \
src/wavegen.cpp
src/libespeak-ng/compiledict.c \
src/libespeak-ng/dictionary.c \
src/libespeak-ng/intonation.c \
src/libespeak-ng/numbers.c \
src/libespeak-ng/readclause.c \
src/libespeak-ng/phonemelist.c \
src/libespeak-ng/setlengths.c \
src/libespeak-ng/synthdata.c \
src/libespeak-ng/synthesize.c \
src/libespeak-ng/synth_mbrola.c \
src/libespeak-ng/translate.c \
src/libespeak-ng/tr_languages.c \
src/libespeak-ng/voices.c \
src/libespeak-ng/wavegen.c


libespeak_FLAGS = libespeak_FLAGS =
libespeak_SOURCE = \ libespeak_SOURCE = \
src/speak_lib.cpp \
src/debug.cpp
src/libespeak-ng/speak_lib.c \
src/libespeak-ng/debug.c


espeakedit_SOURCE = \ espeakedit_SOURCE = \
src/compiledata.cpp \ src/compiledata.cpp \


if OPT_KLATT if OPT_KLATT
common_FLAGS += -DINCLUDE_KLATT common_FLAGS += -DINCLUDE_KLATT
common_SOURCE += src/klatt.cpp
common_SOURCE += src/libespeak-ng/klatt.c
endif endif


if OPT_MBROLA if OPT_MBROLA
common_FLAGS += -DINCLUDE_MBROLA common_FLAGS += -DINCLUDE_MBROLA
common_SOURCE += src/mbrowrap.cpp
common_SOURCE += src/libespeak-ng/mbrowrap.c
endif endif


if OPT_SONIC if OPT_SONIC
common_FLAGS += -DINCLUDE_SONIC common_FLAGS += -DINCLUDE_SONIC
common_SOURCE += src/sonic.cpp
common_SOURCE += src/libespeak-ng/sonic.c
endif endif


if OPT_ASYNC if OPT_ASYNC
libespeak_FLAGS += -DUSE_ASYNC libespeak_FLAGS += -DUSE_ASYNC
libespeak_SOURCE += \ libespeak_SOURCE += \
src/espeak_command.cpp \
src/event.cpp \
src/fifo.cpp
src/libespeak-ng/espeak_command.c \
src/libespeak-ng/event.c \
src/libespeak-ng/fifo.c
endif endif


if AUDIO_RUNTIME if AUDIO_RUNTIME
wave_SOURCE = src/wave.cpp src/wave_pulse.cpp
wave_SOURCE = src/libespeak-ng/wave.c src/libespeak-ng/wave_pulse.c
wave_LIBS = -lpulse -lpulse-simple -lportaudio wave_LIBS = -lpulse -lpulse-simple -lportaudio
wave_FLAGS = -DUSE_PULSEAUDIO -DUSE_PORTAUDIO wave_FLAGS = -DUSE_PULSEAUDIO -DUSE_PORTAUDIO
else else
if AUDIO_PULSEAUDIO if AUDIO_PULSEAUDIO
wave_SOURCE = src/wave_pulse.cpp
wave_SOURCE = src/libespeak-ng/wave_pulse.c
wave_LIBS = -lpulse wave_LIBS = -lpulse
wave_FLAGS = -DUSE_PULSEAUDIO wave_FLAGS = -DUSE_PULSEAUDIO
else else
if AUDIO_PORTAUDIO if AUDIO_PORTAUDIO
wave_SOURCE = src/wave.cpp
wave_SOURCE = src/libespeak-ng/wave.c
wave_LIBS = -lportaudio wave_LIBS = -lportaudio
wave_FLAGS = -DUSE_PORTAUDIO wave_FLAGS = -DUSE_PORTAUDIO
else else
if AUDIO_SADA if AUDIO_SADA
wave_SOURCE = src/wave_sada.cpp
wave_SOURCE = src/libespeak-ng/wave_sada.c
wave_FLAGS = -DUSE_SADA wave_FLAGS = -DUSE_SADA
else else
wave_SOURCE = src/wave.cpp
wave_SOURCE = src/libespeak-ng/wave.c
endif endif
endif endif
endif endif
lib_LTLIBRARIES += src/libespeak.la lib_LTLIBRARIES += src/libespeak.la


src_libespeak_la_LDFLAGS = -version-info $(SHARED_VERSION) $(wave_LIBS) -lpthread src_libespeak_la_LDFLAGS = -version-info $(SHARED_VERSION) $(wave_LIBS) -lpthread
src_libespeak_la_CFLAGS = $(common_FLAGS) $(libespeak_FLAGS) $(wave_FLAGS) \
-fPIC -fvisibility=hidden -D LIBRARY \
-pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\"
src_libespeak_la_CXXFLAGS = $(common_FLAGS) $(libespeak_FLAGS) $(wave_FLAGS) \ src_libespeak_la_CXXFLAGS = $(common_FLAGS) $(libespeak_FLAGS) $(wave_FLAGS) \
-fPIC -fvisibility=hidden -D LIBRARY \ -fPIC -fvisibility=hidden -D LIBRARY \
-pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\"


bin_PROGRAMS += src/speak bin_PROGRAMS += src/speak


src_speak_LDFLAGS = $(wave_LIBS) -lpthread
src_speak_CXXFLAGS = $(common_FLAGS) $(wave_FLAGS)
src_speak_SOURCES = src/speak.cpp $(common_SOURCE) $(wave_SOURCE)
src_speak_LDFLAGS = $(wave_LIBS) -lpthread -lm
src_speak_CFLAGS = $(common_FLAGS) $(wave_FLAGS)
src_speak_SOURCES = src/speak.c $(common_SOURCE) $(wave_SOURCE)


bin_PROGRAMS += src/espeak bin_PROGRAMS += src/espeak


src_espeak_LDADD = src/libespeak.la src_espeak_LDADD = src/libespeak.la
src_espeak_SOURCES = src/espeak.cpp
src_espeak_SOURCES = src/espeak.c


bin_PROGRAMS += src/espeakedit bin_PROGRAMS += src/espeakedit


src_espeakedit_LDFLAGS = $(wave_LIBS) ${WX_LIBS} src_espeakedit_LDFLAGS = $(wave_LIBS) ${WX_LIBS}
src_espeakedit_CFLAGS = ${WX_CXXFLAGS} $(common_FLAGS) $(libespeak_FLAGS) $(wave_FLAGS) \
-D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT
src_espeakedit_CXXFLAGS = ${WX_CXXFLAGS} $(common_FLAGS) $(libespeak_FLAGS) $(wave_FLAGS) \ src_espeakedit_CXXFLAGS = ${WX_CXXFLAGS} $(common_FLAGS) $(libespeak_FLAGS) $(wave_FLAGS) \
-D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT
src_espeakedit_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(espeakedit_SOURCE) $(wave_SOURCE) src_espeakedit_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(espeakedit_SOURCE) $(wave_SOURCE)

+ 1
- 0
configure.ac View File

dnl Program checks. dnl Program checks.
dnl ================================================================ dnl ================================================================


AC_PROG_CC
AC_PROG_CXX AC_PROG_CXX
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_PROG_LIBTOOL AC_PROG_LIBTOOL

src/espeak.cpp → src/espeak.c View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2006 to 2013 by Jonathan Duddington * * Copyright (C) 2006 to 2013 by Jonathan Duddington *
* email: [email protected] * * email: [email protected] *
* Copyright (C) 2015 Reece H. Dunn *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* <http://www.gnu.org/licenses/>. * * <http://www.gnu.org/licenses/>. *
***************************************************************************/ ***************************************************************************/


#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

+ 5
- 5
src/espeak_command.h View File

{ {
#endif #endif


enum t_espeak_type
typedef enum
{ {
ET_TEXT, ET_TEXT,
ET_MARK, ET_MARK,
ET_VOICE_NAME, ET_VOICE_NAME,
ET_VOICE_SPEC, ET_VOICE_SPEC,
ET_TERMINATED_MSG ET_TERMINATED_MSG
};
} t_espeak_type;


typedef struct typedef struct
{ {
int relative; int relative;
} t_espeak_parameter; } t_espeak_parameter;


enum t_command_state
typedef enum
{ {
CS_UNDEFINED, // The command has just been created CS_UNDEFINED, // The command has just been created
CS_PENDING, // stored in the fifo CS_PENDING, // stored in the fifo
CS_PROCESSED // processed CS_PROCESSED // processed
};
} t_command_state;


typedef struct typedef struct
{ {
enum t_espeak_type type;
t_espeak_type type;
t_command_state state; t_command_state state;


union command union command

+ 2
- 2
src/extras.cpp View File

#include "options.h" #include "options.h"


extern char word_phonemes[N_WORD_PHONEMES]; // a word translated into phoneme codes extern char word_phonemes[N_WORD_PHONEMES]; // a word translated into phoneme codes
extern int __cdecl string_sorter(char **a, char **b);
extern "C" int __cdecl string_sorter(char **a, char **b);


//****************************************************************************************************** //******************************************************************************************************






//****************************************************************************************************** //******************************************************************************************************
extern int HashDictionary(const char *string);
extern "C" int HashDictionary(const char *string);
static int n_words; static int n_words;


struct wcount { struct wcount {

src/compiledict.cpp → src/libespeak-ng/compiledict.c View File


src/debug.cpp → src/libespeak-ng/debug.c View File


src/dictionary.cpp → src/libespeak-ng/dictionary.c View File


src/espeak_command.cpp → src/libespeak-ng/espeak_command.c View File


src/event.cpp → src/libespeak-ng/event.c View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2007, Gilles Casse <[email protected]> * * Copyright (C) 2007, Gilles Casse <[email protected]> *
* Copyright (C) 2013 Reece H. Dunn *
* Copyright (C) 2013-2015 Reece H. Dunn *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
#include <semaphore.h> #include <semaphore.h>
#include <sys/time.h> #include <sys/time.h>
#include <errno.h> #include <errno.h>
#include <stdbool.h>


#include "speech.h" #include "speech.h"
#include "speak_lib.h" #include "speak_lib.h"
typedef struct t_node typedef struct t_node
{ {
void* data; void* data;
t_node *next;
struct t_node *next;
} node; } node;


static node* head=NULL; static node* head=NULL;
//> //>
//<polling_thread //<polling_thread


static void* polling_thread(void*)
static void* polling_thread(void*p)
{ {
ENTER("polling_thread"); ENTER("polling_thread");



src/fifo.cpp → src/libespeak-ng/fifo.c View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2007, Gilles Casse <[email protected]> * * Copyright (C) 2007, Gilles Casse <[email protected]> *
* Copyright (C) 2013 Reece H. Dunn *
* Copyright (C) 2013-2015 Reece H. Dunn *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
//> //>
//<say_thread //<say_thread


static void* say_thread(void*)
static void* say_thread(void*p)
{ {
ENTER("say_thread"); ENTER("say_thread");


typedef struct t_node typedef struct t_node
{ {
t_espeak_command* data; t_espeak_command* data;
t_node *next;
struct t_node *next;
} node; } node;


static node* head=NULL; static node* head=NULL;

src/intonation.cpp → src/libespeak-ng/intonation.c View File


src/klatt.cpp → src/libespeak-ng/klatt.c View File


src/mbrowrap.cpp → src/libespeak-ng/mbrowrap.c View File


src/numbers.cpp → src/libespeak-ng/numbers.c View File

* <http://www.gnu.org/licenses/>. * * <http://www.gnu.org/licenses/>. *
***************************************************************************/ ***************************************************************************/


#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>

src/phonemelist.cpp → src/libespeak-ng/phonemelist.c View File


src/readclause.cpp → src/libespeak-ng/readclause.c View File


src/setlengths.cpp → src/libespeak-ng/setlengths.c View File


src/sonic.cpp → src/libespeak-ng/sonic.c View File


src/speak_lib.cpp → src/libespeak-ng/speak_lib.c View File

ep->text_position = char_position & 0xffffff; ep->text_position = char_position & 0xffffff;
ep->length = char_position >> 24; ep->length = char_position >> 24;


time = (double(count_samples + mbrola_delay + (out_ptr - out_start)/2)*1000.0)/samplerate;
ep->audio_position = int(time);
time = ((double)(count_samples + mbrola_delay + (out_ptr - out_start)/2)*1000.0)/samplerate;
ep->audio_position = (int)time;
ep->sample = (count_samples + mbrola_delay + (out_ptr - out_start)/2); ep->sample = (count_samples + mbrola_delay + (out_ptr - out_start)/2);


#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED

src/synth_mbrola.cpp → src/libespeak-ng/synth_mbrola.c View File


src/synthdata.cpp → src/libespeak-ng/synthdata.c View File

* <http://www.gnu.org/licenses/>. * * <http://www.gnu.org/licenses/>. *
***************************************************************************/ ***************************************************************************/


#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>

src/synthesize.cpp → src/libespeak-ng/synthesize.c View File


src/tr_languages.cpp → src/libespeak-ng/tr_languages.c View File


src/translate.cpp → src/libespeak-ng/translate.c View File


src/voices.cpp → src/libespeak-ng/voices.c View File


src/wave.cpp → src/libespeak-ng/wave.c View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2007, Gilles Casse <[email protected]> * * Copyright (C) 2007, Gilles Casse <[email protected]> *
* Copyright (C) 2015 by Reece H. Dunn *
* based on AudioIO.cc (Audacity-1.2.4b) and wavegen.cpp * * based on AudioIO.cc (Audacity-1.2.4b) and wavegen.cpp *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
#ifdef USE_ASYNC #ifdef USE_ASYNC
// This source file is only used for asynchronious modes // This source file is only used for asynchronious modes


#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>

src/wave_pulse.cpp → src/libespeak-ng/wave_pulse.c View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2007, Gilles Casse <[email protected]> * * Copyright (C) 2007, Gilles Casse <[email protected]> *
* Copyright (C) 2015 by Reece H. Dunn *
* eSpeak driver for PulseAudio * * eSpeak driver for PulseAudio *
* based on the XMMS PulseAudio Plugin * * based on the XMMS PulseAudio Plugin *
* * * *
#ifdef USE_ASYNC #ifdef USE_ASYNC
// This source file is only used for asynchronious modes // This source file is only used for asynchronious modes


#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>

src/wave_sada.cpp → src/libespeak-ng/wave_sada.c View File


src/wavegen.cpp → src/libespeak-ng/wavegen.c View File


src/speak.cpp → src/speak.c View File



#include "speech.h" #include "speech.h"


#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

+ 1
- 1
src/spect.cpp View File

#include "wx/datstrm.h" #include "wx/datstrm.h"




extern int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control);
extern "C" int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control);


extern unsigned char pk_shape1[]; extern unsigned char pk_shape1[];
extern int pk_select; extern int pk_select;

+ 2
- 2
src/spect.h View File

/*************************************************************************** /***************************************************************************
* Copyright (C) 2005 to 2007 by Jonathan Duddington * * Copyright (C) 2005 to 2007 by Jonathan Duddington *
* email: [email protected] * * email: [email protected] *
* Copyright (C) 2013 by Reece H. Dunn *
* Copyright (C) 2013-2015 by Reece H. Dunn *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
extern float polint(float xa[],float ya[],int n,float x); extern float polint(float xa[],float ya[],int n,float x);
extern void WavegenInit(int samplerate, int wavemult_fact); extern void WavegenInit(int samplerate, int wavemult_fact);
extern void WavegenInitPkData(int); // initialise envelope data extern void WavegenInitPkData(int); // initialise envelope data
extern void SetPitch(int length, unsigned char *env, int pitch1, int pitch2);
extern "C" void SetPitch(int length, unsigned char *env, int pitch1, int pitch2);
extern void SetSynthHtab(int length_mS, USHORT *ht1, int nh1, float pitch1, USHORT *ht2, int nh2, float pitch2); extern void SetSynthHtab(int length_mS, USHORT *ht1, int nh1, float pitch1, USHORT *ht2, int nh2, float pitch2);
extern void MakeWaveFile(int synthesis_method); extern void MakeWaveFile(int synthesis_method);
extern void MakeWaveBuf(int length, UCHAR *buf); extern void MakeWaveBuf(int length, UCHAR *buf);

+ 4
- 4
src/spectseq.cpp View File





#ifdef INCLUDE_KLATT #ifdef INCLUDE_KLATT
extern void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v, int control);
extern int Wavegen_Klatt(int resume);
extern "C" void SetSynth_Klatt(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v, int control);
extern "C" int Wavegen_Klatt(int resume);
extern void KlattReset(int control); extern void KlattReset(int control);
#endif #endif


extern void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v);
extern int Wavegen();
extern "C" void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v);
extern "C" int Wavegen();
extern void CloseWaveFile2(); extern void CloseWaveFile2();
extern FILE *f_wave; extern FILE *f_wave;



Loading…
Cancel
Save