mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-28 21:41:52 +00:00
1.47.13 (from http://espeak.sourceforge.net/test/latest.html)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#include <speak_lib.h>
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#include <windows.h>
|
||||
#define sleep(x) Sleep(1000*x)
|
||||
#endif
|
||||
|
||||
int callback(short* wav, int num, espeak_EVENT *pEv)
|
||||
{
|
||||
int cEv = 0;
|
||||
while (pEv->type) {
|
||||
cEv++;
|
||||
pEv++;
|
||||
}
|
||||
printf("callback, events: %d\n", cEv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
int nRate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 10000, NULL, 0);
|
||||
printf("nRate: %d\n", nRate);
|
||||
if (nRate < 0)
|
||||
return;
|
||||
espeak_SetSynthCallback(callback);
|
||||
espeak_SetParameter(espeakRATE, 175, 0);
|
||||
int rv;
|
||||
rv = espeak_Char('c');
|
||||
printf("rv: %d\n", rv);
|
||||
const char* sText = "tralalalallala";
|
||||
rv = espeak_Synth(sText, 100, 0, POS_CHARACTER, 0, 0, 0, 0);
|
||||
printf("rv: %d (full: %d, internal: %d)\n",
|
||||
rv, EE_BUFFER_FULL, EE_INTERNAL_ERROR);
|
||||
sleep(2); // 2 seconds
|
||||
puts("slept");
|
||||
espeak_Terminate();
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
Index: src/Makefile
|
||||
===================================================================
|
||||
--- src/Makefile (revision 364)
|
||||
+++ src/Makefile (working copy)
|
||||
@@ -18,6 +18,13 @@
|
||||
# Use SONAME_OPT=-Wl,h, on Solaris
|
||||
SONAME_OPT=-Wl,-soname,
|
||||
|
||||
+ifdef PLATFORM_WINDOWS
|
||||
+ LIB_NAME = libespeak.dll
|
||||
+else
|
||||
+ # On Windows not all source files are compiled
|
||||
+ non_windows_SOURCES = mbrowrap.cpp
|
||||
+endif
|
||||
+
|
||||
# Use EXTRA_LIBS=-lm on Solaris
|
||||
EXTRA_LIBS =
|
||||
|
||||
@@ -72,12 +79,12 @@
|
||||
|
||||
speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
- synthdata.cpp synthesize.cpp translate.cpp mbrowrap.cpp \
|
||||
+ synthdata.cpp synthesize.cpp translate.cpp $(non_windows_SOURCES) \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp klatt.cpp sonic.cpp
|
||||
|
||||
libespeak_SOURCES = speak_lib.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
- synthdata.cpp synthesize.cpp translate.cpp mbrowrap.cpp \
|
||||
+ synthdata.cpp synthesize.cpp translate.cpp $(non_windows_SOURCES) \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp \
|
||||
espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp klatt.cpp sonic.cpp
|
||||
|
||||
@@ -94,8 +101,14 @@
|
||||
LIBS3=-lstdc++ -L . -lespeak
|
||||
|
||||
CXXFLAGS=-O2
|
||||
+ifdef PLATFORM_WINDOWS
|
||||
+ CXXFLAGS += -DPLATFORM_WINDOWS -DNEED_STRUCT_TIMESPEC
|
||||
+ LDFLAGS += -static-libgcc -static-libstdc++
|
||||
+endif
|
||||
+ifdef DEBUG
|
||||
+ CXXFLAGS += -DDEBUG_ENABLED
|
||||
+endif
|
||||
|
||||
-
|
||||
all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME)
|
||||
|
||||
.cpp.o:
|
||||
@@ -116,9 +129,11 @@
|
||||
$(LIB_NAME): $(OBJS2)
|
||||
$(CXX) $(LDFLAGS) -shared $(SONAME_OPT)$(LIB_NAME).$(LIB_VERSION) -o $@ \
|
||||
$(OBJS2) $(LIBS2)
|
||||
- mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG)
|
||||
- $(LN_SF) $(LIB_NAME).$(LIBTAG) $(LIB_NAME).$(LIB_VERSION)
|
||||
- $(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(LIB_NAME)
|
||||
+ $(if $(PLATFORM_WINDOWS), , \
|
||||
+ mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG); \
|
||||
+ $(LN_SF) $(LIB_NAME).$(LIBTAG) $(LIB_NAME).$(LIB_VERSION); \
|
||||
+ $(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(LIB_NAME); \
|
||||
+ )
|
||||
|
||||
$(STATIC_LIB_NAME): $(OBJS2)
|
||||
$(AR) cqs $(STATIC_LIB_NAME) $(OBJS2)
|
||||
Index: src/speech.h
|
||||
===================================================================
|
||||
--- src/speech.h (revision 364)
|
||||
+++ src/speech.h (working copy)
|
||||
@@ -37,7 +37,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
-#define PLATFORM_POSIX
|
||||
#define PATHSEP '/'
|
||||
// USE_PORTAUDIO or USE_PULSEAUDIO are now defined in the makefile
|
||||
//#define USE_PORTAUDIO
|
||||
@@ -77,7 +76,14 @@
|
||||
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
#define N_PATH_HOME 230
|
||||
-#else
|
||||
+// sleep(seconds)
|
||||
+// Sleep(millisecond = 1/1000 s), windows api, kernel32.dll
|
||||
+// usleep(microseconds = 1/1000000 s)
|
||||
+#define sleep(x) Sleep(1000*x)
|
||||
+// we are lucky, in current code usleep is always used in multiplies of 1000
|
||||
+#define usleep(x) Sleep((x+500)/1000)
|
||||
+#else /* PLATFORM_POSIX */
|
||||
+#define PLATFORM_POSIX
|
||||
#define N_PATH_HOME 160
|
||||
#endif
|
||||
|
||||
Index: src/speak_lib.cpp
|
||||
===================================================================
|
||||
--- src/speak_lib.cpp (revision 364)
|
||||
+++ src/speak_lib.cpp (working copy)
|
||||
@@ -31,7 +31,13 @@
|
||||
#include "speech.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
-#ifndef PLATFORM_WINDOWS
|
||||
+
|
||||
+#ifdef PLATFORM_WINDOWS
|
||||
+#include <fcntl.h>
|
||||
+#include <io.h>
|
||||
+#include <windows.h>
|
||||
+#include <winreg.h>
|
||||
+#else /* PLATFORM_POSIX */
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
Index: src/wave.cpp
|
||||
===================================================================
|
||||
--- src/wave.cpp (revision 364)
|
||||
+++ src/wave.cpp (working copy)
|
||||
@@ -32,7 +32,9 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "portaudio.h"
|
||||
-#ifndef PLATFORM_WINDOWS
|
||||
+#ifdef PLATFORM_WINDOWS
|
||||
+#include <windows.h>
|
||||
+#else /* PLATFORM_POSIX */
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include "wave.h"
|
||||
@@ -40,6 +42,14 @@
|
||||
|
||||
//<Definitions
|
||||
|
||||
+#ifdef NEED_STRUCT_TIMESPEC
|
||||
+#define HAVE_STRUCT_TIMESPEC 1
|
||||
+struct timespec {
|
||||
+ long tv_sec;
|
||||
+ long tv_nsec;
|
||||
+};
|
||||
+#endif /* HAVE_STRUCT_TIMESPEC */
|
||||
+
|
||||
enum {ONE_BILLION=1000000000};
|
||||
|
||||
#ifdef USE_PORTAUDIO
|
||||
Index: src/event.cpp
|
||||
===================================================================
|
||||
--- src/event.cpp (revision 364)
|
||||
+++ src/event.cpp (working copy)
|
||||
@@ -24,7 +24,9 @@
|
||||
|
||||
|
||||
//<includes
|
||||
+#ifndef PLATFORM_WINDOWS
|
||||
#include <unistd.h>
|
||||
+#endif
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
Index: src/fifo.cpp
|
||||
===================================================================
|
||||
--- src/fifo.cpp (revision 364)
|
||||
+++ src/fifo.cpp (working copy)
|
||||
@@ -24,7 +24,9 @@
|
||||
|
||||
//<includes
|
||||
|
||||
+#ifndef PLATFORM_WINDOWS
|
||||
#include <unistd.h>
|
||||
+#endif
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -0,0 +1,16 @@
|
||||
These are instructions to built the library on MS Windows, using msys and mingw.
|
||||
This library is fully functional, contrary to the library described
|
||||
in windows_dll directory.
|
||||
|
||||
To build exe file go to windows_cmd directory, to build sapi dll,
|
||||
go to windows_sapi directory.
|
||||
|
||||
- Use sources from src directory.
|
||||
- Have a ready to use portaudio v19 library (dll file is sufficient, here
|
||||
libportaudio-2.dll filename is assumed in a directory relative to espeak)
|
||||
- Copy portaudio.h file from your portaudio directory to src directory,
|
||||
overwriting the existing one. At the time of writing this is the same
|
||||
file as src/portaudio19.h distributed within espeak.
|
||||
|
||||
Make command:
|
||||
make libespeak.dll PLATFORM_WINDOWS=1 LIB_AUDIO="-L ../../portaudio/lib/.libs -lportaudio-2 -lwinmm"
|
||||
Reference in New Issue
Block a user