fix: revertir anunciarTurno al codigo exacto de jun9 que funcionaba
This commit is contained in:
@@ -495,40 +495,16 @@ function playBeep() {
|
|||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Selección de voz española — cargada una vez, reutilizada en cada anuncio
|
function anunciarTurno(codigo, destino) {
|
||||||
let _vozES = null;
|
|
||||||
function getVozES() {
|
|
||||||
if (_vozES) return _vozES;
|
|
||||||
const voices = window.speechSynthesis.getVoices();
|
|
||||||
// Preferencia: es-CO → es-419 → es-MX → es-US → es-ES → cualquier es-*
|
|
||||||
for (const lang of ['es-CO','es-419','es-MX','es-US','es-ES']) {
|
|
||||||
const v = voices.find(v => v.lang === lang);
|
|
||||||
if (v) { _vozES = v; return v; }
|
|
||||||
}
|
|
||||||
const v = voices.find(v => v.lang.startsWith('es'));
|
|
||||||
if (v) { _vozES = v; }
|
|
||||||
return _vozES;
|
|
||||||
}
|
|
||||||
if ('speechSynthesis' in window) {
|
|
||||||
window.speechSynthesis.onvoiceschanged = () => { _vozES = null; getVozES(); };
|
|
||||||
}
|
|
||||||
|
|
||||||
function anunciarTurno(codigo, destino, paciente) {
|
|
||||||
playBeep();
|
playBeep();
|
||||||
if ('speechSynthesis' in window) {
|
if ('speechSynthesis' in window) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.speechSynthesis.cancel();
|
window.speechSynthesis.cancel();
|
||||||
const letras = codigo.split('').join(' ');
|
const letras = codigo.split('').join(' ');
|
||||||
let texto = `Turno ${letras}`;
|
const utt = new SpeechSynthesisUtterance(`Turno ${letras}, pase a ${destino}`);
|
||||||
if (paciente) texto += `, ${paciente}`;
|
utt.lang = 'es-CO'; utt.rate = 0.85; utt.pitch = 1.05; utt.volume = 1;
|
||||||
texto += `, pase a ${destino}`;
|
|
||||||
const utt = new SpeechSynthesisUtterance(texto);
|
|
||||||
utt.lang = 'es-CO';
|
|
||||||
const voz = getVozES();
|
|
||||||
if (voz) utt.voice = voz;
|
|
||||||
utt.rate = 0.85; utt.pitch = 1.05; utt.volume = 1;
|
|
||||||
window.speechSynthesis.speak(utt);
|
window.speechSynthesis.speak(utt);
|
||||||
}, 800);
|
}, 700);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,7 +550,7 @@ function showAnnouncement({ codigo, destino, paciente, color }) {
|
|||||||
|
|
||||||
ov.classList.add('visible');
|
ov.classList.add('visible');
|
||||||
|
|
||||||
anunciarTurno(codigo, destino, paciente);
|
anunciarTurno(codigo, destino);
|
||||||
|
|
||||||
bar.style.transition = 'none';
|
bar.style.transition = 'none';
|
||||||
bar.style.width = '100%';
|
bar.style.width = '100%';
|
||||||
|
|||||||
Reference in New Issue
Block a user