@dawcore/components 0.0.39-next.5 → 0.0.39-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 +8 -6
- package/dist/index.d.mts +623 -242
- package/dist/index.d.ts +623 -242
- package/dist/index.js +2971 -1640
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2951 -1622
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, PropertyValues, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
|
-
import { AnnotationData, AnnotationShortcutMap, MidiNoteData, TrackKind, RenderMode, SpectrogramConfig, Peaks, Bits, FadeType, PeakData, MeterEntry, SnapTo, ColorMapValue, ClipTrack, KeyboardShortcut } from '@waveform-playlist/core';
|
|
3
|
+
import { AnnotationData, AnnotationShortcutMap, MidiNoteData, TrackKind, RenderMode, SpectrogramConfig, Peaks, Bits, FadeType, PeakData, MeterEntry, AudioClip, SnapTo, ColorMapValue, ClipTrack, KeyboardShortcut } from '@waveform-playlist/core';
|
|
4
4
|
import WaveformData from 'waveform-data';
|
|
5
|
-
import { TrackMixerValues, PlayoutAdapter, PlaylistEngine } from '@waveform-playlist/engine';
|
|
5
|
+
import { Arrangement, TrackMixerValues, PlayoutAdapter, PlaylistEngine } from '@waveform-playlist/engine';
|
|
6
6
|
import { MidiLoadOptions, MidiLoadResult } from '@dawcore/midi';
|
|
7
7
|
import { ClipRegistration, CanvasRegistration, ViewportState } from '@dawcore/spectrogram';
|
|
8
8
|
|
|
@@ -97,6 +97,8 @@ declare class DawAnnotationTrackElement extends LitElement {
|
|
|
97
97
|
private _runShortcutAction;
|
|
98
98
|
private _childObserver;
|
|
99
99
|
createRenderRoot(): this;
|
|
100
|
+
/** The listeners of this connection, aborted in disconnectedCallback. */
|
|
101
|
+
private _listeners;
|
|
100
102
|
connectedCallback(): void;
|
|
101
103
|
disconnectedCallback(): void;
|
|
102
104
|
}
|
|
@@ -139,6 +141,8 @@ declare class DawAnnotationListElement extends LitElement {
|
|
|
139
141
|
static styles: lit.CSSResult;
|
|
140
142
|
get track(): DawAnnotationTrackElement | null;
|
|
141
143
|
protected willUpdate(changed: Map<string, unknown>): void;
|
|
144
|
+
/** The listeners of this connection, aborted in disconnectedCallback. */
|
|
145
|
+
private _listeners;
|
|
142
146
|
connectedCallback(): void;
|
|
143
147
|
disconnectedCallback(): void;
|
|
144
148
|
protected shouldUpdate(): boolean;
|
|
@@ -185,34 +189,55 @@ declare global {
|
|
|
185
189
|
declare class DawClipElement extends LitElement {
|
|
186
190
|
src: string;
|
|
187
191
|
peaksSrc: string;
|
|
188
|
-
/**
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
name: string;
|
|
192
|
+
/** Timeline position in seconds. */
|
|
193
|
+
get start(): number;
|
|
194
|
+
set start(value: number);
|
|
195
|
+
get duration(): number;
|
|
196
|
+
set duration(value: number);
|
|
197
|
+
get offset(): number;
|
|
198
|
+
set offset(value: number);
|
|
199
|
+
get gain(): number;
|
|
200
|
+
set gain(value: number);
|
|
201
|
+
get name(): string;
|
|
202
|
+
set name(value: string);
|
|
199
203
|
color: string;
|
|
200
204
|
fadeIn: number;
|
|
201
205
|
fadeOut: number;
|
|
202
206
|
fadeType: string;
|
|
203
207
|
/** MIDI notes — JS property only, not reflected (note arrays are too large for attributes). */
|
|
204
|
-
midiNotes: MidiNoteData[] | null;
|
|
208
|
+
get midiNotes(): MidiNoteData[] | null;
|
|
209
|
+
set midiNotes(value: MidiNoteData[] | null);
|
|
205
210
|
/** MIDI channel (0-indexed). Channel 9 = GM percussion. */
|
|
206
211
|
get midiChannel(): number | null;
|
|
207
212
|
set midiChannel(value: number | null);
|
|
208
|
-
private _midiChannel;
|
|
209
213
|
/** MIDI program (GM instrument 0-127). Used by SoundFontToneTrack. */
|
|
210
214
|
get midiProgram(): number | null;
|
|
211
215
|
set midiProgram(value: number | null);
|
|
212
|
-
|
|
216
|
+
/** What the page declared: the attributes, and a property set before the clip entered. */
|
|
217
|
+
private _declared;
|
|
218
|
+
private _fromAttribute;
|
|
219
|
+
private _internals;
|
|
220
|
+
attributeChangedCallback(name: string, old: string | null, value: string | null): void;
|
|
221
|
+
private get _trackId();
|
|
222
|
+
private _linked;
|
|
223
|
+
private _request;
|
|
224
|
+
/** @internal Shown as `:state(detached)` (#848). */
|
|
225
|
+
_setDetached(detached: boolean): void;
|
|
213
226
|
readonly clipId: `${string}-${string}-${string}-${string}-${string}`;
|
|
214
227
|
createRenderRoot(): this;
|
|
228
|
+
/**
|
|
229
|
+
* A move with `Node.moveBefore()` (#848; modern-web-guidance
|
|
230
|
+
* `custom-elements`): the browser calls this instead of
|
|
231
|
+
* `disconnectedCallback` → `connectedCallback`, so the element stays
|
|
232
|
+
* connected, and Lit's disconnect and connect do not run. It announces
|
|
233
|
+
* itself again, as a connect does, so the editor sees its new place: a
|
|
234
|
+
* clip in another track, a track back in an editor (#848; a real-Chromium
|
|
235
|
+
* check found both missed with an empty hook).
|
|
236
|
+
*/
|
|
237
|
+
connectedMoveCallback(): void;
|
|
215
238
|
connectedCallback(): void;
|
|
239
|
+
/** Tell the editor this element is here (a connect or a moveBefore() move). */
|
|
240
|
+
private _announceConnected;
|
|
216
241
|
private _hasRendered;
|
|
217
242
|
updated(changed: PropertyValues): void;
|
|
218
243
|
}
|
|
@@ -266,15 +291,35 @@ type SerializedEffectEntry = {
|
|
|
266
291
|
|
|
267
292
|
declare class DawTrackElement extends LitElement {
|
|
268
293
|
src: string;
|
|
269
|
-
name:
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
294
|
+
/** The track's name: the arrangement's, or as declared. Setting it renames the track (an undo step). */
|
|
295
|
+
get name(): string;
|
|
296
|
+
set name(value: string);
|
|
297
|
+
get volume(): number;
|
|
298
|
+
set volume(value: number);
|
|
299
|
+
get pan(): number;
|
|
300
|
+
set pan(value: number);
|
|
301
|
+
/** The stored mute (a take's mute is not shown here). */
|
|
302
|
+
get muted(): boolean;
|
|
303
|
+
set muted(value: boolean);
|
|
304
|
+
get soloed(): boolean;
|
|
305
|
+
set soloed(value: boolean);
|
|
306
|
+
/** The track's position in the arrangement the editor plays; -1 when it is not there. */
|
|
307
|
+
get index(): number;
|
|
308
|
+
/** What the page declared: the attributes, and a property set before the track entered. */
|
|
309
|
+
private _declared;
|
|
310
|
+
private _fromAttribute;
|
|
311
|
+
private _internals;
|
|
312
|
+
attributeChangedCallback(name: string, old: string | null, value: string | null): void;
|
|
313
|
+
private _linked;
|
|
314
|
+
private _request;
|
|
315
|
+
/** @internal Shown as `:state(detached)` (#848). */
|
|
316
|
+
_setDetached(detached: boolean): void;
|
|
274
317
|
/**
|
|
275
318
|
* What the track holds: `'audio'` (default) or `'midi'`. Every `<daw-clip>`
|
|
276
|
-
* child must be of this kind (#756). Set it before the track
|
|
277
|
-
*
|
|
319
|
+
* child must be of this kind (#756). Set it before the track enters: the
|
|
320
|
+
* editor reads it then. Live (#848): once the track has entered, it reads
|
|
321
|
+
* the track's kind, which cannot change; a later change keeps the attribute
|
|
322
|
+
* (the page's declaration) and warns.
|
|
278
323
|
*/
|
|
279
324
|
get kind(): TrackKind;
|
|
280
325
|
set kind(value: TrackKind);
|
|
@@ -314,7 +359,19 @@ declare class DawTrackElement extends LitElement {
|
|
|
314
359
|
moveEffect(effectId: string, newIndex: number): void;
|
|
315
360
|
get effects(): EffectState[];
|
|
316
361
|
private _effectsEditor;
|
|
362
|
+
/**
|
|
363
|
+
* A move with `Node.moveBefore()` (#848; modern-web-guidance
|
|
364
|
+
* `custom-elements`): the browser calls this instead of
|
|
365
|
+
* `disconnectedCallback` → `connectedCallback`, so the element stays
|
|
366
|
+
* connected, and Lit's disconnect and connect do not run. It announces
|
|
367
|
+
* itself again, as a connect does, so the editor sees its new place: a
|
|
368
|
+
* clip in another track, a track back in an editor (#848; a real-Chromium
|
|
369
|
+
* check found both missed with an empty hook).
|
|
370
|
+
*/
|
|
371
|
+
connectedMoveCallback(): void;
|
|
317
372
|
connectedCallback(): void;
|
|
373
|
+
/** Tell the editor this element is here (a connect or a moveBefore() move). */
|
|
374
|
+
private _announceConnected;
|
|
318
375
|
private _hasRendered;
|
|
319
376
|
updated(changed: PropertyValues): void;
|
|
320
377
|
}
|
|
@@ -480,6 +537,8 @@ declare class DawTransportButton extends LitElement {
|
|
|
480
537
|
* warns if it's still unusable.
|
|
481
538
|
*/
|
|
482
539
|
protected get targetSupported(): boolean;
|
|
540
|
+
/** The host's capability listeners, one controller per connection. */
|
|
541
|
+
private _capabilityListeners;
|
|
483
542
|
connectedCallback(): void;
|
|
484
543
|
disconnectedCallback(): void;
|
|
485
544
|
private _onCapabilityPointerEnter;
|
|
@@ -490,6 +549,8 @@ declare class DawTransportButton extends LitElement {
|
|
|
490
549
|
declare class DawPlayButtonElement extends DawTransportButton {
|
|
491
550
|
private _isRecording;
|
|
492
551
|
private _targetRef;
|
|
552
|
+
/** The listeners on `_targetRef`, aborted when the target changes or the button disconnects. */
|
|
553
|
+
private _targetListeners;
|
|
493
554
|
private _onRecStart;
|
|
494
555
|
private _onRecEnd;
|
|
495
556
|
connectedCallback(): void;
|
|
@@ -510,6 +571,8 @@ declare class DawPauseButtonElement extends DawTransportButton {
|
|
|
510
571
|
private _isPaused;
|
|
511
572
|
private _isRecording;
|
|
512
573
|
private _targetRef;
|
|
574
|
+
/** The listeners on `_targetRef`, aborted when the target changes or the button disconnects. */
|
|
575
|
+
private _targetListeners;
|
|
513
576
|
private _onRecStart;
|
|
514
577
|
private _onRecEnd;
|
|
515
578
|
private _onRecPause;
|
|
@@ -563,6 +626,21 @@ type TrackMixFields = 'volume' | 'pan' | 'muted' | 'soloed';
|
|
|
563
626
|
* (#843); `editor.tracks` fills the four fields in from it.
|
|
564
627
|
*/
|
|
565
628
|
type StoredTrackDescriptor = Omit<TrackDescriptor, TrackMixFields>;
|
|
629
|
+
/**
|
|
630
|
+
* What `<daw-editor>` keeps per track that the arrangement has no field for
|
|
631
|
+
* (internal, #848): how the track is drawn, the `<daw-track src>` shorthand
|
|
632
|
+
* as declared, and each clip's `peaks-src`. Names, times, gains and the mix
|
|
633
|
+
* are read from the arrangement; nothing here is written back to it.
|
|
634
|
+
*/
|
|
635
|
+
interface TrackExtras {
|
|
636
|
+
kind: TrackKind;
|
|
637
|
+
renderMode: TrackRenderMode;
|
|
638
|
+
spectrogramConfig?: SpectrogramConfig | null;
|
|
639
|
+
/** The `<daw-track src>` shorthand as declared ('' when none). */
|
|
640
|
+
src: string;
|
|
641
|
+
/** A clip's `peaks-src`, by clip id. */
|
|
642
|
+
peaksSrc: ReadonlyMap<string, string>;
|
|
643
|
+
}
|
|
566
644
|
/** A `TrackDescriptor` plus its `trackId` — the shape returned by `editor.tracks`
|
|
567
645
|
* so consumers can map a track's name to the `trackId` the per-track APIs
|
|
568
646
|
* (`addTrackEffect`, `removeTrack`, `updateTrack`, …) are keyed by. */
|
|
@@ -590,8 +668,8 @@ interface BaseClipDescriptor {
|
|
|
590
668
|
/**
|
|
591
669
|
* A clip descriptor sourced from a `<daw-clip>` DOM element. `clipId` is
|
|
592
670
|
* always set — `<daw-clip>.clipId` is a `crypto.randomUUID()` generated at
|
|
593
|
-
* construction.
|
|
594
|
-
*
|
|
671
|
+
* construction. The arrangement clip's id is this id (`buildArrangementTrack`,
|
|
672
|
+
* `_loadAndAppendClip`), so the DOM and the arrangement name the same clip.
|
|
595
673
|
*/
|
|
596
674
|
interface DomClipDescriptor extends BaseClipDescriptor {
|
|
597
675
|
kind: 'dom';
|
|
@@ -600,16 +678,18 @@ interface DomClipDescriptor extends BaseClipDescriptor {
|
|
|
600
678
|
/**
|
|
601
679
|
* A clip descriptor synthesized from a non-DOM source — file drops, the
|
|
602
680
|
* `<daw-track src>` shorthand fallback, or recording-clip insertion. There
|
|
603
|
-
* is no DOM element to align with
|
|
604
|
-
* clip-creation time.
|
|
681
|
+
* is no DOM element to align with.
|
|
605
682
|
*
|
|
606
|
-
* `clipId` is
|
|
607
|
-
*
|
|
608
|
-
* `editor.updateClip()` / `removeClip()` to
|
|
683
|
+
* `clipId` is the arrangement clip's id: set at creation for a recorded take
|
|
684
|
+
* (#659), and written in when a dropped file or the shorthand enters the
|
|
685
|
+
* arrangement (#848). Pass it to `editor.updateClip()` / `removeClip()` to
|
|
686
|
+
* address the clip.
|
|
609
687
|
*/
|
|
610
688
|
interface DropClipDescriptor extends BaseClipDescriptor {
|
|
611
689
|
kind: 'drop';
|
|
612
690
|
clipId?: string;
|
|
691
|
+
/** A dropped file the clip loads (`src` is then ''): a File cannot be an attribute (#848). */
|
|
692
|
+
file?: File;
|
|
613
693
|
}
|
|
614
694
|
type ClipDescriptor = DomClipDescriptor | DropClipDescriptor;
|
|
615
695
|
/**
|
|
@@ -618,6 +698,16 @@ type ClipDescriptor = DomClipDescriptor | DropClipDescriptor;
|
|
|
618
698
|
* inline `c.kind === 'dom'` repetition.
|
|
619
699
|
*/
|
|
620
700
|
declare function isDomClip(desc: ClipDescriptor): desc is DomClipDescriptor;
|
|
701
|
+
/**
|
|
702
|
+
* Options of `addTrack`, `addClip` and `loadFiles` (#848). `signal` cancels
|
|
703
|
+
* the call: it rejects with the signal's `reason`, and what it added is
|
|
704
|
+
* taken out for good (see each method), with no undo step left. A Redo list
|
|
705
|
+
* its arrival cleared stays cleared, as after any edit. A signal already
|
|
706
|
+
* aborted rejects at once and adds nothing.
|
|
707
|
+
*/
|
|
708
|
+
interface EditorCallOptions {
|
|
709
|
+
signal?: AbortSignal;
|
|
710
|
+
}
|
|
621
711
|
/**
|
|
622
712
|
* Public input shape for `editor.addTrack(config)`. All fields optional —
|
|
623
713
|
* defaults match the declarative `<daw-track>` defaults.
|
|
@@ -905,9 +995,6 @@ interface RecordingSession {
|
|
|
905
995
|
/** Display name for the take (preview header + finalized clip name). */
|
|
906
996
|
readonly clipName?: string;
|
|
907
997
|
readonly wasOverdub: boolean;
|
|
908
|
-
/** Stored so it can be removed on stop/cleanup — not just when stream ends. */
|
|
909
|
-
readonly _onTrackEnded: (() => void) | null;
|
|
910
|
-
readonly _audioTrack: MediaStreamTrack | null;
|
|
911
998
|
/** Set during stopRecording, cleared by the done message from the worklet. */
|
|
912
999
|
stopAckResolve: (() => void) | null;
|
|
913
1000
|
/** In-flight stop completion — re-entrant stopRecording calls await this
|
|
@@ -919,7 +1006,7 @@ interface RecordingSession {
|
|
|
919
1006
|
stopping: boolean;
|
|
920
1007
|
}
|
|
921
1008
|
/** Readonly view of a recording session for external consumers. */
|
|
922
|
-
type ReadonlyRecordingSession = Readonly<Omit<RecordingSession, 'chunks' | 'peaks' | '
|
|
1009
|
+
type ReadonlyRecordingSession = Readonly<Omit<RecordingSession, 'chunks' | 'peaks' | 'latencySamples'>> & {
|
|
923
1010
|
readonly latencySamples: number;
|
|
924
1011
|
readonly chunks: ReadonlyArray<ReadonlyArray<Float32Array>>;
|
|
925
1012
|
readonly peaks: ReadonlyArray<Int8Array | Int16Array>;
|
|
@@ -940,7 +1027,6 @@ interface RecordingHost extends ReactiveControllerHost {
|
|
|
940
1027
|
* position and misplaces punch-in (record-during-playback) clips. */
|
|
941
1028
|
readonly currentTime: number;
|
|
942
1029
|
readonly shadowRoot: ShadowRoot | null;
|
|
943
|
-
resolveAudioContextSampleRate(rate: number): void;
|
|
944
1030
|
_addRecordedClip?(trackId: string, buf: AudioBuffer, startSample: number, durSamples: number, offsetSamples?: number, clipName?: string): void;
|
|
945
1031
|
/** Structural view of the editor's engine for the take's mute (#843):
|
|
946
1032
|
* punch-in replaces the overlapped content, so the recorded-over track's
|
|
@@ -974,6 +1060,8 @@ interface RecordingHost extends ReactiveControllerHost {
|
|
|
974
1060
|
declare class RecordingController implements ReactiveController {
|
|
975
1061
|
private _host;
|
|
976
1062
|
private _sessions;
|
|
1063
|
+
/** Each session's mic-unplug listener, aborted when the session ends. */
|
|
1064
|
+
private _trackEndedListeners;
|
|
977
1065
|
/** Track IDs with a startRecording in flight (session not yet in _sessions).
|
|
978
1066
|
* The session is only set after several awaits — without this, two rapid
|
|
979
1067
|
* start calls both pass the _sessions guard and build two capture
|
|
@@ -1027,6 +1115,15 @@ declare class RecordingController implements ReactiveController {
|
|
|
1027
1115
|
private _cleanupSession;
|
|
1028
1116
|
}
|
|
1029
1117
|
|
|
1118
|
+
/** A clip drag past its threshold, with the clip's bounds when it started. */
|
|
1119
|
+
interface DraggedClip {
|
|
1120
|
+
trackId: string;
|
|
1121
|
+
clipId: string;
|
|
1122
|
+
startSample: number;
|
|
1123
|
+
durationSamples: number;
|
|
1124
|
+
offsetSamples: number;
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1030
1127
|
/** Snapshot of a clip's bounds for trim constraint computation. */
|
|
1031
1128
|
interface ClipBounds {
|
|
1032
1129
|
readonly offsetSamples: number;
|
|
@@ -1036,19 +1133,20 @@ interface ClipBounds {
|
|
|
1036
1133
|
}
|
|
1037
1134
|
/** Narrow engine contract for clip move/trim interactions. */
|
|
1038
1135
|
interface ClipEngineContract {
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1136
|
+
/** Move a clip; returns the delta actually applied. One undo step. */
|
|
1137
|
+
moveClip(trackId: string, clipId: string, deltaSamples: number): number;
|
|
1138
|
+
trimClip(trackId: string, clipId: string, boundary: 'left' | 'right', deltaSamples: number): void;
|
|
1139
|
+
/** The loaded clips of each track (a move collides with them, as `moveClip` does). */
|
|
1140
|
+
getState(): {
|
|
1141
|
+
tracks: readonly {
|
|
1142
|
+
id: string;
|
|
1143
|
+
clips: readonly AudioClip[];
|
|
1144
|
+
}[];
|
|
1145
|
+
};
|
|
1042
1146
|
/** Get a clip's full bounds for trim constraint computation. */
|
|
1043
1147
|
getClipBounds(trackId: string, clipId: string): ClipBounds | null;
|
|
1044
1148
|
/** Constrain a trim delta using the engine's collision/bounds logic. */
|
|
1045
1149
|
constrainTrimDelta(trackId: string, clipId: string, boundary: 'left' | 'right', deltaSamples: number): number;
|
|
1046
|
-
/** Begin a transaction — groups mutations into one undo step. */
|
|
1047
|
-
beginTransaction(): void;
|
|
1048
|
-
/** Commit the transaction — pushes one undo step for all grouped mutations. */
|
|
1049
|
-
commitTransaction(): void;
|
|
1050
|
-
/** Abort the transaction — restores pre-transaction state without pushing to undo. */
|
|
1051
|
-
abortTransaction(): void;
|
|
1052
1150
|
}
|
|
1053
1151
|
/** Peak data returned by reextractClipPeaks for imperative waveform updates. */
|
|
1054
1152
|
interface ClipPeakSlice {
|
|
@@ -1085,11 +1183,14 @@ interface ClipPointerHost {
|
|
|
1085
1183
|
* Handles pointer interactions for clip move and trim drag operations.
|
|
1086
1184
|
* Converts pixel deltas to sample deltas and delegates to the engine.
|
|
1087
1185
|
*
|
|
1088
|
-
*
|
|
1089
|
-
*
|
|
1090
|
-
*
|
|
1091
|
-
*
|
|
1092
|
-
*
|
|
1186
|
+
* Both show the drag in the view and change the arrangement once, on release
|
|
1187
|
+
* (#848): nothing is written while the pointer moves, so an arrangement change
|
|
1188
|
+
* during a drag always came from outside.
|
|
1189
|
+
*
|
|
1190
|
+
* Move: the clip container's `left` follows the pointer, constrained by the
|
|
1191
|
+
* track's other loaded clips as `moveClip` will be; one `moveClip` on release.
|
|
1192
|
+
* Trim: updates clip container CSS and peaks imperatively during drag, then
|
|
1193
|
+
* applies the cumulative delta to the engine once on release.
|
|
1093
1194
|
*/
|
|
1094
1195
|
declare class ClipPointerHandler {
|
|
1095
1196
|
private _host;
|
|
@@ -1106,6 +1207,8 @@ declare class ClipPointerHandler {
|
|
|
1106
1207
|
private _originalOffsetSamples;
|
|
1107
1208
|
private _originalDurationSamples;
|
|
1108
1209
|
private _originalStartSample;
|
|
1210
|
+
private _moveClip;
|
|
1211
|
+
private _moveSorted;
|
|
1109
1212
|
constructor(host: ClipPointerHost);
|
|
1110
1213
|
/**
|
|
1111
1214
|
* Convert a pixel delta to samples, snapping in tick space when in beats mode.
|
|
@@ -1116,11 +1219,21 @@ declare class ClipPointerHandler {
|
|
|
1116
1219
|
* even if they started off-grid.
|
|
1117
1220
|
*/
|
|
1118
1221
|
private _snapDeltaToSamples;
|
|
1222
|
+
/** A sample delta from `anchorSample` in pixels: in tick space in beats mode,
|
|
1223
|
+
* so the drawn position does not drift from the sample round-trip. */
|
|
1224
|
+
private _samplesToPx;
|
|
1119
1225
|
/** Returns true if a drag interaction is currently in progress. */
|
|
1120
1226
|
get isActive(): boolean;
|
|
1121
1227
|
/** True once the pointer of the current press has moved past the drag
|
|
1122
1228
|
* threshold: a press that has not moved is not a drag (#848). */
|
|
1123
1229
|
get isDragging(): boolean;
|
|
1230
|
+
/**
|
|
1231
|
+
* The clip being dragged (past the threshold) with its bounds at the drag's
|
|
1232
|
+
* start, or null; null too while the release makes its one arrangement
|
|
1233
|
+
* call, so that call is not taken for an outside change (#848).
|
|
1234
|
+
*/
|
|
1235
|
+
get draggedClip(): DraggedClip | null;
|
|
1236
|
+
private _committing;
|
|
1124
1237
|
/**
|
|
1125
1238
|
* Attempts to handle a pointerdown event on the given target element.
|
|
1126
1239
|
* Returns true if the target is a recognized clip interaction element.
|
|
@@ -1129,11 +1242,10 @@ declare class ClipPointerHandler {
|
|
|
1129
1242
|
private _beginDrag;
|
|
1130
1243
|
/**
|
|
1131
1244
|
* The press has become a drag (the pointer passed the threshold): take the
|
|
1132
|
-
* clip's bounds
|
|
1133
|
-
*
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1136
|
-
* when the clip is gone (the undo removed it): the press is dropped.
|
|
1245
|
+
* clip's bounds now, not at the press, so a drag after an undo made during
|
|
1246
|
+
* the press starts from the clip as the undo left it (#848, review of
|
|
1247
|
+
* #915). Returns false when the clip is gone (the undo removed it): the
|
|
1248
|
+
* press is dropped.
|
|
1137
1249
|
*/
|
|
1138
1250
|
private _startDrag;
|
|
1139
1251
|
/** Processes pointermove events during an active drag. */
|
|
@@ -1144,20 +1256,18 @@ declare class ClipPointerHandler {
|
|
|
1144
1256
|
*
|
|
1145
1257
|
* pointercancel fires INSTEAD of pointerup on touch interruption, pen
|
|
1146
1258
|
* leaving hover range, or OS gestures. Without this handler the drag stays
|
|
1147
|
-
* armed (hover keeps moving the clip)
|
|
1148
|
-
*
|
|
1149
|
-
* per-frame skipAdapter moveClip mutations are never synced or rolled back
|
|
1150
|
-
* (waveform and audio permanently disagree). */
|
|
1259
|
+
* armed (hover keeps moving the clip). The drag wrote nothing to the
|
|
1260
|
+
* arrangement, so reverting is putting the view back. */
|
|
1151
1261
|
onPointerCancel(_e: PointerEvent): void;
|
|
1152
1262
|
/** Re-extract peaks from cache and set on waveform elements during trim drag.
|
|
1153
1263
|
* Returns true if peaks were successfully updated. */
|
|
1154
1264
|
private _updateWaveformPeaks;
|
|
1155
1265
|
/** Restore clip container CSS AND waveform peaks to original values after
|
|
1156
|
-
* a
|
|
1266
|
+
* a drag's visual preview. Peaks matter: a trim wrote re-extracted peak
|
|
1157
1267
|
* arrays imperatively onto the <daw-waveform> elements (bypassing Lit), and
|
|
1158
|
-
* a cancelled/zero-delta
|
|
1268
|
+
* a cancelled/zero-delta drag makes no engine mutation — so no statechange
|
|
1159
1269
|
* re-render will ever repair them. */
|
|
1160
|
-
private
|
|
1270
|
+
private _restoreVisual;
|
|
1161
1271
|
private _reset;
|
|
1162
1272
|
}
|
|
1163
1273
|
|
|
@@ -1210,14 +1320,13 @@ interface DawTrackUpdateDetail {
|
|
|
1210
1320
|
*/
|
|
1211
1321
|
changed: readonly string[];
|
|
1212
1322
|
}
|
|
1323
|
+
/**
|
|
1324
|
+
* `daw-track-error`: every clip of the track failed to load or was refused
|
|
1325
|
+
* for its kind. The track stays in the editor; `retryTrack` loads it again.
|
|
1326
|
+
*/
|
|
1213
1327
|
interface DawTrackErrorDetail {
|
|
1214
1328
|
trackId: string;
|
|
1215
1329
|
error: unknown;
|
|
1216
|
-
/** Present when the load was CANCELLED rather than failed: the track was
|
|
1217
|
-
* removed (or the editor disconnected) while its clips were still loading.
|
|
1218
|
-
* Consumer error UIs should filter these — nothing actually failed; the
|
|
1219
|
-
* event exists so addTrack()/loadMidi() awaiters settle. */
|
|
1220
|
-
reason?: 'removed' | 'disconnected';
|
|
1221
1330
|
}
|
|
1222
1331
|
interface DawFilesLoadErrorDetail {
|
|
1223
1332
|
file: File;
|
|
@@ -1444,8 +1553,8 @@ interface LoadFilesResult {
|
|
|
1444
1553
|
|
|
1445
1554
|
/**
|
|
1446
1555
|
* MIDI loading logic extracted from daw-editor. Operates on the editor via a
|
|
1447
|
-
* narrow host interface (`addTrack`
|
|
1448
|
-
* satisfies it
|
|
1556
|
+
* narrow host interface (`addTrack`, `_discardTrack`, `_operationSignal`) —
|
|
1557
|
+
* `<daw-editor>` satisfies it.
|
|
1449
1558
|
*
|
|
1450
1559
|
* Numbered steps below match the Data Flow diagram in
|
|
1451
1560
|
* `docs/specs/2026-05-23-dawcore-load-midi-design.md`.
|
|
@@ -1453,15 +1562,57 @@ interface LoadFilesResult {
|
|
|
1453
1562
|
|
|
1454
1563
|
/**
|
|
1455
1564
|
* Minimal host surface needed by `loadMidiImpl`. `<daw-editor>` satisfies this
|
|
1456
|
-
* structurally. `
|
|
1457
|
-
*
|
|
1458
|
-
*
|
|
1459
|
-
* fired `daw-track-error` — the latter aren't in the `addTrack` resolution
|
|
1460
|
-
* value, so we need DOM observation to find them).
|
|
1565
|
+
* structurally. A track `addTrack` added is taken out for good on a failure
|
|
1566
|
+
* or an abort; a track whose entry was refused never entered, so there is
|
|
1567
|
+
* nothing to remove (#848: `addTrack` makes no element).
|
|
1461
1568
|
*/
|
|
1462
1569
|
interface MidiLoaderHost {
|
|
1463
|
-
|
|
1464
|
-
|
|
1570
|
+
/** Resolves with the track id once the track has entered (#848). */
|
|
1571
|
+
addTrack(config: TrackConfig, options?: EditorCallOptions): Promise<string>;
|
|
1572
|
+
/** Take a track out for good: no undo step, and no undo brings it back. */
|
|
1573
|
+
_discardTrack(trackId: string, from?: Arrangement): void;
|
|
1574
|
+
/** The arrangement played (the tracks enter it). */
|
|
1575
|
+
readonly arrangement: Arrangement;
|
|
1576
|
+
/** The caller's signal combined with the arrangement played (D6). */
|
|
1577
|
+
_operationSignal(signal?: AbortSignal): AbortSignal;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* How `<daw-track>` and `<daw-clip>` are linked to the arrangement the editor
|
|
1582
|
+
* plays (#848 PR 3): by id. An element is
|
|
1583
|
+
*
|
|
1584
|
+
* - pending: not in an editor, or registered and not entered yet. Its
|
|
1585
|
+
* properties are its own declaration (the attributes, and any property set
|
|
1586
|
+
* before entry, which is the value the track enters with);
|
|
1587
|
+
* - live: the arrangement holds its id. Properties read the arrangement, and
|
|
1588
|
+
* setting one (or changing its attribute) is a request to it, one undo step;
|
|
1589
|
+
* - detached: the editor took it, and the arrangement no longer holds its id
|
|
1590
|
+
* (an Undo of its arrival, a removal made on the arrangement, a refusal).
|
|
1591
|
+
* Properties read the declaration; a change does nothing, with a warning.
|
|
1592
|
+
* The element carries the custom state `detached` (`:state(detached)`).
|
|
1593
|
+
*
|
|
1594
|
+
* Attributes are never written by the editor.
|
|
1595
|
+
*/
|
|
1596
|
+
|
|
1597
|
+
type LinkState = 'pending' | 'live' | 'detached';
|
|
1598
|
+
/** The `<daw-track>` properties read from the arrangement while live. */
|
|
1599
|
+
interface TrackLinkValues {
|
|
1600
|
+
volume: number;
|
|
1601
|
+
pan: number;
|
|
1602
|
+
muted: boolean;
|
|
1603
|
+
soloed: boolean;
|
|
1604
|
+
name: string;
|
|
1605
|
+
}
|
|
1606
|
+
/** The `<daw-clip>` properties read from the arrangement while live. */
|
|
1607
|
+
interface ClipLinkValues {
|
|
1608
|
+
start: number;
|
|
1609
|
+
duration: number;
|
|
1610
|
+
offset: number;
|
|
1611
|
+
gain: number;
|
|
1612
|
+
name: string;
|
|
1613
|
+
midiNotes: MidiNoteData[] | null;
|
|
1614
|
+
midiChannel: number | null;
|
|
1615
|
+
midiProgram: number | null;
|
|
1465
1616
|
}
|
|
1466
1617
|
|
|
1467
1618
|
interface ExportOptions {
|
|
@@ -1503,6 +1654,18 @@ interface ExportAudioHost {
|
|
|
1503
1654
|
getTrackEffectsState(trackId: string): Promise<SerializedEffectEntry[]>;
|
|
1504
1655
|
}
|
|
1505
1656
|
|
|
1657
|
+
/**
|
|
1658
|
+
* A track registered and not in the arrangement yet (#848): a `<daw-track>`
|
|
1659
|
+
* (read when it enters, with clips `addClip()` gave it meanwhile), or a
|
|
1660
|
+
* declaration with no element (`addTrack()`, a dropped file) and its mix.
|
|
1661
|
+
*/
|
|
1662
|
+
type PendingEntry = {
|
|
1663
|
+
element: DawTrackElement;
|
|
1664
|
+
extraClips: DropClipDescriptor[];
|
|
1665
|
+
} | {
|
|
1666
|
+
descriptor: StoredTrackDescriptor;
|
|
1667
|
+
mix: TrackMixerValues;
|
|
1668
|
+
};
|
|
1506
1669
|
declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
1507
1670
|
get samplesPerPixel(): number;
|
|
1508
1671
|
set samplesPerPixel(value: number);
|
|
@@ -1631,20 +1794,90 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1631
1794
|
/** True when the consumer provided BOTH tick conversion callbacks — the
|
|
1632
1795
|
* external tempo map is authoritative and `bpm` is display/grid-only (#407). */
|
|
1633
1796
|
get _hasTickCallbacks(): boolean;
|
|
1634
|
-
/**
|
|
1797
|
+
/**
|
|
1798
|
+
* Sample rate: the adapter's AudioContext rate. Without an adapter (after a
|
|
1799
|
+
* disconnect let it go), the rate of the loaded clips the arrangement holds,
|
|
1800
|
+
* else 48000. Decoded audio is at the context's rate, so the two agree.
|
|
1801
|
+
*/
|
|
1635
1802
|
get sampleRate(): number;
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1803
|
+
private _loadedClipSampleRate;
|
|
1804
|
+
/**
|
|
1805
|
+
* The editor's own arrangement (#848): the one owner of the tracks, the
|
|
1806
|
+
* clips, the mix, the undo history and loading of what the `<daw-track>`
|
|
1807
|
+
* children declare. Made with the editor, kept across a disconnect.
|
|
1808
|
+
*/
|
|
1809
|
+
readonly _ownArrangement: Arrangement;
|
|
1810
|
+
/** An arrangement the app handed in (`editor.arrangement`), played alone; null: the own one. */
|
|
1811
|
+
_handedIn: Arrangement | null;
|
|
1812
|
+
/** The arrangement played now: a handed-in one, else the editor's own. */
|
|
1813
|
+
get _arrangement(): Arrangement;
|
|
1814
|
+
/**
|
|
1815
|
+
* The arrangement the editor plays (#848 PR 3): one handed in by the app,
|
|
1816
|
+
* or else the editor's own, whose content the `<daw-track>` children
|
|
1817
|
+
* declare. Setting one plays it alone, like `video.srcObject`: the
|
|
1818
|
+
* children are not added to it and show `:state(detached)` while it is
|
|
1819
|
+
* set; `null` (or the editor's own) goes back to the own arrangement with
|
|
1820
|
+
* what it held. A swap keeps the adapter: playback stops, a new engine is
|
|
1821
|
+
* built on the new arrangement. Refused (with a warning) during a take.
|
|
1822
|
+
* The editor never disposes or clears an arrangement it was handed.
|
|
1823
|
+
* Throws a `TypeError` for a value that is not an arrangement.
|
|
1824
|
+
*/
|
|
1825
|
+
get arrangement(): Arrangement;
|
|
1826
|
+
set arrangement(value: Arrangement | null);
|
|
1827
|
+
/** Sends the load events, read from the arrangement played (#848; a new one per swap). */
|
|
1828
|
+
private _announcer;
|
|
1829
|
+
/** Stops following the arrangement played (its sources and its tracks). */
|
|
1830
|
+
private _unfollow;
|
|
1831
|
+
constructor();
|
|
1832
|
+
/**
|
|
1833
|
+
* Follow the arrangement played: a source that fails changes no track,
|
|
1834
|
+
* only `sources` tells of it (the events, the failed look); the elements'
|
|
1835
|
+
* link states follow its tracks (a structural change only, not every
|
|
1836
|
+
* mixer frame).
|
|
1837
|
+
*/
|
|
1838
|
+
private _follow;
|
|
1839
|
+
/**
|
|
1840
|
+
* A change to the arrangement while a drag is in progress came from
|
|
1841
|
+
* elsewhere (a drag writes nothing until its release): cancel the drag
|
|
1842
|
+
* when it changed what is dragged (#848 P2, interactions/drag-watch.ts).
|
|
1843
|
+
*/
|
|
1844
|
+
private _watchDrags;
|
|
1845
|
+
/** @internal */
|
|
1846
|
+
_releaseEngine(): void;
|
|
1847
|
+
/** @internal */
|
|
1848
|
+
_disposeTrackChain(trackId: string): void;
|
|
1849
|
+
/** @internal */
|
|
1850
|
+
_playArrangement(next: Arrangement | null): void;
|
|
1851
|
+
/** @internal */
|
|
1852
|
+
_buildEngineIfReady(): void;
|
|
1853
|
+
/**
|
|
1854
|
+
* Ids of tracks registered (a `<daw-track>` connected, a file dropped) and
|
|
1855
|
+
* not yet in the arrangement: they enter at the next flush, once there is
|
|
1856
|
+
* an engine (#848).
|
|
1857
|
+
*/
|
|
1858
|
+
private _entryQueue;
|
|
1859
|
+
private _entryFlushScheduled;
|
|
1860
|
+
/**
|
|
1861
|
+
* Clips an `addClip()` is waiting for, with their track and the way to
|
|
1862
|
+
* reject the call: a removal of the clip or of its track before the clip
|
|
1863
|
+
* loads settles it here, without a public event (#917).
|
|
1864
|
+
*/
|
|
1865
|
+
private _awaitedClips;
|
|
1866
|
+
/** Reject the `addClip()` calls waiting for clips that match `which`. */
|
|
1867
|
+
private _rejectAwaitedClips;
|
|
1868
|
+
/** `.dat` peaks drawn for a clip still loading, by clip id (an editor-only render cache). */
|
|
1869
|
+
_previewPeaks: Map<string, PeakData>;
|
|
1870
|
+
/** The `.dat` data of those clips, handed to the peak pipeline when the audio arrives. */
|
|
1871
|
+
private _previewWaveforms;
|
|
1872
|
+
/**
|
|
1873
|
+
* Tracks registered and not in the arrangement yet, with their declaration
|
|
1874
|
+
* (#848): a `<daw-track>` is read when it enters (its clips and attributes
|
|
1875
|
+
* as they are then); a dropped file carries its descriptor. The one place a
|
|
1876
|
+
* track's state lives until it enters.
|
|
1877
|
+
*/
|
|
1878
|
+
_pending: Map<string, PendingEntry>;
|
|
1879
|
+
/** What the arrangement has no field for, by track id (#848; render mode, `peaks-src`). */
|
|
1880
|
+
_extras: Map<string, TrackExtras>;
|
|
1648
1881
|
_peaksData: Map<string, PeakData>;
|
|
1649
1882
|
_isPlaying: boolean;
|
|
1650
1883
|
_duration: number;
|
|
@@ -1657,9 +1890,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1657
1890
|
set adapter(value: PlayoutAdapter | null);
|
|
1658
1891
|
get adapter(): PlayoutAdapter | null;
|
|
1659
1892
|
private _externalAdapter;
|
|
1660
|
-
/** True after a disconnect disposed the consumer's adapter via the engine
|
|
1661
|
-
* — rebuild attempts fail loudly until a fresh adapter is set. */
|
|
1662
|
-
private _adapterConsumedByDispose;
|
|
1663
1893
|
private _effectsManager;
|
|
1664
1894
|
private get _effects();
|
|
1665
1895
|
/**
|
|
@@ -1742,8 +1972,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1742
1972
|
_engine: PlaylistEngine | null;
|
|
1743
1973
|
private _warnedMissingTicksToSeconds;
|
|
1744
1974
|
private _warnedMissingSecondsToTicks;
|
|
1745
|
-
private _enginePromise;
|
|
1746
|
-
_audioCache: Map<string, Promise<AudioBuffer>>;
|
|
1747
1975
|
private _peaksCache;
|
|
1748
1976
|
_clipBuffers: Map<string, AudioBuffer>;
|
|
1749
1977
|
_clipOffsets: Map<string, {
|
|
@@ -1754,11 +1982,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1754
1982
|
/** Coarsest scale from pre-computed peaks — zoom cannot go finer than this. 0 = no limit. */
|
|
1755
1983
|
private _minSamplesPerPixel;
|
|
1756
1984
|
private _trackElements;
|
|
1757
|
-
/** Track ids with a _loadTrack in flight. Distinct from `_engineTracks`
|
|
1758
|
-
* membership: the peaks-first path inserts a render-only PREVIEW track
|
|
1759
|
-
* into _engineTracks mid-load, so `has()` alone cannot answer "is this
|
|
1760
|
-
* track still loading?". */
|
|
1761
|
-
private _loadingTracks;
|
|
1762
1985
|
private _childObserver;
|
|
1763
1986
|
private _audioResume;
|
|
1764
1987
|
eagerResume?: string;
|
|
@@ -1798,12 +2021,15 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1798
2021
|
* Returns false for unknown track/clip IDs (defensive).
|
|
1799
2022
|
*/
|
|
1800
2023
|
isMidiClip(trackId: string, clipId: string): boolean;
|
|
2024
|
+
/** The arrangement's tracks as they are played: loaded clips, the current mix (#848). */
|
|
2025
|
+
_loadedTracks(): ClipTrack[];
|
|
2026
|
+
/** A loaded clip of a track of the arrangement, or undefined. */
|
|
2027
|
+
private _loadedClip;
|
|
1801
2028
|
private _pointer;
|
|
1802
2029
|
private _viewport;
|
|
1803
2030
|
private _scrollSync;
|
|
1804
2031
|
static styles: lit.CSSResult[];
|
|
1805
2032
|
get effectiveSampleRate(): number;
|
|
1806
|
-
resolveAudioContextSampleRate(rate: number): void;
|
|
1807
2033
|
/**
|
|
1808
2034
|
* In beats mode, derive samplesPerPixel from ticksPerPixel so that
|
|
1809
2035
|
* clip positions, waveforms, and the tick-space grid all align.
|
|
@@ -1821,20 +2047,73 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1821
2047
|
/** Grid height when no tracks exist — matches scroll area's rendered height. */
|
|
1822
2048
|
private get _emptyGridHeight();
|
|
1823
2049
|
_setSelectedTrackId(trackId: string | null): void;
|
|
1824
|
-
get tracks(): TrackWithId[];
|
|
1825
2050
|
/**
|
|
1826
|
-
*
|
|
1827
|
-
*
|
|
1828
|
-
*
|
|
2051
|
+
* Every track: those in the arrangement, in its order, then those still
|
|
2052
|
+
* waiting to enter (#848). A `<daw-track>` whose track an Undo took out of
|
|
2053
|
+
* the arrangement is not listed (its descriptor stays for a Redo).
|
|
2054
|
+
*/
|
|
2055
|
+
get tracks(): TrackWithId[];
|
|
2056
|
+
/** A track of the arrangement as `editor.tracks` lists it: everything read from the arrangement. */
|
|
2057
|
+
private _listTrack;
|
|
2058
|
+
/** A pending track's declaration: its element's attributes and clips now, or its descriptor. */
|
|
2059
|
+
private _pendingDescriptor;
|
|
2060
|
+
/** The extras a track of the arrangement takes when the editor has none for it. */
|
|
2061
|
+
private _defaultExtras;
|
|
2062
|
+
/** How a track is drawn: its extras, else from its kind (an undo-restored track has none). */
|
|
2063
|
+
_renderModeOf(trackId: string): TrackRenderMode;
|
|
2064
|
+
/**
|
|
2065
|
+
* A track's mix, from its one owner, the arrangement (#843), as the engine
|
|
2066
|
+
* plays it: its projection carries the take's mute, which `getMixer()`
|
|
2067
|
+
* leaves out (the stored mute comes back when the take ends). A track still
|
|
2068
|
+
* waiting to enter shows what its element declares.
|
|
1829
2069
|
*/
|
|
1830
2070
|
_mixOf(trackId: string): TrackMixerValues;
|
|
1831
|
-
/**
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
2071
|
+
/** @internal */
|
|
2072
|
+
_trackLinkState(trackId: string): LinkState;
|
|
2073
|
+
/** @internal */
|
|
2074
|
+
_clipLinkState(trackId: string, clipId: string): LinkState;
|
|
2075
|
+
/** @internal The stored mix (not a take's mute) and the name. */
|
|
2076
|
+
_trackValues(trackId: string): TrackLinkValues | null;
|
|
2077
|
+
/** @internal */
|
|
2078
|
+
_clipValues(trackId: string, clipId: string): ClipLinkValues | null;
|
|
2079
|
+
/** @internal A property or attribute set on a live `<daw-track>`: one undo step per field kind. */
|
|
2080
|
+
_requestTrackChange(trackId: string, partial: Partial<TrackLinkValues>): void;
|
|
2081
|
+
/** One gesture id per track for the rest of this task: mix sets made together are one step (#843). */
|
|
2082
|
+
private _taskGestures;
|
|
2083
|
+
private _taskGesture;
|
|
2084
|
+
/** @internal A property or attribute set on a live `<daw-clip>`: one undo step. */
|
|
2085
|
+
_requestClipChange(trackId: string, clipId: string, partial: Partial<ClipLinkValues>): void;
|
|
2086
|
+
/**
|
|
2087
|
+
* The clips of an entering track that another track of the arrangement
|
|
2088
|
+
* holds (the page moved their `<daw-clip>` here while the track waited):
|
|
2089
|
+
* the track takes the held clip as it is, and `from` names what leaves
|
|
2090
|
+
* where. A held clip of the other kind is refused and stays.
|
|
2091
|
+
*/
|
|
2092
|
+
private _takeOverMovedClips;
|
|
2093
|
+
/** Run `fn` as one undo step of each arrangement it changes. */
|
|
2094
|
+
private _inOneStep;
|
|
2095
|
+
/** The `peaks-src` some track took for a clip element, if any. */
|
|
2096
|
+
private _takenPeaksSrc;
|
|
2097
|
+
/**
|
|
2098
|
+
* The arrangement whose history holds a track: the one that holds it now,
|
|
2099
|
+
* or else, for a page track, the own one (an Undo took it out there; a
|
|
2100
|
+
* handed-in arrangement may be played meanwhile), or else the one played.
|
|
2101
|
+
*/
|
|
2102
|
+
private _historyOf;
|
|
2103
|
+
/** The track of the arrangement played that holds a clip: `trackId` when it does, or else the one that does. */
|
|
2104
|
+
private _clipHolderId;
|
|
2105
|
+
/** @internal */
|
|
2106
|
+
_trackKind(trackId: string): TrackKind | null;
|
|
2107
|
+
/** @internal */
|
|
2108
|
+
_trackIndex(trackId: string): number;
|
|
2109
|
+
/** @internal */
|
|
2110
|
+
_detachedReason(): string;
|
|
2111
|
+
/** Set or clear `:state(detached)` on every registered element (#848). */
|
|
2112
|
+
private _refreshLinkStates;
|
|
2113
|
+
/**
|
|
2114
|
+
* Change one mixer field of a track: the arrangement's setter with
|
|
2115
|
+
* `options` (an undo step; changes with one `gesture` id are one step). A
|
|
2116
|
+
* track that has not entered yet changes nothing.
|
|
1838
2117
|
*/
|
|
1839
2118
|
private _writeMix;
|
|
1840
2119
|
/**
|
|
@@ -1842,8 +2121,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1842
2121
|
* of them carry one fresh gesture id. A field left out is not sent.
|
|
1843
2122
|
*/
|
|
1844
2123
|
private _writeMixFields;
|
|
1845
|
-
/** The ordered tracks for `engine.setTracks`, a loading track with its seed. */
|
|
1846
|
-
private _tracksForEngine;
|
|
1847
2124
|
get selectedTrackId(): string | null;
|
|
1848
2125
|
get selection(): {
|
|
1849
2126
|
start: number;
|
|
@@ -1871,108 +2148,183 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1871
2148
|
private _onTrackConnected;
|
|
1872
2149
|
private _onTrackRemoved;
|
|
1873
2150
|
private _onTrackUpdate;
|
|
2151
|
+
/** The arrangement that holds a track: the one played, else the own one (a page track while handed in). */
|
|
2152
|
+
private _arrangementOf;
|
|
2153
|
+
/** Rename a track in the arrangement (an undo step); the same name changes nothing. */
|
|
2154
|
+
private _renameTrack;
|
|
1874
2155
|
/** Drop the controller when no spectrogram tracks remain. */
|
|
1875
2156
|
private _disposeSpectrogramControllerIfEmpty;
|
|
1876
|
-
/** Reconcile `_tracks` descriptors with the engine's track list.
|
|
1877
|
-
*
|
|
1878
|
-
* ADD: engine.undo() restores removed tracks in ENGINE state only —
|
|
1879
|
-
* without a synthesized descriptor the track plays and renders but shows
|
|
1880
|
-
* "Untitled" controls and is missing from `editor.tracks`.
|
|
1881
|
-
* PRUNE (the symmetric half): redo removes the track from engine state
|
|
1882
|
-
* again — without pruning, the synthesized descriptor is a permanent
|
|
1883
|
-
* ghost that even removeTrack() can't clean (no element, no engine
|
|
1884
|
-
* entry). Never prunes tracks that are mid-load or element-backed —
|
|
1885
|
-
* their descriptors legitimately precede their engine entries. */
|
|
1886
|
-
_reconcileDescriptorsWithEngineTracks(tracks: readonly ClipTrack[]): void;
|
|
1887
|
-
/** Prune id-bearing drop descriptors the engine no longer has, and refresh
|
|
1888
|
-
* the rest from their engine clip. Returns the SAME array when nothing
|
|
1889
|
-
* changed, so an unchanged track never triggers a re-render. */
|
|
1890
|
-
private _reconcileIdentifiedDropClips;
|
|
1891
2157
|
private static _CONTROL_PROPS;
|
|
1892
2158
|
private _onTrackControl;
|
|
1893
2159
|
private _onTrackRemoveRequest;
|
|
1894
2160
|
private _onClipConnected;
|
|
1895
|
-
|
|
2161
|
+
/**
|
|
2162
|
+
* A `<daw-clip>` now under `trackId` whose clip another track holds: the
|
|
2163
|
+
* clip moves to this track (one undo step) when both have entered the same
|
|
2164
|
+
* arrangement; a clip of the other kind stays with `daw-clip-error`.
|
|
2165
|
+
* Otherwise the old track lets it go and the element goes on as a new
|
|
2166
|
+
* arrival. Returns true when nothing more is to be done.
|
|
2167
|
+
*/
|
|
2168
|
+
private _rehomeClip;
|
|
1896
2169
|
private _onClipRemovedFromDom;
|
|
2170
|
+
/**
|
|
2171
|
+
* A `<daw-clip>` appended to a track that has entered: the clip goes in as
|
|
2172
|
+
* a loading clip (a loaded one for MIDI), one undo step. Its audio loads
|
|
2173
|
+
* like any other; `daw-clip-ready` or `daw-clip-error` follows (#848).
|
|
2174
|
+
*/
|
|
1897
2175
|
private _loadAndAppendClip;
|
|
1898
2176
|
/**
|
|
1899
2177
|
* Resolve pre-computed peaks for a clip: fetch the .dat/.json, validate the
|
|
1900
2178
|
* sample rate matches the AudioContext, return the WaveformData or null.
|
|
1901
2179
|
* Warns on fetch failure and on sample-rate mismatch — never silent.
|
|
1902
2180
|
*
|
|
1903
|
-
*
|
|
1904
|
-
* `_loadAndAppendClip` (incremental late-append).
|
|
2181
|
+
* Used by `_requestPreview` for a clip that is still loading.
|
|
1905
2182
|
*/
|
|
1906
2183
|
private _resolvePeaks;
|
|
2184
|
+
/** Remove a single clip from all per-clip caches. Used by error rollbacks. */
|
|
2185
|
+
private _purgeClipCaches;
|
|
1907
2186
|
/**
|
|
1908
|
-
*
|
|
1909
|
-
*
|
|
1910
|
-
* `_clipBuffers` / `_clipOffsets`, generate peaks via the worker pipeline,
|
|
1911
|
-
* and populate `_peaksData`. Returns the finished AudioClip.
|
|
1912
|
-
*
|
|
1913
|
-
* Shared between `_loadTrack`'s standard path and `_loadAndAppendClip`.
|
|
1914
|
-
* Not used by `_loadTrack`'s peaks-first preview path because that path
|
|
1915
|
-
* uses sync `extractPeaks` and inserts a preview track BEFORE audio decode.
|
|
1916
|
-
*/
|
|
1917
|
-
private _finalizeAudioClip;
|
|
1918
|
-
/**
|
|
1919
|
-
* Filter MIDI notes to only those with finite, in-range fields. Logs a
|
|
1920
|
-
* warning for each dropped note. Used by _buildMidiClip and the
|
|
1921
|
-
* _applyClipUpdate MIDI branch to prevent NaN propagation through the
|
|
1922
|
-
* timeline.
|
|
2187
|
+
* Replace one loaded clip of a track in the arrangement: an undo step. The
|
|
2188
|
+
* function form, so the track's loading clips stay as they are (#848).
|
|
1923
2189
|
*/
|
|
1924
|
-
private
|
|
2190
|
+
private _replaceClip;
|
|
2191
|
+
private _applyClipUpdate;
|
|
1925
2192
|
/**
|
|
1926
|
-
* A clip
|
|
1927
|
-
*
|
|
1928
|
-
* with a 1s default span; notes upgrade via _applyClipUpdate). Warns when
|
|
1929
|
-
* a clip ambiguously has both src and midiNotes — the audio path runs
|
|
1930
|
-
* and notes would be silently ignored.
|
|
2193
|
+
* A change to a clip still loading (#848 P10): its times, gain and name in
|
|
2194
|
+
* seconds on the `LoadingClip`, one undo step; the audio loads into it.
|
|
1931
2195
|
*/
|
|
1932
|
-
private
|
|
2196
|
+
private _updateLoadingClip;
|
|
2197
|
+
/** Remove a clip (loaded or still loading) from a track of the arrangement: an undo step. */
|
|
1933
2198
|
/**
|
|
1934
|
-
*
|
|
1935
|
-
*
|
|
1936
|
-
* the clip is reachable via `engine.updateTrack` once notes arrive.
|
|
2199
|
+
* An aborted addClip (D3): its clip leaves for good, from the track it
|
|
2200
|
+
* entered or from what a waiting track will enter with.
|
|
1937
2201
|
*/
|
|
1938
|
-
private
|
|
1939
|
-
|
|
1940
|
-
|
|
2202
|
+
private _discardAddedClip;
|
|
2203
|
+
private _removeClipFromTrack;
|
|
2204
|
+
/** Record that the editor took a clip of a track (with its `peaks-src`, '' when none). */
|
|
2205
|
+
private _takeClip;
|
|
1941
2206
|
/**
|
|
1942
|
-
*
|
|
1943
|
-
*
|
|
1944
|
-
*
|
|
1945
|
-
*
|
|
1946
|
-
* back to full setTracks (legacy adapters).
|
|
2207
|
+
* A `<daw-clip>` the editor took is removed while the arrangement does not
|
|
2208
|
+
* hold its clip (its track or its own arrival undone, or refused): it is
|
|
2209
|
+
* gone for good, also from the undo and redo states, so no Redo brings it
|
|
2210
|
+
* back (maintainer's choice, #848).
|
|
1947
2211
|
*/
|
|
1948
|
-
private
|
|
1949
|
-
|
|
1950
|
-
private
|
|
2212
|
+
private _dropUnheldClip;
|
|
2213
|
+
/** The editor no longer holds anything for a clip of a track. */
|
|
2214
|
+
private _forgetClip;
|
|
1951
2215
|
private _readTrackDescriptor;
|
|
2216
|
+
private _readClipDescriptor;
|
|
2217
|
+
private _isEntered;
|
|
2218
|
+
/** Queue a registered track for the next flush. */
|
|
2219
|
+
_queueEntry(trackId: string): void;
|
|
2220
|
+
/**
|
|
2221
|
+
* Enter the queued tracks into the arrangement, in DOM order. Without an
|
|
2222
|
+
* engine they wait (the sample rate of a MIDI clip comes from the
|
|
2223
|
+
* adapter); the engine's build flushes again. The page's tracks entering
|
|
2224
|
+
* while the arrangement has no history are not undo steps: the history is
|
|
2225
|
+
* cleared after them, so Undo right after load removes nothing (and the
|
|
2226
|
+
* next page track finds it empty again).
|
|
2227
|
+
*/
|
|
2228
|
+
_flushTrackEntries(): void;
|
|
2229
|
+
/** Enter one registered track. False when it is gone, already in, or refused. */
|
|
2230
|
+
private _enterTrack;
|
|
2231
|
+
/**
|
|
2232
|
+
* The `<daw-track src>` shorthand changed its src: the entered track gets a
|
|
2233
|
+
* new loading clip for it, one undo step. A track whose clips are
|
|
2234
|
+
* `<daw-clip>` children keeps them. A track still queued reads the new
|
|
2235
|
+
* descriptor when it enters.
|
|
2236
|
+
*/
|
|
2237
|
+
private _replaceShorthandClips;
|
|
2238
|
+
/** Run the load announcements over the arrangement's current state. */
|
|
2239
|
+
private _announceLoading;
|
|
2240
|
+
/**
|
|
2241
|
+
* Fetch a loading clip's `.dat` peaks and draw them until its audio
|
|
2242
|
+
* arrives (an editor-only cache, not the arrangement: writing the clip
|
|
2243
|
+
* after it entered would be an undo step).
|
|
2244
|
+
*/
|
|
2245
|
+
private _requestPreview;
|
|
2246
|
+
/** The peak sync made a clip's peaks: its zoom floor holds, its preview goes. */
|
|
2247
|
+
_clipPeaksReady(clipId: string, audioBuffer: AudioBuffer): void;
|
|
2248
|
+
/** Who waits for a track to enter (addTrack, a dropped file). */
|
|
2249
|
+
private _entryWaiters;
|
|
2250
|
+
private _waitForEntry;
|
|
2251
|
+
/** Settle the wait for a track's entry: entered (`ENTERED`), or refused or gone (the reason).*/
|
|
2252
|
+
private _settleEntry;
|
|
2253
|
+
/**
|
|
2254
|
+
* A dropped file as a track with no element (a File cannot be an attribute):
|
|
2255
|
+
* one loading clip whose source is the file. Resolves with the track id once
|
|
2256
|
+
* it has entered, an undo step like any track an editor method adds.
|
|
2257
|
+
*/
|
|
2258
|
+
_addDroppedFile(file: File): Promise<string>;
|
|
2259
|
+
/**
|
|
2260
|
+
* Take a track out for good: no undo step, and no undo or redo brings it
|
|
2261
|
+
* back (a dropped file that could not be loaded was never a declaration).
|
|
2262
|
+
*/
|
|
2263
|
+
_discardTrack(trackId: string, from?: Arrangement): void;
|
|
2264
|
+
/** One AbortController per arrangement while it is played (D2, interactions/abort.ts). */
|
|
2265
|
+
private _playSignals;
|
|
2266
|
+
/** The signal of the arrangement played now: aborted when it is swapped out. */
|
|
2267
|
+
private get _playSignal();
|
|
2268
|
+
/** @internal A caller's signal combined with the arrangement played now (loadMidi, D6). */
|
|
2269
|
+
_operationSignal(signal?: AbortSignal): AbortSignal;
|
|
2270
|
+
/** One AbortController per connection: aborted in disconnectedCallback (D8). */
|
|
2271
|
+
private _connection;
|
|
2272
|
+
/**
|
|
2273
|
+
* Resolves once the track has loaded (`daw-track-ready`), or when the
|
|
2274
|
+
* editor is disconnected meanwhile (the track is kept and loads after a
|
|
2275
|
+
* reparent); rejects when its audio failed (`daw-track-error`).
|
|
2276
|
+
*/
|
|
2277
|
+
_whenTrackLoaded(trackId: string): Promise<void>;
|
|
2278
|
+
/**
|
|
2279
|
+
* Load again every failed source the track's clips name (#848). A track
|
|
2280
|
+
* whose audio failed stays in the editor, like a broken `<img>`;
|
|
2281
|
+
* `daw-track-ready` follows when it loads.
|
|
2282
|
+
*/
|
|
2283
|
+
retryTrack(trackId: string): void;
|
|
2284
|
+
private _fetchPeaks;
|
|
1952
2285
|
/**
|
|
1953
|
-
* The
|
|
1954
|
-
*
|
|
2286
|
+
* The timeline's duration, the one writer of `_duration`: the loaded clips,
|
|
2287
|
+
* and the clips still loading whose length is known (a duration, or `.dat`
|
|
2288
|
+
* peaks), so the timeline is as wide as what is drawn (#848).
|
|
1955
2289
|
*/
|
|
1956
|
-
private _clipKindError;
|
|
1957
|
-
private _loadTrack;
|
|
1958
|
-
_fetchAndDecode(src: string): Promise<AudioBuffer>;
|
|
1959
|
-
private _fetchPeaks;
|
|
1960
2290
|
_recomputeDuration(): void;
|
|
2291
|
+
/** How long a loading clip is drawn: its duration, else what its `.dat` peaks cover; null when unknown. */
|
|
2292
|
+
private _placeholderSeconds;
|
|
2293
|
+
/**
|
|
2294
|
+
* The engine, built now when the editor is connected with an adapter.
|
|
2295
|
+
* Rejects without an adapter, and on a detached editor (an engine built
|
|
2296
|
+
* there would hold the adapter's graph with nothing to dispose it).
|
|
2297
|
+
*/
|
|
1961
2298
|
_ensureEngine(): Promise<PlaylistEngine>;
|
|
2299
|
+
/** Build the engine from the adapter setter or a connect: a failure is reported, not thrown. */
|
|
2300
|
+
private _buildEngineReporting;
|
|
2301
|
+
/** Last versions the statechange handler worked from; reset for each engine. */
|
|
2302
|
+
private _lastTracksVersion;
|
|
2303
|
+
private _lastMixerVersion;
|
|
1962
2304
|
private _buildEngine;
|
|
2305
|
+
/**
|
|
2306
|
+
* Clips whose audio has just arrived: a `.dat` preview's data goes to the
|
|
2307
|
+
* peak pipeline (no worker run), a spectrogram track gets the audio. The
|
|
2308
|
+
* peak sync then makes their peaks.
|
|
2309
|
+
*/
|
|
2310
|
+
private _adoptLoadedClips;
|
|
2311
|
+
/** The engine's state changed: draw it (the rows are read from the arrangement). */
|
|
2312
|
+
private _onEngineState;
|
|
2313
|
+
private _onEngineStop;
|
|
1963
2314
|
private _disposeEngine;
|
|
1964
2315
|
private _onDragOver;
|
|
1965
2316
|
private _onDragLeave;
|
|
1966
2317
|
private _onDrop;
|
|
1967
|
-
loadFiles(files: FileList | File[]): Promise<LoadFilesResult>;
|
|
2318
|
+
loadFiles(files: FileList | File[], options?: EditorCallOptions): Promise<LoadFilesResult>;
|
|
1968
2319
|
/**
|
|
1969
|
-
* Imperatively load a `.mid` file (URL or File) and
|
|
1970
|
-
*
|
|
1971
|
-
* every
|
|
1972
|
-
*
|
|
2320
|
+
* Imperatively load a `.mid` file (URL or File) and add N tracks (no
|
|
2321
|
+
* element, #848), one per note-bearing MIDI track. On any per-track
|
|
2322
|
+
* failure, every track the call added is removed with no undo step, so the
|
|
2323
|
+
* editor is as before the call.
|
|
1973
2324
|
*
|
|
1974
|
-
* `options.signal`
|
|
1975
|
-
*
|
|
2325
|
+
* `options.signal` cancels the fetch, the parse and the tracks still
|
|
2326
|
+
* waiting to enter (combined with the arrangement played: a swap cancels
|
|
2327
|
+
* too); the call rejects with its `reason` and removes the tracks it added.
|
|
1976
2328
|
*
|
|
1977
2329
|
* Requires the optional `@dawcore/midi` peer dep — throws with an install
|
|
1978
2330
|
* hint (and `console.warn`s the original error) when the dynamic import
|
|
@@ -1986,70 +2338,91 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1986
2338
|
*/
|
|
1987
2339
|
ready(): Promise<PlaylistEngine>;
|
|
1988
2340
|
/**
|
|
1989
|
-
*
|
|
1990
|
-
*
|
|
1991
|
-
*
|
|
1992
|
-
*
|
|
1993
|
-
*
|
|
2341
|
+
* Add a track built from `config` to the arrangement the editor plays when
|
|
2342
|
+
* it is called, and resolve with its id once it has entered (#848), before
|
|
2343
|
+
* its audio has loaded. A swap of `editor.arrangement` before it enters
|
|
2344
|
+
* rejects with an `AbortError` and the track enters nowhere; to add to
|
|
2345
|
+
* another arrangement, call that arrangement's own `addTrack`. No element is created: the track is drawn and listed like any
|
|
2346
|
+
* other, and `<daw-track>` children stay the page's declaration. To follow
|
|
2347
|
+
* loading, add the `daw-track-ready` / `daw-track-error` listener BEFORE
|
|
2348
|
+
* calling: for a track with nothing to fetch it fires before this
|
|
2349
|
+
* resolves. Without `editor.adapter` it waits for one. Rejects when the
|
|
2350
|
+
* arrangement refuses the track, when it is removed before it enters, or
|
|
2351
|
+
* when the engine cannot be built.
|
|
2352
|
+
*
|
|
2353
|
+
* `options.signal` (#848): aborting it before the track has entered takes
|
|
2354
|
+
* it out of the queue (it never enters) and rejects with its `reason`;
|
|
2355
|
+
* after that it changes nothing (the audio goes on loading). A signal
|
|
2356
|
+
* already aborted rejects at once and queues nothing.
|
|
1994
2357
|
*/
|
|
1995
|
-
|
|
2358
|
+
addTrack(config?: TrackConfig, options?: EditorCallOptions): Promise<string>;
|
|
1996
2359
|
/**
|
|
1997
|
-
*
|
|
1998
|
-
*
|
|
1999
|
-
*
|
|
2000
|
-
* peaks, and clip buffers are populated correctly.
|
|
2360
|
+
* A queued track goes into the arrangement played when it was queued: when
|
|
2361
|
+
* that one is swapped out first, the track leaves the queue and its wait
|
|
2362
|
+
* rejects with the swap's AbortError (addTrack, a dropped file).
|
|
2001
2363
|
*/
|
|
2002
|
-
|
|
2364
|
+
private _endEntryOnSwap;
|
|
2365
|
+
/** A track that has not entered leaves the queue and its wait rejects with `reason` (D4). */
|
|
2366
|
+
private _abortEntry;
|
|
2003
2367
|
/**
|
|
2004
|
-
* Remove a track by id
|
|
2005
|
-
* the
|
|
2006
|
-
*
|
|
2368
|
+
* Remove a track by id: its `<daw-track>` element is removed (the
|
|
2369
|
+
* MutationObserver does the rest), or, for a track with no element
|
|
2370
|
+
* (`addTrack`, a dropped file, an Undo), the track itself. One undo step.
|
|
2371
|
+
* Warns when no track has the id.
|
|
2007
2372
|
*/
|
|
2008
2373
|
removeTrack(trackId: string): void;
|
|
2009
2374
|
/**
|
|
2010
|
-
* Move a track to a
|
|
2011
|
-
*
|
|
2012
|
-
* the
|
|
2013
|
-
* tracks (undo-resurrected) reorder the engine directly.
|
|
2375
|
+
* Move a track to a 0-based position in the arrangement's order (every
|
|
2376
|
+
* track counts, those with no element too; `trackEl.index` and
|
|
2377
|
+
* `editor.tracks` give the positions). One undo step; no element moves.
|
|
2014
2378
|
*/
|
|
2015
2379
|
reorderTrack(trackId: string, toIndex: number): void;
|
|
2016
2380
|
private _onTrackReorder;
|
|
2017
2381
|
private _onTrackReorderGrab;
|
|
2018
2382
|
/**
|
|
2019
|
-
*
|
|
2020
|
-
*
|
|
2021
|
-
*
|
|
2022
|
-
*
|
|
2023
|
-
*
|
|
2383
|
+
* Change a track: the mix (one undo step, #843), the name (an undo step),
|
|
2384
|
+
* the render mode and spectrogram config (the editor's). The arrangement
|
|
2385
|
+
* is changed, never an element's attributes (#848): a `<daw-track>`'s
|
|
2386
|
+
* properties show the change. A track that has not entered yet gets it as
|
|
2387
|
+
* the value it enters with.
|
|
2024
2388
|
*/
|
|
2025
2389
|
updateTrack(trackId: string, partial: Partial<TrackConfig>): void;
|
|
2026
|
-
/**
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
*
|
|
2390
|
+
/** `updateTrack` on a track waiting to enter: the values it will enter with. */
|
|
2391
|
+
private _updatePendingTrack;
|
|
2392
|
+
/**
|
|
2393
|
+
* Add a clip to a track (with or without an element) and resolve with its
|
|
2394
|
+
* id once its audio has loaded (`daw-clip-ready`, before its peaks are
|
|
2395
|
+
* drawn). The clip enters the arrangement as a loading clip, one undo
|
|
2396
|
+
* step; no `<daw-clip>` is created (#848). Rejects when it fails to load,
|
|
2397
|
+
* is refused (its kind), or leaves the arrangement before it loads (a
|
|
2398
|
+
* removal, an Undo). A clip added while the editor is detached loads once
|
|
2399
|
+
* a fresh adapter is set.
|
|
2400
|
+
*
|
|
2401
|
+
* `options.signal` (#848): aborting it before the clip has loaded rejects
|
|
2402
|
+
* with its `reason` and removes the clip for good (no undo step); after it
|
|
2403
|
+
* has loaded it changes nothing. A signal already aborted rejects at once
|
|
2404
|
+
* and adds nothing. A swap of `editor.arrangement` rejects the call with an
|
|
2405
|
+
* `AbortError`; its loading clip stays in the arrangement swapped out.
|
|
2030
2406
|
*/
|
|
2031
|
-
addClip(trackId: string, config: ClipConfig): Promise<string>;
|
|
2407
|
+
addClip(trackId: string, config: ClipConfig, options?: EditorCallOptions): Promise<string>;
|
|
2032
2408
|
/**
|
|
2033
|
-
* Remove a clip by id
|
|
2034
|
-
*
|
|
2035
|
-
*
|
|
2409
|
+
* Remove a clip by id: its `<daw-clip>` when there is one (the observer
|
|
2410
|
+
* removes the clip, as `select.remove(i)` removes an option), otherwise
|
|
2411
|
+
* the clip itself, one undo step. Undo brings the clip back with no
|
|
2412
|
+
* element. No-op with a warning when there is no such clip.
|
|
2036
2413
|
*/
|
|
2037
2414
|
removeClip(trackId: string, clipId: string): void;
|
|
2038
2415
|
/**
|
|
2039
|
-
*
|
|
2040
|
-
*
|
|
2041
|
-
*
|
|
2416
|
+
* Change a clip's position (start/duration/offset), gain or name: one undo
|
|
2417
|
+
* step on the arrangement (#848; a clip still loading changes its loading
|
|
2418
|
+
* clip). A `<daw-clip>`'s properties show the change, its attributes do
|
|
2419
|
+
* not. Fades are a `<daw-clip>` declaration only (engine-side fades are
|
|
2420
|
+
* #489): `fadeIn` / `fadeOut` / `fadeType` here change nothing.
|
|
2042
2421
|
*
|
|
2043
2422
|
* Re-decoding (changing `src`) is not supported via this method — remove and
|
|
2044
2423
|
* re-add the clip instead.
|
|
2045
|
-
*
|
|
2046
|
-
* Note: `fadeIn` / `fadeOut` / `fadeType` on the partial are written to the
|
|
2047
|
-
* `<daw-clip>` element (so they round-trip in the descriptor), but engine-side
|
|
2048
|
-
* fade application from `<daw-clip>` properties is not yet implemented — see
|
|
2049
|
-
* the broader fade-engine integration tracked separately.
|
|
2050
2424
|
*/
|
|
2051
2425
|
updateClip(trackId: string, clipId: string, partial: Partial<ClipConfig>): void;
|
|
2052
|
-
private _buildClipElement;
|
|
2053
2426
|
/**
|
|
2054
2427
|
* Start playback, optionally seeking to `startTime` first. When `endTime`
|
|
2055
2428
|
* is provided, playback stops at that time (selection/annotation playback).
|
|
@@ -2140,29 +2513,25 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
2140
2513
|
private get _showControls();
|
|
2141
2514
|
/** True when the ruler header band should be rendered (and its selector is valid). */
|
|
2142
2515
|
private get _showRuler();
|
|
2143
|
-
/**
|
|
2144
|
-
*
|
|
2145
|
-
*
|
|
2146
|
-
*
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
*
|
|
2153
|
-
* (
|
|
2154
|
-
|
|
2155
|
-
* engine→DOM direction (statechange handler) converges in one pass.
|
|
2156
|
-
*/
|
|
2157
|
-
_syncEngineOrderToDom(): void;
|
|
2158
|
-
/**
|
|
2159
|
-
* Engine → DOM: after an engine-initiated order change (undo/redo), move
|
|
2160
|
-
* `<daw-track>` elements to match engine order. The resulting mutations fire
|
|
2161
|
-
* the observer's _syncEngineOrderToDom, which finds the orders equal and
|
|
2162
|
-
* no-ops — converges in one pass (write-only-on-change).
|
|
2163
|
-
*/
|
|
2164
|
-
_syncDomToEngineOrder(tracks: readonly ClipTrack[]): void;
|
|
2516
|
+
/**
|
|
2517
|
+
* `<daw-track>` elements the page moved (one MutationObserver batch): each
|
|
2518
|
+
* is placed after the arrangement track of the nearest `<daw-track>` before
|
|
2519
|
+
* it, in DOM order, as one undo step (#848 P13). Elements whose track is
|
|
2520
|
+
* not in the arrangement are left alone (a queued one enters at its DOM
|
|
2521
|
+
* position). The arrangement's own order changes (an Undo) move no element.
|
|
2522
|
+
*/
|
|
2523
|
+
private _placeMovedTracks;
|
|
2524
|
+
/**
|
|
2525
|
+
* The rows, in the arrangement's order (#848): each track's loaded clips
|
|
2526
|
+
* (the engine's projection, with the current mix) and the clips still loading.
|
|
2527
|
+
*/
|
|
2165
2528
|
private _getOrderedTracks;
|
|
2529
|
+
/**
|
|
2530
|
+
* A clip still loading: a placeholder box where its length is known, with
|
|
2531
|
+
* its `.dat` peaks when they came, drawn failed when its source failed. Its
|
|
2532
|
+
* header carries no clip id, so it cannot be dragged.
|
|
2533
|
+
*/
|
|
2534
|
+
private _renderPlaceholder;
|
|
2166
2535
|
render(): lit.TemplateResult<1>;
|
|
2167
2536
|
}
|
|
2168
2537
|
declare global {
|
|
@@ -2187,6 +2556,8 @@ declare class DawRecordButtonElement extends DawTransportButton {
|
|
|
2187
2556
|
protected static requiredTargetMethods: readonly string[];
|
|
2188
2557
|
private _isRecording;
|
|
2189
2558
|
private _targetRef;
|
|
2559
|
+
/** The listeners on `_targetRef`, aborted when the target changes or the button disconnects. */
|
|
2560
|
+
private _targetListeners;
|
|
2190
2561
|
private _onStart;
|
|
2191
2562
|
private _onComplete;
|
|
2192
2563
|
private _onError;
|
|
@@ -2253,6 +2624,8 @@ declare class DawKeyboardShortcutsElement extends LitElement {
|
|
|
2253
2624
|
get shortcuts(): KeyboardShortcut[];
|
|
2254
2625
|
/** Invalidate cached shortcuts when Lit properties change. */
|
|
2255
2626
|
updated(): void;
|
|
2627
|
+
/** The listeners of this connection, aborted in disconnectedCallback. */
|
|
2628
|
+
private _listeners;
|
|
2256
2629
|
connectedCallback(): void;
|
|
2257
2630
|
disconnectedCallback(): void;
|
|
2258
2631
|
createRenderRoot(): this;
|
|
@@ -2325,6 +2698,8 @@ declare class DawTimeDisplayElement extends LitElement {
|
|
|
2325
2698
|
private get target();
|
|
2326
2699
|
private _onTimeUpdate;
|
|
2327
2700
|
private _onFormatChange;
|
|
2701
|
+
/** The listeners of this connection, aborted in disconnectedCallback. */
|
|
2702
|
+
private _listeners;
|
|
2328
2703
|
connectedCallback(): void;
|
|
2329
2704
|
disconnectedCallback(): void;
|
|
2330
2705
|
private _syncFromTarget;
|
|
@@ -2357,6 +2732,8 @@ declare class DawTimeFormatElement extends LitElement {
|
|
|
2357
2732
|
private _onFormatChange;
|
|
2358
2733
|
private _onPointerEnter;
|
|
2359
2734
|
private _onPointerDown;
|
|
2735
|
+
/** The listeners of this connection, aborted in disconnectedCallback. */
|
|
2736
|
+
private _listeners;
|
|
2360
2737
|
connectedCallback(): void;
|
|
2361
2738
|
disconnectedCallback(): void;
|
|
2362
2739
|
protected updated(): void;
|
|
@@ -2405,6 +2782,8 @@ declare class DawPlayerElement extends LitElement {
|
|
|
2405
2782
|
connectedCallback(): void;
|
|
2406
2783
|
render(): lit.TemplateResult<1>;
|
|
2407
2784
|
protected updated(changed: PropertyValues): void;
|
|
2785
|
+
/** The peaks fetch in flight: a newer peaks-src or a disconnect aborts it (#848, D7). */
|
|
2786
|
+
private _peaksFetch;
|
|
2408
2787
|
private _loadPeaks;
|
|
2409
2788
|
/** Recompute fit-to-width peaks from the loaded WaveformData. No-op without data. */
|
|
2410
2789
|
private _renderWaveform;
|
|
@@ -2501,6 +2880,8 @@ interface AudioResumeHost extends ReactiveControllerHost, HTMLElement {
|
|
|
2501
2880
|
declare class AudioResumeController implements ReactiveController {
|
|
2502
2881
|
private _host;
|
|
2503
2882
|
private _target;
|
|
2883
|
+
/** The gesture listeners on `_target`: one controller per attach. */
|
|
2884
|
+
private _listeners;
|
|
2504
2885
|
private _attached;
|
|
2505
2886
|
private _generation;
|
|
2506
2887
|
/** CSS selector, or 'document'. When undefined, controller is inert. */
|
|
@@ -2628,4 +3009,4 @@ interface SplitHost {
|
|
|
2628
3009
|
*/
|
|
2629
3010
|
declare function splitAtPlayhead(host: SplitHost): boolean;
|
|
2630
3011
|
|
|
2631
|
-
export { ANNOTATION_LANE_HEIGHT, AudioResumeController, type ClipConfig, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, type DawAnnotationConnectedDetail, DawAnnotationElement, DawAnnotationListElement, type DawAnnotationSelectDetail, type DawAnnotationTrackConnectedDetail, DawAnnotationTrackElement, type DawAnnotationUpdateDetail, type DawClipConnectedDetail, DawClipElement, type DawClipErrorDetail, type DawClipIdDetail, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, type DawClipUpdateDetail, DawEditorElement, type DawEffectAddDetail, type DawEffectBypassDetail, type DawEffectChangeDetail, type DawEffectErrorDetail, type DawEffectRemoveDetail, type DawEffectReorderDetail, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawGridElement, DawKeyboardShortcutsElement, DawPauseButtonElement, DawPianoRollElement, DawPlayButtonElement, DawPlayerElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingClipAddDetail, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawSpectrogramElement, DawStopButtonElement, DawTimeDisplayElement, type DawTimeFormatChangeDetail, DawTimeFormatElement, type DawTimeUpdateDetail, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, type DawTrackUpdateDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type DomClipDescriptor, type DropClipDescriptor, type EffectState, type ExportAudioHost, type ExportOptions, type KeyBinding, type LoadFilesResult, PlaybackAnimationController, type PlaybackAnimationOptions, type PlaybackShortcutMap, type PlayheadLike, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, type SerializedEffectEntry, SpectrogramController, type SplitEngineContract, type SplitHost, type SplittingShortcutMap, TIME_DISPLAY_FORMATS, type TimeDisplayFormat, type TrackConfig, type TrackDescriptor, type TrackRenderMode, type TrackWithId, type UndoShortcutMap, type WaveformSegment, formatDisplayTime, isDomClip, isTimeDisplayFormat, parseDisplayTime, resolveTransportTarget, splitAtPlayhead, targetSupports, warnOnce, warnUnsupportedOnce };
|
|
3012
|
+
export { ANNOTATION_LANE_HEIGHT, AudioResumeController, type ClipConfig, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, type DawAnnotationConnectedDetail, DawAnnotationElement, DawAnnotationListElement, type DawAnnotationSelectDetail, type DawAnnotationTrackConnectedDetail, DawAnnotationTrackElement, type DawAnnotationUpdateDetail, type DawClipConnectedDetail, DawClipElement, type DawClipErrorDetail, type DawClipIdDetail, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, type DawClipUpdateDetail, DawEditorElement, type DawEffectAddDetail, type DawEffectBypassDetail, type DawEffectChangeDetail, type DawEffectErrorDetail, type DawEffectRemoveDetail, type DawEffectReorderDetail, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawGridElement, DawKeyboardShortcutsElement, DawPauseButtonElement, DawPianoRollElement, DawPlayButtonElement, DawPlayerElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingClipAddDetail, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawSpectrogramElement, DawStopButtonElement, DawTimeDisplayElement, type DawTimeFormatChangeDetail, DawTimeFormatElement, type DawTimeUpdateDetail, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, type DawTrackUpdateDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type DomClipDescriptor, type DropClipDescriptor, type EditorCallOptions, type EffectState, type ExportAudioHost, type ExportOptions, type KeyBinding, type LoadFilesResult, PlaybackAnimationController, type PlaybackAnimationOptions, type PlaybackShortcutMap, type PlayheadLike, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, type SerializedEffectEntry, SpectrogramController, type SplitEngineContract, type SplitHost, type SplittingShortcutMap, TIME_DISPLAY_FORMATS, type TimeDisplayFormat, type TrackConfig, type TrackDescriptor, type TrackRenderMode, type TrackWithId, type UndoShortcutMap, type WaveformSegment, formatDisplayTime, isDomClip, isTimeDisplayFormat, parseDisplayTime, resolveTransportTarget, splitAtPlayhead, targetSupports, warnOnce, warnUnsupportedOnce };
|