Platforms to show: All Mac Windows Linux Cross-Platform
/Win/Windows Speech/Windows Speech to file
Required plugins for this example: MBS Win Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Windows Speech/Windows Speech to file
This example is the version from Thu, 6th Apr 2016.
Project "Windows Speech to file.xojo_binary_project"
Class Window1 Inherits Window
Binding enablingBinder
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action()
dim s as String
s= EditField1.text
w.Speak s
w.SpeakFile FindFile("Speech Output.wav"),s
End EventHandler
End Control
Control EditField1 Inherits TextArea
ControlInstance EditField1 Inherits TextArea
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action()
w.Pause
End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action()
w.Resume
End EventHandler
End Control
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
End Control
Control PushButton4 Inherits PushButton
ControlInstance PushButton4 Inherits PushButton
EventHandler Sub Action()
dim v as WinVoiceMBS
v=voices(ListBox1.ListIndex)
w.Voice=v
End EventHandler
End Control
EventHandler Sub Open()
dim v as WinVoiceMBS
w=new WinSpeechMBS
if w.Handle=0 then
MsgBox "Speech is not installed!"
quit
end if
ListBox1.AddRow "Default"
if w.ListVoices then
v=w.NextVoice
while v<>nil
ListBox1.AddRow v.Description
voices.Append v
v=w.NextVoice
wend
end if
End EventHandler
Function FindFile(name as string) As FolderItem
// Look for file in parent folders from executable on
dim parent as FolderItem = app.ExecutableFile.Parent
while parent<>Nil
dim file as FolderItem = parent.Child(name)
if file<>Nil and file.Exists then
Return file
end if
parent = parent.Parent
wend
End Function
Property Protected voices(0) As winvoiceMBS
Property Protected w As winspeechMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open()
dim w as Window1
w=new window1
w.Title=w.Title+" 1"
w=new window1
w.Title=w.Title+" 1"
w=new window1
w.Title=w.Title+" 1"
w=new window1
w.Title=w.Title+" 1"
End EventHandler
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Win Plugin.