Browse Source

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

master
Reece H. Dunn 12 years ago
parent
commit
a725bba818
5 changed files with 41 additions and 11 deletions
  1. 9
    4
      Makefile.am
  2. 18
    0
      configure.ac
  3. 1
    5
      src/klatt.cpp
  4. 12
    1
      src/spectseq.cpp
  5. 1
    1
      src/speech.h

+ 9
- 4
Makefile.am View File

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


common_FLAGS =
common_SOURCE = \ common_SOURCE = \
src/compiledict.cpp \ src/compiledict.cpp \
src/dictionary.cpp \ src/dictionary.cpp \
src/intonation.cpp \ src/intonation.cpp \
src/klatt.cpp \
src/mbrowrap.cpp \ src/mbrowrap.cpp \
src/numbers.cpp \ src/numbers.cpp \
src/readclause.cpp \ src/readclause.cpp \
src/voicedlg.cpp \ src/voicedlg.cpp \
src/vowelchart.cpp src/vowelchart.cpp


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

if AUDIO_RUNTIME if AUDIO_RUNTIME
wave_SOURCE = src/wave.cpp src/wave_pulse.cpp wave_SOURCE = src/wave.cpp src/wave_pulse.cpp
wave_LIBS = -lpulse -lpulse-simple -lportaudio wave_LIBS = -lpulse -lpulse-simple -lportaudio
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_CXXFLAGS = $(wave_FLAGS) \
src_libespeak_la_CXXFLAGS = $(common_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)\"
src_libespeak_la_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(wave_SOURCE) src_libespeak_la_SOURCES = $(common_SOURCE) $(libespeak_SOURCE) $(wave_SOURCE)
bin_PROGRAMS += src/speak bin_PROGRAMS += src/speak


src_speak_LDFLAGS = $(wave_LIBS) -lpthread 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) src_speak_SOURCES = src/speak.cpp $(common_SOURCE) $(wave_SOURCE)


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


src_espeakedit_LDFLAGS = $(wave_LIBS) ${WX_LIBS} 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 -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)



+ 18
- 0
configure.ac View File

AM_CONDITIONAL(AUDIO_PORTAUDIO, [test x"$AUDIO" = xportaudio]) AM_CONDITIONAL(AUDIO_PORTAUDIO, [test x"$AUDIO" = xportaudio])
AM_CONDITIONAL(AUDIO_SADA, [test x"$AUDIO" = xsada]) 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 ================================================================
dnl wxWidgets checks. dnl wxWidgets checks.
dnl ================================================================ dnl ================================================================
portaudio: ${have_portaudio} portaudio: ${have_portaudio}
sada: ${have_sada} sada: ${have_sada}
audio configuration: ${AUDIO} audio configuration: ${AUDIO}

Klatt: ${have_klatt}
]) ])

+ 1
- 5
src/klatt.cpp View File


/*************************************************************************** /***************************************************************************
* Copyright (C) 2008 by Jonathan Duddington * * Copyright (C) 2008 by Jonathan Duddington *
* email: [email protected] * * email: [email protected] *
* Copyright (C) 2013 Reece H. Dunn *
* * * *
* Based on a re-implementation by: * * Based on a re-implementation by: *
* (c) 1993,94 Jon Iles and Nick Ing-Simmons * * (c) 1993,94 Jon Iles and Nick Ing-Simmons *
#include "synthesize.h" #include "synthesize.h"
#include "voice.h" #include "voice.h"


#ifdef INCLUDE_KLATT // conditional compilation for the whole file

extern unsigned char *out_ptr; // **JSD extern unsigned char *out_ptr; // **JSD
extern unsigned char *out_start; extern unsigned char *out_start;
extern unsigned char *out_end; extern unsigned char *out_end;
kt_frame.AVpdb = 0; kt_frame.AVpdb = 0;
kt_frame.Gain0 = 62; // 60 kt_frame.Gain0 = 62; // 60
} // end of KlattInit } // end of KlattInit

#endif // INCLUDE_KLATT

+ 12
- 1
src/spectseq.cpp 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 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 *
#define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough #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 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 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 void SetSynth(int length, int modn, frame_t *fr1, frame_t *fr2, voice_t *v);
extern int Wavegen(); extern int Wavegen();
extern void CloseWaveFile2(); extern void CloseWaveFile2();
extern void KlattReset(int control);
extern FILE *f_wave; extern FILE *f_wave;


static int frame_width; static int frame_width;
out_ptr = out_start = wav_outbuf; out_ptr = out_start = wav_outbuf;
out_end = &wav_outbuf[sizeof(wav_outbuf)]; out_end = &wav_outbuf[sizeof(wav_outbuf)];


#ifdef INCLUDE_KLATT
if(synthesis_method == 1) if(synthesis_method == 1)
result = Wavegen_Klatt(resume); result = Wavegen_Klatt(resume);
else else
#endif
result = Wavegen(); result = Wavegen();


if(f_wave != NULL) if(f_wave != NULL)


if(voice->klattv[0]) if(voice->klattv[0])
{ {
#ifdef INCLUDE_KLATT
SetSynth_Klatt((length_mS * samplerate) / 1000, 0, &fr1, &fr2, voice, control); // convert mS to samples SetSynth_Klatt((length_mS * samplerate) / 1000, 0, &fr1, &fr2, voice, control); // convert mS to samples
#endif
} }
else else
{ {
if(voice->klattv[0]) if(voice->klattv[0])
{ {
synthesizer_type = 1; synthesizer_type = 1;
#ifdef INCLUDE_KLATT
KlattReset(2); KlattReset(2);
#endif
} }


SpeakNextClause(NULL,NULL,2); // stop speaking file SpeakNextClause(NULL,NULL,2); // stop speaking file
if(voice->klattv[0]) if(voice->klattv[0])
{ {
synthesizer_type = 1; synthesizer_type = 1;
#ifdef INCLUDE_KLATT
KlattReset(2); KlattReset(2);
#endif
} }


SpeakNextClause(NULL,NULL,2); // stop speaking file SpeakNextClause(NULL,NULL,2); // stop speaking file

+ 1
- 1
src/speech.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 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 <sys/types.h> #include <sys/types.h>


// conditional compilation options // conditional compilation options
#define INCLUDE_KLATT
#define INCLUDE_MBROLA #define INCLUDE_MBROLA
#define INCLUDE_SONIC #define INCLUDE_SONIC



Loading…
Cancel
Save