mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 19:36:04 +00:00
merge: pull in the main-merge conflict fix
This commit is contained in:
@@ -69,6 +69,18 @@ function readChain(el: { getAttribute?(name: string): string | null }): {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An element's automation lanes, bound to whatever chain it carries.
|
||||
*
|
||||
* FX lanes need the chain to resolve their target's range, so they are dropped
|
||||
* for an element with no chain; a volume lane is always readable.
|
||||
*/
|
||||
export function readElementAutomation(el: {
|
||||
getAttribute?(name: string): string | null;
|
||||
}): HfAutomation {
|
||||
return readAutomation(el, readChain(el).chain);
|
||||
}
|
||||
|
||||
/**
|
||||
* Splice an element's FX chain between a decoded source and its gain stage.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { attachElementFxChain, type ElementFxHandle } from "./audioFx.js";
|
||||
import type { AutomationTiming } from "../audio/audioFxAutomation.js";
|
||||
import { attachElementFxChain, readElementAutomation, type ElementFxHandle } from "./audioFx.js";
|
||||
import {
|
||||
scheduleParamLane,
|
||||
volumeLane,
|
||||
type AutomationTiming,
|
||||
} from "../audio/audioFxAutomation.js";
|
||||
import { VOLUME_RANGE } from "../audioAutomation.js";
|
||||
import { swallow } from "./diagnostics";
|
||||
import { getDebugSurface } from "./globals.js";
|
||||
|
||||
@@ -58,6 +63,20 @@ function startBoundedSource(
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The volume lane rides the fader, after the effects — where a DAW puts it,
|
||||
* and the order the render bakes it in.
|
||||
*/
|
||||
function scheduleVolumeLane(
|
||||
el: HTMLMediaElement,
|
||||
gainNode: GainNode,
|
||||
timing: AutomationTiming,
|
||||
): void {
|
||||
const lane = volumeLane(readElementAutomation(el));
|
||||
if (!lane) return;
|
||||
scheduleParamLane([{ param: gainNode.gain }], lane, VOLUME_RANGE.scale, timing);
|
||||
}
|
||||
|
||||
export type ScheduledSource = {
|
||||
el: HTMLMediaElement;
|
||||
sourceNode: AudioBufferSourceNode;
|
||||
@@ -200,6 +219,8 @@ export class WebAudioTransport {
|
||||
const fx = attachElementFxChain(this._ctx, el, sourceNode, gainNode, timing);
|
||||
gainNode.connect(this._masterGain);
|
||||
|
||||
scheduleVolumeLane(el, gainNode, timing);
|
||||
|
||||
this._rate = safeRate;
|
||||
this._rateAnchorCtx = scheduledAt;
|
||||
this._rateAnchorComp = compositionTime;
|
||||
|
||||
Reference in New Issue
Block a user