Skip to content

Commit

Permalink
Merge pull request #16220 from Zinkelburger/add_checkmate_sound
Browse files Browse the repository at this point in the history
Add "checkmate" sound to robot voice
  • Loading branch information
ornicar authored Oct 14, 2024
2 parents 8c580ab + f4d2e47 commit bce53c8
Show file tree
Hide file tree
Showing 21 changed files with 29 additions and 4 deletions.
1 change: 1 addition & 0 deletions public/oops/sounds.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ <h1>Sound Test Page</h1>
'draw',
'berserk',
'check',
'checkmate',
'newChallenge',
'newPM',
'confirmation',
Expand Down
1 change: 1 addition & 0 deletions public/sound/futuristic/Checkmate.mp3
1 change: 1 addition & 0 deletions public/sound/futuristic/Checkmate.ogg
1 change: 1 addition & 0 deletions public/sound/instrument/Checkmate.mp3
1 change: 1 addition & 0 deletions public/sound/instrument/Checkmate.ogg
1 change: 1 addition & 0 deletions public/sound/lisp/Checkmate.mp3
1 change: 1 addition & 0 deletions public/sound/lisp/Checkmate.ogg
1 change: 1 addition & 0 deletions public/sound/nes/Checkmate.mp3
1 change: 1 addition & 0 deletions public/sound/nes/Checkmate.ogg
1 change: 1 addition & 0 deletions public/sound/piano/Checkmate.mp3
1 change: 1 addition & 0 deletions public/sound/piano/Checkmate.ogg
Binary file added public/sound/robot/Checkmate.mp3
Binary file not shown.
Binary file added public/sound/robot/Checkmate.ogg
Binary file not shown.
1 change: 1 addition & 0 deletions public/sound/sfx/Checkmate.mp3
1 change: 1 addition & 0 deletions public/sound/sfx/Checkmate.ogg
1 change: 1 addition & 0 deletions public/sound/standard/Checkmate.mp3
1 change: 1 addition & 0 deletions public/sound/standard/Checkmate.ogg
1 change: 1 addition & 0 deletions public/sound/woodland/Checkmate.mp3
1 change: 1 addition & 0 deletions public/sound/woodland/Checkmate.ogg
6 changes: 5 additions & 1 deletion ui/round/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,11 @@ export default class RoundController implements MoveRootCtrl {
},
check: !!o.check,
});
if (o.check) site.sound.play('check', o.volume);
if (o.status?.name === 'mate') {
site.sound.play('checkmate', o.volume);
} else if (o.check) {
site.sound.play('check', o.volume);
}
blur.onMove();
pubsub.emit('ply', this.ply);
}
Expand Down
10 changes: 7 additions & 3 deletions ui/site/src/sound.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default new (class implements SoundI {
if (!this.enabled()) return;
let dir = this.theme;
if (this.theme === 'music' || this.speech()) {
if (['move', 'capture', 'check'].includes(name)) return;
if (['move', 'capture', 'check', 'checkmate'].includes(name)) return;
dir = 'standard';
}
return this.url(`${dir}/${name[0].toUpperCase() + name.slice(1)}.mp3`);
Expand All @@ -76,7 +76,11 @@ export default new (class implements SoundI {
else {
if (o?.san?.includes('x')) this.throttled('capture', volume);
else this.throttled('move', volume);
if (o?.san?.includes('#') || o?.san?.includes('+')) this.throttled('check', volume);
if (o?.san?.includes('#')) {
this.throttled('checkmate', volume);
} else if (o?.san?.includes('+')) {
this.throttled('check', volume);
}
}
}
if (o?.filter === 'game' || this.theme !== 'music') return;
Expand Down Expand Up @@ -193,7 +197,7 @@ export default new (class implements SoundI {
}

preloadBoardSounds() {
for (const name of ['move', 'capture', 'check', 'genericNotify']) this.load(name);
for (const name of ['move', 'capture', 'check', 'checkmate', 'genericNotify']) this.load(name);
}

async resumeWithTest(): Promise<boolean> {
Expand Down

0 comments on commit bce53c8

Please sign in to comment.