unit ScreenreaderAPI;
interface
uses WinAPI.Windows;
Const dllname = '
ScreenReaderAPI.dll';
// Global functions. These should be used preferably to the specific ones so
// that you are independent of the screen reader used by the end user.
// Speak a string of text and tell if currently speaking text should
// be interrupted or not.
// With true as second argument, the given string of text is immediately
// speaking, interrupting what was speaking before
// With false, the given string is appended to the queue of messages to speak,
// the current message being spoken is not interrupted
Function sayStringA( a : PAnsiChar; interrupt : Boolean):Boolean;
stdcall;
external dllname;
// unicode version of the function above */
Function sayStringW( a : PWideChar; interrupt : Boolean):Boolean;
stdcall;
external dllname;
// Immediately stops any spoken text
Function stopSpeech:Boolean;
stdcall;
external dllname;
// Show a message on the braille display.
Function brailleMessageA( a : PAnsiChar):Boolean;
stdcall;
external dllname;
Function brailleMessageW( a : PWideChar):Boolean;
stdcall;
external dllname;
// Tell or define which scrren reader is currently used by the global functions
// above. See SR_* constants for values meaning
// Since integer identifiers are subject to change, you are recommended to
// use getCurrentScreenReaderName instead of this function.
Function getCurrentScreenReader:Integer;
stdcall;
external dllname;
Function setCurrentScreenReader (screenReaderID : Integer):Integer;
stdcall;
external dllname;
// Get or set the current screen reader using a screen reader name.
// Don't try to free the strings returned, they are statically defined
// inside the library.
Function getCurrentScreenReaderNameA:PAnsiChar;
stdcall;
external dllname;
Function getCurrentScreenReaderNameW:PWideChar;
stdcall;
external dllname;
Function setCurrentScreenReaderNameA (
const name : PAnsiChar):Integer;
stdcall;
external dllname;
Function setCurrentScreenReaderNameW (
const name : PWideChar):Integer;
stdcall;
external dllname;
// Retriev the name from the id or the id from the name of a screen reader
// Don't try to free the strings returned, they are statically defined
// inside the library.
Function getScreenReaderNameA (id : Integer):PAnsiChar;
stdcall;
external dllname;
Function getScreenReaderNameW (id : Integer):PWideChar;
stdcall;
external dllname;
Function getScreenReaderIdA (
const name : PAnsiChar):Integer;
stdcall;
external dllname;
Function getScreenReaderIdW (
const name : PWideChar):Integer;
stdcall;
external dllname;
// Get the number of engines supported
Function getSupportedScreenReadersCount:Integer;
stdcall;
external dllname;
// Tell or define if SAPI5 must be used as fallback if no any other screen
// reader is found. Default is FALSE.
Function sapiIsEnabled:Boolean;
stdcall;
external dllname;
Function sapiEnable (enable: Boolean):Boolean;
stdcall;
external dllname;
// SAPI5 specific functions
// unload SAPI5 engine. */
Function sapiLoad:Boolean;
stdcall;
external dllname;
Procedure sapiUnload;
stdcall;
external dllname;
///** Say functions. SSML variants accept XML tags as defined by Microsoft Speech Synthesis Markup Language. Other variants only accept plain text. */
Function sapiSayStringW (
const str : PWideChar; interrupt : Boolean):Boolean;
stdcall;
external dllname;
Function sapiSaySSMLW (
const str : PWideChar; interrupt : Boolean):Boolean;
stdcall;
external dllname;
// See MSDN if you want to work with SSML speech synthesis markup language
Function sapiSayStringA (
const str : PAnsiChar; interrupt : Boolean):Boolean;
stdcall;
external dllname;
Function sapiSaySSMLA (
const str : PAnsiChar; interrupt : Boolean):Boolean;
stdcall;
external dllname;
Function sapiStopSpeech:Boolean;
stdcall;
external dllname;
// Set speech rate between 0 (slowest) to 100 (fastest). 50=middle.
Function sapiSetRate (rate´: Integer):Boolean;
stdcall;
external dllname;
// Return current speech rate between 0 and 100, negative on error or if that information is unavailable */
Function sapiGetRate:Integer;
stdcall;
external dllname;
// Set the speech volume between 0 (quietest) to 100 (loudest)
Function sapiSetVolume (volume : Integer):Boolean;
stdcall;
external dllname;
// Return the current speech volume between 0 and 100, negative on error or if that information is unavailable */
Function sapiGetVolume:Integer;
stdcall;
external dllname;
// Tell or set the pause status of the speech
FUnction sapiSetPaused (paused : Boolean):Boolean;
stdcall;
external dllname;
Function sapiIsPaused:Boolean;
stdcall;
external dllname;
// Wait for SAPI to complete its speech up to the specified number of milliseconds.
Function sapiWait (timeout : Integer):Boolean;
stdcall;
external dllname;
// Tell if SAPI is currently speaking
Function sapiIsSpeaking:Boolean;
stdcall;
external dllname;
// Return the number of SAPI voices availables in the system
Function sapiGetNumVoices:Integer;
stdcall;
external dllname;
// SEt the speaking voice, use 0-based index */
Function sapiSetVoice (n : Integer):Boolean;
stdcall;
external dllname;
// Return the 0-based index of the current SAPI voice used, -1 for default, <=-2 on error or if that information is unavailable. */
Function sapiGetVoice:Integer;
stdcall;
external dllname;
// Return the name of the nth voice.
// Strings returned by this function must be free when no longer used.
Function sapiGetVoiceNameW (n : Integer):PWideChar;
stdcall;
external dllname;
///* ANSI version of the function above. Returned strings must be free when no longer used. */
Function sapiGetVoiceNameA (n : Integer):PAnsiChar;
stdcall;
external dllname;
// Misc functions
// Install or uninstall a keyboard hook. CAn be used to bypass jaws keyboard
// hook, but it may not always work.
// Don't forget to uninstall on exit. You should also consider uninstalling
// it when the user switch to another application
// (by using Alt+Tab for example), and reinstall it again when the user
// come back to your application, so that other applications behave normally.
Function installKeyboardHook:Boolean;
stdcall;
external dllname;
Procedure uninstallKeyboardHook;
stdcall;
external dllname;
implementation
end.