Add resolver, server, PDF rendering and web app
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
6a7fcdc4b8
commit
bdfdf581f3
59 files changed
+4088
No files matched your search
@@ -0,0 +1,26 @@
|
||||
let ctx: AudioContext | null = null;
|
||||
|
||||
/** Create or resume the audio context. Call from a user gesture (the Start camera click). */
|
||||
export function unlockAudio(): void {
|
||||
try {
|
||||
ctx ??= new AudioContext();
|
||||
if (ctx.state === 'suspended') void ctx.resume();
|
||||
} catch { /* audio unavailable; stay silent */ }
|
||||
}
|
||||
|
||||
function tone(freq: number, ms: number): void {
|
||||
if (!ctx) return;
|
||||
try {
|
||||
const osc = ctx.createOscillator();
|
||||
const gain = ctx.createGain();
|
||||
osc.frequency.value = freq;
|
||||
gain.gain.setValueAtTime(0.2, ctx.currentTime);
|
||||
gain.gain.setValueAtTime(0.0001, ctx.currentTime + ms / 1000);
|
||||
osc.connect(gain).connect(ctx.destination);
|
||||
osc.start();
|
||||
osc.stop(ctx.currentTime + ms / 1000);
|
||||
} catch { /* ignore */ }
|
||||
}
|
||||
|
||||
export const beepAccept = () => tone(880, 120);
|
||||
export const beepLow = () => tone(220, 200);
|
||||
Reference in new issue
Block a user