feat(audio): implement phase 3c master protection

This commit is contained in:
2026-09-05 20:45:47 -07:00
parent 249328e595
commit 90fcbbe467
21 changed files with 6732 additions and 71 deletions
+4 -3
View File
@@ -1,3 +1,4 @@
import { fakeProtectionFactory } from './helpers/protection-fake.mjs';
import assert from 'node:assert/strict';
import test from 'node:test';
import {
@@ -485,7 +486,7 @@ test('every node type realizes against an AudioContext stand-in and disposes cle
voice.dispose();
assert.equal(context.log.stopped, context.log.started);
const subsystem = new AudioSubsystem({ document, rng: new SeededRNG(42), contextFactory: () => mockContext() });
const subsystem = new AudioSubsystem({ document, rng: new SeededRNG(42), protectionFactory: fakeProtectionFactory, contextFactory: () => mockContext() });
await subsystem.unlock();
const handle = subsystem.play('probe');
assert.equal(handle.soundId, 'probe');
@@ -867,7 +868,7 @@ test('trace 10: eviction order is followed at ceiling, WARN_VOICE_LIMIT raised,
const subsystem = new AudioSubsystem({
document: doc,
rng: new SeededRNG(42),
contextFactory: () => mockContext(),
protectionFactory: fakeProtectionFactory, contextFactory: () => mockContext(),
diagnostics,
voiceLimits: limits
});
@@ -954,7 +955,7 @@ test('trace 11: disposal releases all nodes/connections/buffers, and a FINISHED
const subsystem = new AudioSubsystem({
document: doc,
rng: new SeededRNG(42),
contextFactory: () => context,
protectionFactory: fakeProtectionFactory, contextFactory: () => context,
voiceLimits: { oneshot: 2, continuous: 2 }
});
await subsystem.unlock();