@waveform-playlist/engine 14.0.0-next.6 → 14.0.0-next.7
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 +3 -1
- package/dist/index.d.mts +32 -5
- package/dist/index.d.ts +32 -5
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -329,7 +329,9 @@ interface Arrangement {
|
|
|
329
329
|
// read
|
|
330
330
|
getTracks(): readonly ArrangementTrack[];
|
|
331
331
|
getMixer(): ReadonlyMap<string, TrackMixerValues>;
|
|
332
|
-
|
|
332
|
+
// Called with the kind of change: 'set' | 'add' | 'remove' | 'update' | 'reorder' | 'restore' |
|
|
333
|
+
// 'restoreMix' | 'load' | 'mixer' | 'recording' | 'recompute' | 'history'
|
|
334
|
+
subscribe(listener: (change: { readonly type: ArrangementChangeType }) => void): () => void;
|
|
333
335
|
readonly tracksVersion: number;
|
|
334
336
|
readonly mixerVersion: number;
|
|
335
337
|
|
package/dist/index.d.mts
CHANGED
|
@@ -277,6 +277,28 @@ interface MixerChangeOptions {
|
|
|
277
277
|
/** Not an undo step: the value is written into every saved state as well. */
|
|
278
278
|
undoable?: false;
|
|
279
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* The kind of change a `subscribe` listener is told of:
|
|
282
|
+
*
|
|
283
|
+
* - `'set'`: `setTracks` replaced the whole set.
|
|
284
|
+
* - `'add'`, `'remove'`, `'reorder'`: one track was added, removed or moved.
|
|
285
|
+
* - `'update'`: one track changed (`updateTrack`, a clip added, removed,
|
|
286
|
+
* moved, trimmed or split).
|
|
287
|
+
* - `'restore'`: an undo, a redo or an abort changed the tracks (and maybe
|
|
288
|
+
* the mix); `'restoreMix'`: it changed the mix only.
|
|
289
|
+
* - `'load'`: audio arrived and loading clips became loaded clips.
|
|
290
|
+
* - `'mixer'`: one of the mixer setters changed a volume, mute, solo, pan
|
|
291
|
+
* or pan law.
|
|
292
|
+
* - `'recording'`: a take started or stopped recording onto a track.
|
|
293
|
+
* - `'recompute'`: every track was gone through again: clip positions after
|
|
294
|
+
* a tempo change, or clip ticks when an engine attached.
|
|
295
|
+
* - `'history'`: only what can be undone or redone changed.
|
|
296
|
+
*/
|
|
297
|
+
type ArrangementChangeType = 'set' | 'add' | 'remove' | 'update' | 'reorder' | 'restore' | 'restoreMix' | 'load' | 'mixer' | 'recording' | 'recompute' | 'history';
|
|
298
|
+
/** What a `subscribe` listener is told about a change. */
|
|
299
|
+
interface ArrangementChangeInfo {
|
|
300
|
+
readonly type: ArrangementChangeType;
|
|
301
|
+
}
|
|
280
302
|
/**
|
|
281
303
|
* The owner of the tracks, of the mix and of the undo history. Everything
|
|
282
304
|
* else reads it (`getTracks`, `getMixer`, `subscribe`) and changes it by
|
|
@@ -306,11 +328,12 @@ interface Arrangement {
|
|
|
306
328
|
getMixer(): ReadonlyMap<string, TrackMixerValues>;
|
|
307
329
|
/**
|
|
308
330
|
* Be told after every change (tracks, mix or history), once per change, in
|
|
309
|
-
* the order the changes were made
|
|
310
|
-
*
|
|
311
|
-
*
|
|
331
|
+
* the order the changes were made, with the kind of change it was. Read
|
|
332
|
+
* what changed from the arrangement itself. Returns a function that stops
|
|
333
|
+
* it. A listener that throws is reported with `console.warn` and does not
|
|
334
|
+
* fail the change.
|
|
312
335
|
*/
|
|
313
|
-
subscribe(listener: () => void): () => void;
|
|
336
|
+
subscribe(listener: (change: ArrangementChangeInfo) => void): () => void;
|
|
314
337
|
/** Counts changes to the tracks. */
|
|
315
338
|
readonly tracksVersion: number;
|
|
316
339
|
/** Counts changes to the mix. */
|
|
@@ -439,6 +462,10 @@ interface CreateArrangementOptions {
|
|
|
439
462
|
* (`setTrackRecording`, `recordingTrackIds`, `'recording'`).
|
|
440
463
|
*
|
|
441
464
|
* v3 (#848): `addTrack(track, { index })` puts the track at a place in the order.
|
|
465
|
+
*
|
|
466
|
+
* Not a new key (#826): `subscribe` listeners are called with `{ type }`. The
|
|
467
|
+
* engine does not call `subscribe`, and a listener that takes no argument
|
|
468
|
+
* works with either copy.
|
|
442
469
|
*/
|
|
443
470
|
|
|
444
471
|
type GetDecodeContext = () => Promise<BaseAudioContext>;
|
|
@@ -828,4 +855,4 @@ declare class PlaylistEngine {
|
|
|
828
855
|
private _emitStateChange;
|
|
829
856
|
}
|
|
830
857
|
|
|
831
|
-
export { type AddTrackOptions, type Arrangement, type ArrangementSourceState, type ArrangementSourcesValue, type ClipBounds, type CreateArrangementOptions, type EngineDisposeOptions, type EngineEvents, type EngineState, type LoadSource, type MixerChangeOptions, PlaylistEngine, type PlaylistEngineOptions, type PlayoutAdapter, type RemoveClipOptions, type RemoveTrackOptions, type TrackMixerValues, attachDecodeContext, calculateDuration, calculateSplitPoint, calculateViewportBounds, calculateZoomScrollPosition, canSplitAt, clampSeekPosition, constrainBoundaryTrim, constrainClipDrag, createArrangement, defaultLoadSource, findClosestZoomIndex, getVisibleChunkIndices, isArrangement, shouldUpdateViewport, splitClip };
|
|
858
|
+
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, PlaylistEngine, type PlaylistEngineOptions, 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
|
@@ -277,6 +277,28 @@ interface MixerChangeOptions {
|
|
|
277
277
|
/** Not an undo step: the value is written into every saved state as well. */
|
|
278
278
|
undoable?: false;
|
|
279
279
|
}
|
|
280
|
+
/**
|
|
281
|
+
* The kind of change a `subscribe` listener is told of:
|
|
282
|
+
*
|
|
283
|
+
* - `'set'`: `setTracks` replaced the whole set.
|
|
284
|
+
* - `'add'`, `'remove'`, `'reorder'`: one track was added, removed or moved.
|
|
285
|
+
* - `'update'`: one track changed (`updateTrack`, a clip added, removed,
|
|
286
|
+
* moved, trimmed or split).
|
|
287
|
+
* - `'restore'`: an undo, a redo or an abort changed the tracks (and maybe
|
|
288
|
+
* the mix); `'restoreMix'`: it changed the mix only.
|
|
289
|
+
* - `'load'`: audio arrived and loading clips became loaded clips.
|
|
290
|
+
* - `'mixer'`: one of the mixer setters changed a volume, mute, solo, pan
|
|
291
|
+
* or pan law.
|
|
292
|
+
* - `'recording'`: a take started or stopped recording onto a track.
|
|
293
|
+
* - `'recompute'`: every track was gone through again: clip positions after
|
|
294
|
+
* a tempo change, or clip ticks when an engine attached.
|
|
295
|
+
* - `'history'`: only what can be undone or redone changed.
|
|
296
|
+
*/
|
|
297
|
+
type ArrangementChangeType = 'set' | 'add' | 'remove' | 'update' | 'reorder' | 'restore' | 'restoreMix' | 'load' | 'mixer' | 'recording' | 'recompute' | 'history';
|
|
298
|
+
/** What a `subscribe` listener is told about a change. */
|
|
299
|
+
interface ArrangementChangeInfo {
|
|
300
|
+
readonly type: ArrangementChangeType;
|
|
301
|
+
}
|
|
280
302
|
/**
|
|
281
303
|
* The owner of the tracks, of the mix and of the undo history. Everything
|
|
282
304
|
* else reads it (`getTracks`, `getMixer`, `subscribe`) and changes it by
|
|
@@ -306,11 +328,12 @@ interface Arrangement {
|
|
|
306
328
|
getMixer(): ReadonlyMap<string, TrackMixerValues>;
|
|
307
329
|
/**
|
|
308
330
|
* Be told after every change (tracks, mix or history), once per change, in
|
|
309
|
-
* the order the changes were made
|
|
310
|
-
*
|
|
311
|
-
*
|
|
331
|
+
* the order the changes were made, with the kind of change it was. Read
|
|
332
|
+
* what changed from the arrangement itself. Returns a function that stops
|
|
333
|
+
* it. A listener that throws is reported with `console.warn` and does not
|
|
334
|
+
* fail the change.
|
|
312
335
|
*/
|
|
313
|
-
subscribe(listener: () => void): () => void;
|
|
336
|
+
subscribe(listener: (change: ArrangementChangeInfo) => void): () => void;
|
|
314
337
|
/** Counts changes to the tracks. */
|
|
315
338
|
readonly tracksVersion: number;
|
|
316
339
|
/** Counts changes to the mix. */
|
|
@@ -439,6 +462,10 @@ interface CreateArrangementOptions {
|
|
|
439
462
|
* (`setTrackRecording`, `recordingTrackIds`, `'recording'`).
|
|
440
463
|
*
|
|
441
464
|
* v3 (#848): `addTrack(track, { index })` puts the track at a place in the order.
|
|
465
|
+
*
|
|
466
|
+
* Not a new key (#826): `subscribe` listeners are called with `{ type }`. The
|
|
467
|
+
* engine does not call `subscribe`, and a listener that takes no argument
|
|
468
|
+
* works with either copy.
|
|
442
469
|
*/
|
|
443
470
|
|
|
444
471
|
type GetDecodeContext = () => Promise<BaseAudioContext>;
|
|
@@ -828,4 +855,4 @@ declare class PlaylistEngine {
|
|
|
828
855
|
private _emitStateChange;
|
|
829
856
|
}
|
|
830
857
|
|
|
831
|
-
export { type AddTrackOptions, type Arrangement, type ArrangementSourceState, type ArrangementSourcesValue, type ClipBounds, type CreateArrangementOptions, type EngineDisposeOptions, type EngineEvents, type EngineState, type LoadSource, type MixerChangeOptions, PlaylistEngine, type PlaylistEngineOptions, type PlayoutAdapter, type RemoveClipOptions, type RemoveTrackOptions, type TrackMixerValues, attachDecodeContext, calculateDuration, calculateSplitPoint, calculateViewportBounds, calculateZoomScrollPosition, canSplitAt, clampSeekPosition, constrainBoundaryTrim, constrainClipDrag, createArrangement, defaultLoadSource, findClosestZoomIndex, getVisibleChunkIndices, isArrangement, shouldUpdateViewport, splitClip };
|
|
858
|
+
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, PlaylistEngine, type PlaylistEngineOptions, 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
|
@@ -1215,7 +1215,7 @@ var ArrangementImpl = class {
|
|
|
1215
1215
|
}
|
|
1216
1216
|
/** Be told after every change. See `Arrangement.subscribe`. */
|
|
1217
1217
|
subscribe(listener) {
|
|
1218
|
-
const entry = () => listener();
|
|
1218
|
+
const entry = (change) => listener(change);
|
|
1219
1219
|
this._subscribers.add(entry);
|
|
1220
1220
|
return () => {
|
|
1221
1221
|
this._subscribers.delete(entry);
|
|
@@ -1912,9 +1912,10 @@ var ArrangementImpl = class {
|
|
|
1912
1912
|
}
|
|
1913
1913
|
}
|
|
1914
1914
|
}
|
|
1915
|
+
const info = Object.freeze({ type: next.change.type });
|
|
1915
1916
|
for (const subscriber of [...this._subscribers]) {
|
|
1916
1917
|
try {
|
|
1917
|
-
subscriber();
|
|
1918
|
+
subscriber(info);
|
|
1918
1919
|
} catch (error) {
|
|
1919
1920
|
console.warn("[waveform-playlist] Error in an arrangement subscriber:", error);
|
|
1920
1921
|
}
|