diff --git a/Makefile.am b/Makefile.am
index 77889aa5..5761cf8d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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)
diff --git a/configure.ac b/configure.ac
index 813e4b40..5b56f9cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,6 +13,7 @@ dnl ================================================================
dnl Program checks.
dnl ================================================================
+AC_PROG_CC
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
diff --git a/src/espeak.cpp b/src/espeak.c
similarity index 99%
rename from src/espeak.cpp
rename to src/espeak.c
index 517b3481..7a24266e 100644
--- a/src/espeak.cpp
+++ b/src/espeak.c
@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2006 to 2013 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
+ * 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 @@
* . *
***************************************************************************/
+#include
#include
#include
#include
diff --git a/src/espeak_command.h b/src/espeak_command.h
index 9a928476..0dc2ff9b 100644
--- a/src/espeak_command.h
+++ b/src/espeak_command.h
@@ -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
diff --git a/src/extras.cpp b/src/extras.cpp
index 9f9a6e3f..3ce21cc0 100644
--- a/src/extras.cpp
+++ b/src/extras.cpp
@@ -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 {
diff --git a/src/compiledict.cpp b/src/libespeak-ng/compiledict.c
similarity index 100%
rename from src/compiledict.cpp
rename to src/libespeak-ng/compiledict.c
diff --git a/src/debug.cpp b/src/libespeak-ng/debug.c
similarity index 100%
rename from src/debug.cpp
rename to src/libespeak-ng/debug.c
diff --git a/src/dictionary.cpp b/src/libespeak-ng/dictionary.c
similarity index 100%
rename from src/dictionary.cpp
rename to src/libespeak-ng/dictionary.c
diff --git a/src/espeak_command.cpp b/src/libespeak-ng/espeak_command.c
similarity index 100%
rename from src/espeak_command.cpp
rename to src/libespeak-ng/espeak_command.c
diff --git a/src/event.cpp b/src/libespeak-ng/event.c
similarity index 99%
rename from src/event.cpp
rename to src/libespeak-ng/event.c
index 17dcb93e..488112cd 100644
--- a/src/event.cpp
+++ b/src/libespeak-ng/event.c
@@ -1,6 +1,6 @@
/***************************************************************************
* Copyright (C) 2007, Gilles Casse *
- * 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
#include
#include
+#include
#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");
//>
// *
- * 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()
//>
//. *
***************************************************************************/
+#include
#include
#include
#include
diff --git a/src/phonemelist.cpp b/src/libespeak-ng/phonemelist.c
similarity index 100%
rename from src/phonemelist.cpp
rename to src/libespeak-ng/phonemelist.c
diff --git a/src/readclause.cpp b/src/libespeak-ng/readclause.c
similarity index 100%
rename from src/readclause.cpp
rename to src/libespeak-ng/readclause.c
diff --git a/src/setlengths.cpp b/src/libespeak-ng/setlengths.c
similarity index 100%
rename from src/setlengths.cpp
rename to src/libespeak-ng/setlengths.c
diff --git a/src/sonic.cpp b/src/libespeak-ng/sonic.c
similarity index 100%
rename from src/sonic.cpp
rename to src/libespeak-ng/sonic.c
diff --git a/src/speak_lib.cpp b/src/libespeak-ng/speak_lib.c
similarity index 99%
rename from src/speak_lib.cpp
rename to src/libespeak-ng/speak_lib.c
index c956877a..e0e3fd1e 100644
--- a/src/speak_lib.cpp
+++ b/src/libespeak-ng/speak_lib.c
@@ -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
diff --git a/src/synth_mbrola.cpp b/src/libespeak-ng/synth_mbrola.c
similarity index 100%
rename from src/synth_mbrola.cpp
rename to src/libespeak-ng/synth_mbrola.c
diff --git a/src/synthdata.cpp b/src/libespeak-ng/synthdata.c
similarity index 99%
rename from src/synthdata.cpp
rename to src/libespeak-ng/synthdata.c
index 7e79acbc..9b2db92e 100644
--- a/src/synthdata.cpp
+++ b/src/libespeak-ng/synthdata.c
@@ -18,6 +18,7 @@
* . *
***************************************************************************/
+#include
#include
#include
#include
diff --git a/src/synthesize.cpp b/src/libespeak-ng/synthesize.c
similarity index 100%
rename from src/synthesize.cpp
rename to src/libespeak-ng/synthesize.c
diff --git a/src/tr_languages.cpp b/src/libespeak-ng/tr_languages.c
similarity index 100%
rename from src/tr_languages.cpp
rename to src/libespeak-ng/tr_languages.c
diff --git a/src/translate.cpp b/src/libespeak-ng/translate.c
similarity index 100%
rename from src/translate.cpp
rename to src/libespeak-ng/translate.c
diff --git a/src/voices.cpp b/src/libespeak-ng/voices.c
similarity index 100%
rename from src/voices.cpp
rename to src/libespeak-ng/voices.c
diff --git a/src/wave.cpp b/src/libespeak-ng/wave.c
similarity index 99%
rename from src/wave.cpp
rename to src/libespeak-ng/wave.c
index d468cefb..c68f4417 100644
--- a/src/wave.cpp
+++ b/src/libespeak-ng/wave.c
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2007, Gilles Casse *
+ * 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
#include
#include
#include
diff --git a/src/wave_pulse.cpp b/src/libespeak-ng/wave_pulse.c
similarity index 99%
rename from src/wave_pulse.cpp
rename to src/libespeak-ng/wave_pulse.c
index 1bcb593a..1df82a05 100644
--- a/src/wave_pulse.cpp
+++ b/src/libespeak-ng/wave_pulse.c
@@ -1,5 +1,6 @@
/***************************************************************************
* Copyright (C) 2007, Gilles Casse *
+ * 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
#include
#include
#include
diff --git a/src/wave_sada.cpp b/src/libespeak-ng/wave_sada.c
similarity index 100%
rename from src/wave_sada.cpp
rename to src/libespeak-ng/wave_sada.c
diff --git a/src/wavegen.cpp b/src/libespeak-ng/wavegen.c
similarity index 100%
rename from src/wavegen.cpp
rename to src/libespeak-ng/wavegen.c
diff --git a/src/speak.cpp b/src/speak.c
similarity index 99%
rename from src/speak.cpp
rename to src/speak.c
index c907ab16..c38cbf32 100644
--- a/src/speak.cpp
+++ b/src/speak.c
@@ -20,6 +20,7 @@
#include "speech.h"
+#include
#include
#include
#include
diff --git a/src/spect.cpp b/src/spect.cpp
index 493cb8d9..6b30f4da 100644
--- a/src/spect.cpp
+++ b/src/spect.cpp
@@ -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;
diff --git a/src/spect.h b/src/spect.h
index 398455ef..fe8a3caa 100644
--- a/src/spect.h
+++ b/src/spect.h
@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2007 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
- * 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);
diff --git a/src/spectseq.cpp b/src/spectseq.cpp
index 6e60e9fb..513cba66 100644
--- a/src/spectseq.cpp
+++ b/src/spectseq.cpp
@@ -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;