@smoove/core 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/dist/audio/asset.d.ts +0 -21
- package/dist/audio/asset.d.ts.map +0 -1
- package/dist/audio/asset.js +0 -2
- package/dist/audio/asset.js.map +0 -1
- package/dist/audio/audio-driver.d.ts +0 -34
- package/dist/audio/audio-driver.d.ts.map +0 -1
- package/dist/audio/audio-driver.js +0 -2
- package/dist/audio/audio-driver.js.map +0 -1
- package/dist/audio/audio-for-preview.d.ts +0 -12
- package/dist/audio/audio-for-preview.d.ts.map +0 -1
- package/dist/audio/audio-for-preview.js +0 -70
- package/dist/audio/audio-for-preview.js.map +0 -1
- package/dist/audio/audio-for-rendering.d.ts +0 -16
- package/dist/audio/audio-for-rendering.d.ts.map +0 -1
- package/dist/audio/audio-for-rendering.js +0 -32
- package/dist/audio/audio-for-rendering.js.map +0 -1
- package/dist/audio/audio-source-browser.d.ts +0 -30
- package/dist/audio/audio-source-browser.d.ts.map +0 -1
- package/dist/audio/audio-source-browser.js +0 -139
- package/dist/audio/audio-source-browser.js.map +0 -1
- package/dist/audio/audio-source.d.ts +0 -38
- package/dist/audio/audio-source.d.ts.map +0 -1
- package/dist/audio/audio-source.js +0 -2
- package/dist/audio/audio-source.js.map +0 -1
- package/dist/audio/index.d.ts +0 -45
- package/dist/audio/index.d.ts.map +0 -1
- package/dist/audio/index.js +0 -143
- package/dist/audio/index.js.map +0 -1
- package/dist/audio/mixer.d.ts +0 -43
- package/dist/audio/mixer.d.ts.map +0 -1
- package/dist/audio/mixer.js +0 -51
- package/dist/audio/mixer.js.map +0 -1
- package/dist/audio/types.d.ts +0 -31
- package/dist/audio/types.d.ts.map +0 -1
- package/dist/audio/types.js +0 -2
- package/dist/audio/types.js.map +0 -1
- package/dist/block.d.ts +0 -16
- package/dist/block.d.ts.map +0 -1
- package/dist/block.js +0 -173
- package/dist/block.js.map +0 -1
- package/dist/composition.d.ts.map +0 -1
- package/dist/composition.js.map +0 -1
- package/dist/easing.d.ts +0 -22
- package/dist/easing.d.ts.map +0 -1
- package/dist/easing.js +0 -59
- package/dist/easing.js.map +0 -1
- package/dist/emitter.d.ts +0 -7
- package/dist/emitter.d.ts.map +0 -1
- package/dist/emitter.js +0 -29
- package/dist/emitter.js.map +0 -1
- package/dist/environment.d.ts.map +0 -1
- package/dist/environment.js.map +0 -1
- package/dist/flex-engine.d.ts +0 -31
- package/dist/flex-engine.d.ts.map +0 -1
- package/dist/flex-engine.js +0 -186
- package/dist/flex-engine.js.map +0 -1
- package/dist/flex-types.d.ts +0 -165
- package/dist/flex-types.d.ts.map +0 -1
- package/dist/flex-types.js +0 -2
- package/dist/flex-types.js.map +0 -1
- package/dist/flex.d.ts +0 -26
- package/dist/flex.d.ts.map +0 -1
- package/dist/flex.js +0 -179
- package/dist/flex.js.map +0 -1
- package/dist/image.d.ts +0 -10
- package/dist/image.d.ts.map +0 -1
- package/dist/image.js +0 -156
- package/dist/image.js.map +0 -1
- package/dist/interpolate-colors.d.ts +0 -7
- package/dist/interpolate-colors.d.ts.map +0 -1
- package/dist/interpolate-colors.js +0 -240
- package/dist/interpolate-colors.js.map +0 -1
- package/dist/interpolate.d.ts +0 -12
- package/dist/interpolate.d.ts.map +0 -1
- package/dist/interpolate.js +0 -65
- package/dist/interpolate.js.map +0 -1
- package/dist/media-marker.d.ts +0 -19
- package/dist/media-marker.d.ts.map +0 -1
- package/dist/media-marker.js +0 -19
- package/dist/media-marker.js.map +0 -1
- package/dist/media-time.d.ts +0 -17
- package/dist/media-time.d.ts.map +0 -1
- package/dist/media-time.js +0 -17
- package/dist/media-time.js.map +0 -1
- package/dist/signal.d.ts +0 -10
- package/dist/signal.d.ts.map +0 -1
- package/dist/signal.js +0 -39
- package/dist/signal.js.map +0 -1
- package/dist/text.d.ts +0 -91
- package/dist/text.d.ts.map +0 -1
- package/dist/text.js +0 -704
- package/dist/text.js.map +0 -1
- package/dist/video/driver.d.ts +0 -31
- package/dist/video/driver.d.ts.map +0 -1
- package/dist/video/driver.js +0 -3
- package/dist/video/driver.js.map +0 -1
- package/dist/video/index.d.ts +0 -45
- package/dist/video/index.d.ts.map +0 -1
- package/dist/video/index.js +0 -276
- package/dist/video/index.js.map +0 -1
- package/dist/video/types.d.ts +0 -35
- package/dist/video/types.d.ts.map +0 -1
- package/dist/video/types.js +0 -2
- package/dist/video/types.js.map +0 -1
- package/dist/video/video-for-preview.d.ts +0 -12
- package/dist/video/video-for-preview.d.ts.map +0 -1
- package/dist/video/video-for-preview.js +0 -73
- package/dist/video/video-for-preview.js.map +0 -1
- package/dist/video/video-for-rendering.d.ts +0 -16
- package/dist/video/video-for-rendering.d.ts.map +0 -1
- package/dist/video/video-for-rendering.js +0 -45
- package/dist/video/video-for-rendering.js.map +0 -1
- package/dist/video/video-source-browser.d.ts +0 -37
- package/dist/video/video-source-browser.d.ts.map +0 -1
- package/dist/video/video-source-browser.js +0 -171
- package/dist/video/video-source-browser.js.map +0 -1
- package/dist/video/video-source.d.ts +0 -48
- package/dist/video/video-source.d.ts.map +0 -1
- package/dist/video/video-source.js +0 -2
- package/dist/video/video-source.js.map +0 -1
package/package.json
CHANGED
package/dist/audio/asset.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A single audio playback sample captured during offline rendering — one per
|
|
3
|
-
* {@link Audio} per rendered frame. The engine never decodes audio while
|
|
4
|
-
* capturing canvas frames; instead the {@link RenderingAudioDriver} records
|
|
5
|
-
* these so an external pass (e.g. ffmpeg) can mux the audio track afterward.
|
|
6
|
-
*/
|
|
7
|
-
export type AudioAsset = {
|
|
8
|
-
/** Stable id of the source {@link Audio} node. */
|
|
9
|
-
id: string;
|
|
10
|
-
src: string;
|
|
11
|
-
/** Global composition frame this sample is for. */
|
|
12
|
-
frame: number;
|
|
13
|
-
/** Position into the source media, in seconds (from {@link getMediaTime}). */
|
|
14
|
-
mediaTime: number;
|
|
15
|
-
/** Effective level at this frame — `master × intrinsic`, 0..1. */
|
|
16
|
-
volume: number;
|
|
17
|
-
/** Effective mute at this frame — `masterMuted || intrinsicMuted`. */
|
|
18
|
-
muted: boolean;
|
|
19
|
-
playbackRate: number;
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=asset.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asset.d.ts","sourceRoot":"","sources":["../../src/audio/asset.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,KAAK,EAAE,OAAO,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
package/dist/audio/asset.js
DELETED
package/dist/audio/asset.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asset.js","sourceRoot":"","sources":["../../src/audio/asset.ts"],"names":[],"mappings":""}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Composition } from "../composition.js";
|
|
2
|
-
import type { MediaTiming } from "../media-time.js";
|
|
3
|
-
import type { AudioSource } from "./audio-source.js";
|
|
4
|
-
/**
|
|
5
|
-
* What an audio driver needs from the host {@link Audio}: the media source, the
|
|
6
|
-
* resolved timing, the owning composition (for play state + asset collection),
|
|
7
|
-
* the source identity, and getters for the effective audio level so a render
|
|
8
|
-
* driver can record it. No `redraw` — audio paints nothing.
|
|
9
|
-
*/
|
|
10
|
-
export type AudioDriverContext = {
|
|
11
|
-
readonly source: AudioSource;
|
|
12
|
-
readonly timing: MediaTiming;
|
|
13
|
-
readonly comp: Composition;
|
|
14
|
-
readonly id: string;
|
|
15
|
-
readonly src: string;
|
|
16
|
-
/** Effective level (master × intrinsic), 0..1, at the current frame. */
|
|
17
|
-
effectiveVolume(): number;
|
|
18
|
-
/** Effective mute (masterMuted || intrinsicMuted) at the current frame. */
|
|
19
|
-
effectiveMuted(): boolean;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Strategy that maps the composition's current frame onto the audio. Mirrors
|
|
23
|
-
* {@link VideoDriver}: a realtime preview driver and a deterministic render
|
|
24
|
-
* driver (which collects assets rather than playing).
|
|
25
|
-
*/
|
|
26
|
-
export interface AudioDriver {
|
|
27
|
-
/** Called by Sequence each tick while the audio is on-stage (`localFrame` = frame - sequence.from). */
|
|
28
|
-
tick(localFrame: number): void;
|
|
29
|
-
/** Called by Sequence when the audio leaves range. */
|
|
30
|
-
deactivate(): void;
|
|
31
|
-
/** Release any subscriptions; called on `Audio.destroy()`. */
|
|
32
|
-
dispose(): void;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=audio-driver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-driver.d.ts","sourceRoot":"","sources":["../../src/audio/audio-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,eAAe,IAAI,MAAM,CAAC;IAC1B,2EAA2E;IAC3E,cAAc,IAAI,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,uGAAuG;IACvG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,sDAAsD;IACtD,UAAU,IAAI,IAAI,CAAC;IACnB,8DAA8D;IAC9D,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-driver.js","sourceRoot":"","sources":["../../src/audio/audio-driver.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { AudioDriver, AudioDriverContext } from "./audio-driver.js";
|
|
2
|
-
export declare class PreviewAudioDriver implements AudioDriver {
|
|
3
|
-
private readonly ctx;
|
|
4
|
-
private _wasActive;
|
|
5
|
-
private _lastLocalFrame;
|
|
6
|
-
private readonly _unsub;
|
|
7
|
-
constructor(ctx: AudioDriverContext);
|
|
8
|
-
tick(localFrame: number): void;
|
|
9
|
-
deactivate(): void;
|
|
10
|
-
dispose(): void;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=audio-for-preview.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-for-preview.d.ts","sourceRoot":"","sources":["../../src/audio/audio-for-preview.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAWzE,qBAAa,kBAAmB,YAAW,WAAW;IAKxC,OAAO,CAAC,QAAQ,CAAC,GAAG;IAJhC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;gBAEP,GAAG,EAAE,kBAAkB;IAgBpD,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IA8B9B,UAAU,IAAI,IAAI;IAKlB,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { getMediaTime } from "../media-time.js";
|
|
2
|
-
/**
|
|
3
|
-
* Realtime playback synced to the frame clock — the audio counterpart of
|
|
4
|
-
* `PreviewVideoDriver`. Lets the media play on its own and only seeks to correct
|
|
5
|
-
* drift beyond `ACCEPTABLE_TIME_SHIFT`; when the composition is paused
|
|
6
|
-
* (scrubbing via `setFrame`) it seeks to the exact frame.
|
|
7
|
-
*/
|
|
8
|
-
const ACCEPTABLE_TIME_SHIFT = 0.45;
|
|
9
|
-
const SCRUB_SEEK_THRESHOLD = 0.01;
|
|
10
|
-
export class PreviewAudioDriver {
|
|
11
|
-
ctx;
|
|
12
|
-
_wasActive = false;
|
|
13
|
-
_lastLocalFrame = 0;
|
|
14
|
-
_unsub;
|
|
15
|
-
constructor(ctx) {
|
|
16
|
-
this.ctx = ctx;
|
|
17
|
-
// React to play/pause transitions on the composition, re-anchoring the media.
|
|
18
|
-
this._unsub = ctx.comp.isPlaying.subscribe((playing) => {
|
|
19
|
-
if (!this._wasActive || !ctx.source.isReady)
|
|
20
|
-
return;
|
|
21
|
-
const expected = getMediaTime(this._lastLocalFrame, ctx.timing);
|
|
22
|
-
void ctx.source.seek(expected);
|
|
23
|
-
if (playing) {
|
|
24
|
-
ctx.source.play().catch((err) => {
|
|
25
|
-
console.warn("[konva-motion] audio play() rejected:", err);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
ctx.source.pause();
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
tick(localFrame) {
|
|
34
|
-
this._lastLocalFrame = localFrame;
|
|
35
|
-
const { source, comp } = this.ctx;
|
|
36
|
-
if (!source.isReady)
|
|
37
|
-
return;
|
|
38
|
-
const expected = getMediaTime(localFrame, this.ctx.timing);
|
|
39
|
-
const justActivated = !this._wasActive;
|
|
40
|
-
this._wasActive = true;
|
|
41
|
-
if (comp.isPlaying.get()) {
|
|
42
|
-
const drift = Math.abs(source.currentTime - expected);
|
|
43
|
-
// On (re)activation seek hard so audio resumes at the right point;
|
|
44
|
-
// otherwise let the element play and only correct large drift.
|
|
45
|
-
if (justActivated || drift > ACCEPTABLE_TIME_SHIFT) {
|
|
46
|
-
void source.seek(expected);
|
|
47
|
-
if (justActivated) {
|
|
48
|
-
source.play().catch((err) => {
|
|
49
|
-
console.warn("[konva-motion] audio play() rejected:", err);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
// Paused / scrubbing — fast (keyframe) seek keeps dragging snappy.
|
|
56
|
-
source.pause();
|
|
57
|
-
if (Math.abs(source.currentTime - expected) > SCRUB_SEEK_THRESHOLD) {
|
|
58
|
-
void source.seek(expected, "fast");
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
deactivate() {
|
|
63
|
-
this._wasActive = false;
|
|
64
|
-
this.ctx.source.pause();
|
|
65
|
-
}
|
|
66
|
-
dispose() {
|
|
67
|
-
this._unsub();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=audio-for-preview.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-for-preview.js","sourceRoot":"","sources":["../../src/audio/audio-for-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC,MAAM,OAAO,kBAAkB;IAKA;IAJrB,UAAU,GAAG,KAAK,CAAC;IACnB,eAAe,GAAG,CAAC,CAAC;IACX,MAAM,CAAa;IAEpC,YAA6B,GAAuB;QAAvB,QAAG,GAAH,GAAG,CAAoB;QAClD,8EAA8E;QAC9E,IAAI,CAAC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aAAa,IAAI,KAAK,GAAG,qBAAqB,EAAE,CAAC;gBACnD,KAAK,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC3B,IAAI,aAAa,EAAE,CAAC;oBAClB,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;wBACnC,OAAO,CAAC,IAAI,CAAC,uCAAuC,EAAE,GAAG,CAAC,CAAC;oBAC7D,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,mEAAmE;YACnE,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC,GAAG,oBAAoB,EAAE,CAAC;gBACnE,KAAK,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;IACH,CAAC;IAED,UAAU;QACR,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { AudioDriver, AudioDriverContext } from "./audio-driver.js";
|
|
2
|
-
/**
|
|
3
|
-
* Deterministic, non-playing audio driver for offline rendering. The engine
|
|
4
|
-
* captures canvas pixels frame-by-frame and has no in-engine audio encoder, so
|
|
5
|
-
* decoding/playing audio during render buys nothing. Instead each tick records
|
|
6
|
-
* an {@link AudioAsset} on the composition — the seam where a future ffmpeg
|
|
7
|
-
* audio-mux pass reads `comp.getAudioAssets()` to assemble the audio track.
|
|
8
|
-
*/
|
|
9
|
-
export declare class RenderingAudioDriver implements AudioDriver {
|
|
10
|
-
private readonly ctx;
|
|
11
|
-
constructor(ctx: AudioDriverContext);
|
|
12
|
-
tick(localFrame: number): void;
|
|
13
|
-
deactivate(): void;
|
|
14
|
-
dispose(): void;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=audio-for-rendering.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-for-rendering.d.ts","sourceRoot":"","sources":["../../src/audio/audio-for-rendering.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEzE;;;;;;GAMG;AACH,qBAAa,oBAAqB,YAAW,WAAW;IAC1C,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,kBAAkB;IAKpD,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAc9B,UAAU,IAAI,IAAI;IAElB,OAAO,IAAI,IAAI;CAChB"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { getMediaTime } from "../media-time.js";
|
|
2
|
-
/**
|
|
3
|
-
* Deterministic, non-playing audio driver for offline rendering. The engine
|
|
4
|
-
* captures canvas pixels frame-by-frame and has no in-engine audio encoder, so
|
|
5
|
-
* decoding/playing audio during render buys nothing. Instead each tick records
|
|
6
|
-
* an {@link AudioAsset} on the composition — the seam where a future ffmpeg
|
|
7
|
-
* audio-mux pass reads `comp.getAudioAssets()` to assemble the audio track.
|
|
8
|
-
*/
|
|
9
|
-
export class RenderingAudioDriver {
|
|
10
|
-
ctx;
|
|
11
|
-
constructor(ctx) {
|
|
12
|
-
this.ctx = ctx;
|
|
13
|
-
// Never audible during render.
|
|
14
|
-
ctx.source.setMuted(true);
|
|
15
|
-
}
|
|
16
|
-
tick(localFrame) {
|
|
17
|
-
const { comp, timing } = this.ctx;
|
|
18
|
-
const mediaTime = getMediaTime(localFrame, timing);
|
|
19
|
-
comp._collectAudioAsset({
|
|
20
|
-
id: this.ctx.id,
|
|
21
|
-
src: this.ctx.src,
|
|
22
|
-
frame: comp.frame.get(),
|
|
23
|
-
mediaTime,
|
|
24
|
-
volume: this.ctx.effectiveVolume(),
|
|
25
|
-
muted: this.ctx.effectiveMuted(),
|
|
26
|
-
playbackRate: timing.playbackRate,
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
deactivate() { }
|
|
30
|
-
dispose() { }
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=audio-for-rendering.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-for-rendering.js","sourceRoot":"","sources":["../../src/audio/audio-for-rendering.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD;;;;;;GAMG;AACH,MAAM,OAAO,oBAAoB;IACF;IAA7B,YAA6B,GAAuB;QAAvB,QAAG,GAAH,GAAG,CAAoB;QAClD,+BAA+B;QAC/B,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,IAAI,CAAC,UAAkB;QACrB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QAClC,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACnD,IAAI,CAAC,kBAAkB,CAAC;YACtB,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE;YACf,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE;YACvB,SAAS;YACT,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE;YAClC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE;YAChC,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC,CAAC;IACL,CAAC;IAED,UAAU,KAAU,CAAC;IAErB,OAAO,KAAU,CAAC;CACnB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { AudioSource, SeekMode } from "./audio-source.js";
|
|
2
|
-
/**
|
|
3
|
-
* Preview-mode {@link AudioSource}: wraps an `HTMLAudioElement` and drives it in
|
|
4
|
-
* realtime. Ported from {@link BrowserVideoSource} minus the drawable/rvfc bits
|
|
5
|
-
* (audio produces no frames). A server renderer injects a different source via
|
|
6
|
-
* `AudioConfig.sourceFactory`.
|
|
7
|
-
*/
|
|
8
|
-
export declare class BrowserAudioSource implements AudioSource {
|
|
9
|
-
private readonly _el;
|
|
10
|
-
private _ready;
|
|
11
|
-
private readonly _readyCbs;
|
|
12
|
-
private _seeking;
|
|
13
|
-
private _pending;
|
|
14
|
-
constructor();
|
|
15
|
-
load(src: string): Promise<void>;
|
|
16
|
-
get duration(): number;
|
|
17
|
-
get currentTime(): number;
|
|
18
|
-
get isReady(): boolean;
|
|
19
|
-
seek(timeSeconds: number, mode?: SeekMode): Promise<void>;
|
|
20
|
-
/** Issue the pending seek if none is in flight; chains the latest target after each completes. */
|
|
21
|
-
private _drainSeek;
|
|
22
|
-
play(): Promise<void>;
|
|
23
|
-
pause(): void;
|
|
24
|
-
setMuted(muted: boolean): void;
|
|
25
|
-
setVolume(volume: number): void;
|
|
26
|
-
setPlaybackRate(rate: number): void;
|
|
27
|
-
onReady(cb: () => void): () => void;
|
|
28
|
-
destroy(): void;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=audio-source-browser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-source-browser.d.ts","sourceRoot":"","sources":["../../src/audio/audio-source-browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAM/D;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IACpD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IACpC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IAKnD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAA+E;;IAa/F,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBhC,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,GAAE,QAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBpE,kGAAkG;IAClG,OAAO,CAAC,UAAU;IA6BlB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,KAAK,IAAI,IAAI;IAIb,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAI9B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAInC,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IASnC,OAAO,IAAI,IAAI;CAQhB"}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Preview-mode {@link AudioSource}: wraps an `HTMLAudioElement` and drives it in
|
|
3
|
-
* realtime. Ported from {@link BrowserVideoSource} minus the drawable/rvfc bits
|
|
4
|
-
* (audio produces no frames). A server renderer injects a different source via
|
|
5
|
-
* `AudioConfig.sourceFactory`.
|
|
6
|
-
*/
|
|
7
|
-
export class BrowserAudioSource {
|
|
8
|
-
_el;
|
|
9
|
-
_ready = false;
|
|
10
|
-
_readyCbs = new Set();
|
|
11
|
-
// Seek coalescing: keep at most one seek in flight. Rapid scrubbing only ever
|
|
12
|
-
// lands the latest target — intermediate ones are dropped — so the backlog
|
|
13
|
-
// never grows (which is what makes scrubbing a large clip degrade over time).
|
|
14
|
-
_seeking = false;
|
|
15
|
-
_pending = null;
|
|
16
|
-
constructor() {
|
|
17
|
-
// createElement (not `new Audio()`) dodges the global `Audio` constructor,
|
|
18
|
-
// which collides with our exported `Audio` class.
|
|
19
|
-
const el = document.createElement("audio");
|
|
20
|
-
el.crossOrigin = "anonymous";
|
|
21
|
-
el.preload = "auto";
|
|
22
|
-
// Muted so the browser allows programmatic play()/seek before any user gesture.
|
|
23
|
-
el.muted = true;
|
|
24
|
-
this._el = el;
|
|
25
|
-
}
|
|
26
|
-
load(src) {
|
|
27
|
-
return new Promise((resolve, reject) => {
|
|
28
|
-
const onReady = () => {
|
|
29
|
-
cleanup();
|
|
30
|
-
this._ready = true;
|
|
31
|
-
for (const cb of this._readyCbs)
|
|
32
|
-
cb();
|
|
33
|
-
resolve();
|
|
34
|
-
};
|
|
35
|
-
const onErr = () => {
|
|
36
|
-
cleanup();
|
|
37
|
-
reject(new Error(`Failed to load audio: ${src}`));
|
|
38
|
-
};
|
|
39
|
-
const cleanup = () => {
|
|
40
|
-
this._el.removeEventListener("loadeddata", onReady);
|
|
41
|
-
this._el.removeEventListener("error", onErr);
|
|
42
|
-
};
|
|
43
|
-
this._el.addEventListener("loadeddata", onReady);
|
|
44
|
-
this._el.addEventListener("error", onErr);
|
|
45
|
-
this._el.src = src;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
get duration() {
|
|
49
|
-
return Number.isFinite(this._el.duration) ? this._el.duration : 0;
|
|
50
|
-
}
|
|
51
|
-
get currentTime() {
|
|
52
|
-
return this._el.currentTime;
|
|
53
|
-
}
|
|
54
|
-
get isReady() {
|
|
55
|
-
return this._ready;
|
|
56
|
-
}
|
|
57
|
-
seek(timeSeconds, mode = "precise") {
|
|
58
|
-
const clamped = Math.max(0, this.duration > 0 ? Math.min(this.duration, timeSeconds) : timeSeconds);
|
|
59
|
-
// No-op seek with nothing in flight: already there, resolve immediately.
|
|
60
|
-
if (!this._seeking && Math.abs(this._el.currentTime - clamped) <= 1e-4) {
|
|
61
|
-
return Promise.resolve();
|
|
62
|
-
}
|
|
63
|
-
return new Promise((resolve) => {
|
|
64
|
-
if (this._pending) {
|
|
65
|
-
// Supersede the queued target — only the latest scrub position matters.
|
|
66
|
-
this._pending.time = clamped;
|
|
67
|
-
this._pending.mode = mode;
|
|
68
|
-
this._pending.resolvers.push(resolve);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
this._pending = { time: clamped, mode, resolvers: [resolve] };
|
|
72
|
-
}
|
|
73
|
-
this._drainSeek();
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
/** Issue the pending seek if none is in flight; chains the latest target after each completes. */
|
|
77
|
-
_drainSeek() {
|
|
78
|
-
if (this._seeking || !this._pending)
|
|
79
|
-
return;
|
|
80
|
-
const { time, mode, resolvers } = this._pending;
|
|
81
|
-
this._pending = null;
|
|
82
|
-
if (Math.abs(this._el.currentTime - time) <= 1e-4) {
|
|
83
|
-
for (const r of resolvers)
|
|
84
|
-
r();
|
|
85
|
-
this._drainSeek();
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
this._seeking = true;
|
|
89
|
-
const onSeeked = () => {
|
|
90
|
-
this._el.removeEventListener("seeked", onSeeked);
|
|
91
|
-
this._seeking = false;
|
|
92
|
-
for (const r of resolvers)
|
|
93
|
-
r();
|
|
94
|
-
// A newer target may have arrived mid-seek — land it now.
|
|
95
|
-
this._drainSeek();
|
|
96
|
-
};
|
|
97
|
-
this._el.addEventListener("seeked", onSeeked);
|
|
98
|
-
// fastSeek jumps to the nearest keyframe — much snappier for scrubbing a
|
|
99
|
-
// large clip. Fall back to a precise currentTime seek when unavailable.
|
|
100
|
-
if (mode === "fast" && typeof this._el.fastSeek === "function") {
|
|
101
|
-
this._el.fastSeek(time);
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
this._el.currentTime = time;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
play() {
|
|
108
|
-
return this._el.play();
|
|
109
|
-
}
|
|
110
|
-
pause() {
|
|
111
|
-
this._el.pause();
|
|
112
|
-
}
|
|
113
|
-
setMuted(muted) {
|
|
114
|
-
this._el.muted = muted;
|
|
115
|
-
}
|
|
116
|
-
setVolume(volume) {
|
|
117
|
-
this._el.volume = Math.max(0, Math.min(1, volume));
|
|
118
|
-
}
|
|
119
|
-
setPlaybackRate(rate) {
|
|
120
|
-
this._el.playbackRate = rate;
|
|
121
|
-
}
|
|
122
|
-
onReady(cb) {
|
|
123
|
-
if (this._ready) {
|
|
124
|
-
cb();
|
|
125
|
-
return () => { };
|
|
126
|
-
}
|
|
127
|
-
this._readyCbs.add(cb);
|
|
128
|
-
return () => this._readyCbs.delete(cb);
|
|
129
|
-
}
|
|
130
|
-
destroy() {
|
|
131
|
-
this._el.pause();
|
|
132
|
-
this._el.removeAttribute("src");
|
|
133
|
-
this._el.load();
|
|
134
|
-
this._readyCbs.clear();
|
|
135
|
-
this._pending = null;
|
|
136
|
-
this._seeking = false;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
//# sourceMappingURL=audio-source-browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-source-browser.js","sourceRoot":"","sources":["../../src/audio/audio-source-browser.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IACZ,GAAG,CAAgB;IAC5B,MAAM,GAAG,KAAK,CAAC;IACN,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;IAEnD,8EAA8E;IAC9E,2EAA2E;IAC3E,8EAA8E;IACtE,QAAQ,GAAG,KAAK,CAAC;IACjB,QAAQ,GAA0E,IAAI,CAAC;IAE/F;QACE,2EAA2E;QAC3E,kDAAkD;QAClD,MAAM,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAkB,CAAC;QAC5D,EAAE,CAAC,WAAW,GAAG,WAAW,CAAC;QAC7B,EAAE,CAAC,OAAO,GAAG,MAAM,CAAC;QACpB,gFAAgF;QAChF,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,GAA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AAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,eAAe,CAAC,IAAY;QAC1B,IAAI,CAAC,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED,OAAO,CAAC,EAAc;QACpB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,EAAE,EAAE,CAAC;YACL,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACvB,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QACjB,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Environment } from "../environment.js";
|
|
2
|
-
import type { SeekMode } from "../video/video-source.js";
|
|
3
|
-
export type { SeekMode };
|
|
4
|
-
/**
|
|
5
|
-
* Runtime-agnostic audio source — the dependency-injection seam between the
|
|
6
|
-
* engine and the actual media decoder. The browser implementation
|
|
7
|
-
* ({@link BrowserAudioSource}) wraps an `HTMLAudioElement`. Mirrors
|
|
8
|
-
* {@link VideoSource} minus the drawable/dimension members (audio has no pixels).
|
|
9
|
-
*/
|
|
10
|
-
export interface AudioSource {
|
|
11
|
-
load(src: string): Promise<void>;
|
|
12
|
-
/** Duration in seconds, or 0 if unknown. */
|
|
13
|
-
readonly duration: number;
|
|
14
|
-
/** Current media playback position in seconds. */
|
|
15
|
-
readonly currentTime: number;
|
|
16
|
-
readonly isReady: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Seek to a time in seconds. `mode: "fast"` requests an approximate, snappy
|
|
19
|
-
* seek (nearest keyframe) for scrubbing; the default `"precise"` lands on the
|
|
20
|
-
* exact time.
|
|
21
|
-
*/
|
|
22
|
-
seek(timeSeconds: number, mode?: SeekMode): Promise<void>;
|
|
23
|
-
play(): Promise<void>;
|
|
24
|
-
pause(): void;
|
|
25
|
-
setMuted(muted: boolean): void;
|
|
26
|
-
setVolume(volume: number): void;
|
|
27
|
-
setPlaybackRate(rate: number): void;
|
|
28
|
-
/** Fires once when metadata is available. */
|
|
29
|
-
onReady(cb: () => void): () => void;
|
|
30
|
-
destroy(): void;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Factory for an {@link AudioSource}. Receives the resolved {@link Environment}
|
|
34
|
-
* so a single factory can pick an implementation based on whether we are
|
|
35
|
-
* rendering or previewing.
|
|
36
|
-
*/
|
|
37
|
-
export type AudioSourceFactory = (env: Environment) => AudioSource;
|
|
38
|
-
//# sourceMappingURL=audio-source.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-source.d.ts","sourceRoot":"","sources":["../../src/audio/audio-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,YAAY,EAAE,QAAQ,EAAE,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,kDAAkD;IAClD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,6CAA6C;IAC7C,OAAO,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IACpC,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,WAAW,KAAK,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audio-source.js","sourceRoot":"","sources":["../../src/audio/audio-source.ts"],"names":[],"mappings":""}
|
package/dist/audio/index.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import Konva from "konva";
|
|
2
|
-
import { type ReadonlySignal } from "../signal.js";
|
|
3
|
-
import type { AudioChannel, AudioMixer } from "./mixer.js";
|
|
4
|
-
import type { AudioConfig } from "./types.js";
|
|
5
|
-
/**
|
|
6
|
-
* Timeline-driven audio. API mirrors Remotion's `<Audio>`
|
|
7
|
-
* (`trimBefore`/`trimAfter`/`loop`/`muted`/`volume`/`playbackRate`). It is an
|
|
8
|
-
* invisible {@link Konva.Group} so it lives in the `Sequence` tree and is
|
|
9
|
-
* discovered, range-gated, ticked, and mixer-registered exactly like
|
|
10
|
-
* {@link Video} — but it produces no pixels. Picks a {@link RenderingAudioDriver}
|
|
11
|
-
* or {@link PreviewAudioDriver} based on the composition's {@link Environment}.
|
|
12
|
-
*/
|
|
13
|
-
export declare class Audio extends Konva.Group implements AudioChannel {
|
|
14
|
-
/** Human label for mixer UIs — `config.name`, falling back to `config.src`. */
|
|
15
|
-
readonly label: string;
|
|
16
|
-
/** Intrinsic audio level, 0..1 — scaled by the composition mixer's master. */
|
|
17
|
-
readonly volume: ReadonlySignal<number>;
|
|
18
|
-
readonly muted: ReadonlySignal<boolean>;
|
|
19
|
-
private readonly _src;
|
|
20
|
-
private readonly _source;
|
|
21
|
-
private readonly _trimBefore;
|
|
22
|
-
private readonly _trimAfter?;
|
|
23
|
-
private readonly _loop;
|
|
24
|
-
private readonly _playbackRate;
|
|
25
|
-
private readonly _volume;
|
|
26
|
-
private readonly _muted;
|
|
27
|
-
private _mixer;
|
|
28
|
-
private _driver;
|
|
29
|
-
constructor(config: AudioConfig);
|
|
30
|
-
/** @internal — called by Sequence on each tick while this audio is on-stage. */
|
|
31
|
-
_kmTick(localFrame: number): void;
|
|
32
|
-
/** @internal — called by Sequence when it goes out of range. */
|
|
33
|
-
_kmDeactivate(): void;
|
|
34
|
-
private _ensureDriver;
|
|
35
|
-
setMuted(muted: boolean): void;
|
|
36
|
-
setVolume(volume: number): void;
|
|
37
|
-
/** @internal — {@link AudioMixer} hands us the bus (or null on unregister). */
|
|
38
|
-
_bindMixer(mixer: AudioMixer | null): void;
|
|
39
|
-
/** @internal — push effective level (master × intrinsic) to the source. */
|
|
40
|
-
_applyAudio(): void;
|
|
41
|
-
setPlaybackRate(rate: number): void;
|
|
42
|
-
destroy(): this;
|
|
43
|
-
}
|
|
44
|
-
export declare function isAudioNode(node: Konva.Node): node is Audio;
|
|
45
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/audio/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CA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