summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-02-10 13:38:05 +0000
committerJens Arnold <amiconn@rockbox.org>2008-02-10 13:38:05 +0000
commitbec914e72463bb1ef40b57c0bb76e34d9e7a99fa (patch)
tree3b4e5f10c57dc7820fa262d6dfe666dac164bb77 /tools
parent62e6f35c4c2229f3f7c4a1b0e0e480024756d0ec (diff)
downloadrockbox-bec914e72463bb1ef40b57c0bb76e34d9e7a99fa.tar.gz
rockbox-bec914e72463bb1ef40b57c0bb76e34d9e7a99fa.tar.bz2
rockbox-bec914e72463bb1ef40b57c0bb76e34d9e7a99fa.zip
Simplify and better integrate the SAPI5 voice list output code (less duplication), and add list output for SAPI4.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16269 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/sapi_voice.vbs63
1 files changed, 26 insertions, 37 deletions
diff --git a/tools/sapi_voice.vbs b/tools/sapi_voice.vbs
index 2038329b62..440444ca38 100755
--- a/tools/sapi_voice.vbs
+++ b/tools/sapi_voice.vbs
@@ -38,12 +38,11 @@ Dim sLanguage, sVoice, sSpeed
Dim oSpVoice, oSpFS ' SAPI5 voice and filestream
Dim oTTS, nMode ' SAPI4 TTS object, mode selector
+Dim oVoice ' for traversing the list of voices
Dim nLangID, sSelectString
Dim aLine, aData ' used in command reading
-Dim counter, ende, list
-
On Error Resume Next
Set oShell = CreateObject("WScript.Shell")
@@ -57,41 +56,6 @@ sLanguage = oArgs.Item("language")
sVoice = oArgs.Item("voice")
sSpeed = oArgs.Item("speed")
-' display a list of voices for the selected language
-if bList Then
- 'Create SAPI5 object
- Set oSpVoice = CreateObject("SAPI.SpVoice")
- If Err.Number <> 0 Then
- WScript.StdErr.WriteLine "Error - could not get SpVoice object." _
- & " SAPI 5 not installed?"
- WScript.Quit 1
- End If
-
- list = ""
- ' Select matching voice
- For Each nLangID in LangIDs(sLanguage)
- sSelectString = "Language=" & Hex(nLangID)
- counter =0
- ende =0
- While ende <= 0
- Err.Clear
- Set oSpVoice.Voice = oSpVoice.GetVoices(sSelectString).Item(counter)
-
- If Err.Number = 0 Then
- list = list & oSpVoice.Voice.GetDescription & ","
- Else
- ende = 1
- Err.Clear
- End if
- counter = counter + 1
- Wend
- Next
-
- WScript.StdErr.WriteLine list
-
- WScript.Quit 0
-End If
-
If bSAPI4 Then
' Create SAPI4 ActiveVoice object
@@ -107,6 +71,19 @@ If bSAPI4 Then
End If
oTTS.Initialized = 1
+ If bList Then
+ ' Just list available voices for the selected language
+ For Each nLangID in LangIDs(sLanguage)
+ For nMode = 1 To oTTS.CountEngines
+ If oTTS.LanguageID(nMode) = nLangID Then
+ WScript.StdErr.Write oTTS.ModeName(nMode) & ","
+ End If
+ Next
+ Next
+ WScript.StdErr.WriteLine
+ WScript.Quit 0
+ End If
+
' Select matching voice
For Each nLangID in LangIDs(sLanguage)
sSelectString = "LanguageID=" & nLangID
@@ -140,6 +117,18 @@ Else ' SAPI5
& " SAPI 5 not installed?"
WScript.Quit 1
End If
+
+ If bList Then
+ ' Just list available voices for the selected language
+ For Each nLangID in LangIDs(sLanguage)
+ sSelectString = "Language=" & Hex(nLangID)
+ For Each oVoice in oSpVoice.GetVoices(sSelectString)
+ WScript.StdErr.Write oVoice.GetDescription & ","
+ Next
+ Next
+ WScript.StdErr.WriteLine
+ WScript.Quit 0
+ End If
' Select matching voice
For Each nLangID in LangIDs(sLanguage)