@dawcore/components 0.0.33 → 0.0.34
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 -3
- package/dist/index.d.mts +114 -5
- package/dist/index.d.ts +114 -5
- package/dist/index.js +662 -138
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +662 -138
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ localStorage.setItem('master-fx', JSON.stringify(saved));
|
|
|
213
213
|
await editor.setEffectsState(JSON.parse(localStorage.getItem('master-fx')));
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
WAM entries carry the plugin's own `getState()` snapshot, reapplied on restore. Faust entries (added with `addFaustEffect`) persist their DSP source instead of a URL — `{ kind: 'wam', faustDsp, faustName, bypassed, state }` — and are recompiled in the browser on restore. If a saved plugin URL is unreachable (or a saved Faust source no longer compiles), the restore **continues**: the entry becomes a bypassed passthrough placeholder at its saved position (a `daw-effect-error` event fires with `{effectId, url?, source?, message}`), and its saved state is retained so re-serializing round-trips it for a later retry.
|
|
216
|
+
WAM entries carry the plugin's own `getState()` snapshot, reapplied on restore. Faust entries (added with `addFaustEffect`) persist their DSP source instead of a URL — `{ kind: 'wam', faustDsp, faustName, bypassed, state }` — and are recompiled in the browser on restore. If a saved plugin URL is unreachable (or a saved Faust source no longer compiles), the restore **continues**: the entry becomes a bypassed passthrough placeholder at its saved position (a `daw-effect-error` event fires with `{effectId, url?, source?, type?, message}`), and its saved state is retained so re-serializing round-trips it for a later retry. Failed **native** entries get the same treatment — a saved `registerEffect()` type that isn't re-registered on this page becomes a placeholder carrying its saved params instead of rejecting the whole restore. Placeholder entries re-serialize with `placeholder: true`; `exportAudio()` skips them (parity with live playback, which passes audio through them silently), and `setEffectsState` ignores the flag and retries normally.
|
|
217
217
|
|
|
218
218
|
## Transport Access
|
|
219
219
|
|
|
@@ -301,11 +301,11 @@ track.closeEffectGui(wamId); // hides — audio keeps processing, element stays
|
|
|
301
301
|
await track.openEffectGui(wamId, panel); // instant reopen, same element
|
|
302
302
|
```
|
|
303
303
|
|
|
304
|
-
The GUI is created lazily on first open and only destroyed (`destroyGui`) when the effect — or its track — is removed from the chain. Plugins without a GUI, and `native-*` effects, get a generic parameter panel (labeled sliders from the plugin's `getParameterInfo()` or the registry's params metadata) rendered by `@dawcore/wam`; slider edits apply live and dispatch `daw-effect-change` like any other parameter edit.
|
|
304
|
+
The GUI is created lazily on first open and only destroyed (`destroyGui`) when the effect — or its track — is removed from the chain. Plugins without a GUI, and `native-*` effects, get a generic parameter panel (labeled sliders from the plugin's `getParameterInfo()` or the registry's params metadata) rendered by `@dawcore/wam`; slider edits apply live and dispatch `daw-effect-change` like any other parameter edit. Generic panels are rebuilt on reopen so they always show the current parameter values (plugin-provided GUIs stay cached across close/reopen).
|
|
305
305
|
|
|
306
306
|
### Offline Export
|
|
307
307
|
|
|
308
|
-
`editor.exportAudio(options?)` renders the whole session — clips, volume/pan, mute/solo, per-track and master effect chains — on an `OfflineAudioContext` and resolves to an `AudioBuffer` (encode it to WAV/FLAC however you like):
|
|
308
|
+
`editor.exportAudio(options?)` renders the whole session — clips, volume/pan, mute/solo, master volume, per-track and master effect chains — on an `OfflineAudioContext` and resolves to an `AudioBuffer` (encode it to WAV/FLAC however you like):
|
|
309
309
|
|
|
310
310
|
```javascript
|
|
311
311
|
const buffer = await editor.exportAudio();
|
package/dist/index.d.mts
CHANGED
|
@@ -108,6 +108,10 @@ type SerializedEffectEntry = {
|
|
|
108
108
|
type: string;
|
|
109
109
|
params: Record<string, number>;
|
|
110
110
|
bypassed: boolean;
|
|
111
|
+
/** Present when the live entry was a failed-plugin placeholder (silent
|
|
112
|
+
* passthrough). Offline export skips these for parity with live
|
|
113
|
+
* playback; restore ignores the flag and retries normally. */
|
|
114
|
+
placeholder?: true;
|
|
111
115
|
} | {
|
|
112
116
|
kind: 'wam';
|
|
113
117
|
/** Module URL for url-loaded plugins. Absent for Faust entries. */
|
|
@@ -119,6 +123,10 @@ type SerializedEffectEntry = {
|
|
|
119
123
|
faustDsp?: string;
|
|
120
124
|
/** Name the Faust entry was compiled under (restores the same label). */
|
|
121
125
|
faustName?: string;
|
|
126
|
+
/** Present when the live entry was a failed-plugin placeholder (silent
|
|
127
|
+
* passthrough). Offline export skips these for parity with live
|
|
128
|
+
* playback; restore ignores the flag and retries the URL/DSP. */
|
|
129
|
+
placeholder?: true;
|
|
122
130
|
};
|
|
123
131
|
/** Result of creating an effect via the registry. */
|
|
124
132
|
interface CreatedEffect {
|
|
@@ -345,6 +353,9 @@ declare class DawPlayButtonElement extends DawTransportButton {
|
|
|
345
353
|
private _onRecEnd;
|
|
346
354
|
connectedCallback(): void;
|
|
347
355
|
disconnectedCallback(): void;
|
|
356
|
+
protected updated(): void;
|
|
357
|
+
private _ensureTargetListeners;
|
|
358
|
+
private _cleanupListeners;
|
|
348
359
|
render(): lit.TemplateResult<1>;
|
|
349
360
|
private _onClick;
|
|
350
361
|
}
|
|
@@ -365,6 +376,9 @@ declare class DawPauseButtonElement extends DawTransportButton {
|
|
|
365
376
|
static styles: lit.CSSResultGroup[];
|
|
366
377
|
connectedCallback(): void;
|
|
367
378
|
disconnectedCallback(): void;
|
|
379
|
+
protected updated(): void;
|
|
380
|
+
private _ensureTargetListeners;
|
|
381
|
+
private _cleanupListeners;
|
|
368
382
|
render(): lit.TemplateResult<1>;
|
|
369
383
|
private _onClick;
|
|
370
384
|
}
|
|
@@ -553,6 +567,10 @@ declare class PeakPipeline {
|
|
|
553
567
|
peaks: PeakData;
|
|
554
568
|
scale: number;
|
|
555
569
|
} | null;
|
|
570
|
+
/** Scale of the cached WaveformData for this buffer — 0 when not cached.
|
|
571
|
+
* Worker generation caches at baseScale; injected .dat data at its own
|
|
572
|
+
* scale. This is the finest zoom the buffer's peaks can render at. */
|
|
573
|
+
getCachedScale(audioBuffer: AudioBuffer): number;
|
|
556
574
|
/**
|
|
557
575
|
* Return the coarsest (largest) scale among cached WaveformData entries
|
|
558
576
|
* that correspond to the given clip buffers. Returns 0 if none are cached.
|
|
@@ -779,6 +797,10 @@ declare class RecordingController implements ReactiveController {
|
|
|
779
797
|
* start calls both pass the _sessions guard and build two capture
|
|
780
798
|
* pipelines feeding one session (garbled audio + a leaked worklet). */
|
|
781
799
|
private _starting;
|
|
800
|
+
/** True between hostDisconnected and hostConnected. An in-flight
|
|
801
|
+
* startRecording consults this after its awaits so a teardown mid-setup
|
|
802
|
+
* doesn't leak a live capture session on a detached editor. */
|
|
803
|
+
private _hostDisconnected;
|
|
782
804
|
private _workletLoadedCtx;
|
|
783
805
|
/** Tracks worklet pause state explicitly so external consumers (editor,
|
|
784
806
|
* pause button, spacebar) can share one source of truth. */
|
|
@@ -794,6 +816,7 @@ declare class RecordingController implements ReactiveController {
|
|
|
794
816
|
resumeRecording(trackId?: string): void;
|
|
795
817
|
stopRecording(trackId?: string): Promise<void>;
|
|
796
818
|
private _finishStopRecording;
|
|
819
|
+
private _finalizeRecording;
|
|
797
820
|
/** Drain the event-loop queue of pending worklet flush messages. During
|
|
798
821
|
* recording the worklet posts a flush every ~16ms; if main was slower,
|
|
799
822
|
* messages back up. Yield repeatedly until session.totalSamples stabilizes
|
|
@@ -804,6 +827,12 @@ declare class RecordingController implements ReactiveController {
|
|
|
804
827
|
private _processWorkletSamples;
|
|
805
828
|
private _createClipFromRecording;
|
|
806
829
|
private _removeTrackEndedListener;
|
|
830
|
+
private _dispatchRecordingError;
|
|
831
|
+
/** Shared teardown for finalize paths that end without a take (no data
|
|
832
|
+
* captured / too short after latency compensation): restore the armed-track
|
|
833
|
+
* mute, drop the session, and notify via daw-recording-error so record
|
|
834
|
+
* buttons reset their state. */
|
|
835
|
+
private _abandonFinalize;
|
|
807
836
|
/** Restore the armed track's pre-session mute state (idempotent — safe to
|
|
808
837
|
* call from both the finalize path and _cleanupSession). */
|
|
809
838
|
private _restoreArmedTrackMute;
|
|
@@ -914,10 +943,23 @@ declare class ClipPointerHandler {
|
|
|
914
943
|
onPointerMove(e: PointerEvent): void;
|
|
915
944
|
/** Processes pointerup events to finalize and dispatch result events. */
|
|
916
945
|
onPointerUp(_e: PointerEvent): void;
|
|
946
|
+
/** Processes pointercancel — reverts the in-progress drag.
|
|
947
|
+
*
|
|
948
|
+
* pointercancel fires INSTEAD of pointerup on touch interruption, pen
|
|
949
|
+
* leaving hover range, or OS gestures. Without this handler the drag stays
|
|
950
|
+
* armed (hover keeps moving the clip), the engine transaction stays open
|
|
951
|
+
* (every later edit becomes un-undoable until some drag commits), and the
|
|
952
|
+
* per-frame skipAdapter moveClip mutations are never synced or rolled back
|
|
953
|
+
* (waveform and audio permanently disagree). */
|
|
954
|
+
onPointerCancel(_e: PointerEvent): void;
|
|
917
955
|
/** Re-extract peaks from cache and set on waveform elements during trim drag.
|
|
918
956
|
* Returns true if peaks were successfully updated. */
|
|
919
957
|
private _updateWaveformPeaks;
|
|
920
|
-
/** Restore clip container CSS to original values after
|
|
958
|
+
/** Restore clip container CSS AND waveform peaks to original values after
|
|
959
|
+
* a trim visual preview. Peaks matter: the drag wrote re-extracted peak
|
|
960
|
+
* arrays imperatively onto the <daw-waveform> elements (bypassing Lit), and
|
|
961
|
+
* a cancelled/zero-delta trim makes no engine mutation — so no statechange
|
|
962
|
+
* re-render will ever repair them. */
|
|
921
963
|
private _restoreTrimVisual;
|
|
922
964
|
private _reset;
|
|
923
965
|
}
|
|
@@ -963,6 +1005,11 @@ interface DawTrackIdDetail {
|
|
|
963
1005
|
interface DawTrackErrorDetail {
|
|
964
1006
|
trackId: string;
|
|
965
1007
|
error: unknown;
|
|
1008
|
+
/** Present when the load was CANCELLED rather than failed: the track was
|
|
1009
|
+
* removed (or the editor disconnected) while its clips were still loading.
|
|
1010
|
+
* Consumer error UIs should filter these — nothing actually failed; the
|
|
1011
|
+
* event exists so addTrack()/loadMidi() awaiters settle. */
|
|
1012
|
+
reason?: 'removed' | 'disconnected';
|
|
966
1013
|
}
|
|
967
1014
|
interface DawFilesLoadErrorDetail {
|
|
968
1015
|
file: File;
|
|
@@ -1085,6 +1132,9 @@ interface DawEffectErrorDetail {
|
|
|
1085
1132
|
source?: {
|
|
1086
1133
|
faust: string;
|
|
1087
1134
|
};
|
|
1135
|
+
/** Native effect type of the failed entry (restore of an unregistered
|
|
1136
|
+
* custom type), when applicable. */
|
|
1137
|
+
type?: string;
|
|
1088
1138
|
message: string;
|
|
1089
1139
|
}
|
|
1090
1140
|
interface DawEventMap {
|
|
@@ -1191,6 +1241,9 @@ interface ExportAudioHost {
|
|
|
1191
1241
|
/** Natural session duration in seconds. */
|
|
1192
1242
|
duration: number;
|
|
1193
1243
|
tracks: ExportTrack[];
|
|
1244
|
+
/** Master output gain (engine setMasterVolume). Default 1. Without it the
|
|
1245
|
+
* export renders louder/quieter than what the user mixed against. */
|
|
1246
|
+
masterVolume?: number;
|
|
1194
1247
|
getMasterEffectsState(): Promise<SerializedEffectEntry[]>;
|
|
1195
1248
|
getTrackEffectsState(trackId: string): Promise<SerializedEffectEntry[]>;
|
|
1196
1249
|
}
|
|
@@ -1199,6 +1252,19 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1199
1252
|
get samplesPerPixel(): number;
|
|
1200
1253
|
set samplesPerPixel(value: number);
|
|
1201
1254
|
private _samplesPerPixel;
|
|
1255
|
+
/** Raise the zoom floor and re-clamp the LIVE samplesPerPixel when it's
|
|
1256
|
+
* now below the floor. Peaks can only be extracted at >= the floor scale —
|
|
1257
|
+
* the setter alone clamps only FUTURE sets, so without the re-clamp an
|
|
1258
|
+
* already-finer spp keeps sizing clip containers while the waveforms
|
|
1259
|
+
* render at the coarser scale: half/quarter width, misaligned against the
|
|
1260
|
+
* ruler and playhead. */
|
|
1261
|
+
_raiseZoomFloor(scale: number): void;
|
|
1262
|
+
/** Recompute the floor from the surviving cached scales (track removal /
|
|
1263
|
+
* load cancellation / preview cleanup). Usually LOWERS the floor, freeing
|
|
1264
|
+
* finer zoom — but a buffer whose scale never raised the floor (or a mix
|
|
1265
|
+
* of scales) can raise it above the live spp, so re-clamp like
|
|
1266
|
+
* _raiseZoomFloor. Never mutate _minSamplesPerPixel directly. */
|
|
1267
|
+
private _recomputeZoomFloor;
|
|
1202
1268
|
private _timeFormat;
|
|
1203
1269
|
/**
|
|
1204
1270
|
* Time display format used by <daw-time-display> and (future, #463) the
|
|
@@ -1318,6 +1384,9 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1318
1384
|
set adapter(value: PlayoutAdapter | null);
|
|
1319
1385
|
get adapter(): PlayoutAdapter | null;
|
|
1320
1386
|
private _externalAdapter;
|
|
1387
|
+
/** True after a disconnect disposed the consumer's adapter via the engine
|
|
1388
|
+
* — rebuild attempts fail loudly until a fresh adapter is set. */
|
|
1389
|
+
private _adapterConsumedByDispose;
|
|
1321
1390
|
private _effectsManager;
|
|
1322
1391
|
private get _effects();
|
|
1323
1392
|
/** Master effects chain — inserted between the master bus and the destination. */
|
|
@@ -1404,6 +1473,11 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1404
1473
|
/** Coarsest scale from pre-computed peaks — zoom cannot go finer than this. 0 = no limit. */
|
|
1405
1474
|
private _minSamplesPerPixel;
|
|
1406
1475
|
private _trackElements;
|
|
1476
|
+
/** Track ids with a _loadTrack in flight. Distinct from `_engineTracks`
|
|
1477
|
+
* membership: the peaks-first path inserts a render-only PREVIEW track
|
|
1478
|
+
* into _engineTracks mid-load, so `has()` alone cannot answer "is this
|
|
1479
|
+
* track still loading?". */
|
|
1480
|
+
private _loadingTracks;
|
|
1407
1481
|
private _childObserver;
|
|
1408
1482
|
private _audioResume;
|
|
1409
1483
|
eagerResume?: string;
|
|
@@ -1476,6 +1550,17 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1476
1550
|
private _onTrackUpdate;
|
|
1477
1551
|
/** Drop the controller when no spectrogram tracks remain. */
|
|
1478
1552
|
private _disposeSpectrogramControllerIfEmpty;
|
|
1553
|
+
/** Reconcile `_tracks` descriptors with the engine's track list.
|
|
1554
|
+
*
|
|
1555
|
+
* ADD: engine.undo() restores removed tracks in ENGINE state only —
|
|
1556
|
+
* without a synthesized descriptor the track plays and renders but shows
|
|
1557
|
+
* "Untitled" controls and is missing from `editor.tracks`.
|
|
1558
|
+
* PRUNE (the symmetric half): redo removes the track from engine state
|
|
1559
|
+
* again — without pruning, the synthesized descriptor is a permanent
|
|
1560
|
+
* ghost that even removeTrack() can't clean (no element, no engine
|
|
1561
|
+
* entry). Never prunes tracks that are mid-load or element-backed —
|
|
1562
|
+
* their descriptors legitimately precede their engine entries. */
|
|
1563
|
+
_reconcileDescriptorsWithEngineTracks(tracks: ClipTrack[]): void;
|
|
1479
1564
|
private static _CONTROL_PROPS;
|
|
1480
1565
|
private _onTrackControl;
|
|
1481
1566
|
private _onTrackRemoveRequest;
|
|
@@ -1628,6 +1713,14 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1628
1713
|
stop(): void;
|
|
1629
1714
|
/** Toggle between play and pause. */
|
|
1630
1715
|
togglePlayPause(): void;
|
|
1716
|
+
/** Run `fn` with the stop-settle daw-timeupdate suppressed. Every
|
|
1717
|
+
* stop-adjacent code path that immediately re-positions (seek, split,
|
|
1718
|
+
* empty-timeline rewind) must use this — engine.stop() rewinds to the
|
|
1719
|
+
* play-start position and the settle would leak a backward-jumping
|
|
1720
|
+
* daw-timeupdate to consumers (CLAUDE.md seek-while-playing invariant).
|
|
1721
|
+
* The `finally` is load-bearing: a wedged true silently drops every
|
|
1722
|
+
* subsequent stop-settle dispatch. */
|
|
1723
|
+
private _withSeekSuppression;
|
|
1631
1724
|
seekTo(time: number): void;
|
|
1632
1725
|
/** Undo the last structural edit. */
|
|
1633
1726
|
undo(): void;
|
|
@@ -1665,6 +1758,11 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1665
1758
|
createAudioWorkletNode(name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode;
|
|
1666
1759
|
createMediaStreamSource(stream: MediaStream): MediaStreamAudioSourceNode;
|
|
1667
1760
|
startRecording(stream?: MediaStream, options?: RecordingOptions): Promise<void>;
|
|
1761
|
+
/** Live-recording preview left/width. Beats mode uses the same tick-space
|
|
1762
|
+
* math as finalized clips — the sample÷renderSpp path is ceil-quantized,
|
|
1763
|
+
* so the take would visibly jump sideways on finalization (drift grows
|
|
1764
|
+
* with distance from t=0; CLAUDE.md live-preview parity invariant). */
|
|
1765
|
+
private _previewPosition;
|
|
1668
1766
|
private _renderRecordingPreview;
|
|
1669
1767
|
/** Convert playback seconds to a timeline pixel offset for the active mode. */
|
|
1670
1768
|
private _timeToPixels;
|
|
@@ -1747,11 +1845,19 @@ declare class DawKeyboardShortcutsElement extends LitElement {
|
|
|
1747
1845
|
playback: boolean;
|
|
1748
1846
|
splitting: boolean;
|
|
1749
1847
|
undo: boolean;
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1848
|
+
private _playbackShortcuts;
|
|
1849
|
+
get playbackShortcuts(): PlaybackShortcutMap | null;
|
|
1850
|
+
set playbackShortcuts(value: PlaybackShortcutMap | null);
|
|
1851
|
+
private _splittingShortcuts;
|
|
1852
|
+
get splittingShortcuts(): SplittingShortcutMap | null;
|
|
1853
|
+
set splittingShortcuts(value: SplittingShortcutMap | null);
|
|
1854
|
+
private _undoShortcuts;
|
|
1855
|
+
get undoShortcuts(): UndoShortcutMap | null;
|
|
1856
|
+
set undoShortcuts(value: UndoShortcutMap | null);
|
|
1753
1857
|
/** Additional custom shortcuts. */
|
|
1754
|
-
|
|
1858
|
+
private _customShortcuts;
|
|
1859
|
+
get customShortcuts(): KeyboardShortcut[];
|
|
1860
|
+
set customShortcuts(value: KeyboardShortcut[]);
|
|
1755
1861
|
private _editor;
|
|
1756
1862
|
private _cachedShortcuts;
|
|
1757
1863
|
/** All active shortcuts (read-only, cached). */
|
|
@@ -1893,6 +1999,9 @@ declare class DawPlayerElement extends LitElement {
|
|
|
1893
1999
|
set playbackRate(value: number);
|
|
1894
2000
|
private _playbackRate;
|
|
1895
2001
|
private _engine;
|
|
2002
|
+
/** Set by disconnectedCallback — a reconnect (DOM reparent, framework
|
|
2003
|
+
* re-render) must rebuild the engine + track or the player is dead. */
|
|
2004
|
+
private _engineDisposed;
|
|
1896
2005
|
private _trackId;
|
|
1897
2006
|
private _anim;
|
|
1898
2007
|
private _metadataLoaded;
|
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,10 @@ type SerializedEffectEntry = {
|
|
|
108
108
|
type: string;
|
|
109
109
|
params: Record<string, number>;
|
|
110
110
|
bypassed: boolean;
|
|
111
|
+
/** Present when the live entry was a failed-plugin placeholder (silent
|
|
112
|
+
* passthrough). Offline export skips these for parity with live
|
|
113
|
+
* playback; restore ignores the flag and retries normally. */
|
|
114
|
+
placeholder?: true;
|
|
111
115
|
} | {
|
|
112
116
|
kind: 'wam';
|
|
113
117
|
/** Module URL for url-loaded plugins. Absent for Faust entries. */
|
|
@@ -119,6 +123,10 @@ type SerializedEffectEntry = {
|
|
|
119
123
|
faustDsp?: string;
|
|
120
124
|
/** Name the Faust entry was compiled under (restores the same label). */
|
|
121
125
|
faustName?: string;
|
|
126
|
+
/** Present when the live entry was a failed-plugin placeholder (silent
|
|
127
|
+
* passthrough). Offline export skips these for parity with live
|
|
128
|
+
* playback; restore ignores the flag and retries the URL/DSP. */
|
|
129
|
+
placeholder?: true;
|
|
122
130
|
};
|
|
123
131
|
/** Result of creating an effect via the registry. */
|
|
124
132
|
interface CreatedEffect {
|
|
@@ -345,6 +353,9 @@ declare class DawPlayButtonElement extends DawTransportButton {
|
|
|
345
353
|
private _onRecEnd;
|
|
346
354
|
connectedCallback(): void;
|
|
347
355
|
disconnectedCallback(): void;
|
|
356
|
+
protected updated(): void;
|
|
357
|
+
private _ensureTargetListeners;
|
|
358
|
+
private _cleanupListeners;
|
|
348
359
|
render(): lit.TemplateResult<1>;
|
|
349
360
|
private _onClick;
|
|
350
361
|
}
|
|
@@ -365,6 +376,9 @@ declare class DawPauseButtonElement extends DawTransportButton {
|
|
|
365
376
|
static styles: lit.CSSResultGroup[];
|
|
366
377
|
connectedCallback(): void;
|
|
367
378
|
disconnectedCallback(): void;
|
|
379
|
+
protected updated(): void;
|
|
380
|
+
private _ensureTargetListeners;
|
|
381
|
+
private _cleanupListeners;
|
|
368
382
|
render(): lit.TemplateResult<1>;
|
|
369
383
|
private _onClick;
|
|
370
384
|
}
|
|
@@ -553,6 +567,10 @@ declare class PeakPipeline {
|
|
|
553
567
|
peaks: PeakData;
|
|
554
568
|
scale: number;
|
|
555
569
|
} | null;
|
|
570
|
+
/** Scale of the cached WaveformData for this buffer — 0 when not cached.
|
|
571
|
+
* Worker generation caches at baseScale; injected .dat data at its own
|
|
572
|
+
* scale. This is the finest zoom the buffer's peaks can render at. */
|
|
573
|
+
getCachedScale(audioBuffer: AudioBuffer): number;
|
|
556
574
|
/**
|
|
557
575
|
* Return the coarsest (largest) scale among cached WaveformData entries
|
|
558
576
|
* that correspond to the given clip buffers. Returns 0 if none are cached.
|
|
@@ -779,6 +797,10 @@ declare class RecordingController implements ReactiveController {
|
|
|
779
797
|
* start calls both pass the _sessions guard and build two capture
|
|
780
798
|
* pipelines feeding one session (garbled audio + a leaked worklet). */
|
|
781
799
|
private _starting;
|
|
800
|
+
/** True between hostDisconnected and hostConnected. An in-flight
|
|
801
|
+
* startRecording consults this after its awaits so a teardown mid-setup
|
|
802
|
+
* doesn't leak a live capture session on a detached editor. */
|
|
803
|
+
private _hostDisconnected;
|
|
782
804
|
private _workletLoadedCtx;
|
|
783
805
|
/** Tracks worklet pause state explicitly so external consumers (editor,
|
|
784
806
|
* pause button, spacebar) can share one source of truth. */
|
|
@@ -794,6 +816,7 @@ declare class RecordingController implements ReactiveController {
|
|
|
794
816
|
resumeRecording(trackId?: string): void;
|
|
795
817
|
stopRecording(trackId?: string): Promise<void>;
|
|
796
818
|
private _finishStopRecording;
|
|
819
|
+
private _finalizeRecording;
|
|
797
820
|
/** Drain the event-loop queue of pending worklet flush messages. During
|
|
798
821
|
* recording the worklet posts a flush every ~16ms; if main was slower,
|
|
799
822
|
* messages back up. Yield repeatedly until session.totalSamples stabilizes
|
|
@@ -804,6 +827,12 @@ declare class RecordingController implements ReactiveController {
|
|
|
804
827
|
private _processWorkletSamples;
|
|
805
828
|
private _createClipFromRecording;
|
|
806
829
|
private _removeTrackEndedListener;
|
|
830
|
+
private _dispatchRecordingError;
|
|
831
|
+
/** Shared teardown for finalize paths that end without a take (no data
|
|
832
|
+
* captured / too short after latency compensation): restore the armed-track
|
|
833
|
+
* mute, drop the session, and notify via daw-recording-error so record
|
|
834
|
+
* buttons reset their state. */
|
|
835
|
+
private _abandonFinalize;
|
|
807
836
|
/** Restore the armed track's pre-session mute state (idempotent — safe to
|
|
808
837
|
* call from both the finalize path and _cleanupSession). */
|
|
809
838
|
private _restoreArmedTrackMute;
|
|
@@ -914,10 +943,23 @@ declare class ClipPointerHandler {
|
|
|
914
943
|
onPointerMove(e: PointerEvent): void;
|
|
915
944
|
/** Processes pointerup events to finalize and dispatch result events. */
|
|
916
945
|
onPointerUp(_e: PointerEvent): void;
|
|
946
|
+
/** Processes pointercancel — reverts the in-progress drag.
|
|
947
|
+
*
|
|
948
|
+
* pointercancel fires INSTEAD of pointerup on touch interruption, pen
|
|
949
|
+
* leaving hover range, or OS gestures. Without this handler the drag stays
|
|
950
|
+
* armed (hover keeps moving the clip), the engine transaction stays open
|
|
951
|
+
* (every later edit becomes un-undoable until some drag commits), and the
|
|
952
|
+
* per-frame skipAdapter moveClip mutations are never synced or rolled back
|
|
953
|
+
* (waveform and audio permanently disagree). */
|
|
954
|
+
onPointerCancel(_e: PointerEvent): void;
|
|
917
955
|
/** Re-extract peaks from cache and set on waveform elements during trim drag.
|
|
918
956
|
* Returns true if peaks were successfully updated. */
|
|
919
957
|
private _updateWaveformPeaks;
|
|
920
|
-
/** Restore clip container CSS to original values after
|
|
958
|
+
/** Restore clip container CSS AND waveform peaks to original values after
|
|
959
|
+
* a trim visual preview. Peaks matter: the drag wrote re-extracted peak
|
|
960
|
+
* arrays imperatively onto the <daw-waveform> elements (bypassing Lit), and
|
|
961
|
+
* a cancelled/zero-delta trim makes no engine mutation — so no statechange
|
|
962
|
+
* re-render will ever repair them. */
|
|
921
963
|
private _restoreTrimVisual;
|
|
922
964
|
private _reset;
|
|
923
965
|
}
|
|
@@ -963,6 +1005,11 @@ interface DawTrackIdDetail {
|
|
|
963
1005
|
interface DawTrackErrorDetail {
|
|
964
1006
|
trackId: string;
|
|
965
1007
|
error: unknown;
|
|
1008
|
+
/** Present when the load was CANCELLED rather than failed: the track was
|
|
1009
|
+
* removed (or the editor disconnected) while its clips were still loading.
|
|
1010
|
+
* Consumer error UIs should filter these — nothing actually failed; the
|
|
1011
|
+
* event exists so addTrack()/loadMidi() awaiters settle. */
|
|
1012
|
+
reason?: 'removed' | 'disconnected';
|
|
966
1013
|
}
|
|
967
1014
|
interface DawFilesLoadErrorDetail {
|
|
968
1015
|
file: File;
|
|
@@ -1085,6 +1132,9 @@ interface DawEffectErrorDetail {
|
|
|
1085
1132
|
source?: {
|
|
1086
1133
|
faust: string;
|
|
1087
1134
|
};
|
|
1135
|
+
/** Native effect type of the failed entry (restore of an unregistered
|
|
1136
|
+
* custom type), when applicable. */
|
|
1137
|
+
type?: string;
|
|
1088
1138
|
message: string;
|
|
1089
1139
|
}
|
|
1090
1140
|
interface DawEventMap {
|
|
@@ -1191,6 +1241,9 @@ interface ExportAudioHost {
|
|
|
1191
1241
|
/** Natural session duration in seconds. */
|
|
1192
1242
|
duration: number;
|
|
1193
1243
|
tracks: ExportTrack[];
|
|
1244
|
+
/** Master output gain (engine setMasterVolume). Default 1. Without it the
|
|
1245
|
+
* export renders louder/quieter than what the user mixed against. */
|
|
1246
|
+
masterVolume?: number;
|
|
1194
1247
|
getMasterEffectsState(): Promise<SerializedEffectEntry[]>;
|
|
1195
1248
|
getTrackEffectsState(trackId: string): Promise<SerializedEffectEntry[]>;
|
|
1196
1249
|
}
|
|
@@ -1199,6 +1252,19 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1199
1252
|
get samplesPerPixel(): number;
|
|
1200
1253
|
set samplesPerPixel(value: number);
|
|
1201
1254
|
private _samplesPerPixel;
|
|
1255
|
+
/** Raise the zoom floor and re-clamp the LIVE samplesPerPixel when it's
|
|
1256
|
+
* now below the floor. Peaks can only be extracted at >= the floor scale —
|
|
1257
|
+
* the setter alone clamps only FUTURE sets, so without the re-clamp an
|
|
1258
|
+
* already-finer spp keeps sizing clip containers while the waveforms
|
|
1259
|
+
* render at the coarser scale: half/quarter width, misaligned against the
|
|
1260
|
+
* ruler and playhead. */
|
|
1261
|
+
_raiseZoomFloor(scale: number): void;
|
|
1262
|
+
/** Recompute the floor from the surviving cached scales (track removal /
|
|
1263
|
+
* load cancellation / preview cleanup). Usually LOWERS the floor, freeing
|
|
1264
|
+
* finer zoom — but a buffer whose scale never raised the floor (or a mix
|
|
1265
|
+
* of scales) can raise it above the live spp, so re-clamp like
|
|
1266
|
+
* _raiseZoomFloor. Never mutate _minSamplesPerPixel directly. */
|
|
1267
|
+
private _recomputeZoomFloor;
|
|
1202
1268
|
private _timeFormat;
|
|
1203
1269
|
/**
|
|
1204
1270
|
* Time display format used by <daw-time-display> and (future, #463) the
|
|
@@ -1318,6 +1384,9 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1318
1384
|
set adapter(value: PlayoutAdapter | null);
|
|
1319
1385
|
get adapter(): PlayoutAdapter | null;
|
|
1320
1386
|
private _externalAdapter;
|
|
1387
|
+
/** True after a disconnect disposed the consumer's adapter via the engine
|
|
1388
|
+
* — rebuild attempts fail loudly until a fresh adapter is set. */
|
|
1389
|
+
private _adapterConsumedByDispose;
|
|
1321
1390
|
private _effectsManager;
|
|
1322
1391
|
private get _effects();
|
|
1323
1392
|
/** Master effects chain — inserted between the master bus and the destination. */
|
|
@@ -1404,6 +1473,11 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1404
1473
|
/** Coarsest scale from pre-computed peaks — zoom cannot go finer than this. 0 = no limit. */
|
|
1405
1474
|
private _minSamplesPerPixel;
|
|
1406
1475
|
private _trackElements;
|
|
1476
|
+
/** Track ids with a _loadTrack in flight. Distinct from `_engineTracks`
|
|
1477
|
+
* membership: the peaks-first path inserts a render-only PREVIEW track
|
|
1478
|
+
* into _engineTracks mid-load, so `has()` alone cannot answer "is this
|
|
1479
|
+
* track still loading?". */
|
|
1480
|
+
private _loadingTracks;
|
|
1407
1481
|
private _childObserver;
|
|
1408
1482
|
private _audioResume;
|
|
1409
1483
|
eagerResume?: string;
|
|
@@ -1476,6 +1550,17 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1476
1550
|
private _onTrackUpdate;
|
|
1477
1551
|
/** Drop the controller when no spectrogram tracks remain. */
|
|
1478
1552
|
private _disposeSpectrogramControllerIfEmpty;
|
|
1553
|
+
/** Reconcile `_tracks` descriptors with the engine's track list.
|
|
1554
|
+
*
|
|
1555
|
+
* ADD: engine.undo() restores removed tracks in ENGINE state only —
|
|
1556
|
+
* without a synthesized descriptor the track plays and renders but shows
|
|
1557
|
+
* "Untitled" controls and is missing from `editor.tracks`.
|
|
1558
|
+
* PRUNE (the symmetric half): redo removes the track from engine state
|
|
1559
|
+
* again — without pruning, the synthesized descriptor is a permanent
|
|
1560
|
+
* ghost that even removeTrack() can't clean (no element, no engine
|
|
1561
|
+
* entry). Never prunes tracks that are mid-load or element-backed —
|
|
1562
|
+
* their descriptors legitimately precede their engine entries. */
|
|
1563
|
+
_reconcileDescriptorsWithEngineTracks(tracks: ClipTrack[]): void;
|
|
1479
1564
|
private static _CONTROL_PROPS;
|
|
1480
1565
|
private _onTrackControl;
|
|
1481
1566
|
private _onTrackRemoveRequest;
|
|
@@ -1628,6 +1713,14 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1628
1713
|
stop(): void;
|
|
1629
1714
|
/** Toggle between play and pause. */
|
|
1630
1715
|
togglePlayPause(): void;
|
|
1716
|
+
/** Run `fn` with the stop-settle daw-timeupdate suppressed. Every
|
|
1717
|
+
* stop-adjacent code path that immediately re-positions (seek, split,
|
|
1718
|
+
* empty-timeline rewind) must use this — engine.stop() rewinds to the
|
|
1719
|
+
* play-start position and the settle would leak a backward-jumping
|
|
1720
|
+
* daw-timeupdate to consumers (CLAUDE.md seek-while-playing invariant).
|
|
1721
|
+
* The `finally` is load-bearing: a wedged true silently drops every
|
|
1722
|
+
* subsequent stop-settle dispatch. */
|
|
1723
|
+
private _withSeekSuppression;
|
|
1631
1724
|
seekTo(time: number): void;
|
|
1632
1725
|
/** Undo the last structural edit. */
|
|
1633
1726
|
undo(): void;
|
|
@@ -1665,6 +1758,11 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1665
1758
|
createAudioWorkletNode(name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode;
|
|
1666
1759
|
createMediaStreamSource(stream: MediaStream): MediaStreamAudioSourceNode;
|
|
1667
1760
|
startRecording(stream?: MediaStream, options?: RecordingOptions): Promise<void>;
|
|
1761
|
+
/** Live-recording preview left/width. Beats mode uses the same tick-space
|
|
1762
|
+
* math as finalized clips — the sample÷renderSpp path is ceil-quantized,
|
|
1763
|
+
* so the take would visibly jump sideways on finalization (drift grows
|
|
1764
|
+
* with distance from t=0; CLAUDE.md live-preview parity invariant). */
|
|
1765
|
+
private _previewPosition;
|
|
1668
1766
|
private _renderRecordingPreview;
|
|
1669
1767
|
/** Convert playback seconds to a timeline pixel offset for the active mode. */
|
|
1670
1768
|
private _timeToPixels;
|
|
@@ -1747,11 +1845,19 @@ declare class DawKeyboardShortcutsElement extends LitElement {
|
|
|
1747
1845
|
playback: boolean;
|
|
1748
1846
|
splitting: boolean;
|
|
1749
1847
|
undo: boolean;
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1848
|
+
private _playbackShortcuts;
|
|
1849
|
+
get playbackShortcuts(): PlaybackShortcutMap | null;
|
|
1850
|
+
set playbackShortcuts(value: PlaybackShortcutMap | null);
|
|
1851
|
+
private _splittingShortcuts;
|
|
1852
|
+
get splittingShortcuts(): SplittingShortcutMap | null;
|
|
1853
|
+
set splittingShortcuts(value: SplittingShortcutMap | null);
|
|
1854
|
+
private _undoShortcuts;
|
|
1855
|
+
get undoShortcuts(): UndoShortcutMap | null;
|
|
1856
|
+
set undoShortcuts(value: UndoShortcutMap | null);
|
|
1753
1857
|
/** Additional custom shortcuts. */
|
|
1754
|
-
|
|
1858
|
+
private _customShortcuts;
|
|
1859
|
+
get customShortcuts(): KeyboardShortcut[];
|
|
1860
|
+
set customShortcuts(value: KeyboardShortcut[]);
|
|
1755
1861
|
private _editor;
|
|
1756
1862
|
private _cachedShortcuts;
|
|
1757
1863
|
/** All active shortcuts (read-only, cached). */
|
|
@@ -1893,6 +1999,9 @@ declare class DawPlayerElement extends LitElement {
|
|
|
1893
1999
|
set playbackRate(value: number);
|
|
1894
2000
|
private _playbackRate;
|
|
1895
2001
|
private _engine;
|
|
2002
|
+
/** Set by disconnectedCallback — a reconnect (DOM reparent, framework
|
|
2003
|
+
* re-render) must rebuild the engine + track or the player is dead. */
|
|
2004
|
+
private _engineDisposed;
|
|
1896
2005
|
private _trackId;
|
|
1897
2006
|
private _anim;
|
|
1898
2007
|
private _metadataLoaded;
|