Voice 10: fluxer-core::voice soundboard and entrance sounds (#71) #130
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "voice-10-core-soundboard"
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
The soundboard and entrance sounds in
fluxer-core::voice(Voice spec §5.2):voice/soundboard.rs:Soundboard(by_guild, defaults, favourites <= 100, cooldown_until, listener_mutes, upload state), lazy per-guild fetch onOpenSoundboard, the threeGUILD_SOUNDBOARD_SOUND_*events,VOICE_CHANNEL_EFFECT_SEND->FetchMedia->AudioCommand::PlayClipwith gain capped at 3, sender marked speaking for duration + 80 ms, emoji shown (active_effects), 429 cooldown fromretry_afteror 2000 ms, upload validation (name 2-32, <= 20 MiB, MP3/OGG/M4A/WAV sniffed, <= 200 per guild), selectorssoundboard_picker,can_use_soundboard.voice/entrance.rs: after connecting,FetchEntranceSoundsthenPostEntranceSoundwith the scope-resolved selection (guild, guilds, global / dms, global);ENTRANCE_SOUND_PLAYplays after the sender's join chime, waiting up to 1500 ms for their voice state.ApiRequest/ApiResult/UserActionvariants as in the Interfaces block (plusFetchEntranceSounds,SoundSent,EntranceSoundPosted); favourites and listener mutes persisted inLocalSettings::soundboard.Testing
crates/fluxer-core/tests/soundboard.rs: all nine plan tests, driven throughApp::applywith the scrubbed fixtures. Unit tests for favourite keys, audio sniffing, name checks, entrance scope fallback.FLUXER_SCREENSHOT_TESTS=1 cargo xtask cigreen locally.Deviations / outside the Files list
guilds.rs:Guilds::permissions_in(user, channel)extracted fromselectors::sidebar::can_view(which now uses it) so the soundboard can check CONNECT/SPEAK/USE_SOUNDBOARD/USE_EXTERNAL_SOUNDS.voice/live.rs:has_roommadepub(crate);user_speakingincludes a playing clip unless the sender shows muted.tests/calls.rs: theapihelper ignoresFetchEntranceSounds, which every connection now makes.apps/fluxer/src/runtime.rs: arms for the new requests so the workspace compiles;FetchMediadownloads and drops the bytes until Voice 14 wires the audio engine.fluxer-platformsettings:[voice.soundboard]table (favourites, listener_mutes) with a round-trip assertion.persist.rs:#[allow(clippy::large_enum_variant)]onPersistResult(the new boxed field tippedLoadedover the lint threshold; boxing it would touch ~20 call sites).SoundCreated/SoundUpdatedcarryBox<SoundboardSound>.Closes #71
🤖 Generated with Claude Code
Independent review: Voice 10 (core-soundboard), commit
add3ec1I reviewed only
4b4e513..origin/voice-10-core-soundboard.(1) Plan tests: all 9 named tests are in
crates/fluxer-core/tests/soundboard.rsand check the spec's values: gain = sound volume × soundboard volume × output volume, capped at 3 (Review Focus 5; it also covers NaN and infinite inputs); speaking lasts the clip duration + 80 ms; a 429 sets the cooldown fromretry_after, or 2000 ms when it is missing; at most 100 favourites with keys<guild|default>:<sound>, kept in the settings; picker order is favourites, current guild, external guilds, defaults, withUSE_EXTERNAL_SOUNDSgating the external ones; the three gateway events update the list; upload checks name 2–32, size up to 20 MiB and at most 200 sounds per guild before any request; the entrance sound is posted after connect and plays after the join chime.(2) Interfaces:
Soundboard { by_guild, defaults, favourites: Vec<String>, cooldown_until, listener_mutes }, everyApiRequest/ApiResult/UserActionvariant listed, andsoundboard_picker(&App) -> PickerModel,can_use_soundboard(&App) -> boolandactive_effects(&App)exist, re-exported fromselectors.cooldown_untilis anOption<SendCooldown>(a timer and its duration), not a timestamp. That fits the store having no clock, and the UI only needs to checkis_some.(3) Invariants: fluxer-core gains no dependency and no I/O. Server data cannot panic it: favourite keys are parsed with checks, durations are capped at
MAX_CLIP_DURATION, gains are clamped, and the settings file is normalised on load.SoundBytesDebug does not print the file. No tokens are in code or fixtures.fetch_media(from Task 2) does not attach auth. Theclippy::large_enum_variantallow onPersistResultis reasonable: it has a reason and covers a one-shot variant. The muted-sender speaking rule (shown_muted= self_mute | mute | suppress) matchesparticipant_speakingand spec §5.2. Moving the permission code fromsidebar::can_viewintoGuilds::permissions_inkeeps the behaviour the same.(4) Review Focus 5: met (see (1)).
(5)
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: green locally (all steps passed).Findings
FetchMediafor a clip key it is not already fetching, and leaves the cache short-cut to the runtime (theApiResult::Mediadoc says "or the audio engine still has it"). This is fine as long as Voice 14 answersFetchMediafrom the engine cache without a download. Voice 14 should note it.shown_muteddoes not countdeaf/self_deaf, whereas spec "effective mute" does. This matches the existingparticipant_speaking, and a deafened sender cannot send a sound, so the only case left is an entrance sound from a deafened joiner showing them speaking. Cosmetic.Verdict: APPROVE. No blocking findings, and ci is green locally.