Expand description
SharedArrayBuffer layout for zero-copy U3 uniform + sonic token mirror (Phase 7.4).
Layout: [header 32][uniform 352][tokens 128][float mirror 328] = 840 B (padded to 1024).
Structs§
- Acoustic
SabHeader - SAB header — worklet polls
uniform_seq/token_seq(Release/Acquire). - Voice
Descriptor Slot - 64-byte cache-line-aligned voice descriptor slot with monotonic SeqLock synchronization.
- Voice
Snapshot - Decoded voice snapshot returned when a SeqLock read succeeds without tear.
Constants§
- ACOUSTIC_
SAB_ BYTES - ACOUSTIC_
SAB_ FLOAT_ MIRROR_ BYTES - ACOUSTIC_
SAB_ FLOAT_ MIRROR_ OFFSET - ACOUSTIC_
SAB_ HEADER_ BYTES - ACOUSTIC_
SAB_ MAGIC - ACOUSTIC_
SAB_ TOKEN_ BYTES - ACOUSTIC_
SAB_ TOKEN_ OFFSET - ACOUSTIC_
SAB_ UNIFORM_ OFFSET - ACOUSTIC_
SAB_ UNIFORM_ PADDED - ACOUSTIC_
SAB_ VERSION - MAX_
ACOUSTIC_ VOICE_ SLOTS - VOICE_
DESCRIPTOR_ SLOT_ SIZE
Functions§
- calculate_
acoustic_ salience - Calculate acoustic salience score $S_i = \frac{A_i \cdot \mathcal{D}}{1.0 + |\vec{P}i - \vec{P}{\text{listener}}|^2}$.
- init_
acoustic_ sab - Initialise a SAB region: writes the header and zeroes the remaining
layout. Returns false when
outis smaller thanACOUSTIC_SAB_BYTES. - push_
token_ to_ sab - Push one token into SAB ring (16 slots × 8 B).
- read_
uniform_ from_ sab - Read the
AcousticUniformpayload out of the SAB region;Nonewhen the slice is too short to contain it. - read_
voice_ slot - Consumer read: reads parameters from a voice slot; returns
Noneif producer was writing or torn read occurred. - update_
voice_ slot - Producer update: writes parameters into a voice slot using odd-even SeqLock signaling.
- write_
uniform_ to_ sab - Write pod uniform + optional f32 mirror for worklet
Float32Arrayview. - write_
uniform_ to_ sab_ with_ mirror - Write the uniform plus an optional
f32mirror region for a workletFloat32Arrayview, then bumpuniform_seq. Returns false whenoutis too small or the uniform would overlap the token region.