A defeat sound when Maia offers to resign
Some checks are pending
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run

Every sound set gets a Defeat sound, played when Maia offers to resign: the
Lichess sets their own Defeat.ogg (sfx, piano, futuristic, nes — Enigmahack,
AGPLv3+, unmodified), the Kenney sets a falling tone of «Interface Sounds»
(CC0: clicks minimize_006, the pair of its checkmate maximize_006; wood
minimize_008; glass minimize_004), leading silence trimmed and the peak matched
to the set's checkmate sound. Sources in THIRD_PARTY_NOTICES.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-25 13:11:16 +03:00
parent 5e7a588368
commit 53da355044
10 changed files with 25 additions and 6 deletions

View file

@ -556,6 +556,8 @@ pub enum Sound {
Capture,
Check,
Checkmate,
/// A game lost — here: Maia offers to resign.
Defeat,
}
pub fn sound_bytes(set: SoundSet, sound: Sound) -> &'static [u8] {
@ -590,6 +592,13 @@ pub fn sound_bytes(set: SoundSet, sound: Sound) -> &'static [u8] {
(SoundSet::Clicks, Sound::Capture) => s!("clicks", "Capture"),
(SoundSet::Clicks, Sound::Check) => s!("clicks", "Check"),
(SoundSet::Clicks, Sound::Checkmate) => s!("clicks", "Checkmate"),
(SoundSet::Sfx, Sound::Defeat) => s!("sfx", "Defeat"),
(SoundSet::Piano, Sound::Defeat) => s!("piano", "Defeat"),
(SoundSet::Futuristic, Sound::Defeat) => s!("futuristic", "Defeat"),
(SoundSet::Nes, Sound::Defeat) => s!("nes", "Defeat"),
(SoundSet::Wood, Sound::Defeat) => s!("wood", "Defeat"),
(SoundSet::Glass, Sound::Defeat) => s!("glass", "Defeat"),
(SoundSet::Clicks, Sound::Defeat) => s!("clicks", "Defeat"),
}
}
@ -601,7 +610,13 @@ mod tests {
fn every_sound_is_a_real_ogg_file() {
// Lichess keeps some sounds as git symlinks; a copied link is a few bytes of text.
for set in SoundSet::ALL {
for s in [Sound::Move, Sound::Capture, Sound::Check, Sound::Checkmate] {
for s in [
Sound::Move,
Sound::Capture,
Sound::Check,
Sound::Checkmate,
Sound::Defeat,
] {
let b = sound_bytes(set, s);
assert!(b.starts_with(b"OggS") && b.len() > 1000, "{set:?} {s:?}");
}

View file

@ -2291,6 +2291,7 @@ impl GameView {
s.opponent.forget();
s.resign_offer = Some(std::time::Instant::now());
self.scroll_to_cursor = true;
actions.push(GameAction::Sound(Sound::Defeat));
return;
}
}