@waveform-playlist/engine 14.0.0-next.8 → 14.0.0-next.9
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/README.md +15 -15
- package/dist/index.d.mts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @waveform-playlist/engine
|
|
2
2
|
|
|
3
|
-
Framework-agnostic multitrack timeline engine for waveform-playlist — pure clip/track operations, an arrangement that owns the tracks, the mix and the undo history, and a stateful `
|
|
3
|
+
Framework-agnostic multitrack timeline engine for waveform-playlist — pure clip/track operations, an arrangement that owns the tracks, the mix and the undo history, and a stateful `EditorEngine` that plays an arrangement and manages selection, loop and zoom, decoupled from any audio backend via a pluggable `PlayoutAdapter`.
|
|
4
4
|
|
|
5
5
|
Used by `@waveform-playlist/browser` (the React provider) and `@dawcore/components` (the Lit web-components layer). Pair it with a `PlayoutAdapter` implementation such as `@waveform-playlist/playout` (Tone.js) or `@dawcore/transport` (native Web Audio) to actually produce sound — the engine itself never touches the audio graph directly.
|
|
6
6
|
|
|
@@ -26,12 +26,12 @@ npm install @waveform-playlist/engine @waveform-playlist/core
|
|
|
26
26
|
## Quick Start
|
|
27
27
|
|
|
28
28
|
```typescript
|
|
29
|
-
import {
|
|
29
|
+
import { EditorEngine } from '@waveform-playlist/engine';
|
|
30
30
|
import { createClipFromSeconds, type ClipTrack } from '@waveform-playlist/core';
|
|
31
31
|
import { createToneAdapter } from '@waveform-playlist/playout'; // any PlayoutAdapter implementation
|
|
32
32
|
|
|
33
33
|
const adapter = createToneAdapter();
|
|
34
|
-
const engine = new
|
|
34
|
+
const engine = new EditorEngine({ adapter, sampleRate: 48000 });
|
|
35
35
|
await engine.init();
|
|
36
36
|
|
|
37
37
|
const track: ClipTrack = {
|
|
@@ -75,12 +75,12 @@ engine.redo();
|
|
|
75
75
|
|
|
76
76
|
## The arrangement
|
|
77
77
|
|
|
78
|
-
An arrangement is the owner of three things: the tracks with their clips, the mix (volume, mute, solo and pan by track id) and the undo history with its transactions. Everything else reads it and changes it by calling its methods.
|
|
78
|
+
An arrangement is the owner of three things: the tracks with their clips, the mix (volume, mute, solo and pan by track id) and the undo history with its transactions. Everything else reads it and changes it by calling its methods. An `EditorEngine` plays an arrangement: it follows it by subscription, and for each change it makes the adapter call and emits `statechange`.
|
|
79
79
|
|
|
80
|
-
An engine built without an `arrangement` option makes one of its own, so `new
|
|
80
|
+
An engine built without an `arrangement` option makes one of its own, so `new EditorEngine({ adapter })` works as in the Quick Start. Make the arrangement yourself when it has to exist before the engine does, or outlive it:
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
|
-
import { createArrangement,
|
|
83
|
+
import { createArrangement, EditorEngine } from '@waveform-playlist/engine';
|
|
84
84
|
|
|
85
85
|
const arrangement = createArrangement({ tracks: [track], undoLimit: 50 });
|
|
86
86
|
|
|
@@ -96,12 +96,12 @@ const unsubscribe = arrangement.subscribe(() => {
|
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
// Play it
|
|
99
|
-
const engine = new
|
|
99
|
+
const engine = new EditorEngine({ adapter: createToneAdapter(), arrangement });
|
|
100
100
|
await engine.init();
|
|
101
101
|
|
|
102
102
|
// The arrangement outlives the engine
|
|
103
103
|
engine.dispose();
|
|
104
|
-
const next = new
|
|
104
|
+
const next = new EditorEngine({ adapter: createToneAdapter(), arrangement });
|
|
105
105
|
// next has the same tracks, the same mix and the same undo history
|
|
106
106
|
```
|
|
107
107
|
|
|
@@ -147,7 +147,7 @@ slider.addEventListener('input', () => {
|
|
|
147
147
|
A track of an arrangement is an `ArrangementTrack` (from `@waveform-playlist/core`): its clips are loaded clips (`AudioClip`) or clips whose audio is not loaded yet (`LoadingClip`: a `src` and times in seconds). `isLoadingClip(clip)` tells them apart; narrow with it before reading `startSample`, `durationSamples` or any other sample field of a clip from `arrangement.getTracks()`. `createArrangement({ tracks })`, `getTracks`, `setTracks`, `addTrack` and `updateTrack` of the arrangement use that type. The engine's own `setTracks`, `addTrack` and `updateTrack` still take `ClipTrack` (loaded clips only).
|
|
148
148
|
|
|
149
149
|
```typescript
|
|
150
|
-
import { createArrangement,
|
|
150
|
+
import { createArrangement, EditorEngine } from '@waveform-playlist/engine';
|
|
151
151
|
import { audioTrack, isLoadingClip } from '@waveform-playlist/core';
|
|
152
152
|
|
|
153
153
|
const arrangement = createArrangement({
|
|
@@ -161,7 +161,7 @@ const arrangement = createArrangement({
|
|
|
161
161
|
arrangement.sources.getSnapshot(); // { sources: Map(2), pendingCount: 2, failedCount: 0, isLoading: true }
|
|
162
162
|
|
|
163
163
|
// An engine with an adapter attaches adapter.audioContext, and the loads start.
|
|
164
|
-
const engine = new
|
|
164
|
+
const engine = new EditorEngine({ adapter: createToneAdapter(), arrangement });
|
|
165
165
|
await engine.init();
|
|
166
166
|
|
|
167
167
|
arrangement.sources.subscribe(({ sources, isLoading, failedCount }) => {
|
|
@@ -220,7 +220,7 @@ const arrangement = createArrangement({ loadSource });
|
|
|
220
220
|
|
|
221
221
|
The messages of `defaultLoadSource`'s own errors (`Failed to fetch <source>: <status> <statusText>`, `Failed to fetch <source>` when `fetch` threw a `TypeError`, `Decoded audio is empty: <source>`) name a URL without its query string, its fragment and a user name or password before the host (a URL the browser's parser finds credentials in is named in its parsed, absolute form; a malformed one the parser refuses loses only its query string and fragment), never echo a `data:` or `blob:` URL, and call a `File` by its name and any other `Blob` "Blob". The browser's `TypeError` is kept in `cause` only when the name in the message is the source unchanged. When anything was left out of the name (a user name or password, a query string, a fragment, a `data:` or `blob:` URL) the error has no `cause`, because the browser's own message can quote the whole URL. An `Error` the browser's decoder rejects with is passed on as it is, so its message is the browser's and does not name the source.
|
|
222
222
|
|
|
223
|
-
Nothing is fetched until the arrangement has an audio context to decode with; until then its sources are `pending`.
|
|
223
|
+
Nothing is fetched until the arrangement has an audio context to decode with; until then its sources are `pending`. An `EditorEngine` built with an adapter attaches `adapter.audioContext` in its constructor and detaches it in `dispose()`. Without an engine, or with `new EditorEngine({ adapter, arrangement, attachDecodeContext: false })`, attach one yourself:
|
|
224
224
|
|
|
225
225
|
```typescript
|
|
226
226
|
import { attachDecodeContext } from '@waveform-playlist/engine';
|
|
@@ -246,13 +246,13 @@ Rules that hold for the engine and the arrangement alike:
|
|
|
246
246
|
|
|
247
247
|
## API
|
|
248
248
|
|
|
249
|
-
###
|
|
249
|
+
### EditorEngine
|
|
250
250
|
|
|
251
|
-
Key methods (see `src/types.ts` for the full `EngineState` shape). `
|
|
251
|
+
Key methods (see `src/types.ts` for the full `EngineState` shape). `EditorEngineOptions` takes `adapter`, `arrangement`, `sampleRate`, `samplesPerPixel`, `zoomLevels`, `undoLimit`, `attachDecodeContext`, `bpm` and `ppqn`, all optional:
|
|
252
252
|
|
|
253
253
|
```typescript
|
|
254
|
-
class
|
|
255
|
-
constructor(options?:
|
|
254
|
+
class EditorEngine {
|
|
255
|
+
constructor(options?: EditorEngineOptions);
|
|
256
256
|
|
|
257
257
|
// Tracks
|
|
258
258
|
setTracks(tracks: readonly ClipTrack[]): void; // replaces every track, clears the undo history
|
package/dist/index.d.mts
CHANGED
|
@@ -309,7 +309,7 @@ interface ArrangementChangeInfo {
|
|
|
309
309
|
/**
|
|
310
310
|
* The owner of the tracks, of the mix and of the undo history. Everything
|
|
311
311
|
* else reads it (`getTracks`, `getMixer`, `subscribe`) and changes it by
|
|
312
|
-
* calling its methods.
|
|
312
|
+
* calling its methods. An `EditorEngine` built on it plays it.
|
|
313
313
|
*
|
|
314
314
|
* Nothing it returns is a copy: never write to a tracks array, a track, a
|
|
315
315
|
* clip or the mixer Map. Outside production builds the tracks are frozen.
|
|
@@ -488,21 +488,21 @@ declare function isArrangement(value: unknown): boolean;
|
|
|
488
488
|
* flight are aborted and start again at the next attach; what is loaded
|
|
489
489
|
* stays. One context at a time: a second attach warns and replaces the first.
|
|
490
490
|
*
|
|
491
|
-
*
|
|
491
|
+
* An `EditorEngine` with an adapter does this itself with the adapter's
|
|
492
492
|
* context (see its `attachDecodeContext` option).
|
|
493
493
|
*/
|
|
494
494
|
declare function attachDecodeContext(arrangement: Arrangement, getContext: GetDecodeContext): () => void;
|
|
495
495
|
|
|
496
496
|
/**
|
|
497
497
|
* Make an arrangement: the owner of the tracks, the mix and the undo
|
|
498
|
-
* history. It needs no engine; give it to `new
|
|
498
|
+
* history. It needs no engine; give it to `new EditorEngine({ arrangement })`
|
|
499
499
|
* to play it, and to the next engine when that one is disposed.
|
|
500
500
|
*/
|
|
501
501
|
declare function createArrangement(options?: CreateArrangementOptions): Arrangement;
|
|
502
502
|
|
|
503
503
|
/**
|
|
504
504
|
* Interface for pluggable audio playback adapters.
|
|
505
|
-
* Implement this to connect
|
|
505
|
+
* Implement this to connect EditorEngine to any audio backend
|
|
506
506
|
* (Tone.js, openDAW, HTMLAudioElement, etc.)
|
|
507
507
|
*/
|
|
508
508
|
interface PlayoutAdapter {
|
|
@@ -581,7 +581,7 @@ interface PlayoutAdapter {
|
|
|
581
581
|
* what the listener actually hears. Tone.js Transport reports a position that's
|
|
582
582
|
* `lookAhead` ahead of audible (default 0.1s); native AudioContext-based adapters
|
|
583
583
|
* have no lookahead. Consumers visualizing playback position should use
|
|
584
|
-
* `
|
|
584
|
+
* `EditorEngine.getAudibleTime()`, which applies this (plus
|
|
585
585
|
* `audioContext.outputLatency`) only while playing. Returns 0 or undefined when
|
|
586
586
|
* there's no lookahead. */
|
|
587
587
|
readonly lookAhead?: number;
|
|
@@ -632,7 +632,7 @@ interface EngineState {
|
|
|
632
632
|
/** Whether redo is available. */
|
|
633
633
|
canRedo: boolean;
|
|
634
634
|
}
|
|
635
|
-
/** Options of `
|
|
635
|
+
/** Options of `EditorEngine.dispose()`. */
|
|
636
636
|
interface EngineDisposeOptions {
|
|
637
637
|
/**
|
|
638
638
|
* Leave the adapter undisposed (#848), for a host that plays another
|
|
@@ -643,9 +643,9 @@ interface EngineDisposeOptions {
|
|
|
643
643
|
keepAdapter?: boolean;
|
|
644
644
|
}
|
|
645
645
|
/**
|
|
646
|
-
* Configuration options for
|
|
646
|
+
* Configuration options for EditorEngine constructor.
|
|
647
647
|
*/
|
|
648
|
-
interface
|
|
648
|
+
interface EditorEngineOptions {
|
|
649
649
|
adapter?: PlayoutAdapter;
|
|
650
650
|
/**
|
|
651
651
|
* The arrangement to play, from `createArrangement()`. It outlives the
|
|
@@ -676,7 +676,7 @@ interface PlaylistEngineOptions {
|
|
|
676
676
|
ppqn?: number;
|
|
677
677
|
}
|
|
678
678
|
/**
|
|
679
|
-
* Events emitted by
|
|
679
|
+
* Events emitted by EditorEngine.
|
|
680
680
|
*/
|
|
681
681
|
interface EngineEvents {
|
|
682
682
|
statechange: (state: EngineState) => void;
|
|
@@ -686,7 +686,7 @@ interface EngineEvents {
|
|
|
686
686
|
}
|
|
687
687
|
|
|
688
688
|
/**
|
|
689
|
-
*
|
|
689
|
+
* EditorEngine — Stateful, framework-agnostic timeline engine.
|
|
690
690
|
*
|
|
691
691
|
* Composes an Arrangement (the tracks, the mix, the undo history and
|
|
692
692
|
* transactions) with an event emitter and optional PlayoutAdapter for audio
|
|
@@ -696,7 +696,7 @@ interface EngineEvents {
|
|
|
696
696
|
*/
|
|
697
697
|
|
|
698
698
|
type EventName = keyof EngineEvents;
|
|
699
|
-
declare class
|
|
699
|
+
declare class EditorEngine {
|
|
700
700
|
private _arrangement;
|
|
701
701
|
private _stopFollowingArrangement;
|
|
702
702
|
private _detachFromArrangement;
|
|
@@ -721,7 +721,7 @@ declare class PlaylistEngine {
|
|
|
721
721
|
private _disposed;
|
|
722
722
|
private _listeners;
|
|
723
723
|
readonly undoLimit: number;
|
|
724
|
-
constructor(options?:
|
|
724
|
+
constructor(options?: EditorEngineOptions);
|
|
725
725
|
get canUndo(): boolean;
|
|
726
726
|
get canRedo(): boolean;
|
|
727
727
|
undo(): void;
|
|
@@ -862,4 +862,4 @@ declare class PlaylistEngine {
|
|
|
862
862
|
private _emitStateChange;
|
|
863
863
|
}
|
|
864
864
|
|
|
865
|
-
export { type AddTrackOptions, type Arrangement, type ArrangementChangeInfo, type ArrangementChangeType, type ArrangementSourceState, type ArrangementSourcesValue, type ClipBounds, type CreateArrangementOptions, type EngineDisposeOptions, type EngineEvents, type EngineState, type LoadSource, type MixerChangeOptions,
|
|
865
|
+
export { type AddTrackOptions, type Arrangement, type ArrangementChangeInfo, type ArrangementChangeType, type ArrangementSourceState, type ArrangementSourcesValue, type ClipBounds, type CreateArrangementOptions, EditorEngine, type EditorEngineOptions, type EngineDisposeOptions, type EngineEvents, type EngineState, type LoadSource, type MixerChangeOptions, type PlayoutAdapter, type RemoveClipOptions, type RemoveTrackOptions, type TrackMixerValues, attachDecodeContext, calculateDuration, calculateSplitPoint, calculateViewportBounds, calculateZoomScrollPosition, canSplitAt, clampSeekPosition, constrainBoundaryTrim, constrainClipDrag, createArrangement, defaultLoadSource, findClosestZoomIndex, getVisibleChunkIndices, isArrangement, shouldUpdateViewport, splitClip };
|
package/dist/index.d.ts
CHANGED
|
@@ -309,7 +309,7 @@ interface ArrangementChangeInfo {
|
|
|
309
309
|
/**
|
|
310
310
|
* The owner of the tracks, of the mix and of the undo history. Everything
|
|
311
311
|
* else reads it (`getTracks`, `getMixer`, `subscribe`) and changes it by
|
|
312
|
-
* calling its methods.
|
|
312
|
+
* calling its methods. An `EditorEngine` built on it plays it.
|
|
313
313
|
*
|
|
314
314
|
* Nothing it returns is a copy: never write to a tracks array, a track, a
|
|
315
315
|
* clip or the mixer Map. Outside production builds the tracks are frozen.
|
|
@@ -488,21 +488,21 @@ declare function isArrangement(value: unknown): boolean;
|
|
|
488
488
|
* flight are aborted and start again at the next attach; what is loaded
|
|
489
489
|
* stays. One context at a time: a second attach warns and replaces the first.
|
|
490
490
|
*
|
|
491
|
-
*
|
|
491
|
+
* An `EditorEngine` with an adapter does this itself with the adapter's
|
|
492
492
|
* context (see its `attachDecodeContext` option).
|
|
493
493
|
*/
|
|
494
494
|
declare function attachDecodeContext(arrangement: Arrangement, getContext: GetDecodeContext): () => void;
|
|
495
495
|
|
|
496
496
|
/**
|
|
497
497
|
* Make an arrangement: the owner of the tracks, the mix and the undo
|
|
498
|
-
* history. It needs no engine; give it to `new
|
|
498
|
+
* history. It needs no engine; give it to `new EditorEngine({ arrangement })`
|
|
499
499
|
* to play it, and to the next engine when that one is disposed.
|
|
500
500
|
*/
|
|
501
501
|
declare function createArrangement(options?: CreateArrangementOptions): Arrangement;
|
|
502
502
|
|
|
503
503
|
/**
|
|
504
504
|
* Interface for pluggable audio playback adapters.
|
|
505
|
-
* Implement this to connect
|
|
505
|
+
* Implement this to connect EditorEngine to any audio backend
|
|
506
506
|
* (Tone.js, openDAW, HTMLAudioElement, etc.)
|
|
507
507
|
*/
|
|
508
508
|
interface PlayoutAdapter {
|
|
@@ -581,7 +581,7 @@ interface PlayoutAdapter {
|
|
|
581
581
|
* what the listener actually hears. Tone.js Transport reports a position that's
|
|
582
582
|
* `lookAhead` ahead of audible (default 0.1s); native AudioContext-based adapters
|
|
583
583
|
* have no lookahead. Consumers visualizing playback position should use
|
|
584
|
-
* `
|
|
584
|
+
* `EditorEngine.getAudibleTime()`, which applies this (plus
|
|
585
585
|
* `audioContext.outputLatency`) only while playing. Returns 0 or undefined when
|
|
586
586
|
* there's no lookahead. */
|
|
587
587
|
readonly lookAhead?: number;
|
|
@@ -632,7 +632,7 @@ interface EngineState {
|
|
|
632
632
|
/** Whether redo is available. */
|
|
633
633
|
canRedo: boolean;
|
|
634
634
|
}
|
|
635
|
-
/** Options of `
|
|
635
|
+
/** Options of `EditorEngine.dispose()`. */
|
|
636
636
|
interface EngineDisposeOptions {
|
|
637
637
|
/**
|
|
638
638
|
* Leave the adapter undisposed (#848), for a host that plays another
|
|
@@ -643,9 +643,9 @@ interface EngineDisposeOptions {
|
|
|
643
643
|
keepAdapter?: boolean;
|
|
644
644
|
}
|
|
645
645
|
/**
|
|
646
|
-
* Configuration options for
|
|
646
|
+
* Configuration options for EditorEngine constructor.
|
|
647
647
|
*/
|
|
648
|
-
interface
|
|
648
|
+
interface EditorEngineOptions {
|
|
649
649
|
adapter?: PlayoutAdapter;
|
|
650
650
|
/**
|
|
651
651
|
* The arrangement to play, from `createArrangement()`. It outlives the
|
|
@@ -676,7 +676,7 @@ interface PlaylistEngineOptions {
|
|
|
676
676
|
ppqn?: number;
|
|
677
677
|
}
|
|
678
678
|
/**
|
|
679
|
-
* Events emitted by
|
|
679
|
+
* Events emitted by EditorEngine.
|
|
680
680
|
*/
|
|
681
681
|
interface EngineEvents {
|
|
682
682
|
statechange: (state: EngineState) => void;
|
|
@@ -686,7 +686,7 @@ interface EngineEvents {
|
|
|
686
686
|
}
|
|
687
687
|
|
|
688
688
|
/**
|
|
689
|
-
*
|
|
689
|
+
* EditorEngine — Stateful, framework-agnostic timeline engine.
|
|
690
690
|
*
|
|
691
691
|
* Composes an Arrangement (the tracks, the mix, the undo history and
|
|
692
692
|
* transactions) with an event emitter and optional PlayoutAdapter for audio
|
|
@@ -696,7 +696,7 @@ interface EngineEvents {
|
|
|
696
696
|
*/
|
|
697
697
|
|
|
698
698
|
type EventName = keyof EngineEvents;
|
|
699
|
-
declare class
|
|
699
|
+
declare class EditorEngine {
|
|
700
700
|
private _arrangement;
|
|
701
701
|
private _stopFollowingArrangement;
|
|
702
702
|
private _detachFromArrangement;
|
|
@@ -721,7 +721,7 @@ declare class PlaylistEngine {
|
|
|
721
721
|
private _disposed;
|
|
722
722
|
private _listeners;
|
|
723
723
|
readonly undoLimit: number;
|
|
724
|
-
constructor(options?:
|
|
724
|
+
constructor(options?: EditorEngineOptions);
|
|
725
725
|
get canUndo(): boolean;
|
|
726
726
|
get canRedo(): boolean;
|
|
727
727
|
undo(): void;
|
|
@@ -862,4 +862,4 @@ declare class PlaylistEngine {
|
|
|
862
862
|
private _emitStateChange;
|
|
863
863
|
}
|
|
864
864
|
|
|
865
|
-
export { type AddTrackOptions, type Arrangement, type ArrangementChangeInfo, type ArrangementChangeType, type ArrangementSourceState, type ArrangementSourcesValue, type ClipBounds, type CreateArrangementOptions, type EngineDisposeOptions, type EngineEvents, type EngineState, type LoadSource, type MixerChangeOptions,
|
|
865
|
+
export { type AddTrackOptions, type Arrangement, type ArrangementChangeInfo, type ArrangementChangeType, type ArrangementSourceState, type ArrangementSourcesValue, type ClipBounds, type CreateArrangementOptions, EditorEngine, type EditorEngineOptions, type EngineDisposeOptions, type EngineEvents, type EngineState, type LoadSource, type MixerChangeOptions, type PlayoutAdapter, type RemoveClipOptions, type RemoveTrackOptions, type TrackMixerValues, attachDecodeContext, calculateDuration, calculateSplitPoint, calculateViewportBounds, calculateZoomScrollPosition, canSplitAt, clampSeekPosition, constrainBoundaryTrim, constrainClipDrag, createArrangement, defaultLoadSource, findClosestZoomIndex, getVisibleChunkIndices, isArrangement, shouldUpdateViewport, splitClip };
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
-
|
|
23
|
+
EditorEngine: () => EditorEngine,
|
|
24
24
|
attachDecodeContext: () => attachDecodeContext,
|
|
25
25
|
calculateDuration: () => calculateDuration,
|
|
26
26
|
calculateSplitPoint: () => calculateSplitPoint,
|
|
@@ -2213,11 +2213,11 @@ var AdapterSync = class {
|
|
|
2213
2213
|
}
|
|
2214
2214
|
};
|
|
2215
2215
|
|
|
2216
|
-
// src/
|
|
2216
|
+
// src/EditorEngine.ts
|
|
2217
2217
|
var DEFAULT_SAMPLE_RATE = 48e3;
|
|
2218
2218
|
var DEFAULT_SAMPLES_PER_PIXEL = 1024;
|
|
2219
2219
|
var DEFAULT_ZOOM_LEVELS = [256, 512, 1024, 2048, 4096, 8192];
|
|
2220
|
-
var
|
|
2220
|
+
var EditorEngine = class {
|
|
2221
2221
|
constructor(options = {}) {
|
|
2222
2222
|
this._detachDecodeContext = null;
|
|
2223
2223
|
this._currentTime = 0;
|
|
@@ -2244,13 +2244,13 @@ var PlaylistEngine = class {
|
|
|
2244
2244
|
});
|
|
2245
2245
|
});
|
|
2246
2246
|
if (this._zoomLevels.length === 0) {
|
|
2247
|
-
throw new Error("
|
|
2247
|
+
throw new Error("EditorEngine: zoomLevels must not be empty");
|
|
2248
2248
|
}
|
|
2249
2249
|
const initialSpp = options.samplesPerPixel ?? DEFAULT_SAMPLES_PER_PIXEL;
|
|
2250
2250
|
const zoomIndex = this._zoomLevels.indexOf(initialSpp);
|
|
2251
2251
|
if (zoomIndex === -1) {
|
|
2252
2252
|
throw new Error(
|
|
2253
|
-
`
|
|
2253
|
+
`EditorEngine: samplesPerPixel ${initialSpp} is not in zoomLevels [${this._zoomLevels.join(", ")}]. Either pass a samplesPerPixel value that exists in zoomLevels, or include ${initialSpp} in your zoomLevels array.`
|
|
2254
2254
|
);
|
|
2255
2255
|
}
|
|
2256
2256
|
this._zoomIndex = zoomIndex;
|
|
@@ -2266,7 +2266,7 @@ var PlaylistEngine = class {
|
|
|
2266
2266
|
this._arrangement = asArrangementImpl(options.arrangement);
|
|
2267
2267
|
if (options.undoLimit !== void 0) {
|
|
2268
2268
|
console.warn(
|
|
2269
|
-
"[waveform-playlist]
|
|
2269
|
+
"[waveform-playlist] EditorEngine: undoLimit is ignored when an arrangement is passed. Set it on createArrangement({ undoLimit })."
|
|
2270
2270
|
);
|
|
2271
2271
|
}
|
|
2272
2272
|
} else {
|
|
@@ -2815,12 +2815,12 @@ var PlaylistEngine = class {
|
|
|
2815
2815
|
function asArrangementImpl(arrangement) {
|
|
2816
2816
|
if (isArrangement(arrangement)) return arrangement;
|
|
2817
2817
|
throw new Error(
|
|
2818
|
-
"[waveform-playlist]
|
|
2818
|
+
"[waveform-playlist] EditorEngine: the `arrangement` option must be an arrangement made by createArrangement()."
|
|
2819
2819
|
);
|
|
2820
2820
|
}
|
|
2821
2821
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2822
2822
|
0 && (module.exports = {
|
|
2823
|
-
|
|
2823
|
+
EditorEngine,
|
|
2824
2824
|
attachDecodeContext,
|
|
2825
2825
|
calculateDuration,
|
|
2826
2826
|
calculateSplitPoint,
|