fix: restaurar playBeep original en display_global (revertir playBell)
This commit is contained in:
@@ -478,27 +478,25 @@ function activarSonido() {
|
|||||||
document.addEventListener('click', () => { if (!sonidoActivo) activarSonido(); }, { once: true });
|
document.addEventListener('click', () => { if (!sonidoActivo) activarSonido(); }, { once: true });
|
||||||
document.addEventListener('touchstart', () => { if (!sonidoActivo) activarSonido(); }, { once: true });
|
document.addEventListener('touchstart', () => { if (!sonidoActivo) activarSonido(); }, { once: true });
|
||||||
|
|
||||||
function playBell() {
|
function playBeep() {
|
||||||
if (!sonidoActivo || !audioCtx) return;
|
if (!sonidoActivo || !audioCtx) return;
|
||||||
try {
|
try {
|
||||||
const t = audioCtx.currentTime;
|
|
||||||
// Campana de dos tonos (ding-dong)
|
|
||||||
[800, 1000].forEach((freq, i) => {
|
|
||||||
const osc = audioCtx.createOscillator();
|
const osc = audioCtx.createOscillator();
|
||||||
const g = audioCtx.createGain();
|
const g = audioCtx.createGain();
|
||||||
osc.type = 'sine';
|
osc.type = 'sine';
|
||||||
osc.connect(g); g.connect(audioCtx.destination);
|
osc.connect(g); g.connect(audioCtx.destination);
|
||||||
osc.frequency.setValueAtTime(freq, t + i * 0.3);
|
osc.frequency.setValueAtTime(880, audioCtx.currentTime);
|
||||||
g.gain.setValueAtTime(0.4, t + i * 0.3);
|
osc.frequency.setValueAtTime(1100, audioCtx.currentTime + 0.1);
|
||||||
g.gain.exponentialRampToValueAtTime(0.001, t + i * 0.3 + 0.4);
|
osc.frequency.setValueAtTime(880, audioCtx.currentTime + 0.2);
|
||||||
osc.start(t + i * 0.3);
|
g.gain.setValueAtTime(0.35, audioCtx.currentTime);
|
||||||
osc.stop(t + i * 0.3 + 0.4);
|
g.gain.exponentialRampToValueAtTime(0.0001, audioCtx.currentTime + 0.65);
|
||||||
});
|
osc.start(audioCtx.currentTime);
|
||||||
|
osc.stop(audioCtx.currentTime + 0.65);
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
function anunciarTurno(codigo, destino, paciente) {
|
function anunciarTurno(codigo, destino, paciente) {
|
||||||
playBell();
|
playBeep();
|
||||||
if ('speechSynthesis' in window) {
|
if ('speechSynthesis' in window) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.speechSynthesis.cancel();
|
window.speechSynthesis.cancel();
|
||||||
|
|||||||
Reference in New Issue
Block a user