Soundboard 56: fluxer-core soundboard: preview, live cooldown, managing any guild's sounds, editing #385

Closed
opened 2026-11-13 01:40:48 +00:00 by charles · 0 comments
Owner

Plan: docs/superpowers/plans/2026-11-12-textchat.md, section "Task 56" (Soundboard and entrance sounds, added 2026-11-12, high priority per Charles).

Task 56: fluxer-core soundboard: preview, live cooldown, managing any guild's sounds, editing

Issue: (to be created)
Closes: none (the store half of #138, #140 and #141; Task 59 closes them).

Files:

  • Modify: crates/fluxer-core/src/voice/{soundboard.rs,port.rs,mod.rs}, crates/fluxer-core/src/{guilds.rs,event.rs,effect.rs,selectors/mod.rs}, crates/fluxer-core/README.md
  • Test: crates/fluxer-core/tests/soundboard.rs

Interfaces:

  • Produces (preview, SoundboardPlaybackEngine.preview): UserAction::PreviewSound { guild_id: Option<Snowflake>, sound_id: Snowflake, volume: Option<f64> } — ApiRequest::FetchMedia under the same clip key as playing the sound, then AudioCommand::PlayClip with the new ClipKind::Preview at soundboard_gain(volume.unwrap_or(sound.volume), soundboard_volume, output_volume); plays in or out of a call, ignores "Play soundboard sounds" and listener mutes (the original's comment: auditioning), marks nobody speaking, shows no effect emoji; one preview at a time on PREVIEW_CLIP_TAG: ClipTag (a new preview replaces the old). UserAction::PreviewLocalSound { bytes: SoundBytes, content_type: String, volume: f64 } → AudioCommand::PlayClipBytes { key: String /* "local:<n>", fresh each time */, bytes: SoundBytes, content_type: String, gain: f32, tag: ClipTag /* PREVIEW_CLIP_TAG */ } (the trimmer's "Play selection" and the edit dialog's "Preview" of a file not yet uploaded); UserAction::StopPreview → AudioCommand::StopClip(PREVIEW_CLIP_TAG); Soundboard::previewing: bool (set on play, cleared by ClipFinished of that tag or StopPreview).

  • Produces (cooldown, #138; the store still has no clock, #109): SendCooldown { timer: TimerId, duration: Duration, remaining: Duration, tick: TimerId }; after a 429 the store schedules tick at remaining % 1 s (1 s when that is zero), then every 1 s, subtracting what elapsed, so remaining.as_millis().div_ceil(1000) is exactly the original's Math.ceil(cooldownMs / 1000) at every step; PickerModel::cooldown = remaining; when timer fires the cooldown and its tick are dropped and blocked is no longer Cooldown.

  • Produces (#140, GuildSoundboardTab.tsx's canModifySound): Guilds::guild_permissions(&self, user_id: Snowflake, guild_id: Snowflake) -> Permissions (owner → all; @everyone + member roles; ADMINISTRATOR → all; unknown guild → empty; the base of permissions_in without overwrites); selectors::can_manage_sound(app: &App, guild_id: Snowflake, sound_id: Snowflake) -> bool — MANAGE_EXPRESSIONS in that guild, or CREATE_EXPRESSIONS there and the sound's user_id is the current user; any guild the user is in, not only the call's; selectors::can_upload_sound(app, guild_id) -> bool (CREATE_EXPRESSIONS or MANAGE_EXPRESSIONS in the guild).

  • Produces (edit, GuildSoundboardSoundModal.tsx mode edit): UserAction::EditSound { guild_id: Snowflake, sound_id: Snowflake, name: String, volume: f64, emoji: Option<SoundEmoji> } → ApiRequest::UpdateSound with only the fields that differ from the stored sound (emoji: None on a sound that has one sends emoji_id: null, emoji_name: null), name checked as for upload (UploadError::Name), nothing sent when nothing changed; outcome in Soundboard::edit: EditState::{Idle, Saving { sound_id }, Failed { sound_id, error: UploadError }}, cleared on SoundUpdated. RenameSound stays (an EditSound with the other fields unchanged).

  • Step 1: Write failing tests: preview_fetches_then_plays_at_soundboard_gain, `preview_plays_with_soundboard_sounds_off_and_ou

🤖 Generated with Claude Code

Plan: `docs/superpowers/plans/2026-11-12-textchat.md`, section "Task 56" (Soundboard and entrance sounds, added 2026-11-12, high priority per Charles). ### Task 56: `fluxer-core` soundboard: preview, live cooldown, managing any guild's sounds, editing **Issue:** (to be created) **Closes:** none (the store half of #138, #140 and #141; Task 59 closes them). **Files:** - Modify: `crates/fluxer-core/src/voice/{soundboard.rs,port.rs,mod.rs}`, `crates/fluxer-core/src/{guilds.rs,event.rs,effect.rs,selectors/mod.rs}`, `crates/fluxer-core/README.md` - Test: `crates/fluxer-core/tests/soundboard.rs` **Interfaces:** - Produces (preview, `SoundboardPlaybackEngine.preview`): `UserAction::PreviewSound { guild_id: Option<Snowflake>, sound_id: Snowflake, volume: Option<f64> }` — `ApiRequest::FetchMedia` under the same clip key as playing the sound, then `AudioCommand::PlayClip` with the new `ClipKind::Preview` at `soundboard_gain(volume.unwrap_or(sound.volume), soundboard_volume, output_volume)`; plays in or out of a call, ignores "Play soundboard sounds" and listener mutes (the original's comment: auditioning), marks nobody speaking, shows no effect emoji; one preview at a time on `PREVIEW_CLIP_TAG: ClipTag` (a new preview replaces the old). `UserAction::PreviewLocalSound { bytes: SoundBytes, content_type: String, volume: f64 }` → `AudioCommand::PlayClipBytes { key: String /* "local:<n>", fresh each time */, bytes: SoundBytes, content_type: String, gain: f32, tag: ClipTag /* PREVIEW_CLIP_TAG */ }` (the trimmer's "Play selection" and the edit dialog's "Preview" of a file not yet uploaded); `UserAction::StopPreview` → `AudioCommand::StopClip(PREVIEW_CLIP_TAG)`; `Soundboard::previewing: bool` (set on play, cleared by `ClipFinished` of that tag or `StopPreview`). - Produces (cooldown, #138; the store still has no clock, #109): `SendCooldown { timer: TimerId, duration: Duration, remaining: Duration, tick: TimerId }`; after a 429 the store schedules `tick` at `remaining % 1 s` (1 s when that is zero), then every 1 s, subtracting what elapsed, so `remaining.as_millis().div_ceil(1000)` is exactly the original's `Math.ceil(cooldownMs / 1000)` at every step; `PickerModel::cooldown` = `remaining`; when `timer` fires the cooldown and its tick are dropped and `blocked` is no longer `Cooldown`. - Produces (#140, `GuildSoundboardTab.tsx`'s `canModifySound`): `Guilds::guild_permissions(&self, user_id: Snowflake, guild_id: Snowflake) -> Permissions` (owner → all; `@everyone` + member roles; `ADMINISTRATOR` → all; unknown guild → empty; the base of `permissions_in` without overwrites); `selectors::can_manage_sound(app: &App, guild_id: Snowflake, sound_id: Snowflake) -> bool` — `MANAGE_EXPRESSIONS` in that guild, or `CREATE_EXPRESSIONS` there and the sound's `user_id` is the current user; any guild the user is in, not only the call's; `selectors::can_upload_sound(app, guild_id) -> bool` (`CREATE_EXPRESSIONS` or `MANAGE_EXPRESSIONS` in the guild). - Produces (edit, `GuildSoundboardSoundModal.tsx` mode `edit`): `UserAction::EditSound { guild_id: Snowflake, sound_id: Snowflake, name: String, volume: f64, emoji: Option<SoundEmoji> }` → `ApiRequest::UpdateSound` with only the fields that differ from the stored sound (`emoji: None` on a sound that has one sends `emoji_id: null, emoji_name: null`), name checked as for upload (`UploadError::Name`), nothing sent when nothing changed; outcome in `Soundboard::edit: EditState::{Idle, Saving { sound_id }, Failed { sound_id, error: UploadError }}`, cleared on `SoundUpdated`. `RenameSound` stays (an `EditSound` with the other fields unchanged). - [ ] **Step 1: Write failing tests**: `preview_fetches_then_plays_at_soundboard_gain`, `preview_plays_with_soundboard_sounds_off_and_ou 🤖 Generated with [Claude Code](https://claude.com/claude-code)
charles added this to the Text chat milestone 2026-11-13 01:40:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#385
No description provided.