speech tweaks

for the record, increasing speech rate doesn't help with bullet
This commit is contained in:
Thibault Duplessis 2019-04-29 21:36:50 +07:00
parent 5fe5fd4b5a
commit 135911adf7
3 changed files with 6 additions and 6 deletions

View file

@ -55,8 +55,8 @@ interface Lichess {
}
playMusic(): any;
Speech?: {
say(t: string, cut?: boolean): void;
step(s: { san?: San }, cut?: boolean): void;
say(t: string, cut: boolean): void;
step(s: { san?: San }, cut: boolean): void;
};
spinnerHtml: string;
movetimeChart: any;

View file

@ -20,13 +20,13 @@ function renderSan(san: San) {
return move;
}
export function say(text: string, cut: boolean = false) {
export function say(text: string, cut: boolean) {
const msg = new SpeechSynthesisUtterance(text);
msg.rate = 1.2;
if (cut) speechSynthesis.cancel();
window.lichess.sound.say(msg);
}
export function step(s: { san?: San}, cut: boolean = true) {
export function step(s: { san?: San}, cut: boolean) {
say(s.san ? renderSan(s.san) : 'Game start', cut);
}

View file

@ -13,7 +13,7 @@ export function onSpeechChange(ctrl: RoundController) {
else {
window.Speech!.say(s);
const w = ctrl.data.game.winner;
if (w) window.Speech!.say(ctrl.trans.noarg(w + 'IsVictorious'))
if (w) window.Speech!.say(ctrl.trans.noarg(w + 'IsVictorious'), false)
}
});
else if (window.Speech && !enabled) window.Speech = undefined;
@ -22,7 +22,7 @@ export function onSpeechChange(ctrl: RoundController) {
export function userJump(ctrl: RoundController, ply: Ply) {
if (window.Speech) window.Speech.step(ctrl.stepAt(ply));
if (window.Speech) window.Speech.step(ctrl.stepAt(ply), true);
}
export function step(step: Step) {