AUDIO
Source snapshot · 11 November 2026

API reference / ravet_gain::state

Module state 

Expand description

Legacy scalar state and complete portable gain/bypass state.

The 20-byte little-endian record stores product magic, schema version, permanent parameter ID, and requested amplitude. It excludes smoothing progress, host channel configuration, and transient diagnostics. Stream I/O belongs on the control thread; decode fully before changing live state. encode_parameters and decode_parameters provide the separate complete version-two record, with explicit migration from version one. CLAP now saves version two and loads either version; GainState retains the scalar API.

Structs§

GainState
A validated gain snapshot, suitable for complete atomic publication.

Enums§

StateError

Constants§

PARAMETERS_STATE_BYTES
Complete gain/bypass record size; CLAP also uses this version-two format.
STATE_BYTES

Functions§

decode_parameters
Decode a complete version-two record or explicitly migrate a legacy version-one scalar record with bypass off. No processor state is changed.
encode_parameters
Encode version two using the reusable stable-ID codec. Validate against the product schema before encoding; display/schema order does not define identity.
read_parameters
Read a complete version-two or legacy version-one record using at most 33 bytes (including EOF probe). Short reads and Interrupted are supported. Decode fully before publishing; stream I/O belongs on the control thread.
write_parameters
Write the canonical complete version-two record, supporting short writes. Discard a partially written destination if an I/O failure occurs.