autotools: add support for disabling Klatt (--without-klatt/--with-klatt=no)

This commit is contained in:
Reece H. Dunn
2013-09-16 10:22:38 +01:00
parent 341fbce098
commit a725bba818
5 changed files with 41 additions and 11 deletions
+9 -4
View File
@@ -55,11 +55,11 @@ libespeak_includedir = $(includedir)/espeak
libespeak_include_HEADERS = \
src/speak_lib.h
common_FLAGS =
common_SOURCE = \
src/compiledict.cpp \
src/dictionary.cpp \
src/intonation.cpp \
src/klatt.cpp \
src/mbrowrap.cpp \
src/numbers.cpp \
src/readclause.cpp \
@@ -96,6 +96,11 @@ espeakedit_SOURCE = \
src/voicedlg.cpp \
src/vowelchart.cpp
if OPT_KLATT
common_FLAGS += -DINCLUDE_KLATT
common_SOURCE += src/klatt.cpp
endif
if AUDIO_RUNTIME
wave_SOURCE = src/wave.cpp src/wave_pulse.cpp
wave_LIBS = -lpulse -lpulse-simple -lportaudio
@@ -127,7 +132,7 @@ 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_CXXFLAGS = $(wave_FLAGS) \
src_libespeak_la_CXXFLAGS = $(common_FLAGS) $(wave_FLAGS) \
-fpic -fvisibility=hidden -D LIBRARY \
-pedantic -fno-exceptions -D PATH_ESPEAK_DATA=\"$(DATADIR)\"
src_libespeak_la_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(wave_SOURCE)
@@ -135,7 +140,7 @@ src_libespeak_la_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(wave_SOURCE)
bin_PROGRAMS += src/speak
src_speak_LDFLAGS = $(wave_LIBS) -lpthread
src_speak_CXXFLAGS = $(wave_FLAGS)
src_speak_CXXFLAGS = $(common_FLAGS) $(wave_FLAGS)
src_speak_SOURCES = src/speak.cpp $(common_SOURCE) $(wave_SOURCE)
bin_PROGRAMS += src/espeak
@@ -146,7 +151,7 @@ src_espeak_SOURCES = src/espeak.cpp
bin_PROGRAMS += src/espeakedit
src_espeakedit_LDFLAGS = $(wave_LIBS) ${WX_LIBS}
src_espeakedit_CXXFLAGS = ${WX_CXXFLAGS} $(wave_FLAGS) \
src_espeakedit_CXXFLAGS = ${WX_CXXFLAGS} $(common_FLAGS) $(wave_FLAGS) \
-D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA -D_ESPEAKEDIT
src_espeakedit_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(espeakedit_SOURCE) $(wave_SOURCE)
+18
View File
@@ -124,6 +124,22 @@ AM_CONDITIONAL(AUDIO_PULSEAUDIO, [test x"$AUDIO" = xpulseaudio])
AM_CONDITIONAL(AUDIO_PORTAUDIO, [test x"$AUDIO" = xportaudio])
AM_CONDITIONAL(AUDIO_SADA, [test x"$AUDIO" = xsada])
dnl ================================================================
dnl Optional compilation checks.
dnl ================================================================
AC_ARG_WITH([klatt],
[AS_HELP_STRING([--with-klatt], [enable the Klatt formant synthesizer @<:@default=yes@:>@])],
[])
if test "$with_klatt" = "no" ; then
have_klatt=no
else
have_klatt=yes
fi
AM_CONDITIONAL(OPT_KLATT, [test x"$have_klatt" = xyes])
dnl ================================================================
dnl wxWidgets checks.
dnl ================================================================
@@ -161,4 +177,6 @@ AC_MSG_NOTICE([
portaudio: ${have_portaudio}
sada: ${have_sada}
audio configuration: ${AUDIO}
Klatt: ${have_klatt}
])
+1 -5
View File
@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2008 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
* Copyright (C) 2013 Reece H. Dunn *
* *
* Based on a re-implementation by: *
* (c) 1993,94 Jon Iles and Nick Ing-Simmons *
@@ -38,8 +38,6 @@
#include "synthesize.h"
#include "voice.h"
#ifdef INCLUDE_KLATT // conditional compilation for the whole file
extern unsigned char *out_ptr; // **JSD
extern unsigned char *out_start;
extern unsigned char *out_end;
@@ -1409,5 +1407,3 @@ for(ix=0; ix<256; ix++)
kt_frame.AVpdb = 0;
kt_frame.Gain0 = 62; // 60
} // end of KlattInit
#endif // INCLUDE_KLATT
+12 -1
View File
@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2007 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
* Copyright (C) 2013 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 *
@@ -35,13 +36,15 @@
#define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough
#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 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 void CloseWaveFile2();
extern void KlattReset(int control);
extern FILE *f_wave;
static int frame_width;
@@ -115,9 +118,11 @@ void MakeWaveFile(int synthesis_method)
out_ptr = out_start = wav_outbuf;
out_end = &wav_outbuf[sizeof(wav_outbuf)];
#ifdef INCLUDE_KLATT
if(synthesis_method == 1)
result = Wavegen_Klatt(resume);
else
#endif
result = Wavegen();
if(f_wave != NULL)
@@ -972,7 +977,9 @@ static void SetSynth_mS(int length_mS, SpectFrame *sp1, SpectFrame *sp2, peak_t
if(voice->klattv[0])
{
#ifdef INCLUDE_KLATT
SetSynth_Klatt((length_mS * samplerate) / 1000, 0, &fr1, &fr2, voice, control); // convert mS to samples
#endif
}
else
{
@@ -1004,7 +1011,9 @@ void SpectSeq::MakeWave(int start, int end, PitchEnvelope &pitch)
if(voice->klattv[0])
{
synthesizer_type = 1;
#ifdef INCLUDE_KLATT
KlattReset(2);
#endif
}
SpeakNextClause(NULL,NULL,2); // stop speaking file
@@ -1120,7 +1129,9 @@ void SpectFrame::MakeWaveF(int control, PitchEnvelope &pitche, int amplitude, in
if(voice->klattv[0])
{
synthesizer_type = 1;
#ifdef INCLUDE_KLATT
KlattReset(2);
#endif
}
SpeakNextClause(NULL,NULL,2); // stop speaking file
+1 -1
View File
@@ -1,6 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 to 2007 by Jonathan Duddington *
* email: jonsd@users.sourceforge.net *
* Copyright (C) 2013 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 *
@@ -23,7 +24,6 @@
#include <sys/types.h>
// conditional compilation options
#define INCLUDE_KLATT
#define INCLUDE_MBROLA
#define INCLUDE_SONIC