API Documentation
- file SpeechCore.h
- #include <stdint.h>#include <stdbool.h>#include <wchar.h>
Cross-platform C++ library for screen reader output. @Copyright (C) 2024 Oussama Ben Gatrane @license This product is licensed under the MIT License. See the license file for the full license text.
SpeechCore.
See also
https://github.com/still-standing88/SpeechCore Version: 1.1.0 Author: [Oussama AKA Still standing] Description: Cross-platform C++ library for screen reader output.
Defines
-
_SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
-
SPEECH_C_API
-
SC_SPEECH_FLOW_CONTROL
-
SC_SPEECH_PARAMETER_CONTROL
-
SC_VOICE_CONFIG
-
SC_FILE_OUTPUT
-
SC_HAS_SPEECH
-
SC_HAS_BRAILLE
Functions
- SPEECH_C_API void Speech_Init ()
Initializes the SpeechCore library. Must be called before using other functions.
- SPEECH_C_API void Speech_Free ()
Finalizes SpeechCore and frees up resources.
- SPEECH_C_API void Speech_Detect_Driver ()
Detects and selects an available screen reader.
Loops through available screen readers detected on the platform and selects the first one that’s running. If prefer_sapi is set to true, it sets SAPI as the current screen reader. This function is called automatically by Speech_Init and Speech_Output.
- SPEECH_C_API const wchar_t * Speech_Current_Driver ()
Retrieves the name of the currently detected/used screen reader.
- Returns:
A const wchar_t string representing the current driver name.
- SPEECH_C_API const wchar_t * Speech_Get_Driver (int index)
Retrieves the name of a screen reader driver by index.
- Parameters:
index – The index of the driver to retrieve.
- Returns:
A const wchar_t string representing the driver name.
- SPEECH_C_API void Speech_Set_Driver (int index)
Sets the current screen reader driver by index.
- Parameters:
index – The index of the driver to set as current.
- SPEECH_C_API int Speech_Get_Drivers ()
Retrieves the number of available screen reader drivers.
- Returns:
An integer representing the number of drivers.
- SPEECH_C_API uint32_t Speech_Get_Flags ()
Retrieves the flags associated with the currently detected/used screen reader.
The speech flags represent the features the screen reader supports.
- Returns:
An uint32_t representing the speech flags.
- SPEECH_C_API bool Speech_Is_Loaded ()
Checks if the library is loaded.
- Returns:
A bool representing if the library is loaded.
- SPEECH_C_API bool Speech_Is_Speaking ()
Checks if the current screen reader is actively speaking.
- Returns:
A bool representing the state of the screen reader’s speaking state.
- SPEECH_C_API bool Speech_Output (const wchar_t *text, bool _interrupt=false)
Outputs a given string to be spoken by the currently used/detected screen reader.
- Parameters:
text – A const wchar_t string representing the text to be spoken.
_interrupt – Whether to interrupt the current speech segment. Default is false.
- Returns:
A bool indicating if the operation was successful.
- SPEECH_C_API bool Speech_Braille (const wchar_t *text)
Outputs a given string to the braille display if supported.
- Parameters:
text – A const wchar_t string representing the text to be displayed in braille.
- Returns:
A bool indicating if the operation was successful.
- SPEECH_C_API bool Speech_Stop ()
Stops speaking if the screen reader is currently speaking.
- Returns:
A bool indicating if the operation was successful.
- SPEECH_C_API float Speech_Get_Volume ()
Gets the volume of the current screen reader if supported.
- Returns:
A float representing the volume.
- SPEECH_C_API void Speech_Set_Volume (float offset)
Sets the volume for the current screen reader if supported.
- Parameters:
offset – A float representing the volume to be set.
- SPEECH_C_API float Speech_Get_Rate ()
Gets the rate/speed parameter for the current screen reader if supported.
- Returns:
A float representing the rate value.
- SPEECH_C_API void Speech_Set_Rate (float offset)
Sets the rate/speed for the current screen reader if supported.
- Parameters:
offset – A float representing the rate to be set.
- SPEECH_C_API const wchar_t * Speech_Get_Current_Voice ()
Retrieves the current voice of the active screen reader if supported.
- Returns:
A const wchar_t string representing the voice name.
- SPEECH_C_API const wchar_t * Speech_Get_Voice (int index)
Retrieves the voice name of the given voice by its index for the currently active screen reader if supported.
- Parameters:
index – The index of the voice.
- Returns:
A const wchar_t string representing the name of the voice.
- SPEECH_C_API void Speech_Set_Voice (int index)
Sets the voice by its index for the currently active screen reader if supported.
- Parameters:
index – The index of the voice to set.
- SPEECH_C_API int Speech_Get_Voices ()
Retrieves the number of available voices in the currently active screen reader if supported.
- Returns:
An integer representing the number of voices.
- SPEECH_C_API void Speech_Output_File (const char *filePath, const wchar_t *text)
Outputs the given text into a file for the currently active screen reader if supported.
- Parameters:
filePath – A const char* representing the name of the file.
text – A const wchar_t string representing the text to be outputted.
- SPEECH_C_API void Speech_Resume ()
Resumes speech for the currently active screen reader if supported.
- SPEECH_C_API void Speech_Pause ()
Pauses speech for the currently active screen reader if supported.
-
_SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
- dir E:/dev/c++_libs/speechCore/REPO/include