Skip to main content

Crate prism_sys

Crate prism_sys 

Source
Expand description

Raw FFI bindings to prism (https://github.com/ethindp/prism), a platform-agnostic speech and screen reader output library.

Structs§

PrismBackend
An opaque backend instance obtained from a registry.
PrismBackendVTable
A table of function pointers implementing a custom backend.
PrismConfig
A struct containing configuration parameters for Prism or it’s back-ends to use.
PrismContext
An opaque prism context, holding a backend registry.
PrismLogHandler
A structure pairing a log callback with an opaque user pointer.
PrismPluginBackend
A descriptor supplied by a plugin to describe a single backend.
PrismPluginHost
A structure describing the loading Prism library, passed to a plugin’s entry point.
PrismPluginInstanceContext
The structure Prism passes as the userdata argument to the create member of a backend supplied by a plugin. The context is valid only for the duration of the create call; the services object it names is valid for the longer period given under Host services.
PrismPluginServices
A structure through which a backend supplied by a plugin reaches the facilities Prism makes available to it. Prism provides one to each backend it registers from a plugin, as described under Host services.
PrismRegistry
An opaque, immutable set of backend registrations.
PrismRegistryBuilder
An opaque, mutable collection of backend registrations.

Constants§

PRISM_BACKEND_ANDROID_SCREEN_READER
Android screen readers (Android)
PRISM_BACKEND_ANDROID_TTS
Android TTS engine (Android)
PRISM_BACKEND_AV_SPEECH
AVSpeechSynthesizer (macOS, iOS, tvOS, WatchOS, VisionOS)
PRISM_BACKEND_BOY_PC_READER
BoyPCReader (windows only)
PRISM_BACKEND_FEATURE_MAX_BIT
The highest bit reserved for feature flags.
PRISM_BACKEND_INVALID
Invalid/sentinel value (always 0)
PRISM_BACKEND_IS_SUPPORTED_AT_RUNTIME
The underlying engine or service is available. This determination is advisory; prism_backend_initialize MAY still fail.
PRISM_BACKEND_JAWS
JAWS screen reader (Windows)
PRISM_BACKEND_NVDA
NVDA screen reader (Windows)
PRISM_BACKEND_ONE_CORE
Windows OneCore speech API (Windows 10+)
PRISM_BACKEND_ORCA
Orca screen reader (Linux/BSD, win32 via Wine)
PRISM_BACKEND_PC_TALKER
PCTalker (windows only)
PRISM_BACKEND_PERFORMS_SILENCE_TRIMMING_ON_SPEAK
Reserved.
PRISM_BACKEND_PERFORMS_SILENCE_TRIMMING_ON_SPEAK_TO_MEMORY
The backend trims leading and trailing silence from the audio stream before delivering it to the audio callback.
PRISM_BACKEND_SAPI
Microsoft SAPI (Windows)
PRISM_BACKEND_SENSE_READER
Sense Reader screen reader (Windows)
PRISM_BACKEND_SPEECH_DISPATCHER
Speech Dispatcher (Linux/BSD, win32 via Wine)
PRISM_BACKEND_SPIEL
Spiel (Linux and BSDs only)
PRISM_BACKEND_SUPPORTS_BRAILLE
prism_backend_braille is implemented.
PRISM_BACKEND_SUPPORTS_COUNT_VOICES
prism_backend_count_voices is implemented.
PRISM_BACKEND_SUPPORTS_GET_BIT_DEPTH
prism_backend_get_bit_depth is implemented.
PRISM_BACKEND_SUPPORTS_GET_CHANNELS
prism_backend_get_channels is implemented.
PRISM_BACKEND_SUPPORTS_GET_PITCH
prism_backend_get_pitch is implemented.
PRISM_BACKEND_SUPPORTS_GET_RATE
prism_backend_get_rate is implemented.
PRISM_BACKEND_SUPPORTS_GET_SAMPLE_RATE
prism_backend_get_sample_rate is implemented.
PRISM_BACKEND_SUPPORTS_GET_VOICE
prism_backend_get_voice is implemented.
PRISM_BACKEND_SUPPORTS_GET_VOICE_LANGUAGE
prism_backend_get_voice_language is implemented.
PRISM_BACKEND_SUPPORTS_GET_VOICE_NAME
prism_backend_get_voice_name is implemented.
PRISM_BACKEND_SUPPORTS_GET_VOLUME
prism_backend_get_volume is implemented.
PRISM_BACKEND_SUPPORTS_IS_SPEAKING
prism_backend_is_speaking is implemented.
PRISM_BACKEND_SUPPORTS_OUTPUT
prism_backend_output is implemented.
PRISM_BACKEND_SUPPORTS_PAUSE
prism_backend_pause is implemented.
PRISM_BACKEND_SUPPORTS_REFRESH_VOICES
prism_backend_refresh_voices is implemented.
PRISM_BACKEND_SUPPORTS_RESUME
prism_backend_resume is implemented.
PRISM_BACKEND_SUPPORTS_SET_PITCH
prism_backend_set_pitch is implemented.
PRISM_BACKEND_SUPPORTS_SET_RATE
prism_backend_set_rate is implemented.
PRISM_BACKEND_SUPPORTS_SET_VOICE
prism_backend_set_voice is implemented.
PRISM_BACKEND_SUPPORTS_SET_VOLUME
prism_backend_set_volume is implemented.
PRISM_BACKEND_SUPPORTS_SPEAK
prism_backend_speak is implemented.
PRISM_BACKEND_SUPPORTS_SPEAK_SSML
Reserved.
PRISM_BACKEND_SUPPORTS_SPEAK_TO_MEMORY
prism_backend_speak_to_memory is implemented.
PRISM_BACKEND_SUPPORTS_SPEAK_TO_MEMORY_SSML
Reserved.
PRISM_BACKEND_SUPPORTS_STOP
prism_backend_stop is implemented.
PRISM_BACKEND_SYSTEM_ACCESS
SystemAccess screen reader (windows) (only available if explicitly enabled at build time)
PRISM_BACKEND_UIA
UIAutomation backend (Windows only)
PRISM_BACKEND_VOICE_OVER
VoiceOver screen reader (macOS, MacCatalyst, iOS, WatchOS, tvOS, VisionOS)
PRISM_BACKEND_WEB_SPEECH
Web SpeechSynthesis API (web)
PRISM_BACKEND_WINDOW_EYES
WindowEyes screen reader (windows) (only available if explicitly enabled at build time)
PRISM_BACKEND_ZDSR
Zhengdu Screen Reader (Windows)
PRISM_BACKEND_ZOOM_TEXT
ZoomText (Windows)
PRISM_CONFIG_VERSION
The PrismConfig layout version this binding describes.
PRISM_ERROR_ALREADY_INITIALIZED
The backend was already initialized.
PRISM_ERROR_ALREADY_PAUSED
Speech is already paused.
PRISM_ERROR_BACKEND_ENTERED_UNDEFINED_STATE
An error occured when the backend was executing a function which has caused the backend to enter an undefined state. The caller should re-initialize the backend from scratch.
PRISM_ERROR_BACKEND_NOT_AVAILABLE
The backend’s underlying system component is unavailable.
PRISM_ERROR_COUNT
The number of defined error codes. Not itself an error.
PRISM_ERROR_INCOMPATIBLE_ABI
A plugin declined the host, or a backend descriptor declared an ABI generation this build of Prism does not accept
PRISM_ERROR_INTERNAL
An internal error occurred during initialization.
PRISM_ERROR_INTERNAL_BACKEND_LIMIT_EXCEEDED
The backend possesses an internal hard ceiling as to how many instances may be instantiated at any given time, and this limit would be exceeded were another to be initialized.
PRISM_ERROR_INVALID_AUDIO_FORMAT
The audio format which the underlying engine returned to Prism cannot be understood by Prism, or it’s parameters are nonsensical.
PRISM_ERROR_INVALID_OPERATION
The builder is spent, or a backend with the same name or the same identifier is already present in the builder.
PRISM_ERROR_INVALID_PARAM
The vtable’s size member was zero, the declared feature set was inconsistent with the vtable, or the priority value was negative.
PRISM_ERROR_INVALID_UTF8
text contains invalid UTF-8 sequences.
PRISM_ERROR_LIBRARY_INVALID
A shared library was opened but does not export the plugin entry point
PRISM_ERROR_LIBRARY_LOAD_FAILED
A shared library could not be opened, because no file exists at the given path, it is not a loadable image, it was built for a different architecture, or its initialization code failed
PRISM_ERROR_MEMORY_FAILURE
Memory allocation failed during initialization.
PRISM_ERROR_NOT_IMPLEMENTED
The backend does not support audio format queries.
PRISM_ERROR_NOT_INITIALIZED
The backend has not been initialized.
PRISM_ERROR_NOT_PAUSED
Speech is not currently paused.
PRISM_ERROR_NOT_SPEAKING
No speech is currently playing.
PRISM_ERROR_NO_VOICES
No voices are available for this backend
PRISM_ERROR_RANGE_OUT_OF_BOUNDS
A parameter value exceeded its valid range
PRISM_ERROR_SPEAK_FAILURE
Speech synthesis failed.
PRISM_ERROR_UNKNOWN
An unspecified error occurred.
PRISM_ERROR_VOICE_NOT_FOUND
The specified voice was not found
PRISM_LOG_LEVEL_DEBUG
Diagnostic information useful during development.
PRISM_LOG_LEVEL_ERROR
Error conditions.
PRISM_LOG_LEVEL_INFO
Informational messages describing normal operation.
PRISM_LOG_LEVEL_NONE
Not a message severity. When supplied to prism_set_log_level, it suppresses all messages, since no message has a severity greater than or equal to it.
PRISM_LOG_LEVEL_TRACE
The most verbose level, used for fine-grained tracing of internal operations.
PRISM_LOG_LEVEL_WARN
Conditions that are not errors but MAY indicate a problem.
PRISM_OK
Channel count was retrieved.
PRISM_PLUGIN_ABI_VERSION
The plugin ABI generation this binding describes.

Functions§

prism_availability_auto_power_supported
Reports whether this build can pause and resume polling automatically in response to operating-system power transitions.
prism_availability_poll_pause
Pauses the availability poll thread.
prism_availability_poll_resume
Resumes the availability poll thread.
prism_backend_braille
Outputs text to a connected braille display.
prism_backend_count_voices
Returns the number of voices available from the backend.
prism_backend_free
Releases a backend instance.
prism_backend_get_bit_depth
Retrieves the native bit depth of audio produced by the backend.
prism_backend_get_channels
Retrieves the number of audio channels produced by the backend.
prism_backend_get_features
Returns a bitmask of all features supported by this backend, as well as other information.
prism_backend_get_pitch
Retrieves the current speech pitch.
prism_backend_get_rate
Retrieves the current speech rate.
prism_backend_get_sample_rate
Retrieves the sample rate of audio produced by the backend.
prism_backend_get_voice
Retrieves the index of the currently selected voice.
prism_backend_get_voice_language
Retrieves the language code or language string of a voice.
prism_backend_get_voice_name
Retrieves the human-readable name of a voice.
prism_backend_get_volume
Retrieves the current speech volume.
prism_backend_initialize
Initializes a backend instance.
prism_backend_is_speaking
Queries whether the backend is currently producing speech output.
prism_backend_name
Returns the human-readable name of a backend.
prism_backend_output
Outputs text using all available modalities supported by the backend.
prism_backend_pause
Pauses currently playing speech.
prism_backend_refresh_voices
Refreshes the backend’s internal voice list.
prism_backend_resume
Resumes previously paused speech.
prism_backend_set_pitch
Sets the speech pitch.
prism_backend_set_rate
Sets the speech rate (speed).
prism_backend_set_voice
Selects a voice to use for subsequent speech synthesis.
prism_backend_set_volume
Sets the speech volume.
prism_backend_speak
Synthesizes speech from the given text and plays it through the default audio output.
prism_backend_speak_to_memory
Synthesizes speech from the given text and delivers the audio samples to a callback function.
prism_backend_stop
Immediately stops any currently playing speech.
prism_config_init
Creates a new configuration structure which can be passed to prism_init.
prism_error_string
Returns a human-readable description of an error code.
prism_init
Creates a new Prism context.
prism_log
Emits a log message.
prism_log_flush
Blocks until all messages queued before the call have been delivered.
prism_log_shutdown
Stops the logging thread and releases the resources associated with the logger.
prism_registry_acquire
Acquires a backend instance, reusing a cached instance if available or creating a new one otherwise.
prism_registry_acquire_best
Acquires the highest-priority backend that successfully initializes, reusing a cached instance if available.
prism_registry_builder_add_backend
Adds a custom backend to a registry builder.
prism_registry_builder_add_library
Loads a plugin from a shared library and adds each backend it supplies to a registry builder.
prism_registry_builder_free
Releases a registry builder.
prism_registry_builder_new
Creates a new registry builder seeded with the compiled-in backends.
prism_registry_count
Returns the number of backends registered in the registry.
prism_registry_create
Creates a new backend instance.
prism_registry_create_best
Creates a new instance of the highest-priority backend that successfully initializes.
prism_registry_exists
Checks whether a backend with the given ID exists in the registry.
prism_registry_freeze
Freezes a builder, producing an immutable registry.
prism_registry_get
Retrieves a cached backend instance if one exists.
prism_registry_id
Looks up a backend by name and returns its ID.
prism_registry_id_at
Returns the backend ID at the specified index in the registry.
prism_registry_name
Returns the human-readable name of a backend given its ID.
prism_registry_priority
Returns the priority value of a backend.
prism_registry_release
Decrements the reference count of a registry, finalizing it when the count reaches zero.
prism_registry_retain
Increments the reference count of a registry.
prism_set_log_handler
Installs the handler that receives log messages, replacing any previously installed handler.
prism_set_log_level
Sets the minimum severity of messages that will be delivered.
prism_shutdown
Destroys a Prism context and releases associated resources.
prism_version
Returns the version of the loaded Prism library as an encoded integer.
prism_version_string
Returns the version of the loaded Prism library as a human-readable string.

Type Aliases§

PrismAudioCallback
Receives audio samples from prism_backend_speak_to_memory.
PrismAvailabilityBaselineCallback
The type of a function invoked once the poll thread has established its availability baseline.
PrismAvailabilityCallback
The type of a function invoked when a backend’s runtime availability changes.
PrismBackendId
A backend’s identifier, derived from its name.
PrismError
An error code. PRISM_OK means success; every other value is a failure.
PrismLogCallback
The type of a function invoked to deliver a single log message.
PrismLogLevel
The severity of a log message, or a threshold for delivering them.
PrismPluginQueryFn
The entry point a prism plugin shared library exports.