Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

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/SpeechWin
This example is the version from Sun, 17th Mar 2012.
Project "SpeechWin.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control ListBox1 Inherits ListBox
ControlInstance ListBox1 Inherits ListBox
EventHandler Sub Change() // Switch to another voice if you click on a voice name if Listbox1.ListIndex>=0 then dim v as variant = listbox1.RowTag(Listbox1.ListIndex) if v isa WinVoiceMBS then dim voice as WinVoiceMBS = v speech.Voice = voice end if end if End EventHandler
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() dim text as string text=ConvertEncoding(EditField1.text,encodings.utf16) speech.Speak text End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() dim text as string dim file as FolderItem text=ConvertEncoding(EditField1.text,encodings.utf16) file=GetSaveFolderItem("","test.wav") if file<>nil then speech.SpeakFile file,text end if End EventHandler
End Control
Control PushButton3 Inherits PushButton
ControlInstance PushButton3 Inherits PushButton
EventHandler Sub Action() speech.pause End EventHandler
End Control
Control EditField1 Inherits TextArea
ControlInstance EditField1 Inherits TextArea
End Control
EventHandler Sub Open() Speech=new WinSpeechMBS if Speech.ListVoices then // list voices in listbox dim v as WinVoiceMBS v=speech.NextVoice while v<>nil listbox1.AddRow v.Description listbox1.RowTag(Listbox1.LastIndex) = v v=speech.NextVoice wend end if End EventHandler
Property speech As WinSpeechMBS
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Win Plugin.

MBS Xojo Plugins