diff --git a/windows/make_espeak.iss b/windows/make_espeak.iss new file mode 100755 index 00000000..0de7f772 --- /dev/null +++ b/windows/make_espeak.iss @@ -0,0 +1,309 @@ +; This is the script for "Inno Setup 5" to create the setup_espeak.exe installer for Windows + +[Setup] +AppName=eSpeak +AppVerName=eSpeak version 1.26 +DefaultDirName={pf}\eSpeak +DefaultGroupName=eSpeak +OutputBaseFilename=setup_espeak +Compression=lzma +SolidCompression=yes + +[InstallDelete] +Type: files; Name: "{app}\espeak.dll" + +[Dirs] +Name: "{app}\espeak-data\soundicons" +Name: "{app}\espeak-data\mbrola" + +[Files] +Source: "espeak_sapi.dll"; DestDir: "{app}"; Flags: regserver promptifolder replacesameversion +Source: "TTSApp.exe"; DestDir:"{app}" +Source: "espeak-data\*"; DestDir: "{app}\espeak-data"; Flags: recursesubdirs +Source: "dictsource2\*"; DestDir: "{app}\dictsource" +Source: "docs\*"; DestDir: "{app}\docs"; Flags: recursesubdirs +Source: "command_line\*"; DestDir: "{app}\command_line" +Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme + +[Registry] +Root: HKLM; Subkey: "Software\Microsoft\Speech\Voices\Tokens\eSpeak"; Flags: deletekey uninsdeletekey +Root: HKLM; Subkey: "Software\Microsoft\Speech\Voices\Tokens\eSpeak_1"; Flags: deletekey uninsdeletekey +Root: HKLM; Subkey: "Software\Microsoft\Speech\Voices\Tokens\eSpeak_2"; Flags: deletekey uninsdeletekey +Root: HKLM; Subkey: "Software\Microsoft\Speech\Voices\Tokens\eSpeak_3"; Flags: deletekey uninsdeletekey +Root: HKLM; Subkey: "Software\Microsoft\Speech\Voices\Tokens\eSpeak_4"; Flags: deletekey uninsdeletekey +Root: HKLM; Subkey: "Software\Microsoft\Speech\Voices\Tokens\eSpeak_5"; Flags: deletekey uninsdeletekey +Root: HKLM; Subkey: "Software\Microsoft\Speech\PhoneConverters\Tokens\eSpeak"; Flags: deletekey uninsdeletekey + + + +[Code] +var + UILanguage: Integer; + UIVoice: String; + Page: TInputQueryWizardPage; + +const + sEspeak = 'eSpeak-'; + RegVoice1 = 'Software\Microsoft\Speech\Voices\Tokens\eSpeak'; + RegPhConv = 'Software\Microsoft\Speech\PhoneConverters\Tokens'; + + +function VoiceFromLanguage(language: Integer): String; +var + lang_main: Integer; + +begin + lang_main := language and $3ff; + Result := 'af'; + + // translation from microsoft codes to language codes + case lang_main of + $05: Result := 'cs'; + $07: Result := 'de'; + $08: Result := 'el'; + $0a: Result := 'es'; + $0b: Result := 'fi'; + $0c: Result := 'fr'; + $0e: Result := 'hu'; + $10: Result := 'it'; + $13: Result := 'nl'; + $14: Result := 'no'; + $15: Result := 'pl'; + $16: Result := 'pt'; + $18: Result := 'ro'; + $19: Result := 'ru'; + $1a: Result := 'hr'; + $1b: Result := 'sk'; + $1d: Result := 'sv'; + $2a: Result := 'vi'; + $36: Result := 'af'; + $39: Result := 'hi'; + $41: Result := 'sw'; + $52: Result := 'cy'; + end; +end; + + +function LanguageFromVoice(voice: String): String; +var + value: Integer; + lang1: String; + len: Integer; +begin + value := $409; // default en-us + + lang1 := Copy(voice,0,2); + if lang1 = 'mb' then + begin + lang1 := Copy(voice,3,3); + len := Length(voice); + if len > 8 then + lang1 := Copy(voice,8,6); // eg. mb-de4-en, return 'en' + end; + + case lang1 of + 'af': value := $436; + 'cs': value := $405; + 'cy': value := $452; + 'de': value := $407; + 'el': value := $408; + 'en': value := $409; + 'es': value := $40a; + 'fi': value := $40b; + 'fr': value := $40c; + 'hi': value := $439; + 'hr': value := $41a; + 'hu': value := $40e; + 'is': value := $40f; + 'it': value := $410; + 'nl': value := $413; + 'no': value := $414; + 'pl': value := $415; + 'pt': value := $416; + 'ro': value := $418; + 'ru': value := $419; + 'sk': value := $41b; + 'sv': value := $41d; + 'sw': value := $441; + 'vi': value := $42a; + // mbrola voices + '-af': value := $436; + '-br': value := $416; + '-ca': value := $c0c; + '-cr': value := $41a; + '-cz': value := $405; + '-de': value := $407; + '-en': value := $809; + '-es': value := $40a; + '-fr': value := $40c; + '-gr': value := $408; + '-hu': value := $40e; + '-ic': value := $40f; + '-in': value := $439; + '-it': value := $410; + '-mx': value := $80a; + '-nl': value := $413; + '-pl': value := $415; + '-pt': value := $816; + '-ro': value := $418; + '-sw': value := $41d; + '-us': value := $409; + '-vz': value := $200a; + end; + + // check for specific voices + case voice of + 'pt-pt': value := $816; + end; + + Result := Format('%X',[value]); +end; + + +// is the language number already in a PhoneConvertor ? +function CheckPhoneConvertors(Lcode: String): Integer; +var + Convertors: TArrayOfString; + ix: Integer; + len: Integer; + s1: String; + s2: String; + sLangs: String; +begin + Result := 0; + len := Length(Lcode); + if RegGetSubkeyNames(HKEY_LOCAL_MACHINE, RegPhConv, Convertors) then + begin + for ix := 0 to GetArrayLength(Convertors) - 1 do + begin + s1 := RegPhConv + '\' + Convertors[ix] + '\Attributes'; + if RegQueryStringValue(HKEY_LOCAL_MACHINE, s1, 'Language', sLangs) then + begin + s2 := Copy(sLangs, 1, len); + if s2 = Lcode then + Result := 1; + if sLangs = Lcode then + Result := 1; + if Pos(';' + Lcode, sLangs) > 0 then + Result := 1; + end; + end; + end; +end; + +// ensure the language number is included in a PhoneConvertor +procedure SetPhoneConvertor(Lcode: String); +var + done: Boolean; + s1: String; + sLangs: String; +begin + if CheckPhoneConvertors(Lcode) = 0 then + begin + done := False; + s1 := RegPhConv + '\Universal\Attributes'; + if RegQueryStringValue(HKEY_LOCAL_MACHINE, s1, 'Language', sLangs) then + begin + done := RegWriteStringValue(HKEY_LOCAL_MACHINE, s1, 'Language', Lcode + ';' + sLangs); + end; + + if done = False then + begin + s1 := RegPhConv + '\eSpeak\Attributes'; + if RegQueryStringValue(HKEY_LOCAL_MACHINE, s1, 'Language', sLangs) = False then + begin + // add 'eSpeak' dummy PhoneConvertor + RegWriteStringValue(HKEY_LOCAL_MACHINE, RegPhConv + '\eSpeak', 'CLSID','{9185F743-1143-4C28-86B5-BFF14F20E5C8}'); + RegWriteStringValue(HKEY_LOCAL_MACHINE, RegPhConv + '\eSpeak', 'PhoneMap','- 0001'); + RegWriteStringValue(HKEY_LOCAL_MACHINE, s1, 'Language',''); + end; + + if RegQueryStringValue(HKEY_LOCAL_MACHINE, s1, 'Language', sLangs) then + begin + done := RegWriteStringValue(HKEY_LOCAL_MACHINE, s1, 'Language', Lcode + ';' + sLangs); + end; + end; + end; +end; + + +procedure SetupVoice(Voice, Lcode: String; Index: Integer); +var + RegVoice2: String; + RegVoice2a: String; + VoiceUC: String; + +begin + if Index = 0 then + RegVoice2 := RegVoice1 + else + RegVoice2 := RegVoice1 + Format('_%d',[Index]); + + RegVoice2a := RegVoice2 + '\Attributes'; + + if Voice = 'default' then + VoiceUC := 'default' + else + VoiceUC := Uppercase(Voice); + + RegWriteStringValue(HKEY_LOCAL_MACHINE,RegVoice2,'',sEspeak+VoiceUC); + RegWriteStringValue(HKEY_LOCAL_MACHINE,RegVoice2,'CLSID','{BE985C8D-BE32-4A22-AA93-55C16A6D1D91}'); + RegWriteStringValue(HKEY_LOCAL_MACHINE,RegVoice2,'Path',ExpandConstant('{app}')); + RegWriteStringValue(HKEY_LOCAL_MACHINE,RegVoice2,'VoiceName',Voice); + + RegWriteStringValue(HKEY_LOCAL_MACHINE,RegVoice2a,'Name',sEspeak+Voice); + RegWriteStringValue(HKEY_LOCAL_MACHINE,RegVoice2a,'Gender','Male'); + RegWriteStringValue(HKEY_LOCAL_MACHINE,RegVoice2a,'Age','Adult'); + RegWriteStringValue(HKEY_LOCAL_MACHINE,RegVoice2a,'Language',Lcode); + RegWriteStringValue(HKEY_LOCAL_MACHINE,RegVoice2a,'Vendor','Jonathan Duddington'); + + SetPhoneConvertor(Lcode); +end; + + + +procedure CurStepChanged(CurStep: TSetupStep); +var + ix: Integer; +begin + if CurStep = ssPostInstall then + begin + + for ix := 0 to 5 do begin + if Page.Values[ix] <> '' then + SetUpVoice(Page.Values[ix],LanguageFromVoice(Page.Values[ix]),ix); + end; + end; +end; + + +procedure InitializeWizard; +var + lang: String; +begin + // Create the language selection page + lang := ActiveLanguage; + Page := CreateInputQueryPage(wpSelectDir, + 'Select which voices to install', 'or press Enter to accept defaults', + 'Enter voice names, eg: (for Portuguese) pt, or with a variant, eg: pt+13'); + + // Add items (False means it's not a password edit) + Page.Add('', False); + Page.Add('', False); + Page.Add('', False); + Page.Add('', False); + Page.Add('', False); + Page.Add('', False); + + UILanguage := GetUILanguage; + UIVoice := VoiceFromLanguage(UILanguage); + + // Set initial values (optional) + Page.Values[0] := 'en'; + Page.Values[1] := UIVoice; + Page.Values[2] := 'en-r'; + +end; + + + diff --git a/windows/make_espeakedit.iss b/windows/make_espeakedit.iss new file mode 100755 index 00000000..095f111a --- /dev/null +++ b/windows/make_espeakedit.iss @@ -0,0 +1,21 @@ + +[Setup] +AppName=eSpeakEdit +AppVerName=eSpeakEdit version 1.26 +DefaultDirName={pf}\eSpeak +DefaultGroupName=eSpeak +OutputBaseFilename=setup_espeakedit +Compression=lzma +SolidCompression=yes +DirExistsWarning=no + +[Files] +Source: "espeakedit.exe"; DestDir: "{app}" +Source: "dictsource\*"; DestDir: "{app}\dictsource"; Flags: recursesubdirs +Source: "espeakedit\*"; DestDir: "{app}\espeakedit"; Flags: recursesubdirs +Source: "phsource\*"; DestDir: "{app}\phsource"; Flags: recursesubdirs +Source: "docs\*"; DestDir: "{app}\docs"; Flags: recursesubdirs +;Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme + + + diff --git a/windows/windows_cmd/!ReadMe.txt b/windows/windows_cmd/!ReadMe.txt new file mode 100755 index 00000000..d1d456f9 --- /dev/null +++ b/windows/windows_cmd/!ReadMe.txt @@ -0,0 +1,11 @@ +======================================================================== + CONSOLE APPLICATION : espeak +======================================================================== + +This is a Virtual C++ project to make a command-line version +of eSpeak for Windows. + +Copy the source files from the Linux "src" directory into this +"src" directory, EXCEPT for speech.h. Keep the original Windows +command-line version iof speech.h. + diff --git a/windows/windows_cmd/PAStaticWMME.lib b/windows/windows_cmd/PAStaticWMME.lib new file mode 100755 index 00000000..6ddf5596 Binary files /dev/null and b/windows/windows_cmd/PAStaticWMME.lib differ diff --git a/windows/windows_cmd/StdAfx.cpp b/windows/windows_cmd/StdAfx.cpp new file mode 100755 index 00000000..e680b910 --- /dev/null +++ b/windows/windows_cmd/StdAfx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// espeak.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/windows/windows_cmd/StdAfx.h b/windows/windows_cmd/StdAfx.h new file mode 100755 index 00000000..b1d6e6f5 --- /dev/null +++ b/windows/windows_cmd/StdAfx.h @@ -0,0 +1,22 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__6C2D1701_32D2_4335_A2C8_C6A23021ADBE__INCLUDED_) +#define AFX_STDAFX_H__6C2D1701_32D2_4335_A2C8_C6A23021ADBE__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__6C2D1701_32D2_4335_A2C8_C6A23021ADBE__INCLUDED_) diff --git a/windows/windows_cmd/espeak.dsp b/windows/windows_cmd/espeak.dsp new file mode 100755 index 00000000..381b02cf --- /dev/null +++ b/windows/windows_cmd/espeak.dsp @@ -0,0 +1,206 @@ +# Microsoft Developer Studio Project File - Name="espeak" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=espeak - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "espeak.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "espeak.mak" CFG="espeak - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "espeak - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "espeak - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "espeak - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib winmm.lib user32.lib gdi32.lib winspool.lib comdlg32.lib PAStaticWMME.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"espeak.exe" + +!ELSEIF "$(CFG)" == "espeak - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "espeak - Win32 Release" +# Name "espeak - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\src\compiledict.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\dictionary.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\intonation.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\numbers.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\phonemelist.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\readclause.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\setlengths.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\speak.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\src\synth_mbrola.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\synthdata.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\synthesize.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tr_english.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tr_languages.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\translate.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\voices.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\wavegen.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\src\phoneme.h +# End Source File +# Begin Source File + +SOURCE=.\src\sintab.h +# End Source File +# Begin Source File + +SOURCE=.\src\speak_lib.h +# End Source File +# Begin Source File + +SOURCE=.\src\speech.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\src\synthesize.h +# End Source File +# Begin Source File + +SOURCE=.\src\tr_languages.h +# End Source File +# Begin Source File + +SOURCE=.\src\translate.h +# End Source File +# Begin Source File + +SOURCE=.\src\voice.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/windows/windows_cmd/espeak.dsw b/windows/windows_cmd/espeak.dsw new file mode 100755 index 00000000..3db315d0 --- /dev/null +++ b/windows/windows_cmd/espeak.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "espeak"=.\espeak.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/windows/windows_cmd/src/speech.h b/windows/windows_cmd/src/speech.h new file mode 100755 index 00000000..ed893f65 --- /dev/null +++ b/windows/windows_cmd/src/speech.h @@ -0,0 +1,83 @@ +/*************************************************************************** + * Copyright (C) 2005,2006 by Jonathan Duddington * + * jsd@clara.co.uk * + * * + * 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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +// Windows command-line version of eSpeak + + +// conditional compilation options + +#define PLATFORM_WINDOWS +#define __WIN32__ +#define NEED_WCSTOF +#define NEED_GETOPT + +#define PATHSEP '\\' +#define USE_PORTAUDIO +#define ESPEAK_API + +// will look for espeak_data directory here, and also in user's home directory +#define PATH_ESPEAK_DATA "/usr/share/espeak-data" + +typedef unsigned short USHORT; +typedef unsigned char UCHAR; +typedef double DOUBLEX; + + + +#define N_PEAKS 9 +#define N_MARKERS 7 + + +typedef struct { + const char *mnem; + int value; +} MNEM_TAB; +int LookupMnem(MNEM_TAB *table, char *string); + + +typedef struct { + short pkfreq; + short pkheight; + short pkwidth; + short pkright; +} peak_t; + +typedef struct { + short frflags; + unsigned char length; + unsigned char rms; + short ffreq[9]; + unsigned char fheight[9]; + unsigned char fwidth[6]; // width/4 + unsigned char fright[6]; // width/4 +} frame_t; + + +int GetFileLength(const char *filename); +char *Alloc(int size); +void Free(void *ptr); + + +extern void strncpy0(char *to,const char *from, int size); +extern char path_home[]; + +extern const int version_phdata; +extern const char *version_string; + diff --git a/windows/windows_cmd/src/stdint.h b/windows/windows_cmd/src/stdint.h new file mode 100755 index 00000000..6b162070 --- /dev/null +++ b/windows/windows_cmd/src/stdint.h @@ -0,0 +1,4 @@ + +// dummy stdint.h file for Windows + +typedef unsigned int uint32_t; diff --git a/windows/windows_dll/!ReadMe.txt b/windows/windows_dll/!ReadMe.txt new file mode 100644 index 00000000..812f6338 --- /dev/null +++ b/windows/windows_dll/!ReadMe.txt @@ -0,0 +1,16 @@ + +This is a Virtual C++ project for the Windows dll +version of eSpeak. This provides the API which is +defined in speak_lib.h, using the +AUDIO_OUTPUT_SYNCHRONOUS mode only. + +This is not the sapi5 version of eSpeak. + +Copy the program source files from the Linux "src" +directory into this "src" directory, EXCEPT for: + speak_lib.h + speech.h + StdAfx.h + stdint.h +Keep the Windows versions of these files. + diff --git a/windows/windows_dll/StdAfx.cpp b/windows/windows_dll/StdAfx.cpp new file mode 100755 index 00000000..e680b910 --- /dev/null +++ b/windows/windows_dll/StdAfx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// espeak.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/windows/windows_dll/StdAfx.h b/windows/windows_dll/StdAfx.h new file mode 100755 index 00000000..15759d58 --- /dev/null +++ b/windows/windows_dll/StdAfx.h @@ -0,0 +1,24 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__55502A81_7778_46B7_B400_FD19199C842B__INCLUDED_) +#define AFX_STDAFX_H__55502A81_7778_46B7_B400_FD19199C842B__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +// Insert your headers here +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__55502A81_7778_46B7_B400_FD19199C842B__INCLUDED_) diff --git a/windows/windows_dll/espeak.dsp b/windows/windows_dll/espeak.dsp new file mode 100755 index 00000000..32f86c59 --- /dev/null +++ b/windows/windows_dll/espeak.dsp @@ -0,0 +1,225 @@ +# Microsoft Developer Studio Project File - Name="espeak" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=espeak - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "espeak.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "espeak.mak" CFG="espeak - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "espeak - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "espeak - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "espeak - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ESPEAK_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ESPEAK_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"Release/espeak_lib.dll" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "espeak - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ESPEAK_EXPORTS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ESPEAK_EXPORTS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"Debug/espeak_lib.dll" /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "espeak - Win32 Release" +# Name "espeak - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\src\compiledict.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\dictionary.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\intonation.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\numbers.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\phonemelist.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\readclause.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\setlengths.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\speak_lib.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\src\synth_mbrola.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\synthdata.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\synthesize.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tr_english.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\tr_languages.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\translate.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\voices.cpp +# End Source File +# Begin Source File + +SOURCE=.\src\wavegen.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\espeak.h +# End Source File +# Begin Source File + +SOURCE=.\src\phoneme.h +# End Source File +# Begin Source File + +SOURCE=.\src\portaudio.h +# End Source File +# Begin Source File + +SOURCE=.\src\sintab.h +# End Source File +# Begin Source File + +SOURCE=.\src\speak_lib.h +# End Source File +# Begin Source File + +SOURCE=.\src\speech.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# Begin Source File + +SOURCE=.\src\stdint.h +# End Source File +# Begin Source File + +SOURCE=.\src\synthesize.h +# End Source File +# Begin Source File + +SOURCE=.\src\tr_languages.h +# End Source File +# Begin Source File + +SOURCE=.\src\translate.h +# End Source File +# Begin Source File + +SOURCE=.\src\voice.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/windows/windows_dll/espeak.dsw b/windows/windows_dll/espeak.dsw new file mode 100755 index 00000000..3db315d0 --- /dev/null +++ b/windows/windows_dll/espeak.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "espeak"=.\espeak.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/windows/windows_dll/src/StdAfx.h b/windows/windows_dll/src/StdAfx.h new file mode 100755 index 00000000..15759d58 --- /dev/null +++ b/windows/windows_dll/src/StdAfx.h @@ -0,0 +1,24 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__55502A81_7778_46B7_B400_FD19199C842B__INCLUDED_) +#define AFX_STDAFX_H__55502A81_7778_46B7_B400_FD19199C842B__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +// Insert your headers here +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__55502A81_7778_46B7_B400_FD19199C842B__INCLUDED_) diff --git a/windows/windows_dll/src/speak_lib.h b/windows/windows_dll/src/speak_lib.h new file mode 100644 index 00000000..07bea82b --- /dev/null +++ b/windows/windows_dll/src/speak_lib.h @@ -0,0 +1,576 @@ +#ifndef SPEAK_LIB_H +#define SPEAK_LIB_H +/*************************************************************************** + * Copyright (C) 2006 by Jonathan Duddington * + * jonsd@users.sourceforge.net * + * * + * 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 * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + + +/*************************************************************/ +/* This is the header file for the library version of espeak */ +/* */ +/*************************************************************/ +#define ESPEAK_API __declspec(dllexport) + +#include + + /********************/ + /* Initialization */ + /********************/ + + +typedef enum { + espeakEVENT_LIST_TERMINATED = 0, // Retrieval mode: terminates the event list. + espeakEVENT_WORD = 1, // Start of word + espeakEVENT_SENTENCE, // Start of sentence + espeakEVENT_MARK, // Mark + espeakEVENT_PLAY, // Audio element + espeakEVENT_END, // End of sentence + espeakEVENT_MSG_TERMINATED, // End of message + espeakEVENT_PHONEME // Phoneme, if enabled in espeak_Initialize() +} espeak_EVENT_TYPE; + + + +typedef struct { + espeak_EVENT_TYPE type; + unsigned int unique_identifier; // message identifier (or 0 for key or character) + int text_position; // the number of characters from the start of the text + int length; // word length, in characters (for espeakEVENT_WORD) + int audio_position; // the time in mS within the generated speech output data + int sample; // sample id (internal use) + void* user_data; // pointer supplied by the calling program + union { + int number; // used for WORD and SENTENCE events. For PHONEME events this is the phoneme mnemonic. + const char *name; // used for MARK and PLAY events. UTF8 string + } id; +} espeak_EVENT; +/* + When a message is supplied to espeak_synth, the request is buffered and espeak_synth returns. When the message is really processed, the callback function will be repetedly called. + + + In RETRIEVAL mode, the callback function supplies to the calling program the audio data and an event list terminated by 0 (LIST_TERMINATED). + + In PLAYBACK mode, the callback function is called as soon as an event happens. + + For example suppose that the following message is supplied to espeak_Synth: + "hello, hello." + + + * Once processed in RETRIEVAL mode, it could lead to 3 calls of the callback function : + + ** Block 1: +