Text chat 56: fluxer-core soundboard: preview, live cooldown, managing any guild's sounds, editing (#385) #399
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "textchat-56-core-soundboard-parity"
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 (Text chat 56,
fluxer-coresoundboard)SoundboardPlaybackEngine.preview):UserAction::PreviewSound { guild_id, sound_id, volume }fetches the sound under the same clip key that playing it uses, then sendsAudioCommand::PlayClipunderPREVIEW_CLIP_TAG(ClipTag(u64::MAX)) atsoundboard_gain(volume.unwrap_or(sound.volume), soundboard_volume, output_volume), using the newClipKind::Preview { gain }. It plays in or out of a call and ignores "Play soundboard sounds", the listener mutes and deafening. Nobody is marked as speaking and no effect emoji shows.PreviewLocalSound { bytes, content_type, volume }sendsAudioCommand::PlayClipBytesunder a freshlocal:<n>key.StopPreviewsendsAudioCommand::StopClip(PREVIEW_CLIP_TAG). Only one preview plays at a time: a new preview drops one still being fetched and stops one that is playing.Soundboard::previewingis set on play and cleared byClipFinishedof that tag or byStopPreview. TheClipFinishedof a preview the store already stopped is counted and ignored, so it does not end the next preview.SendCooldown { timer, duration, remaining, tick }. The first tick fires atremaining % 1 s(or 1 s when that is zero), then every 1 s. The last second ends withtimer, so no extra tick is scheduled for it.PickerModel::cooldownis nowremaining.Guilds::guild_permissions(user, guild)is the base ofpermissions_in, which now uses it.selectors::can_manage_soundandselectors::can_upload_soundare new.UserAction::EditSound { guild_id, sound_id, name, volume, emoji }sendsApiRequest::UpdateSoundwith only the changed fields. An emoji change writes bothemoji_idandemoji_name; removing the emoji sendsnull/null. Nothing is sent when nothing changed, and an invalid name is not sent. The outcome is inSoundboard::edit: EditState, whichSoundUpdatedclears.RenameSoundis unchanged.Tests
All 20 tests the plan names are in
crates/fluxer-core/tests/soundboard.rs. I saw them fail to compile before the implementation and pass after it. The existing soundboard and entrance tests still pass.FLUXER_SCREENSHOT_TESTS=1 cargo xtask cipasses locally on Linux.Deviations from the plan
UploadError::Name. The merged code hasUploadError::NameLength, so I used that.apps/fluxer/src/audio_rt.rsis outside the Files list. I changed it only so the runtime compiles with the two newAudioCommandvariants:PlayClipBytesgoes toAudioEngine::play_clipwith the bytes.StopClipsets the clip's gain to 0 for now, becauseAudioEngine::stop_clipcomes in Task 58. Task 61 does the full wiring.effect.rs:ApiRequest::UpdateSoundalready existed.Closes #385
🤖 Generated with Claude Code
Independent review: Text chat 56 (
9424abd, diff 6113a8e..textchat-56-core-soundboard-parity)Checks
crates/fluxer-core/tests/soundboard.rs, and each asserts what the plan asks with the spec's values. The cooldown runs 2400 ms, then a tick at 400 ms, then 2000, then 1000, shown as 3, 2, 1 seconds. The fallback counts down from 2 s. Clearing the emoji sends{"emoji_id":null,"emoji_name":null}. An invalid name and an edit with no changes send nothing.PreviewSound,PreviewLocalSound,StopPreview,PlayClipBytes {key, bytes, content_type, gain, tag},StopClip(ClipTag),PREVIEW_CLIP_TAG,ClipKind::Preview { gain }(pub(crate); Task 57 uses it inside core),Soundboard::previewing,SendCooldown {timer, duration, remaining, tick},PickerModel::cooldown = remaining,Guilds::guild_permissions,can_manage_sound,can_upload_sound,EditSound,EditState::{Idle, Saving, Failed}, andRenameSoundis kept. The one deviation isUploadError::NameLengthin place of the plan'sUploadError::Name. The merged code already usesNameLength, so this is accepted.SoundBytes, whoseDebugprints only the byte count. No path, URL or bytes are logged, and the change adds no new fixtures.permissions_innow builds onguild_permissionsand behaves the same as before.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin the review worktree: all steps passed.Findings
voice/soundboard.rs(stopped_previews): the counter is wrong whenever the engine sends noClipFinishedfor a stopped preview.audio_rt(until Task 61),StopCliponly sets the gain to 0. The nextPlayClipunder the same tag replaces the old clip in the engine (engine.rs"The same tag again replaces what it was playing"), and the engine reports noClipFinishedfor it. So whenever a new preview replaces one that is playing, the counter stays at 1, andpreviewingstays true after the new preview ends.stop_clipreports nothing when the clip has already ended (the race the implementer describes).stop_clipreportClipFinishedexactly once perStopClip, even when nothing is playing, or the store should track previews by generation instead of counting.voice/soundboard.rs(channel change): joining a call resetspreviewingto false without sendingStopClip. An out-of-call preview that is still playing then shows as stopped. This is only the button state.edit_sound: for a sound whose list is not loaded, every field is sent, includingemoji_id/emoji_name: nullwhenemojiisNone, which clears a server-side emoji. The dialog always opens from a loaded tile, so this is acceptable. Noted for Task 59.PreviewLocalSoundgain: this uses soundboard volume × output volume. The entrance trimmer (Tasks 57/60) may want the output volume alone, asplayPreviewdoes.Verdict: approve. There are no blocking findings, and local CI is green.