feat(audio): desactivar completamente todos los sonidos de la aplicacion y del inicio de sesion
This commit is contained in:
+25
-145
@@ -1,152 +1,32 @@
|
||||
// Sintetizador Web Audio API para feedback sonoro en tiempo real sin dependencias externas
|
||||
// ========================================================
|
||||
// SISTEMA DE SONIDOS SIBOPAY - COMPLETAMENTE DESACTIVADO
|
||||
// Todos los efectos de sonido y alertas auditivas han sido removidos a solicitud.
|
||||
// ========================================================
|
||||
class SoundEffects {
|
||||
constructor() {
|
||||
this.ctx = null;
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
init() {
|
||||
if (!this.ctx) {
|
||||
const AudioCtx = window.AudioContext || window.webkitAudioContext;
|
||||
this.ctx = new AudioCtx();
|
||||
}
|
||||
if (this.ctx.state === 'suspended') {
|
||||
this.ctx.resume();
|
||||
}
|
||||
}
|
||||
|
||||
// Sonido de escaneo exitoso / cobro completado (Tono alegre ascendente)
|
||||
playSuccess() {
|
||||
try {
|
||||
this.init();
|
||||
const now = this.ctx.currentTime;
|
||||
const osc1 = this.ctx.createOscillator();
|
||||
const osc2 = this.ctx.createOscillator();
|
||||
const gain = this.ctx.createGain();
|
||||
|
||||
osc1.type = 'triangle';
|
||||
osc2.type = 'sine';
|
||||
|
||||
// Acorde alegre de confirmación: C5 -> E5 -> G5
|
||||
osc1.frequency.setValueAtTime(523.25, now);
|
||||
osc1.frequency.exponentialRampToValueAtTime(659.25, now + 0.1);
|
||||
osc1.frequency.exponentialRampToValueAtTime(783.99, now + 0.2);
|
||||
|
||||
osc2.frequency.setValueAtTime(261.63, now);
|
||||
osc2.frequency.setValueAtTime(329.63, now + 0.1);
|
||||
osc2.frequency.setValueAtTime(392.00, now + 0.2);
|
||||
|
||||
gain.gain.setValueAtTime(0.2, now);
|
||||
gain.gain.exponentialRampToValueAtTime(0.01, now + 0.35);
|
||||
|
||||
osc1.connect(gain);
|
||||
osc2.connect(gain);
|
||||
gain.connect(this.ctx.destination);
|
||||
|
||||
osc1.start(now);
|
||||
osc2.start(now);
|
||||
osc1.stop(now + 0.35);
|
||||
osc2.stop(now + 0.35);
|
||||
} catch (e) {
|
||||
console.warn('Audio no disponible:', e);
|
||||
}
|
||||
}
|
||||
|
||||
// Sonido de moneda para Modo Kids
|
||||
playCoin() {
|
||||
try {
|
||||
this.init();
|
||||
const now = this.ctx.currentTime;
|
||||
const osc = this.ctx.createOscillator();
|
||||
const gain = this.ctx.createGain();
|
||||
|
||||
osc.type = 'sine';
|
||||
osc.frequency.setValueAtTime(987.77, now); // B5
|
||||
osc.frequency.setValueAtTime(1318.51, now + 0.08); // E6
|
||||
|
||||
gain.gain.setValueAtTime(0.25, now);
|
||||
gain.gain.exponentialRampToValueAtTime(0.01, now + 0.3);
|
||||
|
||||
osc.connect(gain);
|
||||
gain.connect(this.ctx.destination);
|
||||
|
||||
osc.start(now);
|
||||
osc.stop(now + 0.3);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// Chirp de escáner láser de código de barras
|
||||
playScanChirp() {
|
||||
try {
|
||||
this.init();
|
||||
const now = this.ctx.currentTime;
|
||||
const osc = this.ctx.createOscillator();
|
||||
const gain = this.ctx.createGain();
|
||||
|
||||
osc.type = 'square';
|
||||
osc.frequency.setValueAtTime(2000, now);
|
||||
osc.frequency.exponentialRampToValueAtTime(1200, now + 0.06);
|
||||
|
||||
gain.gain.setValueAtTime(0.15, now);
|
||||
gain.gain.exponentialRampToValueAtTime(0.01, now + 0.07);
|
||||
|
||||
osc.connect(gain);
|
||||
gain.connect(this.ctx.destination);
|
||||
|
||||
osc.start(now);
|
||||
osc.stop(now + 0.07);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// Sonido de error / límite superado (Tono grave de advertencia)
|
||||
playError() {
|
||||
try {
|
||||
this.init();
|
||||
const now = this.ctx.currentTime;
|
||||
const osc = this.ctx.createOscillator();
|
||||
const gain = this.ctx.createGain();
|
||||
|
||||
osc.type = 'sawtooth';
|
||||
osc.frequency.setValueAtTime(220, now);
|
||||
osc.frequency.setValueAtTime(180, now + 0.15);
|
||||
|
||||
gain.gain.setValueAtTime(0.2, now);
|
||||
gain.gain.exponentialRampToValueAtTime(0.01, now + 0.35);
|
||||
|
||||
osc.connect(gain);
|
||||
gain.connect(this.ctx.destination);
|
||||
|
||||
osc.start(now);
|
||||
osc.stop(now + 0.35);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// Sonido de clic / tap sutil
|
||||
playTap() {
|
||||
try {
|
||||
this.init();
|
||||
const now = this.ctx.currentTime;
|
||||
const osc = this.ctx.createOscillator();
|
||||
const gain = this.ctx.createGain();
|
||||
|
||||
osc.type = 'sine';
|
||||
osc.frequency.setValueAtTime(600, now);
|
||||
osc.frequency.exponentialRampToValueAtTime(300, now + 0.04);
|
||||
|
||||
gain.gain.setValueAtTime(0.08, now);
|
||||
gain.gain.exponentialRampToValueAtTime(0.001, now + 0.04);
|
||||
|
||||
osc.connect(gain);
|
||||
gain.connect(this.ctx.destination);
|
||||
|
||||
osc.start(now);
|
||||
osc.stop(now + 0.04);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// Sonido de escaneo / beep
|
||||
playBeep() {
|
||||
this.playScanChirp();
|
||||
}
|
||||
init() {}
|
||||
playSuccess() {}
|
||||
playCoin() {}
|
||||
playScanChirp() {}
|
||||
playError() {}
|
||||
playTap() {}
|
||||
playBeep() {}
|
||||
playNotice() {}
|
||||
playTrash() {}
|
||||
}
|
||||
|
||||
window.sounds = new SoundEffects();
|
||||
const silentInstance = new SoundEffects();
|
||||
|
||||
// Proxy de seguridad para asegurar que cualquier llamada desconocida sea silenciosa y segura
|
||||
window.sounds = new Proxy(silentInstance, {
|
||||
get(target, prop) {
|
||||
if (prop in target) {
|
||||
return target[prop];
|
||||
}
|
||||
return function() {};
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user