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

@@ -56,27 +56,27 @@ libespeak_includedir = $(includedir)/espeak
libespeak_include_HEADERS = \
src/speak_lib.h

common_FLAGS =
common_FLAGS = -Isrc
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_SOURCE = \
src/speak_lib.cpp \
src/debug.cpp
src/libespeak-ng/speak_lib.c \
src/libespeak-ng/debug.c

espeakedit_SOURCE = \
src/compiledata.cpp \
@@ -95,47 +95,47 @@ espeakedit_SOURCE = \

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

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

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

if OPT_ASYNC
libespeak_FLAGS += -DUSE_ASYNC
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

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_FLAGS = -DUSE_PULSEAUDIO -DUSE_PORTAUDIO
else
if AUDIO_PULSEAUDIO
wave_SOURCE = src/wave_pulse.cpp
wave_SOURCE = src/libespeak-ng/wave_pulse.c
wave_LIBS = -lpulse
wave_FLAGS = -DUSE_PULSEAUDIO
else
if AUDIO_PORTAUDIO
wave_SOURCE = src/wave.cpp
wave_SOURCE = src/libespeak-ng/wave.c
wave_LIBS = -lportaudio
wave_FLAGS = -DUSE_PORTAUDIO
else
if AUDIO_SADA
wave_SOURCE = src/wave_sada.cpp
wave_SOURCE = src/libespeak-ng/wave_sada.c
wave_FLAGS = -DUSE_SADA
else
wave_SOURCE = src/wave.cpp
wave_SOURCE = src/libespeak-ng/wave.c
endif
endif
endif
@@ -147,6 +147,9 @@ docs/speak_lib.h: src/speak_lib.h
lib_LTLIBRARIES += src/libespeak.la

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) \
-fPIC -fvisibility=hidden -D LIBRARY \
-pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\"
@@ -154,18 +157,20 @@ src_libespeak_la_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(wave_SOURCE)

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

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

bin_PROGRAMS += src/espeakedit

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) \
-D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT
src_espeakedit_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(espeakedit_SOURCE) $(wave_SOURCE)

+ 1
- 0
configure.ac View File

@@ -13,6 +13,7 @@ dnl ================================================================
dnl Program checks.
dnl ================================================================

AC_PROG_CC
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL

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

@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2006 to 2013 by Jonathan Duddington *
* email: [email protected] *
* Copyright (C) 2015 Reece H. Dunn *
* *
* 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 *
@@ -17,6 +18,7 @@
* <http://www.gnu.org/licenses/>. *
***************************************************************************/

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

+ 5
- 5
src/espeak_command.h View File

@@ -11,7 +11,7 @@ extern "C"
{
#endif

enum t_espeak_type
typedef enum
{
ET_TEXT,
ET_MARK,
@@ -22,7 +22,7 @@ enum t_espeak_type
ET_VOICE_NAME,
ET_VOICE_SPEC,
ET_TERMINATED_MSG
};
} t_espeak_type;

typedef struct
{
@@ -76,16 +76,16 @@ typedef struct
int relative;
} t_espeak_parameter;

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

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

union command

+ 2
- 2
src/extras.cpp View File

@@ -37,7 +37,7 @@
#include "options.h"

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);

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

@@ -1470,7 +1470,7 @@ void CompareLexicon(int id)


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

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

@@ -1,6 +1,6 @@
/***************************************************************************
* 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 *
* it under the terms of the GNU General Public License as published by *
@@ -32,6 +32,7 @@
#include <semaphore.h>
#include <sys/time.h>
#include <errno.h>
#include <stdbool.h>

#include "speech.h"
#include "speak_lib.h"
@@ -63,7 +64,7 @@ enum {MIN_TIMEOUT_IN_MS=10,
typedef struct t_node
{
void* data;
t_node *next;
struct t_node *next;
} node;

static node* head=NULL;
@@ -474,7 +475,7 @@ ENTER("get_remaining_time");
//>
//<polling_thread

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


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

@@ -1,6 +1,6 @@
/***************************************************************************
* 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 *
* it under the terms of the GNU General Public License as published by *
@@ -376,7 +376,7 @@ static void close_stream()
//>
//<say_thread

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

@@ -489,7 +489,7 @@ int fifo_is_command_enabled()
typedef struct t_node
{
t_espeak_command* data;
t_node *next;
struct t_node *next;
} node;

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

@@ -18,6 +18,7 @@
* <http://www.gnu.org/licenses/>. *
***************************************************************************/

#include <stdbool.h>
#include <stdio.h>
#include <ctype.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

@@ -580,8 +580,8 @@ void MarkerEvent(int type, unsigned int char_position, int value, int value2, un
ep->text_position = char_position & 0xffffff;
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);

#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

@@ -18,6 +18,7 @@
* <http://www.gnu.org/licenses/>. *
***************************************************************************/

#include <stdbool.h>
#include <stdio.h>
#include <stdlib.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

@@ -1,5 +1,6 @@
/***************************************************************************
* 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 *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -23,6 +24,7 @@
#ifdef USE_ASYNC
// This source file is only used for asynchronious modes

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

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

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

#include <stdbool.h>
#include <stdio.h>
#include <string.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

@@ -20,6 +20,7 @@

#include "speech.h"

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

+ 1
- 1
src/spect.cpp View File

@@ -34,7 +34,7 @@
#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 int pk_select;

+ 2
- 2
src/spect.h View File

@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2007 by Jonathan Duddington *
* 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 *
* it under the terms of the GNU General Public License as published by *
@@ -384,7 +384,7 @@ extern SpectDisplay *currentcanvas;
extern float polint(float xa[],float ya[],int n,float x);
extern void WavegenInit(int samplerate, int wavemult_fact);
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 MakeWaveFile(int synthesis_method);
extern void MakeWaveBuf(int length, UCHAR *buf);

+ 4
- 4
src/spectseq.cpp View File

@@ -37,13 +37,13 @@


#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);
#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 FILE *f_wave;


Loading…
Cancel
Save