A guide for using Tolk is as follows:
Using tolk in your PureBASIC projects
Using tolk in your PB projects
To use tolk in your PB projects, just use the following code:
XIncludeFile "tolk.pb"
Next, go to the initialization part of your project and enter the following at the bottom, top, or wherever you need it:
tolk::load()
This loads the tolk library. Next, wherever you need it, do:
tolk::output (string)
Alternatively, create a say() function like this:
Procedure say (text.s)
tolk::output (text)
EndProcedure
The following functions are in the tolk library. Note that tolk:: must be prepended to each function.
load()
Loads the tolk library into memory. Typically used at the top of your code, or wherever you initialize your application.
IsLoaded()
Specifies if the tolk library is loaded or not. Returns #True if tolk is loaded and #False otherwise.
unload()
Used to unload the tolk library. Generally used when the application exits.
TrySAPI(trySAPI.a)
Tests if SAPI is available. Requires an ASCII number (0-255) to test. Returns #True on success and #False otherwise.
PreferSAPI(preferSAPI.a)
Forces the tolk library to prefer SAPI output in tolk::output(). Requires a SAPI voice ID (0-255).
DetectScreenReader()
Causes tolk to run a check of all screen readers running on the system. Returns a string containing the screen readers name.
HasSpeech()
Detects if the screen reader supports speech output. Returns #True if the screen reader supports speech output, #False otherwise.
HasBraille()
Detects if the screen reader supports braille output. Returns #True on success, #False otherwise.
Output(str.s, interrupt.a = #False)
Forces the screen reader currently loaded to speak something.
Speak(str.s, interrupt.a = #False)
See Output() above.
Braille(str.s)
Causes the screen reader currently loaded to send data to the braille display's display. Requires text to send to the display. This can be included in your say() function.
IsSpeaking()
Requests tolk to check if the screen reader currently loaded is speaking. Returns #True if the screen reader currently loaded is speaking, #False otherwise.
Silence()
Forces the screen reader to stop speaking immediately. Return #True if the screen reader was silenced successfully and #False otherwise.
"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question." — Charles Babbage.
My Github