diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-08-04 21:01:44 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-08-04 21:01:44 +0000 |
commit | 0319e3be3fbad4ee0f629a46160d172f4faca5b5 (patch) | |
tree | c88d4516c8a5cc09c258d103d23b6748628de7a8 | |
parent | ac40296723f072665121439363fd038ea104166b (diff) | |
download | rockbox-0319e3be3fbad4ee0f629a46160d172f4faca5b5.tar.gz rockbox-0319e3be3fbad4ee0f629a46160d172f4faca5b5.zip |
Handle SAPI5 voices without vendor attribute (reported for japanese L&H engines - see FS#9148).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18196 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | tools/sapi_voice.vbs | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/sapi_voice.vbs b/tools/sapi_voice.vbs index 3f6b657066..a7d773e40e 100644 --- a/tools/sapi_voice.vbs +++ b/tools/sapi_voice.vbs | |||
@@ -34,7 +34,7 @@ Const SPSF_48kHz16BitMono = 38 | |||
34 | 34 | ||
35 | Dim oShell, oArgs, oEnv | 35 | Dim oShell, oArgs, oEnv |
36 | Dim bVerbose, bSAPI4, bList | 36 | Dim bVerbose, bSAPI4, bList |
37 | Dim sLanguage, sVoice, sSpeed | 37 | Dim sLanguage, sVoice, sSpeed, sVendor |
38 | 38 | ||
39 | Dim oSpVoice, oSpFS ' SAPI5 voice and filestream | 39 | Dim oSpVoice, oSpFS ' SAPI5 voice and filestream |
40 | Dim oTTS, nMode ' SAPI4 TTS object, mode selector | 40 | Dim oTTS, nMode ' SAPI4 TTS object, mode selector |
@@ -109,6 +109,10 @@ If bSAPI4 Then | |||
109 | 109 | ||
110 | ' Speed selection | 110 | ' Speed selection |
111 | If sSpeed <> "" Then oTTS.Speed = sSpeed | 111 | If sSpeed <> "" Then oTTS.Speed = sSpeed |
112 | |||
113 | ' Get vendor infomration | ||
114 | sVendor = oTTS.MfgName(nMode) | ||
115 | |||
112 | Else ' SAPI5 | 116 | Else ' SAPI5 |
113 | ' Create SAPI5 object | 117 | ' Create SAPI5 object |
114 | Set oSpVoice = CreateObject("SAPI.SpVoice") | 118 | Set oSpVoice = CreateObject("SAPI.SpVoice") |
@@ -154,9 +158,16 @@ Else ' SAPI5 | |||
154 | ' Speed selection | 158 | ' Speed selection |
155 | If sSpeed <> "" Then oSpVoice.Rate = sSpeed | 159 | If sSpeed <> "" Then oSpVoice.Rate = sSpeed |
156 | 160 | ||
161 | ' Get vendor information, protect from missing attribute | ||
162 | sVendor = oSpVoice.Voice.GetAttribute("Vendor") | ||
163 | If Err.Number <> 0 Then | ||
164 | Err.Clear | ||
165 | sVendor = "(unknown)" | ||
166 | End If | ||
167 | |||
157 | ' Filestream object for output | 168 | ' Filestream object for output |
158 | Set oSpFS = CreateObject("SAPI.SpFileStream") | 169 | Set oSpFS = CreateObject("SAPI.SpFileStream") |
159 | oSpFS.Format.Type = AudioFormat(oSpVoice.Voice.GetAttribute("Vendor")) | 170 | oSpFS.Format.Type = AudioFormat(sVendor) |
160 | End If | 171 | End If |
161 | 172 | ||
162 | Do | 173 | Do |
@@ -169,11 +180,7 @@ Do | |||
169 | Case "QUERY" | 180 | Case "QUERY" |
170 | Select Case aLine(1) | 181 | Select Case aLine(1) |
171 | Case "VENDOR" | 182 | Case "VENDOR" |
172 | If bSAPI4 Then | 183 | WScript.StdOut.WriteLine sVendor |
173 | WScript.StdOut.WriteLine oTTS.MfgName(nMode) | ||
174 | Else | ||
175 | WScript.StdOut.WriteLine oSpVoice.Voice.GetAttribute("Vendor") | ||
176 | End If | ||
177 | End Select | 184 | End Select |
178 | Case "SPEAK" | 185 | Case "SPEAK" |
179 | aData = Split(aLine(1), vbTab, 2) | 186 | aData = Split(aLine(1), vbTab, 2) |