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('touchstart', () => { if (!sonidoActivo) activarSonido(); }, { once: true });
|
||||
|
||||
function playBell() {
|
||||
function playBeep() {
|
||||
if (!sonidoActivo || !audioCtx) return;
|
||||
try {
|
||||
const t = audioCtx.currentTime;
|
||||
// Campana de dos tonos (ding-dong)
|
||||
[800, 1000].forEach((freq, i) => {
|
||||
const osc = audioCtx.createOscillator();
|
||||
const g = audioCtx.createGain();
|
||||
osc.type = 'sine';
|
||||
osc.connect(g); g.connect(audioCtx.destination);
|
||||
osc.frequency.setValueAtTime(freq, t + i * 0.3);
|
||||
g.gain.setValueAtTime(0.4, t + i * 0.3);
|
||||
g.gain.exponentialRampToValueAtTime(0.001, t + i * 0.3 + 0.4);
|
||||
osc.start(t + i * 0.3);
|
||||
osc.stop(t + i * 0.3 + 0.4);
|
||||
});
|
||||
const osc = audioCtx.createOscillator();
|
||||
const g = audioCtx.createGain();
|
||||
osc.type = 'sine';
|
||||
osc.connect(g); g.connect(audioCtx.destination);
|
||||
osc.frequency.setValueAtTime(880, audioCtx.currentTime);
|
||||
osc.frequency.setValueAtTime(1100, audioCtx.currentTime + 0.1);
|
||||
osc.frequency.setValueAtTime(880, audioCtx.currentTime + 0.2);
|
||||
g.gain.setValueAtTime(0.35, audioCtx.currentTime);
|
||||
g.gain.exponentialRampToValueAtTime(0.0001, audioCtx.currentTime + 0.65);
|
||||
osc.start(audioCtx.currentTime);
|
||||
osc.stop(audioCtx.currentTime + 0.65);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
function anunciarTurno(codigo, destino, paciente) {
|
||||
playBell();
|
||||
playBeep();
|
||||
if ('speechSynthesis' in window) {
|
||||
setTimeout(() => {
|
||||
window.speechSynthesis.cancel();
|
||||
|
||||
Reference in New Issue
Block a user