feat(toma-progresiva): alarma más fuerte 3 ciclos con sawtooth+compressor y vibración 5x900ms
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
7f522a683e
commit
65c3cc8c20
+23
-11
@@ -2086,16 +2086,28 @@ function _guardarFirmaMP(widget, svg, msgEl, entry, campoId) {
|
|||||||
|
|
||||||
function _mpPlayBeep() {
|
function _mpPlayBeep() {
|
||||||
try {
|
try {
|
||||||
var ctx = new (window.AudioContext || window.webkitAudioContext)();
|
var ctx = new (window.AudioContext || window.webkitAudioContext)();
|
||||||
[880, 1100, 880, 1100].forEach(function(freq, i) {
|
var comp = ctx.createDynamicsCompressor();
|
||||||
var osc = ctx.createOscillator(), gain = ctx.createGain();
|
comp.threshold.value = -6; comp.ratio.value = 12; comp.attack.value = 0;
|
||||||
osc.connect(gain); gain.connect(ctx.destination);
|
comp.connect(ctx.destination);
|
||||||
osc.frequency.value = freq;
|
// 3 ciclos de alarma, cada ciclo 3 notas; 2 osciladores por nota para más volumen
|
||||||
var t0 = ctx.currentTime + i * 0.22;
|
var notes = [1200, 880, 1200];
|
||||||
gain.gain.setValueAtTime(0.7, t0);
|
for (var cycle = 0; cycle < 3; cycle++) {
|
||||||
gain.gain.exponentialRampToValueAtTime(0.001, t0 + 0.18);
|
notes.forEach(function(freq, i) {
|
||||||
osc.start(t0); osc.stop(t0 + 0.18);
|
var t0 = ctx.currentTime + cycle * 1.0 + i * 0.28;
|
||||||
});
|
[0, 6].forEach(function(detune) { // dos osciladores ligeramente desafinados
|
||||||
|
var osc = ctx.createOscillator();
|
||||||
|
var g = ctx.createGain();
|
||||||
|
osc.type = 'sawtooth';
|
||||||
|
osc.frequency.value = freq;
|
||||||
|
osc.detune.value = detune;
|
||||||
|
osc.connect(g); g.connect(comp);
|
||||||
|
g.gain.setValueAtTime(1.0, t0);
|
||||||
|
g.gain.exponentialRampToValueAtTime(0.001, t0 + 0.24);
|
||||||
|
osc.start(t0); osc.stop(t0 + 0.24);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2128,7 +2140,7 @@ function _mpIniciarCountdown(targetMsOrMins, nextLabel, nextFirmaId) {
|
|||||||
box.style.animation = 'mp-pulse 1s ease-in-out infinite';
|
box.style.animation = 'mp-pulse 1s ease-in-out infinite';
|
||||||
box.innerHTML = '<div style="font-size:1.1rem;font-weight:700"><i class="fas fa-bell me-2"></i>¡Hora de la siguiente muestra!</div>'
|
box.innerHTML = '<div style="font-size:1.1rem;font-weight:700"><i class="fas fa-bell me-2"></i>¡Hora de la siguiente muestra!</div>'
|
||||||
+ (nextLabel ? '<div style="font-size:.85rem;opacity:.9;margin-top:4px">' + nextLabel + '</div>' : '');
|
+ (nextLabel ? '<div style="font-size:.85rem;opacity:.9;margin-top:4px">' + nextLabel + '</div>' : '');
|
||||||
if (navigator.vibrate) navigator.vibrate([500,150,500,150,500]);
|
if (navigator.vibrate) navigator.vibrate([900,150,900,150,900,150,900,150,900]);
|
||||||
_mpPlayBeep();
|
_mpPlayBeep();
|
||||||
// Desbloquear y mostrar siguiente canvas
|
// Desbloquear y mostrar siguiente canvas
|
||||||
var nw = nextFirmaId ? document.getElementById('fpw-' + nextFirmaId) : null;
|
var nw = nextFirmaId ? document.getElementById('fpw-' + nextFirmaId) : null;
|
||||||
|
|||||||
Reference in New Issue
Block a user