Voice 8: fluxer-core::voice live room, subscriptions, volumes, speaking, chimes (#69) #117
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "voice-8-core-live-room-volumes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this builds
Voice plan Task 8 (spec §5.2 "Subscription policy", "Gain", "Speaking", "Chimes"), in
fluxer-core::voice:voice/live.rs—LiveRoom(app.voice.live): remote participants by LiveKit identity (parse_identity, the original'suser_(\d+)_(.+)), their tracks,rtt()andrtt_history()(60 samples). Malformed identities and this client's own are ignored everywhere.TrackPublishedof a microphone emitsSetSubscribed(true iff not effectively deaf and the user is not locally muted) andAudioCommand::SetGain. After every event the policy is re-evaluated for every microphone publication and only changes are sent: deafen/undeafen (self or by a moderator),SetLocalMute,SetUserVolume; everything is sent again afterVoiceEvent::Reconnected. Other sources get one explicitSetSubscribed { subscribed: false }on publish (as the original'sVoiceRoomEventBinder) and are never subscribed.voice/volumes.rs—ParticipantVolumes { volumes, local_mutes }(app.voice.volumes),UserAction::{SetUserVolume { user_id, percent }, SetLocalMute { user_id, muted }}, persisted inLocalSettings::participant_volumes([voice.volumes]table andvoice.local_mutesinsettings.toml; old files load).volume_gainis the original's curve,participant_gain(user, output)the product.voice/speaking.rs— the level detector with the original's 30 ms attack / 220 ms release and threshold (0.006 RMS at the default sensitivity), counted in 50 ms level reports because the store has no clock. Selectorsis_speaking,self_speaking,voice_ping;VoiceParticipantRow::speakingis now live. Speaking is hidden while the user shows as self-muted, server-muted or suppressed.How it was tested
crates/fluxer-core/tests/voice_live.rs: the nine tests the plan names, plus volumes loading/persisting, track mute, ping history, "nobody chimes while not in a room", "participant leaving removes its playback source", and a proptest that walks random room/gateway/user events and checks after every step that what the room was told equals the policy (a microphone is received exactly when not deaf and not locally muted; nothing else is ever subscribed). Unit tests for the curve, the detector and the identity parser.crates/fluxer-platform/tests/settings.rsround-trips the new keys and loads hand-written junk.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciis green locally.Review focus 1 (deafen must stop receiving and mute the microphone):
deafen_unsubscribes_all_mics_and_undeafen_resubscribes.Deviations from the plan
event.rs(the twoUserActions the Interfaces block asks for),app.rs(two lines:Voice::load_settings, pass&Voiceto the persist reducer),voice/connection.rs(three lines: callreduce_live, empty the room on a newConnectand on close),selectors/mod.rsandlib.rs(re-exports),fluxer-platformsettings.rs+ test (the file format, as Task 7 did for[voice]), both READMEs.tests/voice_connection.rs::events_of_later_tasks_are_acceptedasserted that a published microphone has no effects; that is exactly what this task changes, so that event moved out of the "no effects" loop.LocalSettings::participant_volumesis aBox<ParticipantVolumes>: unboxed, the settings pushedPersistOp/PersistResultover clippy'slarge_enum_variantlimit, and boxing the enum variants instead would have changed signatures other crates build against.composeVoiceVolumeGain) puts the output volume through the same curve, and so doesparticipant_gain. The setting itself arrives with Task 9; until thenVoice::output_volume_percent()andVoice::vad_threshold()return the original's defaults (100, 50) — Task 9 only has to change those two functions, gains are re-evaluated after every event.Stacked on: voice-7-core-voice-connection
Closes #69
🤖 Generated with Claude Code
The ports of Voice spec §5.3 (voice::port), Effect::{Voice, Audio}, CoreEvent::{Voice, Audio, GatewayError}, the connection machine (VoiceConnection, VoiceFailure) with join, leave, move, kick, resume and token refresh, the user's mute and deafen switches (LocalVoiceState) saved in a new [voice] section of the local settings, and effective_mute / effective_deaf. fluxer-platform reads and writes the new settings section; apps/fluxer drops the two new effects until the voice runtime (Voice 14) exists. Refs #68 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>Independent review: Voice 8 (core live room, volumes, speaking, chimes)
Reviewed
6a8bab0..e68ab28cold, against the plan's Task 8, spec §5.2 and the fork.1. Plan tests — all nine exist in
tests/voice_live.rsand assert what the plan says:mic_track_subscribed_when_not_deaf,deafen_unsubscribes_all_mics_and_undeafen_resubscribes,local_mute_unsubscribes_that_user_only,camera_and_screen_tracks_never_subscribed,gain_is_curve_times_output_volume(0 / 50 / 100 / 150 / 200 % = 0, 10^-0.6, 1, 2, 4 to 1e-4, same asVoiceVolumeUtils.ts),speaking_is_active_speaker_or_level_and_hidden_when_muted,join_chime_deduplicated_within_2000ms(timer is exactly 2000 ms),leave_chime_for_my_channel_only,malformed_identity_is_ignored. Clearing the duplicate window on a leave matches the original (recentJoinChimesByConnectionId.delete).2. Interfaces —
ParticipantVolumes { volumes, local_mutes },UserAction::{SetUserVolume { user_id, percent }, SetLocalMute { user_id, muted }},is_speaking(&App, user_id),self_speaking(&App),voice_ping(&App),App.voice.{volumes, live}are present as written and persisted ([voice.volumes],voice.local_mutes; old files load).3. Invariants — no new dependency in
fluxer-core, core-isolation step green, no I/O. Identities, levels (NaN) and settings values from outside cannot panic; the proptest covers it. No secrets in code or fixtures.4. Review Focus 1 — covered: self deafen and server deafen each emit
SetSubscribed { subscribed: false }for every microphone andSetMicrophoneMuted(true); undeafen resubscribes; a microphone published while deaf is toldfalse;Reconnectedre-tells the room.5. CI —
FLUXER_SCREENSHOT_TESTS=1 cargo xtask cione68ab28in a clean target dir: all steps passed. Remote runners not checked.Findings
voice/live.rs:LiveRoomexposesrtt()/rtt_history()/participants()as methods over private fields, where the plan's Interfaces block readsrtt: Option<Duration>. Nothing merged reads the field andvoice_pingis the selector, but Voice 17 (ping graph) has to uselive.rtt_history().voice/speaking.rs: attack/release are counted in 50 ms reports, so the effective times are 50 ms / 250 ms instead of 30 / 220 ms, and they stretch or shrink if the audio engine (Voice 4/14) reports at another rate. Voice 14 has to keep the ~20 Hz cadence or pass elapsed time.voice/live.rsParticipantLeft: core only forgets the participant; no command frees the mixer source (the port has none). Plan says "participant leaving removes its playback source", so Voice 14 has to drop the source on the room'sParticipantLeftitself. Worth afollow-upissue so it is not lost.voice/volumes.rsparticipant_gain: the output volume goes through the curve (as the original'scomposeVoiceVolumeGain) where spec §5.2 says a plain "× output volume". Identical at the fixed 100 % today; Voice 9 should confirm which one is meant when it wires the setting.event.rs,app.rs,voice/connection.rs,fluxer-platform/settings.rsare outside the task's file list, andvoice_connection.rs::events_of_later_tasks_are_accepted(Voice 7) was edited. All of it is needed for the task and the edit only moves the microphone publication out of the "no effects" loop; Voice 9/10 will touch the same lines (LocalSettingsis now boxed forParticipantVolumesbecause oflarge_enum_variant).Verdict: approve — no blocking findings, local ci green.