fix: harden adaptive audio resume and release
This commit is contained in:
@@ -141,12 +141,13 @@ export const createAdaptiveMixer: AdaptiveMixerFactory = (context, destination)
|
||||
liftPhase === 'off' ||
|
||||
liftPhase === 'exiting'
|
||||
) return;
|
||||
const entryWillComplete = liftPhase === 'entering';
|
||||
scheduledStart = nextBeatTime(
|
||||
now + LIFT_EXIT_DWELL_SECONDS,
|
||||
transportAnchor,
|
||||
);
|
||||
scheduledEnd = scheduledStart + MUSIC_BEAT_SECONDS;
|
||||
holdParameter(driveLiftGate.gain, now);
|
||||
if (!entryWillComplete) holdParameter(driveLiftGate.gain, now);
|
||||
driveLiftGate.gain.setValueAtTime(1, scheduledStart);
|
||||
driveLiftGate.gain.linearRampToValueAtTime(0, scheduledEnd);
|
||||
liftPhase = 'exiting';
|
||||
|
||||
@@ -499,8 +499,8 @@ export function createSoundtrackEngine(
|
||||
async resume() {
|
||||
if (closed) throw new DOMException('Audio graph is closed.', 'InvalidStateError');
|
||||
await context.resume();
|
||||
ensureDriveLiftLoad();
|
||||
if (transportStarted) return;
|
||||
ensureDriveLiftLoad();
|
||||
loadPromise ??= loadAndStart();
|
||||
await loadPromise;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user