git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@40 d46cf337-b52f-0410-862d-fd96e6ae7743master
@@ -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; | |||
@@ -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 | |||
@@ -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. | |||
@@ -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 |
@@ -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 <stdio.h> | |||
// 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_) |
@@ -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 |
@@ -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> | |||
{{{ | |||
}}} | |||
############################################################################### | |||
@@ -0,0 +1,83 @@ | |||
/*************************************************************************** | |||
* Copyright (C) 2005,2006 by Jonathan Duddington * | |||
* [email protected] * | |||
* * | |||
* 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; | |||
@@ -0,0 +1,4 @@ | |||
// dummy stdint.h file for Windows | |||
typedef unsigned int uint32_t; |
@@ -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. | |||
@@ -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 |
@@ -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 <windows.h> | |||
// 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_) |
@@ -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 |
@@ -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> | |||
{{{ | |||
}}} | |||
############################################################################### | |||
@@ -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 <windows.h> | |||
// 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_) |
@@ -0,0 +1,576 @@ | |||
#ifndef SPEAK_LIB_H | |||
#define SPEAK_LIB_H | |||
/*************************************************************************** | |||
* Copyright (C) 2006 by Jonathan Duddington * | |||
* [email protected] * | |||
* * | |||
* 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 <stdio.h> | |||
/********************/ | |||
/* 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: | |||
<audio data> + | |||
List of events: SENTENCE + WORD + LIST_TERMINATED | |||
** Block 2: | |||
<audio data> + | |||
List of events: WORD + END + LIST_TERMINATED | |||
** Block 3: | |||
no audio data | |||
List of events: MSG_TERMINATED + LIST_TERMINATED | |||
* Once processed in PLAYBACK mode, it could lead to 5 calls of the callback function: | |||
** SENTENCE | |||
** WORD (call when the sounds are actually played) | |||
** WORD | |||
** END (call when the end of sentence is actually played.) | |||
** MSG_TERMINATED | |||
The MSG_TERMINATED event is the last event. It can inform the calling program to clear the user data related to the message. | |||
So if the synthesis must be stopped, the callback function is called for each pending message with the MSG_TERMINATED event. | |||
A MARK event indicates a <mark> element in the text. | |||
A PLAY event indicates an <audio> element in the text, for which the calling program should play the named sound file. | |||
*/ | |||
typedef enum { | |||
POS_CHARACTER = 1, | |||
POS_WORD, | |||
POS_SENTENCE | |||
} espeak_POSITION_TYPE; | |||
typedef enum { | |||
/* PLAYBACK mode: plays the audio data, supplies events to the calling program*/ | |||
AUDIO_OUTPUT_PLAYBACK, | |||
/* RETRIEVAL mode: supplies audio data and events to the calling program */ | |||
AUDIO_OUTPUT_RETRIEVAL, | |||
/* SYNCHRONOUS mode: as RETRIEVAL but doesn't return until synthesis is completed */ | |||
AUDIO_OUTPUT_SYNCHRONOUS, | |||
/* Synchronous playback */ | |||
AUDIO_OUTPUT_SYNCH_PLAYBACK | |||
} espeak_AUDIO_OUTPUT; | |||
typedef enum { | |||
EE_OK=0, | |||
EE_INTERNAL_ERROR=-1, | |||
EE_BUFFER_FULL=1, | |||
EE_NOT_FOUND=2 | |||
} espeak_ERROR; | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
int espeak_Initialize(espeak_AUDIO_OUTPUT output, int buflength, const char *path, int options); | |||
/* Must be called before any synthesis functions are called. | |||
output: the audio data can either be played by eSpeak or passed back by the SynthCallback function. | |||
buflength: The length in mS of sound buffers passed to the SynthCallback function. | |||
path: The directory which contains the espeak-data directory, or NULL for the default location. | |||
options: bit 0: 1=allow espeakEVENT_PHONEME events. | |||
Returns: sample rate in Hz, or -1 (EE_INTERNAL_ERROR). | |||
*/ | |||
typedef int (t_espeak_callback)(short*, int, espeak_EVENT*); | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
void espeak_SetSynthCallback(t_espeak_callback* SynthCallback); | |||
/* Must be called before any synthesis functions are called. | |||
This specifies a function in the calling program which is called when a buffer of | |||
speech sound data has been produced. | |||
The callback function is of the form: | |||
int SynthCallback(short *wav, int numsamples, espeak_EVENT *events); | |||
wav: is the speech sound data which has been produced. | |||
NULL indicates that the synthesis has been completed. | |||
numsamples: is the number of entries in wav. This number may vary, may be less than | |||
the value implied by the buflength parameter given in espeak_Initialize, and may | |||
sometimes be zero (which does NOT indicate end of synthesis). | |||
events: an array of espeak_EVENT items which indicate word and sentence events, and | |||
also the occurance if <mark> and <audio> elements within the text. | |||
Callback returns: 0=continue synthesis, 1=abort synthesis. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
void espeak_SetUriCallback(int (*UriCallback)(int, const char*, const char*)); | |||
/* This function must be called before synthesis functions are used, in order to deal with | |||
<audio> tags. It specifies a callback function which is called when an <audio> element is | |||
encountered and allows the calling program to indicate whether the sound file which | |||
is specified in the <audio> element is available and is to be played. | |||
The callback function is of the form: | |||
int UriCallback(int type, const char *uri, const char *base); | |||
type: type of callback event. Currently only 1= <audio> element | |||
uri: the "src" attribute from the <audio> element | |||
base: the "xml:base" attribute (if any) from the <speak> element | |||
Return: 1=don't play the sound, but speak the text alternative. | |||
0=place a PLAY event in the event list at the point where the <audio> element | |||
occurs. The calling program can then play the sound at that point. | |||
*/ | |||
/********************/ | |||
/* Synthesis */ | |||
/********************/ | |||
#define espeakCHARS_AUTO 0 | |||
#define espeakCHARS_UTF8 1 | |||
#define espeakCHARS_8BIT 2 | |||
#define espeakCHARS_WCHAR 3 | |||
#define espeakSSML 0x10 | |||
#define espeakPHONEMES 0x100 | |||
#define espeakENDPAUSE 0x1000 | |||
#define espeakKEEP_NAMEDATA 0x2000 | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_Synth(const void *text, | |||
size_t size, | |||
unsigned int position, | |||
espeak_POSITION_TYPE position_type, | |||
unsigned int end_position, | |||
unsigned int flags, | |||
unsigned int* unique_identifier, | |||
void* user_data); | |||
/* Synthesize speech for the specified text. The speech sound data is passed to the calling | |||
program in buffers by means of the callback function specified by espeak_SetSynthCallback(). The command is asynchronous: it is internally buffered and returns as soon as possible. If espeak_Initialize was previously called with AUDIO_OUTPUT_PLAYBACK as argument, the sound data are played by eSpeak. | |||
text: The text to be spoken, terminated by a zero character. It may be either 8-bit characters, | |||
wide characters (wchar_t), or UTF8 encoding. Which of these is determined by the "flags" | |||
parameter. | |||
size: Equal to (or greatrer than) the size of the text data, in bytes. This is used in order | |||
to allocate internal storage space for the text. This value is not used for | |||
AUDIO_OUTPUT_SYNCHRONOUS mode. | |||
position: The position in the text where speaking starts. Zero indicates speak from the | |||
start of the text. | |||
position_type: Determines whether "position" is a number of characters, words, or sentences. | |||
Values: | |||
end_position: If set, this gives a character position at which speaking will stop. A value | |||
of zero indicates no end position. | |||
flags: These may be OR'd together: | |||
Type of character codes, one of: | |||
espeakCHARS_UTF8 UTF8 encoding | |||
espeakCHARS_8BIT The 8 bit ISO-8859 character set for the particular language. | |||
espeakCHARS_AUTO 8 bit or UTF8 (this is the default) | |||
espeakCHARS_WCHAR Wide characters (wchar_t) | |||
espeakSSML Elements within < > are treated as SSML elements, or if not recognised are ignored. | |||
espeakPHONEMES Text within [[ ]] is treated as phonemes codes (in espeak's Hirschenbaum encoding). | |||
espeakENDPAUSE If set then a sentence pause is added at the end of the text. If not set then | |||
this pause is suppressed. | |||
unique_identifier: message identifier; helpful for identifying later | |||
data supplied to the callback. | |||
user_data: pointer which will be passed to the callback function. | |||
Return: EE_OK: operation achieved | |||
EE_BUFFER_FULL: the command can not be buffered; | |||
you may try after a while to call the function again. | |||
EE_INTERNAL_ERROR. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_Synth_Mark(const void *text, | |||
size_t size, | |||
const char *index_mark, | |||
unsigned int end_position, | |||
unsigned int flags, | |||
unsigned int* unique_identifier, | |||
void* user_data); | |||
/* Synthesize speech for the specified text. Similar to espeak_Synth() but the start position is | |||
specified by the name of a <mark> element in the text. | |||
index_mark: The "name" attribute of a <mark> element within the text which specified the | |||
point at which synthesis starts. UTF8 string. | |||
For the other parameters, see espeak_Synth() | |||
Return: EE_OK: operation achieved | |||
EE_BUFFER_FULL: the command can not be buffered; | |||
you may try after a while to call the function again. | |||
EE_INTERNAL_ERROR. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_Key(const char *key_name); | |||
/* Speak the name of a keyboard key. | |||
Currently this just speaks the "key_name" as given | |||
Return: EE_OK: operation achieved | |||
EE_BUFFER_FULL: the command can not be buffered; | |||
you may try after a while to call the function again. | |||
EE_INTERNAL_ERROR. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_Char(wchar_t character); | |||
/* Speak the name of the given character | |||
Return: EE_OK: operation achieved | |||
EE_BUFFER_FULL: the command can not be buffered; | |||
you may try after a while to call the function again. | |||
EE_INTERNAL_ERROR. | |||
*/ | |||
/* Note, there is no function to play a sound icon. This would be done by the calling program */ | |||
/***********************/ | |||
/* Speech Parameters */ | |||
/***********************/ | |||
typedef enum { | |||
espeakSILENCE=0, /* internal use */ | |||
espeakRATE, | |||
espeakVOLUME, | |||
espeakPITCH, | |||
espeakRANGE, | |||
espeakPUNCTUATION, | |||
espeakCAPITALS, | |||
espeakEMPHASIS, /* internal use */ | |||
espeakLINELENGTH, /* internal use */ | |||
espeakVOICETYPE, // internal, 1=mbrola | |||
N_SPEECH_PARAM /* last enum */ | |||
} espeak_PARAMETER; | |||
typedef enum { | |||
espeakPUNCT_NONE=0, | |||
espeakPUNCT_ALL=1, | |||
espeakPUNCT_SOME=2 | |||
} espeak_PUNCT_TYPE; | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_SetParameter(espeak_PARAMETER parameter, int value, int relative); | |||
/* Sets the value of the specified parameter. | |||
relative=0 Sets the absolute value of the parameter. | |||
relative=1 Sets a relative value of the parameter. | |||
parameter: | |||
espeakRATE: speaking speed in word per minute. | |||
espeakVOLUME: volume in range 0-100 0=silence | |||
espeakPITCH: base pitch, range 0-100. 50=normal | |||
espeakRANGE: pitch range, range 0-100. 0-monotone, 50=normal | |||
espeakPUNCTUATION: which punctuation characters to announce: | |||
value in espeak_PUNCT_TYPE (none, all, some), | |||
see espeak_GetParameter() to specify which characters are announced. | |||
espeakCAPITALS: announce capital letters by: | |||
0=none, | |||
1=sound icon, | |||
2=spelling, | |||
3 or higher, by raising pitch. This values gives the amount in Hz by which the pitch | |||
of a word raised to indicate it has a capital letter. | |||
Return: EE_OK: operation achieved | |||
EE_BUFFER_FULL: the command can not be buffered; | |||
you may try after a while to call the function again. | |||
EE_INTERNAL_ERROR. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
int espeak_GetParameter(espeak_PARAMETER parameter, int current); | |||
/* current=0 Returns the default value of the specified parameter. | |||
current=1 Returns the current value of the specified parameter, as set by SetParameter() | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_SetPunctuationList(const wchar_t *punctlist); | |||
/* Specified a list of punctuation characters whose names are to be spoken when the | |||
value of the Punctuation parameter is set to "some". | |||
punctlist: A list of character codes, terminated by a zero character. | |||
Return: EE_OK: operation achieved | |||
EE_BUFFER_FULL: the command can not be buffered; | |||
you may try after a while to call the function again. | |||
EE_INTERNAL_ERROR. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
void espeak_SetPhonemeTrace(int value, FILE *stream); | |||
/* Controls the output of phoneme symbols for the text | |||
value=0 No phoneme output (default) | |||
value=1 Output the translated phoneme symbols for the text | |||
value=2 as (1), but also output a trace of how the translation was done (matching rules and list entries) | |||
stream output stream for the phoneme symbols (and trace). If stream=NULL then it uses stdout. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
void espeak_CompileDictionary(const char *path, FILE *log); | |||
/* Compile pronunciation dictionary for a language which corresponds to the currently | |||
selected voice. The required voice should be selected before calling this function. | |||
path: The directory which contains the language's '_rules' and '_list' files. | |||
'path' should end with a path separator character ('/'). | |||
log: Stream for error reports and statistics information. If log=NULL then stderr will be used. | |||
*/ | |||
/***********************/ | |||
/* Voice Selection */ | |||
/***********************/ | |||
// voice table | |||
typedef struct { | |||
char *name; // a given name for this voice. UTF8 string. | |||
char *languages; // list of pairs of (byte) priority + (string) language (and dialect qualifier) | |||
char *identifier; // the filename for this voice within espeak-data/voices | |||
unsigned char gender; // 0=none 1=male, 2=female, | |||
unsigned char age; // 0=not specified, or age in years | |||
unsigned char variant; // only used when passed as a parameter to espeak_SetVoiceByProperties | |||
unsigned char xx1; // for internal use | |||
int score; // for internal use | |||
void *spare; // for internal use | |||
} espeak_VOICE; | |||
/* Note: The espeak_VOICE structure is used for two purposes: | |||
1. To return the details of the available voices. | |||
2. As a parameter to espeak_SetVoiceByProperties() in order to specify selection criteria. | |||
In (1), the "languages" field consists of a list of (UTF8) language names for which this voice | |||
may be used, each language name in the list is terminated by a zero byte and is also preceded by | |||
a single byte which gives a "priority" number. The list of languages is terminated by an | |||
additional zero byte. | |||
A language name consists of a language code, optionally followed by one or more qualifier (dialect) | |||
names separated by hyphens (eg. "en-uk"). A voice might, for example, have languages "en-uk" and | |||
"en". Even without "en" listed, voice would still be selected for the "en" language (because | |||
"en-uk" is related) but at a lower priority. | |||
The priority byte indicates how the voice is preferred for the language. A low number indicates a | |||
more preferred voice, a higher number indicates a less preferred voice. | |||
In (2), the "languages" field consists simply of a single (UTF8) language name, with no preceding | |||
priority byte. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec); | |||
/* Reads the voice files from espeak-data/voices and creates an array of espeak_VOICE pointers. | |||
The list is terminated by a NULL pointer | |||
If voice_spec is NULL then all voices are listed. | |||
If voice spec is give, then only the voices which are compatible with the voice_spec | |||
are listed, and they are listed in preference order. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_SetVoiceByName(const char *name); | |||
/* Searches for a voice with a matching "name" field. Language is not considered. | |||
"name" is a UTF8 string. | |||
Return: EE_OK: operation achieved | |||
EE_BUFFER_FULL: the command can not be buffered; | |||
you may try after a while to call the function again. | |||
EE_INTERNAL_ERROR. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_SetVoiceByProperties(espeak_VOICE *voice_spec); | |||
/* An espeak_VOICE structure is used to pass criteria to select a voice. Any of the following | |||
fields may be set: | |||
name NULL, or a voice name | |||
languages NULL, or a single language string (with optional dialect), eg. "en-uk", or "en" | |||
gender 0=not specified, 1=male, 2=female | |||
age 0=not specified, or an age in years | |||
variant After a list of candidates is produced, scored and sorted, "variant" is used to index | |||
that list and choose a voice. | |||
variant=0 takes the top voice (i.e. best match). variant=1 takes the next voice, etc | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_VOICE *espeak_GetCurrentVoice(void); | |||
/* Returns the espeak_VOICE data for the currently selected voice. | |||
This is not affected by temporary voice changes caused by SSML elements such as <voice> and <s> | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_Cancel(void); | |||
/* Stop immediately synthesis and audio output of the current text. When this | |||
function returns, the audio output is fully stopped and the synthesizer is ready to | |||
synthesize a new message. | |||
Return: EE_OK: operation achieved | |||
EE_INTERNAL_ERROR. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
int espeak_IsPlaying(void); | |||
/* Returns 1 if audio is played, 0 otherwise. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_Synchronize(void); | |||
/* This function returns when all data have been spoken. | |||
Return: EE_OK: operation achieved | |||
EE_INTERNAL_ERROR. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
espeak_ERROR espeak_Terminate(void); | |||
/* last function to be called. | |||
Return: EE_OK: operation achieved | |||
EE_INTERNAL_ERROR. | |||
*/ | |||
#ifdef __cplusplus | |||
extern "C" | |||
#endif | |||
const char *espeak_Info(void* ptr); | |||
/* Returns the version number string. | |||
The parameter is for future use, and should be set to NULL | |||
*/ | |||
#endif |
@@ -0,0 +1,84 @@ | |||
/*************************************************************************** | |||
* Copyright (C) 2005,2006 by Jonathan Duddington * | |||
* [email protected] * | |||
* * | |||
* 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 __declspec(dllexport) | |||
#define LIBRARY | |||
// 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; | |||
@@ -0,0 +1,4 @@ | |||
// dummy stdint.h file for Windows | |||
typedef unsigned int uint32_t; |
@@ -0,0 +1,11 @@ | |||
This is a Virtual C++ project for the Windows SAPI5 | |||
version of eSpeak. | |||
Copy the program source files from the Linux "src" | |||
directory into this "src" directory, EXCEPT for: | |||
speech.h | |||
StdAfx.h | |||
stdint.h | |||
Keep the Windows versions of these files. | |||
@@ -0,0 +1,94 @@ | |||
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ | |||
/* File created by MIDL compiler version 5.01.0164 */ | |||
/* at Sat Dec 16 21:19:27 2006 | |||
*/ | |||
/* Compiler settings for C:\Program Files\Microsoft Speech SDK 5.1\Samples\CPP\Engines\TTS\TtsEng.idl: | |||
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext | |||
error checks: allocation ref bounds_check enum stub_data | |||
*/ | |||
//@@MIDL_FILE_HEADING( ) | |||
/* verify that the <rpcndr.h> version is high enough to compile this file*/ | |||
#ifndef __REQUIRED_RPCNDR_H_VERSION__ | |||
#define __REQUIRED_RPCNDR_H_VERSION__ 440 | |||
#endif | |||
#include "rpc.h" | |||
#include "rpcndr.h" | |||
#ifndef __TtsEng_h__ | |||
#define __TtsEng_h__ | |||
#ifdef __cplusplus | |||
extern "C"{ | |||
#endif | |||
/* Forward Declarations */ | |||
#ifndef __SampleTTSEngine_FWD_DEFINED__ | |||
#define __SampleTTSEngine_FWD_DEFINED__ | |||
#ifdef __cplusplus | |||
typedef class SampleTTSEngine SampleTTSEngine; | |||
#else | |||
typedef struct SampleTTSEngine SampleTTSEngine; | |||
#endif /* __cplusplus */ | |||
#endif /* __SampleTTSEngine_FWD_DEFINED__ */ | |||
/* header files for imported files */ | |||
#include "oaidl.h" | |||
#include "ocidl.h" | |||
#include "sapiddk.h" | |||
void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); | |||
void __RPC_USER MIDL_user_free( void __RPC_FAR * ); | |||
/* interface __MIDL_itf_TtsEng_0000 */ | |||
/* [local] */ | |||
typedef struct VOICEITEM | |||
{ | |||
LPCWSTR pText; | |||
ULONG ulTextLen; | |||
ULONG ulNumAudioBytes; | |||
BYTE __RPC_FAR *pAudio; | |||
} VOICEITEM; | |||
extern RPC_IF_HANDLE __MIDL_itf_TtsEng_0000_v0_0_c_ifspec; | |||
extern RPC_IF_HANDLE __MIDL_itf_TtsEng_0000_v0_0_s_ifspec; | |||
#ifndef __SAMPLETTSENGLib_LIBRARY_DEFINED__ | |||
#define __SAMPLETTSENGLib_LIBRARY_DEFINED__ | |||
/* library SAMPLETTSENGLib */ | |||
/* [helpstring][version][uuid] */ | |||
EXTERN_C const IID LIBID_SAMPLETTSENGLib; | |||
EXTERN_C const CLSID CLSID_SampleTTSEngine; | |||
#ifdef __cplusplus | |||
class DECLSPEC_UUID("BE985C8D-BE32-4A22-AA93-55C16A6D1D91") | |||
SampleTTSEngine; | |||
#endif | |||
#endif /* __SAMPLETTSENGLib_LIBRARY_DEFINED__ */ | |||
/* Additional Prototypes for ALL interfaces */ | |||
/* end of Additional Prototypes */ | |||
#ifdef __cplusplus | |||
} | |||
#endif | |||
#endif |
@@ -0,0 +1,47 @@ | |||
/* this file contains the actual definitions of */ | |||
/* the IIDs and CLSIDs */ | |||
/* link this file in with the server and any clients */ | |||
/* File created by MIDL compiler version 5.01.0164 */ | |||
/* at Sat Dec 16 21:19:27 2006 | |||
*/ | |||
/* Compiler settings for C:\Program Files\Microsoft Speech SDK 5.1\Samples\CPP\Engines\TTS\TtsEng.idl: | |||
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext | |||
error checks: allocation ref bounds_check enum stub_data | |||
*/ | |||
//@@MIDL_FILE_HEADING( ) | |||
#ifdef __cplusplus | |||
extern "C"{ | |||
#endif | |||
#ifndef __IID_DEFINED__ | |||
#define __IID_DEFINED__ | |||
typedef struct _IID | |||
{ | |||
unsigned long x; | |||
unsigned short s1; | |||
unsigned short s2; | |||
unsigned char c[8]; | |||
} IID; | |||
#endif // __IID_DEFINED__ | |||
#ifndef CLSID_DEFINED | |||
#define CLSID_DEFINED | |||
typedef IID CLSID; | |||
#endif // CLSID_DEFINED | |||
const IID LIBID_SAMPLETTSENGLib = {0x7192AA2F,0xF759,0x43e9,{0x91,0xE7,0x22,0x63,0x71,0xEF,0x6B,0x2F}}; | |||
const CLSID CLSID_SampleTTSEngine = {0xBE985C8D,0xBE32,0x4A22,{0xAA,0x93,0x55,0xC1,0x6A,0x6D,0x1D,0x91}}; | |||
#ifdef __cplusplus | |||
} | |||
#endif | |||
@@ -0,0 +1,18 @@ | |||
//{{NO_DEPENDENCIES}} | |||
// Microsoft Developer Studio generated include file. | |||
// Used by TtsEng.rc | |||
// | |||
#define IDS_PROJNAME 100 | |||
#define IDR_SAMPLETTSENGINE 101 | |||
#define IDR_SAMPLEVOICEDATAOBJ 102 | |||
// Next default values for new objects | |||
// | |||
#ifdef APSTUDIO_INVOKED | |||
#ifndef APSTUDIO_READONLY_SYMBOLS | |||
#define _APS_NEXT_RESOURCE_VALUE 201 | |||
#define _APS_NEXT_COMMAND_VALUE 32768 | |||
#define _APS_NEXT_CONTROL_VALUE 201 | |||
#define _APS_NEXT_SYMED_VALUE 103 | |||
#endif | |||
#endif |
@@ -0,0 +1,3 @@ | |||
// This is a dummy file. | |||
// A file of this name is needed on Windows | |||
@@ -0,0 +1,88 @@ | |||
/*************************************************************************** | |||
* Copyright (C) 2005,2006 by Jonathan Duddington * | |||
* [email protected] * | |||
* * | |||
* 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. * | |||
***************************************************************************/ | |||
// speech.h file for the Windows SAPI5 version of eSpeak | |||
// conditional compilation options | |||
#define PLATFORM_WINDOWS | |||
#define __WIN32__ | |||
#define NEED_WCSTOF | |||
#define NEED_GETOPT | |||
#define USE_MBROLA_LIB | |||
#define ESPEAK_API | |||
#define PATHSEP '\\' | |||
//#define PLATFORM_POSIX | |||
//#define __cdecl // define as null, needed for Borland compiler ? | |||
//#define USE_PORTAUDIO | |||
//#define USE_NANOSLEEP | |||
// 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; | |||
@@ -0,0 +1,4 @@ | |||
// dummy stdint.h file for Windows | |||
typedef unsigned int uint32_t; |
@@ -0,0 +1,14 @@ | |||
// stdafx.cpp : source file that includes just the standard includes | |||
// stdafx.pch will be the pre-compiled header | |||
// stdafx.obj will contain the pre-compiled type information | |||
//Copyright (c) Microsoft Corporation. All rights reserved. | |||
#include "stdafx.h" | |||
#ifdef _ATL_STATIC_REGISTRY | |||
#include <statreg.h> | |||
#include <statreg.cpp> | |||
#endif | |||
#include <atlimpl.cpp> | |||
@@ -0,0 +1,32 @@ | |||
// 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__3F7C4D2C_D007_11D2_B503_00C04F797396__INCLUDED_) | |||
#define AFX_STDAFX_H__3F7C4D2C_D007_11D2_B503_00C04F797396__INCLUDED_ | |||
#if _MSC_VER > 1000 | |||
#pragma once | |||
#endif // _MSC_VER > 1000 | |||
#ifndef STRICT | |||
#define STRICT | |||
#endif | |||
#ifndef _WIN32_WINNT | |||
#define _WIN32_WINNT 0x0400 | |||
#endif | |||
#include <atlbase.h> | |||
//You may derive a class from CComModule and use it if you want to override | |||
//something, but do not change the name of _Module | |||
extern CComModule _Module; | |||
#include <atlcom.h> | |||
//{{AFX_INSERT_LOCATION}} | |||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. | |||
#endif // !defined(AFX_STDAFX_H__3F7C4D2C_D007_11D2_B503_00C04F797396__INCLUDED) | |||
@@ -0,0 +1,77 @@ | |||
// TtsEng.cpp : Implementation of DLL Exports. | |||
//Copyright (c) Microsoft Corporation. All rights reserved. | |||
// Note: Proxy/Stub Information | |||
// To build a separate proxy/stub DLL, | |||
// run nmake -f msttsdrvps.mk in the project directory. | |||
#include "stdafx.h" | |||
#include "resource.h" | |||
#include <initguid.h> | |||
#include "TtsEng.h" | |||
#include "TtsEng_i.c" | |||
#include "TtsEngObj.h" | |||
CComModule _Module; | |||
BEGIN_OBJECT_MAP(ObjectMap) | |||
OBJECT_ENTRY( CLSID_SampleTTSEngine , CTTSEngObj ) | |||
END_OBJECT_MAP() | |||
///////////////////////////////////////////////////////////////////////////// | |||
// DLL Entry Point | |||
#ifdef _WIN32_WCE | |||
extern "C" BOOL WINAPI DllMain(HANDLE hInstance, ULONG dwReason, LPVOID) | |||
#else | |||
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) | |||
#endif | |||
{ | |||
if (dwReason == DLL_PROCESS_ATTACH) | |||
{ | |||
_Module.Init(ObjectMap, (HINSTANCE)hInstance, &LIBID_SAMPLETTSENGLib); | |||
} | |||
else if (dwReason == DLL_PROCESS_DETACH) | |||
_Module.Term(); | |||
return TRUE; // ok | |||
} | |||
///////////////////////////////////////////////////////////////////////////// | |||
// Used to determine whether the DLL can be unloaded by OLE | |||
STDAPI DllCanUnloadNow(void) | |||
{ | |||
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; | |||
} | |||
///////////////////////////////////////////////////////////////////////////// | |||
// Returns a class factory to create an object of the requested type | |||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) | |||
{ | |||
return _Module.GetClassObject(rclsid, riid, ppv); | |||
} | |||
///////////////////////////////////////////////////////////////////////////// | |||
// DllRegisterServer - Adds entries to the system registry | |||
STDAPI DllRegisterServer(void) | |||
{ | |||
// registers object, typelib and all interfaces in typelib | |||
return _Module.RegisterServer(TRUE); | |||
} | |||
///////////////////////////////////////////////////////////////////////////// | |||
// DllUnregisterServer - Removes entries from the system registry | |||
STDAPI DllUnregisterServer(void) | |||
{ | |||
return _Module.UnregisterServer(TRUE); | |||
} | |||
@@ -0,0 +1,5 @@ | |||
EXPORTS | |||
DllCanUnloadNow PRIVATE | |||
DllGetClassObject PRIVATE | |||
DllRegisterServer PRIVATE | |||
DllUnregisterServer PRIVATE |
@@ -0,0 +1,276 @@ | |||
# Microsoft Developer Studio Project File - Name="TtsEng" - Package Owner=<4> | |||
# Microsoft Developer Studio Generated Build File, Format Version 6.00 | |||
# ** DO NOT EDIT ** | |||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 | |||
CFG=TtsEng - Win32 Debug x86 | |||
!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 "ttseng.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 "ttseng.mak" CFG="TtsEng - Win32 Debug x86" | |||
!MESSAGE | |||
!MESSAGE Possible choices for configuration are: | |||
!MESSAGE | |||
!MESSAGE "TtsEng - Win32 Debug x86" (based on "Win32 (x86) Dynamic-Link Library") | |||
!MESSAGE "TtsEng - Win32 Release x86" (based on "Win32 (x86) Dynamic-Link Library") | |||
!MESSAGE | |||
# Begin Project | |||
# PROP AllowPerConfigDependencies 0 | |||
# PROP Scc_ProjName "" | |||
# PROP Scc_LocalPath "Desktop" | |||
CPP=cl.exe | |||
MTL=midl.exe | |||
RSC=rc.exe | |||
!IF "$(CFG)" == "TtsEng - Win32 Debug x86" | |||
# PROP BASE Use_MFC 0 | |||
# PROP BASE Use_Debug_Libraries 1 | |||
# PROP BASE Output_Dir "TtsEng___Win32_Debug_x86" | |||
# PROP BASE Intermediate_Dir "TtsEng___Win32_Debug_x86" | |||
# PROP BASE Target_Dir "" | |||
# PROP Use_MFC 0 | |||
# PROP Use_Debug_Libraries 1 | |||
# PROP Output_Dir "Debug_x86" | |||
# PROP Intermediate_Dir "Debug_x86" | |||
# PROP Ignore_Export_Lib 0 | |||
# PROP Target_Dir "" | |||
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\..\sdk\include" /I "..\..\..\ddk\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c | |||
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /I "..\..\..\..\..\ddk\include" /I "..\..\..\..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /FR /Yu"stdafx.h" /FD /GZ /c | |||
# ADD MTL /I "..\..\..\..\..\ddk\idl" /I "..\..\..\..\idl" | |||
# ADD BASE RSC /l 0x409 /d "_DEBUG" | |||
# ADD RSC /l 0x409 /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 /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept | |||
# ADD LINK32 kernel32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /dll /map /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\lib\i386" | |||
# Begin Custom Build - Performing registration | |||
OutDir=.\Debug_x86 | |||
TargetPath=.\Debug_x86\ttseng.dll | |||
InputPath=.\Debug_x86\ttseng.dll | |||
SOURCE="$(InputPath)" | |||
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" | |||
regsvr32 /s /c "$(TargetPath)" | |||
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" | |||
# End Custom Build | |||
!ELSEIF "$(CFG)" == "TtsEng - Win32 Release x86" | |||
# PROP BASE Use_MFC 0 | |||
# PROP BASE Use_Debug_Libraries 0 | |||
# PROP BASE Output_Dir "TtsEng___Win32_Release_x86" | |||
# PROP BASE Intermediate_Dir "TtsEng___Win32_Release_x86" | |||
# PROP BASE Target_Dir "" | |||
# PROP Use_MFC 0 | |||
# PROP Use_Debug_Libraries 0 | |||
# PROP Output_Dir "Release_x86" | |||
# PROP Intermediate_Dir "Release_x86" | |||
# PROP Ignore_Export_Lib 0 | |||
# PROP Target_Dir "" | |||
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c | |||
# ADD CPP /nologo /MT /W3 /O1 /I "..\..\..\..\..\ddk\include" /I "..\..\..\..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /Yu"stdafx.h" /FD /c | |||
# ADD MTL /I "..\..\..\..\..\ddk\idl" /I "..\..\..\..\idl" | |||
# ADD BASE RSC /l 0x409 /d "NDEBUG" | |||
# ADD RSC /l 0x409 /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 /subsystem:windows /dll /machine:I386 | |||
# ADD LINK32 kernel32.lib advapi32.lib ole32.lib /nologo /subsystem:windows /dll /map /machine:I386 /out:"Release_x86/espeak_sapi.dll" /libpath:"..\..\..\..\lib\i386" | |||
# Begin Custom Build - Performing registration | |||
OutDir=.\Release_x86 | |||
TargetPath=.\Release_x86\espeak_sapi.dll | |||
InputPath=.\Release_x86\espeak_sapi.dll | |||
SOURCE="$(InputPath)" | |||
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" | |||
regsvr32 /s /c "$(TargetPath)" | |||
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg" | |||
# End Custom Build | |||
!ENDIF | |||
# Begin Target | |||
# Name "TtsEng - Win32 Debug x86" | |||
# Name "TtsEng - Win32 Release x86" | |||
# 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 BASE CPP /Yc"stdafx.h" | |||
# 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=.\TtsEng.cpp | |||
# End Source File | |||
# Begin Source File | |||
SOURCE=.\TtsEng.def | |||
# End Source File | |||
# Begin Source File | |||
SOURCE=.\TtsEng.idl | |||
# ADD BASE MTL /I "..\..\..\sdk\idl" /tlb ".\TtsEng.tlb" /h "TtsEng.h" /iid "" /Oicf | |||
# ADD MTL /I "..\..\..\sdk\idl" /tlb ".\TtsEng.tlb" /h "TtsEng.h" /iid "TtsEng_i.c" /Oicf | |||
# End Source File | |||
# Begin Source File | |||
SOURCE=.\TtsEng.rc | |||
# End Source File | |||
# Begin Source File | |||
SOURCE=.\TtsEngObj.cpp | |||
# SUBTRACT CPP /YX /Yc /Yu | |||
# 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\portaudio.h | |||
# End Source File | |||
# Begin Source File | |||
SOURCE=.\src\portaudio18.h | |||
# End Source File | |||
# Begin Source File | |||
SOURCE=.\src\portaudio19.h | |||
# End Source File | |||
# Begin Source File | |||
SOURCE=.\Resource.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=.\TtsEngObj.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" | |||
# Begin Source File | |||
SOURCE=.\TtsEngObj.rgs | |||
# End Source File | |||
# End Group | |||
# End Target | |||
# End Project |
@@ -0,0 +1,29 @@ | |||
Microsoft Developer Studio Workspace File, Format Version 6.00 | |||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! | |||
############################################################################### | |||
Project: "TtsEng"=".\ttseng.dsp" - Package Owner=<4> | |||
Package=<5> | |||
{{{ | |||
}}} | |||
Package=<4> | |||
{{{ | |||
}}} | |||
############################################################################### | |||
Global: | |||
Package=<5> | |||
{{{ | |||
}}} | |||
Package=<3> | |||
{{{ | |||
}}} | |||
############################################################################### | |||
@@ -0,0 +1,50 @@ | |||
/***************************************************************************** | |||
* TtsEng.idl * | |||
*------------* | |||
* Description: | |||
* This idl file is for the sample SAPI5 Text To Speech Engine. | |||
*----------------------------------------------------------------------------- | |||
* Creation: 09/17/99 | |||
* Copyright (c) Microsoft Corporation. All rights reserved. | |||
*****************************************************************************/ | |||
//--- Import base idl | |||
import "oaidl.idl"; | |||
import "ocidl.idl"; | |||
import "sapiddk.idl"; | |||
//=== Forward References ====================================================== | |||
//=== Constants =============================================================== | |||
//=== Interface definitions =================================================== | |||
typedef struct VOICEITEM | |||
{ | |||
LPCWSTR pText; | |||
ULONG ulTextLen; | |||
ULONG ulNumAudioBytes; | |||
BYTE* pAudio; | |||
} VOICEITEM; | |||
//=== CoClass definitions ===================================================== | |||
[ | |||
uuid(7192AA2F-F759-43e9-91E7-226371EF6B2F), | |||
version(1.0), | |||
helpstring("Simple TTS Engine 1.0 Type Library") | |||
] | |||
library SAMPLETTSENGLib | |||
{ | |||
importlib("stdole32.tlb"); | |||
importlib("stdole2.tlb"); | |||
[ | |||
uuid(BE985C8D-BE32-4A22-AA93-55C16A6D1D91), | |||
// uuid(A832755E-9C2A-40b4-89B2-3A92EE705852), | |||
helpstring("SampleTTSEngine Class") | |||
] | |||
coclass SampleTTSEngine | |||
{ | |||
[default] interface ISpTTSEngine; | |||
interface ISpObjectWithToken; | |||
}; | |||
}; |
@@ -0,0 +1,91 @@ | |||
//Microsoft Developer Studio generated resource script. | |||
// | |||
#include "resource.h" | |||
#define APSTUDIO_READONLY_SYMBOLS | |||
///////////////////////////////////////////////////////////////////////////// | |||
// | |||
// Generated from the TEXTINCLUDE 2 resource. | |||
// | |||
#define APSTUDIO_HIDDEN_SYMBOLS | |||
#include "windows.h" | |||
#undef APSTUDIO_HIDDEN_SYMBOLS | |||
#include "resource.h" | |||
///////////////////////////////////////////////////////////////////////////// | |||
#undef APSTUDIO_READONLY_SYMBOLS | |||
///////////////////////////////////////////////////////////////////////////// | |||
// English (U.S.) resources | |||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) | |||
#ifdef _WIN32 | |||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US | |||
#pragma code_page(1252) | |||
#endif //_WIN32 | |||
#ifdef APSTUDIO_INVOKED | |||
///////////////////////////////////////////////////////////////////////////// | |||
// | |||
// TEXTINCLUDE | |||
// | |||
1 TEXTINCLUDE DISCARDABLE | |||
BEGIN | |||
"resource.h\0" | |||
END | |||
2 TEXTINCLUDE DISCARDABLE | |||
BEGIN | |||
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n" | |||
"#include ""windows.h""\r\n" | |||
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" | |||
"#include ""resource.h""\r\n" | |||
"\r\n" | |||
"\0" | |||
END | |||
3 TEXTINCLUDE DISCARDABLE | |||
BEGIN | |||
"1 TYPELIB ""TtsEng.tlb""\r\n" | |||
"#include ""version.rc2""\r\n" | |||
"\0" | |||
END | |||
#endif // APSTUDIO_INVOKED | |||
///////////////////////////////////////////////////////////////////////////// | |||
// | |||
// REGISTRY | |||
// | |||
IDR_SAMPLETTSENGINE REGISTRY DISCARDABLE "TtsEngObj.rgs" | |||
///////////////////////////////////////////////////////////////////////////// | |||
// | |||
// String Table | |||
// | |||
STRINGTABLE DISCARDABLE | |||
BEGIN | |||
IDS_PROJNAME "TtsEng" | |||
END | |||
#endif // English (U.S.) resources | |||
///////////////////////////////////////////////////////////////////////////// | |||
#ifndef APSTUDIO_INVOKED | |||
///////////////////////////////////////////////////////////////////////////// | |||
// | |||
// Generated from the TEXTINCLUDE 3 resource. | |||
// | |||
1 TYPELIB "TtsEng.tlb" | |||
#include "version.rc2" | |||
///////////////////////////////////////////////////////////////////////////// | |||
#endif // not APSTUDIO_INVOKED | |||
@@ -0,0 +1,693 @@ | |||
/******************************************************************************* | |||
* TtsEngObj.cpp * | |||
*---------------* | |||
* Description: | |||
* This module is the main implementation file for the CTTSEngObj class. | |||
*------------------------------------------------------------------------------- | |||
* Creation Date: 03/24/99 | |||
* Copyright (c) Microsoft Corporation. All rights reserved. | |||
* All Rights Reserved | |||
* | |||
*******************************************************************************/ | |||
//--- Additional includes | |||
#include "stdafx.h" | |||
#include "TtsEngObj.h" | |||
#include "src/speak_lib.h" | |||
#include "stdio.h" | |||
//--- Local | |||
//#define LOG_DEBUG | |||
#define CTRL_EMBEDDED 1 | |||
CTTSEngObj *m_EngObj; | |||
ISpTTSEngineSite* m_OutputSite; | |||
FILE *f_log2=NULL; | |||
extern int AddNameData(const char *name, int wide); | |||
extern void InitNamedata(void); | |||
int master_volume = 100; | |||
int master_rate = 0; | |||
int gVolume = 100; | |||
int gSpeed = -1; | |||
int gPitch = -1; | |||
int gRange = -1; | |||
int gEmphasis = 0; | |||
int gSayas = 0; | |||
char *path_install = NULL; | |||
unsigned long audio_offset = 0; | |||
unsigned long audio_latest = 0; | |||
unsigned int gBufSize = 0; | |||
wchar_t *TextBuf=NULL; | |||
typedef struct { | |||
unsigned int bufix; | |||
unsigned int textix; | |||
unsigned int cmdlen; | |||
} FRAG_OFFSET; | |||
int srate; // samplerate, Hz/50 | |||
int n_frag_offsets = 0; | |||
int frag_ix = 0; | |||
int frag_count=0; | |||
FRAG_OFFSET *frag_offsets = NULL; | |||
int SynthCallback(short *wav, int numsamples, espeak_EVENT *events); | |||
int SynthCallback(short *wav, int numsamples, espeak_EVENT *events) | |||
{//================================================================ | |||
int hr; | |||
wchar_t *tailptr; | |||
unsigned int text_offset; | |||
int length; | |||
espeak_EVENT *event; | |||
#define N_EVENTS 100 | |||
int n_Events = 0; | |||
SPEVENT *Event; | |||
SPEVENT Events[N_EVENTS]; | |||
if(m_OutputSite->GetActions() & SPVES_ABORT) | |||
return(1); | |||
m_EngObj->CheckActions(m_OutputSite); | |||
// return the events | |||
for(event=events; event->type != 0; event++) | |||
{ | |||
audio_latest = event->audio_position + audio_offset; | |||
if((event->type == espeakEVENT_WORD) && (event->length > 0)) | |||
{ | |||
while(((frag_ix+1) < frag_count) && | |||
((event->text_position -1 + frag_offsets[frag_ix+1].cmdlen) >= frag_offsets[frag_ix+1].bufix)) | |||
{ | |||
frag_ix++; | |||
} | |||
text_offset = frag_offsets[frag_ix].textix + | |||
event->text_position -1 - frag_offsets[frag_ix].bufix + frag_offsets[frag_ix].cmdlen; | |||
length = event->length - frag_offsets[frag_ix].cmdlen; | |||
frag_offsets[frag_ix].cmdlen = 0; | |||
if(text_offset < 0) | |||
text_offset = 0; | |||
Event = &Events[n_Events++]; | |||
Event->eEventId = SPEI_WORD_BOUNDARY; | |||
Event->elParamType = SPET_LPARAM_IS_UNDEFINED; | |||
Event->ullAudioStreamOffset = ((event->audio_position + audio_offset) * srate)/10; // ms -> bytes | |||
Event->lParam = text_offset; | |||
Event->wParam = length; | |||
} | |||
if(event->type == espeakEVENT_MARK) | |||
{ | |||
Event = &Events[n_Events++]; | |||
Event->eEventId = SPEI_TTS_BOOKMARK; | |||
Event->elParamType = SPET_LPARAM_IS_STRING; | |||
Event->ullAudioStreamOffset = ((event->audio_position + audio_offset) * 441)/10; // ms -> bytes | |||
Event->lParam = (long)event->id.name; | |||
Event->wParam = wcstol((wchar_t *)event->id.name,&tailptr,10); | |||
} | |||
#ifdef deleted | |||
if(event->type == espeakEVENT_SENTENCE) | |||
{ | |||
Event = &Events[n_Events++]; | |||
Event->eEventId = SPEI_SENTENCE_BOUNDARY; | |||
Event->elParamType = SPET_LPARAM_IS_UNDEFINED; | |||
Event->ullAudioStreamOffset = (event->audio_position * 441)/10; // ms -> bytes | |||
Event->lParam = event->text_position-1 + text_offset; | |||
Event->wParam = 0; // TEMP | |||
} | |||
#endif | |||
} | |||
if(n_Events > 0) | |||
m_OutputSite->AddEvents(Events, n_Events ); | |||
// return the sound data | |||
hr = m_OutputSite->Write(wav, numsamples*2, NULL); | |||
return(hr); | |||
} | |||
static int ConvertRate(int new_rate) | |||
{//================================= | |||
int rate; | |||
static int rate_table[21] = {80,100,116,124,132,140,148,156,164,170,176, | |||
182,188,197,208,220,240,270,300,335,370 }; | |||
rate = new_rate + master_rate; | |||
if(rate < -10) rate = -10; | |||
if(rate > 10) rate = 10; | |||
return(rate_table[rate+10]); | |||
} // end of ConvertRate | |||
static int ConvertPitch(int pitch) | |||
{//=============================== | |||
static int pitch_table[41] = | |||
{0, 0, 0, 0, 0, 0, 0, 0, 4, 8,12,16,20,24,28,32,36,40,44,47,50, | |||
54,58,62,66,70,74,78,82,84,88,92,96,99,99,99,99,99,99,99,99}; | |||
// {0,3,5,8,10,13,15,18,20,23,25,28,30,33,35,38,40,43,45,48,50, | |||
// 53,55,58,60,63,65,68,70,73,75,78,80,83,85,88,90,93,95,97,99}; | |||
if(pitch < -20) pitch = -20; | |||
if(pitch > 20) pitch = 20; | |||
return(pitch_table[pitch+20]); | |||
} | |||
static int ConvertRange(int range) | |||
{//=============================== | |||
static int range_table[21] = {16,28,39,49,58,66,74,81,88,94,100,105,110,115,120,125,130,135,140,145,150}; | |||
if(range < -10) range = -10; | |||
if(range > 10) range = 10; | |||
return(range_table[range+10]/2); | |||
} | |||
/***************************************************************************** | |||
* CTTSEngObj::FinalConstruct * | |||
*----------------------------* | |||
* Description: | |||
* Constructor | |||
*****************************************************************************/ | |||
HRESULT CTTSEngObj::FinalConstruct() | |||
{ | |||
SPDBG_FUNC( "CTTSEngObj::FinalConstruct" ); | |||
HRESULT hr = S_OK; | |||
#ifdef LOG_DEBUG | |||
f_log2=fopen("C:\\log_espeak","a"); | |||
if(f_log2) fprintf(f_log2,"\n****\n"); | |||
#endif | |||
//--- Init vars | |||
m_hVoiceData = NULL; | |||
m_pVoiceData = NULL; | |||
m_pWordList = NULL; | |||
m_ulNumWords = 0; | |||
m_EngObj = this; | |||
return hr; | |||
} /* CTTSEngObj::FinalConstruct */ | |||
/***************************************************************************** | |||
* CTTSEngObj::FinalRelease * | |||
*--------------------------* | |||
* Description: | |||
* destructor | |||
*****************************************************************************/ | |||
void CTTSEngObj::FinalRelease() | |||
{ | |||
SPDBG_FUNC( "CTTSEngObj::FinalRelease" ); | |||
delete m_pWordList; | |||
#ifdef LOG_DEBUG | |||
if(f_log2!=NULL) fclose(f_log2); | |||
#endif | |||
if( m_pVoiceData ) | |||
{ | |||
::UnmapViewOfFile( (void*)m_pVoiceData ); | |||
} | |||
if( m_hVoiceData ) | |||
{ | |||
::CloseHandle( m_hVoiceData ); | |||
} | |||
} /* CTTSEngObj::FinalRelease */ | |||
// | |||
//=== ISpObjectWithToken Implementation ====================================== | |||
// | |||
void WcharToChar(char *out, const wchar_t *in, int len) | |||
{//==================================================== | |||
int ix; | |||
for(ix=0; ix<len; ix++) | |||
{ | |||
if((out[ix] = (char)in[ix]) == 0) | |||
break; | |||
} | |||
out[len-1] = 0; | |||
} | |||
/***************************************************************************** | |||
* CTTSEngObj::SetObjectToken * | |||
*----------------------------* | |||
* Description: | |||
* Read the "VoiceName" attribute from the registry, and use it to select | |||
* an eSpeak voice file | |||
*****************************************************************************/ | |||
STDMETHODIMP CTTSEngObj::SetObjectToken(ISpObjectToken * pToken) | |||
{ | |||
char voice[80]; | |||
strcpy(voice,"default"); | |||
SPDBG_FUNC( "CTTSEngObj::SetObjectToken" ); | |||
HRESULT hr = SpGenericSetObjectToken(pToken, m_cpToken); | |||
if( SUCCEEDED( hr ) ) | |||
{ | |||
CSpDynamicString voicename; | |||
CSpDynamicString path; | |||
HRESULT hr2; | |||
int len; | |||
hr2 = m_cpToken->GetStringValue( L"VoiceName", &voicename); | |||
if( SUCCEEDED(hr2) ) | |||
{ | |||
WcharToChar(voice,voicename,sizeof(voice)); | |||
} | |||
hr2 = m_cpToken->GetStringValue( L"Path", &path); | |||
if( SUCCEEDED(hr2) ) | |||
{ | |||
len = wcslen(path)+1; | |||
path_install = (char *)malloc(len); | |||
WcharToChar(path_install,path,len); | |||
} | |||
} | |||
gVolume = 100; | |||
gSpeed = -1; | |||
gPitch = -1; | |||
gRange = -1; | |||
gEmphasis = 0; | |||
gSayas = 0; | |||
espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS,100,path_install); | |||
espeak_SetVoiceByName(voice); | |||
espeak_SetSynthCallback(SynthCallback); | |||
return hr; | |||
} /* CTTSEngObj::SetObjectToken */ | |||
// | |||
//=== ISpTTSEngine Implementation ============================================ | |||
// | |||
int CTTSEngObj::ProcessFragList(const SPVTEXTFRAG* pTextFragList, wchar_t *pW_start, ISpTTSEngineSite* pOutputSite, int *n_text) | |||
{//============================================================================================================================= | |||
int action; | |||
int control; | |||
wchar_t *pW; | |||
const SPVSTATE *state; | |||
unsigned int ix; | |||
unsigned int len; | |||
unsigned int total=0; | |||
char cmdbuf[50]; | |||
wchar_t markbuf[32]; | |||
int speed; | |||
int volume; | |||
int pitch; | |||
int range; | |||
int emphasis; | |||
int sayas; | |||
unsigned int text_offset = 0; | |||
frag_count = 0; | |||
frag_ix = 0; | |||
pW = pW_start; | |||
while(pTextFragList != NULL) | |||
{ | |||
action = pTextFragList->State.eAction; | |||
control = pOutputSite->GetActions(); | |||
len = pTextFragList->ulTextLen; | |||
if(control & SPVES_ABORT) | |||
break; | |||
CheckActions(pOutputSite); | |||
sayas = 0; | |||
switch(action) | |||
{ | |||
case SPVA_SpellOut: | |||
sayas = 0x12; // SAYAS_CHARS; // drop through to SPVA_Speak | |||
case SPVA_Speak: | |||
text_offset = pTextFragList->ulTextSrcOffset; | |||
audio_offset = audio_latest; | |||
#ifdef deleted | |||
// attempt to recognise when JAWS is spelling, it doesn't use SPVA_SpellOut | |||
if((pW != NULL) && (*n_text == 1) && ((len == 1) || ((len==2) && (pTextFragList->pTextStart[1]==' ')))) | |||
{ | |||
// A single text fragment with one character. Speak as a character, not a word | |||
sayas = 0x11; | |||
gSayas = 0; | |||
} | |||
#endif | |||
if(frag_count >= n_frag_offsets) | |||
{ | |||
if((frag_offsets = (FRAG_OFFSET *)realloc(frag_offsets,sizeof(FRAG_OFFSET)*(frag_count+500))) != NULL) | |||
{ | |||
n_frag_offsets = frag_count+500; | |||
} | |||
} | |||
// first set the volume, rate, pitch | |||
state = &pTextFragList->State; | |||
volume = (state->Volume * master_volume)/100; | |||
speed = ConvertRate(state->RateAdj); | |||
pitch = ConvertPitch(state->PitchAdj.MiddleAdj); | |||
range = ConvertRange(state->PitchAdj.RangeAdj); | |||
emphasis = state->EmphAdj; | |||
if(emphasis != 0) | |||
emphasis = 3; | |||
len = 0; | |||
if(volume != gVolume) | |||
{ | |||
sprintf(&cmdbuf[len],"%c%dA",CTRL_EMBEDDED,volume); | |||
len += strlen(&cmdbuf[len]); | |||
} | |||
if(speed != gSpeed) | |||
{ | |||
sprintf(&cmdbuf[len],"%c%dS",CTRL_EMBEDDED,speed); | |||
len += strlen(&cmdbuf[len]); | |||
} | |||
if(pitch != gPitch) | |||
{ | |||
sprintf(&cmdbuf[len],"%c%dP",CTRL_EMBEDDED,pitch); | |||
len += strlen(&cmdbuf[len]); | |||
} | |||
if(range != gRange) | |||
{ | |||
sprintf(&cmdbuf[len],"%c%dR",CTRL_EMBEDDED,range); | |||
len += strlen(&cmdbuf[len]); | |||
} | |||
if(emphasis != gEmphasis) | |||
{ | |||
sprintf(&cmdbuf[len],"%c%dF",CTRL_EMBEDDED,emphasis); | |||
len += strlen(&cmdbuf[len]); | |||
} | |||
if(sayas != gSayas) | |||
{ | |||
sprintf(&cmdbuf[len],"%c%dY",CTRL_EMBEDDED,sayas); | |||
len += strlen(&cmdbuf[len]); | |||
} | |||
gVolume = volume; | |||
gSpeed = speed; | |||
gPitch = pitch; | |||
gRange = range; | |||
gEmphasis = emphasis; | |||
gSayas = sayas; | |||
total += (len + pTextFragList->ulTextLen); | |||
if(pTextFragList->ulTextLen > 0) | |||
{ | |||
total++; | |||
} | |||
if(pW != NULL) | |||
{ | |||
for(ix=0; ix<len; ix++) | |||
{ | |||
*pW++ = cmdbuf[ix]; | |||
} | |||
frag_offsets[frag_count].textix = text_offset; | |||
frag_offsets[frag_count].bufix = pW - pW_start; | |||
frag_offsets[frag_count].cmdlen = len; | |||
for(ix=0; ix<pTextFragList->ulTextLen; ix++) | |||
{ | |||
*pW++ = pTextFragList->pTextStart[ix]; | |||
} | |||
if(pTextFragList->ulTextLen > 0) | |||
{ | |||
*pW++ = ' '; | |||
} | |||
} | |||
frag_count++; | |||
break; | |||
case SPVA_Bookmark: | |||
total += (2 + pTextFragList->ulTextLen); | |||
if(pW != NULL) | |||
{ | |||
int index; | |||
for(ix=0; ix<pTextFragList->ulTextLen; ix++) | |||
{ | |||
markbuf[ix] = (char )pTextFragList->pTextStart[ix]; | |||
} | |||
markbuf[ix] = 0; | |||
if((index = AddNameData((const char *)markbuf,1)) >= 0) | |||
{ | |||
sprintf(cmdbuf,"%c%dM",CTRL_EMBEDDED,index); | |||
len = strlen(cmdbuf); | |||
for(ix=0; ix<len; ix++) | |||
{ | |||
*pW++ = cmdbuf[ix]; | |||
} | |||
} | |||
} | |||
break; | |||
} | |||
pTextFragList = pTextFragList->pNext; | |||
} | |||
if(pW != NULL) | |||
{ | |||
*pW = 0; | |||
} | |||
*n_text = frag_count; | |||
return(total); | |||
} // end of ProcessFragList | |||
/***************************************************************************** | |||
* CTTSEngObj::Speak * | |||
*-------------------* | |||
* Description: | |||
* This is the primary method that SAPI calls to render text. | |||
*----------------------------------------------------------------------------- | |||
* Input Parameters | |||
* | |||
* pUser | |||
* Pointer to the current user profile object. This object contains | |||
* information like what languages are being used and this object | |||
* also gives access to resources like the SAPI master lexicon object. | |||
* | |||
* dwSpeakFlags | |||
* This is a set of flags used to control the behavior of the | |||
* SAPI voice object and the associated engine. | |||
* | |||
* VoiceFmtIndex | |||
* Zero based index specifying the output format that should | |||
* be used during rendering. | |||
* | |||
* pTextFragList | |||
* A linked list of text fragments to be rendered. There is | |||
* one fragement per XML state change. If the input text does | |||
* not contain any XML markup, there will only be a single fragment. | |||
* | |||
* pOutputSite | |||
* The interface back to SAPI where all output audio samples and events are written. | |||
* | |||
* Return Values | |||
* S_OK - This should be returned after successful rendering or if | |||
* rendering was interrupted because *pfContinue changed to FALSE. | |||
* E_INVALIDARG | |||
* E_OUTOFMEMORY | |||
* | |||
*****************************************************************************/ | |||
STDMETHODIMP CTTSEngObj::Speak( DWORD dwSpeakFlags, | |||
REFGUID rguidFormatId, | |||
const WAVEFORMATEX * pWaveFormatEx, | |||
const SPVTEXTFRAG* pTextFragList, | |||
ISpTTSEngineSite* pOutputSite ) | |||
{ | |||
SPDBG_FUNC( "CTTSEngObj::Speak" ); | |||
HRESULT hr = S_OK; | |||
unsigned int size; | |||
int xVolume; | |||
int xSpeed; | |||
int xPitch; | |||
int xRange; | |||
int xEmphasis; | |||
int xSayas; | |||
int punctuation; | |||
int n_text_frag=0; | |||
//--- Check args | |||
if( SP_IS_BAD_INTERFACE_PTR( pOutputSite ) || | |||
SP_IS_BAD_READ_PTR( pTextFragList ) ) | |||
{ | |||
hr = E_INVALIDARG; | |||
} | |||
else | |||
{ | |||
InitNamedata(); | |||
//--- Init some vars | |||
m_pCurrFrag = pTextFragList; | |||
m_pNextChar = m_pCurrFrag->pTextStart; | |||
m_pEndChar = m_pNextChar + m_pCurrFrag->ulTextLen; | |||
m_ullAudioOff = 0; | |||
m_OutputSite = pOutputSite; | |||
xVolume = gVolume; | |||
xSpeed = gSpeed; | |||
xPitch = gPitch; | |||
xRange = gRange; | |||
xEmphasis = gEmphasis; | |||
xSayas = gSayas; | |||
// find the size of the text buffer needed for this Speak() request | |||
size = ProcessFragList(pTextFragList,NULL,pOutputSite,&n_text_frag); | |||
gVolume = xVolume; | |||
gSpeed = xSpeed; | |||
gPitch = xPitch; | |||
gRange = xRange; | |||
gEmphasis = xEmphasis; | |||
gSayas = xSayas; | |||
punctuation = 0; | |||
if(dwSpeakFlags & SPF_NLP_SPEAK_PUNC) | |||
punctuation = 1; | |||
espeak_SetParameter(espeakPUNCTUATION,punctuation,0); | |||
size = (size + 50)*sizeof(wchar_t); | |||
if(size > gBufSize) | |||
{ | |||
size += 1000; // some extra so we don't need to realloc() again too often | |||
TextBuf = (wchar_t *)realloc(TextBuf,size); | |||
if(TextBuf == NULL) | |||
{ | |||
gBufSize=0; | |||
return(1); | |||
} | |||
gBufSize = size; | |||
} | |||
audio_latest = 0; | |||
size = ProcessFragList(pTextFragList,TextBuf,pOutputSite,&n_text_frag); | |||
if(size > 0) | |||
{ | |||
espeak_Synth(TextBuf,0,0,POS_CHARACTER,0,espeakCHARS_WCHAR | espeakKEEP_NAMEDATA,NULL,NULL); | |||
} | |||
} | |||
return hr; | |||
} /* CTTSEngObj::Speak */ | |||
HRESULT CTTSEngObj::CheckActions( ISpTTSEngineSite* pOutputSite ) | |||
{//============================================================== | |||
int control; | |||
USHORT volume; | |||
long rate; | |||
control = pOutputSite->GetActions(); | |||
if(control & SPVES_VOLUME) | |||
{ | |||
if(pOutputSite->GetVolume(&volume) == S_OK) | |||
{ | |||
master_volume = volume; | |||
} | |||
} | |||
if(control & SPVES_RATE) | |||
{ | |||
if(pOutputSite->GetRate(&rate) == S_OK) | |||
{ | |||
master_rate = rate; | |||
} | |||
} | |||
return(S_OK); | |||
} // end of CTTSEngObj::CheckActions | |||
/***************************************************************************** | |||
* CTTSEngObj::GetVoiceFormat * | |||
*----------------------------* | |||
* Description: | |||
* This method returns the output data format associated with the | |||
* specified format Index. Formats are in order of quality with the best | |||
* starting at 0. | |||
*****************************************************************************/ | |||
STDMETHODIMP CTTSEngObj::GetOutputFormat( const GUID * pTargetFormatId, const WAVEFORMATEX * pTargetWaveFormatEx, | |||
GUID * pDesiredFormatId, WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx ) | |||
{ | |||
SPDBG_FUNC( "CTTSEngObj::GetVoiceFormat" ); | |||
HRESULT hr = S_OK; | |||
enum SPSTREAMFORMAT sample_rate = SPSF_22kHz16BitMono; | |||
srate = 441; | |||
if(espeak_GetParameter(espeakVOICETYPE,1) == 1) | |||
{ | |||
srate = 320; | |||
sample_rate = SPSF_16kHz16BitMono; // an mbrola voice | |||
} | |||
hr = SpConvertStreamFormatEnum(sample_rate, pDesiredFormatId, ppCoMemDesiredWaveFormatEx); | |||
return hr; | |||
} /* CTTSEngObj::GetVoiceFormat */ | |||
int FAR PASCAL CompileDictionary(const char *voice, const char *path_log) | |||
{//=========================================================== | |||
FILE *f_log; | |||
char fname[120]; | |||
f_log = fopen(path_log,"w"); | |||
sprintf(fname,"%s/",path_install); | |||
espeak_SetVoiceByName(voice); | |||
espeak_CompileDictionary(fname,f_log); | |||
fclose(f_log); | |||
return(0); | |||
} | |||
@@ -0,0 +1,121 @@ | |||
/****************************************************************************** | |||
* TtsEngObj.h * | |||
*-------------* | |||
* This is the header file for the sample CTTSEngObj class definition. | |||
*------------------------------------------------------------------------------ | |||
* Copyright (c) Microsoft Corporation. All rights reserved. | |||
* | |||
******************************************************************************/ | |||
#ifndef TtsEngObj_h | |||
#define TtsEngObj_h | |||
//--- Additional includes | |||
#ifndef __TtsEng_h__ | |||
#include "ttseng.h" | |||
#endif | |||
#ifndef SPDDKHLP_h | |||
#include <spddkhlp.h> | |||
#endif | |||
#ifndef SPCollec_h | |||
#include <spcollec.h> | |||
#endif | |||
#include "resource.h" | |||
__declspec( dllexport )int FAR PASCAL _export CompileDictionary(const char *voice, const char *path_log); | |||
//=== Constants ==================================================== | |||
//=== Class, Enum, Struct and Union Declarations =================== | |||
//=== Enumerated Set Definitions =================================== | |||
//=== Function Type Definitions ==================================== | |||
//=== Class, Struct and Union Definitions ========================== | |||
/*** CSentItem | |||
* This object is a helper class | |||
*/ | |||
class CSentItem | |||
{ | |||
public: | |||
CSentItem() { memset( this, 0, sizeof(*this) ); } | |||
CSentItem( CSentItem& Other ) { memcpy( this, &Other, sizeof( Other ) ); } | |||
/*--- Data members ---*/ | |||
const SPVSTATE* pXmlState; | |||
LPCWSTR pItem; | |||
ULONG ulItemLen; | |||
ULONG ulItemSrcOffset; // Original source character position | |||
ULONG ulItemSrcLen; // Length of original source item in characters | |||
}; | |||
typedef CSPList<CSentItem,CSentItem&> CItemList; | |||
/*** CTTSEngObj COM object ******************************** | |||
*/ | |||
class ATL_NO_VTABLE CTTSEngObj : | |||
public CComObjectRootEx<CComMultiThreadModel>, | |||
public CComCoClass<CTTSEngObj, &CLSID_SampleTTSEngine>, | |||
public ISpTTSEngine, | |||
public ISpObjectWithToken | |||
{ | |||
/*=== ATL Setup ===*/ | |||
public: | |||
DECLARE_REGISTRY_RESOURCEID(IDR_SAMPLETTSENGINE) | |||
DECLARE_PROTECT_FINAL_CONSTRUCT() | |||
BEGIN_COM_MAP(CTTSEngObj) | |||
COM_INTERFACE_ENTRY(ISpTTSEngine) | |||
COM_INTERFACE_ENTRY(ISpObjectWithToken) | |||
END_COM_MAP() | |||
/*=== Methods =======*/ | |||
public: | |||
/*--- Constructors/Destructors ---*/ | |||
HRESULT FinalConstruct(); | |||
void FinalRelease(); | |||
/*=== Interfaces ====*/ | |||
public: | |||
//--- ISpObjectWithToken ---------------------------------- | |||
STDMETHODIMP SetObjectToken( ISpObjectToken * pToken ); | |||
STDMETHODIMP GetObjectToken( ISpObjectToken ** ppToken ) | |||
{ return SpGenericGetObjectToken( ppToken, m_cpToken ); } | |||
//--- ISpTTSEngine -------------------------------------------- | |||
STDMETHOD(Speak)( DWORD dwSpeakFlags, | |||
REFGUID rguidFormatId, const WAVEFORMATEX * pWaveFormatEx, | |||
const SPVTEXTFRAG* pTextFragList, ISpTTSEngineSite* pOutputSite ); | |||
STDMETHOD(GetOutputFormat)( const GUID * pTargetFormatId, const WAVEFORMATEX * pTargetWaveFormatEx, | |||
GUID * pDesiredFormatId, WAVEFORMATEX ** ppCoMemDesiredWaveFormatEx ); | |||
HRESULT CheckActions( ISpTTSEngineSite* pOutputSite ); | |||
int ProcessFragList(const SPVTEXTFRAG* pTextFragList, wchar_t *pW, ISpTTSEngineSite* pOutputSite, int *n_text); | |||
private: | |||
/*--- Non interface methods ---*/ | |||
/*=== Member Data ===*/ | |||
private: | |||
CComPtr<ISpObjectToken> m_cpToken; | |||
HANDLE m_hVoiceData; | |||
void* m_pVoiceData; | |||
//--- Voice (word/audio data) list | |||
// Note: You will probably have something more sophisticated here | |||
// we are just trying to keep it simple for the example. | |||
VOICEITEM* m_pWordList; | |||
ULONG m_ulNumWords; | |||
//--- Working variables to walk the text fragment list during Speak() | |||
const SPVTEXTFRAG* m_pCurrFrag; | |||
const WCHAR* m_pNextChar; | |||
const WCHAR* m_pEndChar; | |||
ULONGLONG m_ullAudioOff; | |||
}; | |||
#endif //--- This must be the last line in the file |
@@ -0,0 +1,25 @@ | |||
HKCR | |||
{ | |||
TtsEng.SampleTTSEngine.1 = s 'SampleTTSEngine Class' | |||
{ | |||
CLSID = s '{BE985C8D-BE32-4A22-AA93-55C16A6D1D91}' | |||
} | |||
TtsEng.SampleTTSEngine = s 'SampleTTSEngine Class' | |||
{ | |||
CLSID = s '{BE985C8D-BE32-4A22-AA93-55C16A6D1D91}' | |||
CurVer = s 'TtsEng.SampleTTSEngine.1' | |||
} | |||
NoRemove CLSID | |||
{ | |||
ForceRemove {BE985C8D-BE32-4A22-AA93-55C16A6D1D91} = s 'SampleTTSEngine Class' | |||
{ | |||
ProgID = s 'TtsEng.SampleTTSEngine.1' | |||
VersionIndependentProgID = s 'TtsEng.SampleTTSEngine' | |||
InprocServer32 = s '%MODULE%' | |||
{ | |||
val ThreadingModel = s 'Both' | |||
} | |||
'TypeLib' = s '{7192AA2F-F759-43E9-91E7-226371EF6B2F}' | |||
} | |||
} | |||
} |
@@ -0,0 +1,78 @@ | |||
/**************************************************************************** | |||
* * | |||
* VERSION.H -- Version information for internal builds * | |||
* * | |||
* This file is only modified by the official builder to update the * | |||
* VERSION, VER_PRODUCTVERSION and VER_PRODUCTVERSION_STR values * | |||
* * | |||
* version.h is created on the fly from verhead.bat and vertail.h, * | |||
* with the current version numbers inserted in between * | |||
* * | |||
****************************************************************************/ | |||
#ifndef VER_H | |||
/* ver.h defines constants needed by the VS_VERSION_INFO structure */ | |||
//#include <winver.h> | |||
#endif | |||
#include <windows.h> | |||
#define VER_FILETYPE VFT_APP | |||
#define VER_FILESUBTYPE VFT2_UNKNOWN | |||
#define VER_FILEDESCRIPTION_STR "TTS SAMPLE ENGINE 5" | |||
#define VER_INTERNALNAME_STR "TTSSAMPLEENG5" | |||
/*--------------------------------------------------------------*/ | |||
/* the following entry should be phased out in favor of */ | |||
/* VER_PRODUCTVERSION_STR, but is used in the shell today. */ | |||
/*--------------------------------------------------------------*/ | |||
/*--------------------------------------------------------------*/ | |||
/* the following values should be modified by the official */ | |||
/* builder for each build */ | |||
/*--------------------------------------------------------------*/ | |||
#define VERSION "5.0" | |||
#define VER_FILEVERSION_STR "5.0" | |||
#define VER_FILEVERSION 5,0 | |||
#define VER_PRODUCTVERSION_STR "5.0" | |||
#define VER_PRODUCTVERSION 5,0 | |||
#define OFFICIAL 1 | |||
#define FINAL 1 | |||
/*--------------------------------------------------------------*/ | |||
/* the following section defines values used in the version */ | |||
/* data structure for all files, and which do not change. */ | |||
/*--------------------------------------------------------------*/ | |||
/* default is nodebug */ | |||
#if _DEBUG | |||
#define VER_DEBUG VS_FF_DEBUG | |||
#else | |||
#define VER_DEBUG 0 | |||
#endif | |||
/* default is privatebuild */ | |||
#ifndef OFFICIAL | |||
#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD | |||
#else | |||
#define VER_PRIVATEBUILD 0 | |||
#endif | |||
/* default is prerelease */ | |||
#ifndef FINAL | |||
#define VER_PRERELEASE VS_FF_PRERELEASE | |||
#else | |||
#define VER_PRERELEASE 0 | |||
#endif | |||
#define VER_FILEFLAGSMASK VS_FFI_FILEFLAGSMASK | |||
#define VER_FILEOS VOS_DOS_WINDOWS32 | |||
#define VER_FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG) | |||
#define VER_COMPANYNAME_STR "Microsoft Corporation\0" | |||
#define VER_PRODUCTNAME_STR "Microsoft\256 Windows(TM) Operating System\0" | |||
#define VER_LEGALTRADEMARKS_STR \ | |||
"Microsoft\256 is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0" | |||
//#include "\sapi5\build\common.ver" |
@@ -0,0 +1,44 @@ | |||
#ifndef _MAC | |||
///////////////////////////////////////////////////////////////////////////// | |||
// | |||
// Version | |||
// | |||
VS_VERSION_INFO VERSIONINFO | |||
FILEVERSION 1,0,24,00 | |||
PRODUCTVERSION 1,0,24,00 | |||
FILEFLAGSMASK 0x3fL | |||
#ifdef _DEBUG | |||
FILEFLAGS 0x1L | |||
#else | |||
FILEFLAGS 0x0L | |||
#endif | |||
FILEOS 0x40004L | |||
FILETYPE 0x1L | |||
FILESUBTYPE 0x0L | |||
BEGIN | |||
BLOCK "StringFileInfo" | |||
BEGIN | |||
BLOCK "040904b0" | |||
BEGIN | |||
VALUE "Comments", "\0" | |||
VALUE "CompanyName", "Jonathan Duddington\0" | |||
VALUE "FileDescription", "Text to Speech\0" | |||
VALUE "FileVersion", "1, 0,24,00\0" | |||
VALUE "InternalName", "espeak1.24\0" | |||
VALUE "LegalCopyright", "Copyright (c) Jonathan Duddington\0" | |||
VALUE "LegalTrademarks", "\0" | |||
VALUE "OriginalFilename", "espeak_sapi.dll\0" | |||
VALUE "PrivateBuild", "\0" | |||
VALUE "ProductName", "espeak TTS\0" | |||
VALUE "ProductVersion", "1, 0, 24, 00\0" | |||
VALUE "SpecialBuild", "\0" | |||
END | |||
END | |||
BLOCK "VarFileInfo" | |||
BEGIN | |||
VALUE "Translation", 0x809, 1200 | |||
END | |||
END | |||
#endif // !_MAC |