speech tweaks
for the record, increasing speech rate doesn't help with bullet
This commit is contained in:
parent
5fe5fd4b5a
commit
135911adf7
4
ui/@types/lichess/index.d.ts
vendored
4
ui/@types/lichess/index.d.ts
vendored
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue