Expand description
Raw FFI bindings to prism (https://github.com/ethindp/prism), a platform-agnostic speech and screen reader output library.
Structs§
- Prism
Backend - An opaque backend instance obtained from a registry.
- Prism
BackendV Table - A table of function pointers implementing a custom backend.
- Prism
Config - A struct containing configuration parameters for Prism or it’s back-ends to use.
- Prism
Context - An opaque prism context, holding a backend registry.
- Prism
LogHandler - A structure pairing a log callback with an opaque user pointer.
- Prism
Plugin Backend - A descriptor supplied by a plugin to describe a single backend.
- Prism
Plugin Host - A structure describing the loading Prism library, passed to a plugin’s entry point.
- Prism
Plugin Instance Context - The structure Prism passes as the
userdataargument to thecreatemember of a backend supplied by a plugin. The context is valid only for the duration of thecreatecall; the services object it names is valid for the longer period given under Host services. - Prism
Plugin Services - 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.
- Prism
Registry - An opaque, immutable set of backend registrations.
- Prism
Registry Builder - 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_initializeMAY still fail. - PRISM_
BACKEND_ JAWS - JAWS screen reader (Windows)
- PRISM_
BACKEND_ NVDA - NVDA screen reader (Windows)
- PRISM_
BACKEND_ ONE_ CORE - Windows
OneCorespeech 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_brailleis implemented.- PRISM_
BACKEND_ SUPPORTS_ COUNT_ VOICES prism_backend_count_voicesis implemented.- PRISM_
BACKEND_ SUPPORTS_ GET_ BIT_ DEPTH prism_backend_get_bit_depthis implemented.- PRISM_
BACKEND_ SUPPORTS_ GET_ CHANNELS prism_backend_get_channelsis implemented.- PRISM_
BACKEND_ SUPPORTS_ GET_ PITCH prism_backend_get_pitchis implemented.- PRISM_
BACKEND_ SUPPORTS_ GET_ RATE prism_backend_get_rateis implemented.- PRISM_
BACKEND_ SUPPORTS_ GET_ SAMPLE_ RATE prism_backend_get_sample_rateis implemented.- PRISM_
BACKEND_ SUPPORTS_ GET_ VOICE prism_backend_get_voiceis implemented.- PRISM_
BACKEND_ SUPPORTS_ GET_ VOICE_ LANGUAGE prism_backend_get_voice_languageis implemented.- PRISM_
BACKEND_ SUPPORTS_ GET_ VOICE_ NAME prism_backend_get_voice_nameis implemented.- PRISM_
BACKEND_ SUPPORTS_ GET_ VOLUME prism_backend_get_volumeis implemented.- PRISM_
BACKEND_ SUPPORTS_ IS_ SPEAKING prism_backend_is_speakingis implemented.- PRISM_
BACKEND_ SUPPORTS_ OUTPUT prism_backend_outputis implemented.- PRISM_
BACKEND_ SUPPORTS_ PAUSE prism_backend_pauseis implemented.- PRISM_
BACKEND_ SUPPORTS_ REFRESH_ VOICES prism_backend_refresh_voicesis implemented.- PRISM_
BACKEND_ SUPPORTS_ RESUME prism_backend_resumeis implemented.- PRISM_
BACKEND_ SUPPORTS_ SET_ PITCH prism_backend_set_pitchis implemented.- PRISM_
BACKEND_ SUPPORTS_ SET_ RATE prism_backend_set_rateis implemented.- PRISM_
BACKEND_ SUPPORTS_ SET_ VOICE prism_backend_set_voiceis implemented.- PRISM_
BACKEND_ SUPPORTS_ SET_ VOLUME prism_backend_set_volumeis implemented.- PRISM_
BACKEND_ SUPPORTS_ SPEAK prism_backend_speakis implemented.- PRISM_
BACKEND_ SUPPORTS_ SPEAK_ SSML - Reserved.
- PRISM_
BACKEND_ SUPPORTS_ SPEAK_ TO_ MEMORY prism_backend_speak_to_memoryis implemented.- PRISM_
BACKEND_ SUPPORTS_ SPEAK_ TO_ MEMORY_ SSML - Reserved.
- PRISM_
BACKEND_ SUPPORTS_ STOP prism_backend_stopis implemented.- PRISM_
BACKEND_ SYSTEM_ ACCESS SystemAccessscreen reader (windows) (only available if explicitly enabled at build time)- PRISM_
BACKEND_ UIA UIAutomationbackend (Windows only)- PRISM_
BACKEND_ VOICE_ OVER VoiceOverscreen reader (macOS,MacCatalyst, iOS,WatchOS, tvOS,VisionOS)- PRISM_
BACKEND_ WEB_ SPEECH - Web
SpeechSynthesisAPI (web) - PRISM_
BACKEND_ WINDOW_ EYES WindowEyesscreen 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
PrismConfiglayout 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
sizemember was zero, the declared feature set was inconsistent with the vtable, or the priority value was negative. - PRISM_
ERROR_ INVALID_ UTF8 textcontains 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§
- Prism
Audio Callback - Receives audio samples from
prism_backend_speak_to_memory. - Prism
Availability Baseline Callback - The type of a function invoked once the poll thread has established its availability baseline.
- Prism
Availability Callback - The type of a function invoked when a backend’s runtime availability changes.
- Prism
Backend Id - A backend’s identifier, derived from its name.
- Prism
Error - An error code.
PRISM_OKmeans success; every other value is a failure. - Prism
LogCallback - The type of a function invoked to deliver a single log message.
- Prism
LogLevel - The severity of a log message, or a threshold for delivering them.
- Prism
Plugin Query Fn - The entry point a prism plugin shared library exports.