summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2008-01-19 18:46:06 +0000
committerDominik Wenger <domonoky@googlemail.com>2008-01-19 18:46:06 +0000
commita423db0024865bd48943bba1837f97ed1d1be1f8 (patch)
treec3eef7631d9d55820fe2899e83571cc8a9813615 /tools
parent6b5780dae3561842c858f9c63d00430521628c9c (diff)
downloadrockbox-a423db0024865bd48943bba1837f97ed1d1be1f8.tar.gz
rockbox-a423db0024865bd48943bba1837f97ed1d1be1f8.tar.bz2
rockbox-a423db0024865bd48943bba1837f97ed1d1be1f8.zip
added an option to get a list of voices for a language, for rbutil.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16112 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/sapi_voice.vbs44
1 files changed, 42 insertions, 2 deletions
diff --git a/tools/sapi_voice.vbs b/tools/sapi_voice.vbs
index 919b9a370b..2038329b62 100755
--- a/tools/sapi_voice.vbs
+++ b/tools/sapi_voice.vbs
@@ -33,7 +33,7 @@ Const SPSF_44kHz16BitMono = 34
Const SPSF_48kHz16BitMono = 38
Dim oShell, oArgs, oEnv
-Dim bVerbose, bSAPI4
+Dim bVerbose, bSAPI4, bList
Dim sLanguage, sVoice, sSpeed
Dim oSpVoice, oSpFS ' SAPI5 voice and filestream
@@ -42,6 +42,7 @@ Dim nLangID, sSelectString
Dim aLine, aData ' used in command reading
+Dim counter, ende, list
On Error Resume Next
@@ -51,10 +52,47 @@ bVerbose = (oEnv("V") <> "")
Set oArgs = WScript.Arguments.Named
bSAPI4 = oArgs.Exists("sapi4")
+bList = oArgs.Exists("listvoices")
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
Set oTTS = WScript.CreateObject("ActiveVoice.ActiveVoice", "TTS_")
@@ -261,7 +299,7 @@ Function AudioFormat(ByRef sVendor)
AudioFormat = SPSF_16kHz16BitMono
Case Else
AudioFormat = SPSF_22kHz16BitMono
- WScript.StdErr.WriteLine "Warning - unknown vendor """ & sVendor _
+ WScript.StdOut.WriteLine "Warning - unknown vendor """ & sVendor _
& """ - using default wave format"
End Select
End Function
@@ -356,3 +394,5 @@ Function LangIDs(ByRef sLanguage)
LangIDs = Array(&h807) ' Swiss German
End Select
End Function
+
+