@dawcore/components 0.0.39-next.0 → 0.0.39-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -11
- package/dist/index.d.mts +720 -238
- package/dist/index.d.ts +720 -238
- package/dist/index.js +3223 -1670
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3182 -1630
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -13
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 { 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;
|
|
@@ -555,6 +618,29 @@ interface TrackDescriptor {
|
|
|
555
618
|
spectrogramConfig?: SpectrogramConfig | null;
|
|
556
619
|
clips: ClipDescriptor[];
|
|
557
620
|
}
|
|
621
|
+
/** The mixer fields of a `TrackDescriptor`. */
|
|
622
|
+
type TrackMixFields = 'volume' | 'pan' | 'muted' | 'soloed';
|
|
623
|
+
/**
|
|
624
|
+
* What `<daw-editor>` stores per track (internal, not exported from the
|
|
625
|
+
* package): a `TrackDescriptor` without its mix. The mix is the arrangement's
|
|
626
|
+
* (#843); `editor.tracks` fills the four fields in from it.
|
|
627
|
+
*/
|
|
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
|
+
}
|
|
558
644
|
/** A `TrackDescriptor` plus its `trackId` — the shape returned by `editor.tracks`
|
|
559
645
|
* so consumers can map a track's name to the `trackId` the per-track APIs
|
|
560
646
|
* (`addTrackEffect`, `removeTrack`, `updateTrack`, …) are keyed by. */
|
|
@@ -582,8 +668,8 @@ interface BaseClipDescriptor {
|
|
|
582
668
|
/**
|
|
583
669
|
* A clip descriptor sourced from a `<daw-clip>` DOM element. `clipId` is
|
|
584
670
|
* always set — `<daw-clip>.clipId` is a `crypto.randomUUID()` generated at
|
|
585
|
-
* construction.
|
|
586
|
-
*
|
|
671
|
+
* construction. The arrangement clip's id is this id (`buildArrangementTrack`,
|
|
672
|
+
* `_loadAndAppendClip`), so the DOM and the arrangement name the same clip.
|
|
587
673
|
*/
|
|
588
674
|
interface DomClipDescriptor extends BaseClipDescriptor {
|
|
589
675
|
kind: 'dom';
|
|
@@ -592,16 +678,18 @@ interface DomClipDescriptor extends BaseClipDescriptor {
|
|
|
592
678
|
/**
|
|
593
679
|
* A clip descriptor synthesized from a non-DOM source — file drops, the
|
|
594
680
|
* `<daw-track src>` shorthand fallback, or recording-clip insertion. There
|
|
595
|
-
* is no DOM element to align with
|
|
596
|
-
* clip-creation time.
|
|
681
|
+
* is no DOM element to align with.
|
|
597
682
|
*
|
|
598
|
-
* `clipId` is
|
|
599
|
-
*
|
|
600
|
-
* `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.
|
|
601
687
|
*/
|
|
602
688
|
interface DropClipDescriptor extends BaseClipDescriptor {
|
|
603
689
|
kind: 'drop';
|
|
604
690
|
clipId?: string;
|
|
691
|
+
/** A dropped file the clip loads (`src` is then ''): a File cannot be an attribute (#848). */
|
|
692
|
+
file?: File;
|
|
605
693
|
}
|
|
606
694
|
type ClipDescriptor = DomClipDescriptor | DropClipDescriptor;
|
|
607
695
|
/**
|
|
@@ -610,6 +698,16 @@ type ClipDescriptor = DomClipDescriptor | DropClipDescriptor;
|
|
|
610
698
|
* inline `c.kind === 'dom'` repetition.
|
|
611
699
|
*/
|
|
612
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
|
+
}
|
|
613
711
|
/**
|
|
614
712
|
* Public input shape for `editor.addTrack(config)`. All fields optional —
|
|
615
713
|
* defaults match the declarative `<daw-track>` defaults.
|
|
@@ -767,19 +865,35 @@ declare class DawTrackControlsElement extends LitElement {
|
|
|
767
865
|
volume: number;
|
|
768
866
|
pan: number;
|
|
769
867
|
muted: boolean;
|
|
868
|
+
/** A take is recording onto the track: it plays muted, and the M button is disabled. */
|
|
869
|
+
recording: boolean;
|
|
770
870
|
soloed: boolean;
|
|
771
871
|
/** Show the reorder grip + move up/down buttons (set by the editor from
|
|
772
872
|
* its track-reordering attribute). */
|
|
773
873
|
reorderable: boolean;
|
|
774
874
|
trackIndex: number;
|
|
775
875
|
trackCount: number;
|
|
876
|
+
/**
|
|
877
|
+
* One gesture per slider (#843): the `daw-track-control` events of one
|
|
878
|
+
* drag, or of one key press (a held key included), carry the same
|
|
879
|
+
* `gesture` id, and the editor makes them one undo step. Each gesture is
|
|
880
|
+
* attached to its range input while the element is connected.
|
|
881
|
+
*/
|
|
882
|
+
private readonly _volumeGesture;
|
|
883
|
+
private readonly _panGesture;
|
|
884
|
+
private _detachGestures;
|
|
776
885
|
static styles: lit.CSSResult;
|
|
886
|
+
connectedCallback(): void;
|
|
887
|
+
disconnectedCallback(): void;
|
|
888
|
+
private _attachGestures;
|
|
889
|
+
private _detachAllGestures;
|
|
777
890
|
protected firstUpdated(): void;
|
|
778
891
|
private _onVolumeInput;
|
|
779
892
|
private _onPanInput;
|
|
780
893
|
private _onMuteClick;
|
|
781
894
|
private _onSoloClick;
|
|
782
895
|
private _onRemoveClick;
|
|
896
|
+
/** `gesture` for the sliders only: each mute or solo click is a step. */
|
|
783
897
|
private _dispatchControl;
|
|
784
898
|
private _dispatchReorder;
|
|
785
899
|
private _onMoveUp;
|
|
@@ -880,13 +994,7 @@ interface RecordingSession {
|
|
|
880
994
|
readonly latencySamples: number;
|
|
881
995
|
/** Display name for the take (preview header + finalized clip name). */
|
|
882
996
|
readonly clipName?: string;
|
|
883
|
-
/** Pre-session mute state of the armed track — restored when the session
|
|
884
|
-
* ends. null = mute never engaged (no engine on the host). */
|
|
885
|
-
armedPrevMuted: boolean | null;
|
|
886
997
|
readonly wasOverdub: boolean;
|
|
887
|
-
/** Stored so it can be removed on stop/cleanup — not just when stream ends. */
|
|
888
|
-
readonly _onTrackEnded: (() => void) | null;
|
|
889
|
-
readonly _audioTrack: MediaStreamTrack | null;
|
|
890
998
|
/** Set during stopRecording, cleared by the done message from the worklet. */
|
|
891
999
|
stopAckResolve: (() => void) | null;
|
|
892
1000
|
/** In-flight stop completion — re-entrant stopRecording calls await this
|
|
@@ -898,7 +1006,7 @@ interface RecordingSession {
|
|
|
898
1006
|
stopping: boolean;
|
|
899
1007
|
}
|
|
900
1008
|
/** Readonly view of a recording session for external consumers. */
|
|
901
|
-
type ReadonlyRecordingSession = Readonly<Omit<RecordingSession, 'chunks' | 'peaks' | '
|
|
1009
|
+
type ReadonlyRecordingSession = Readonly<Omit<RecordingSession, 'chunks' | 'peaks' | 'latencySamples'>> & {
|
|
902
1010
|
readonly latencySamples: number;
|
|
903
1011
|
readonly chunks: ReadonlyArray<ReadonlyArray<Float32Array>>;
|
|
904
1012
|
readonly peaks: ReadonlyArray<Int8Array | Int16Array>;
|
|
@@ -919,20 +1027,15 @@ interface RecordingHost extends ReactiveControllerHost {
|
|
|
919
1027
|
* position and misplaces punch-in (record-during-playback) clips. */
|
|
920
1028
|
readonly currentTime: number;
|
|
921
1029
|
readonly shadowRoot: ShadowRoot | null;
|
|
922
|
-
resolveAudioContextSampleRate(rate: number): void;
|
|
923
1030
|
_addRecordedClip?(trackId: string, buf: AudioBuffer, startSample: number, durSamples: number, offsetSamples?: number, clipName?: string): void;
|
|
924
|
-
/** Structural view of the editor's engine for the
|
|
925
|
-
*
|
|
926
|
-
*
|
|
927
|
-
*
|
|
1031
|
+
/** Structural view of the editor's engine for the take's mute (#843):
|
|
1032
|
+
* punch-in replaces the overlapped content, so the recorded-over track's
|
|
1033
|
+
* existing material must not play under the take. The track a take is
|
|
1034
|
+
* recording onto plays muted; that mute is outside the undo history and
|
|
1035
|
+
* leaves the stored mute alone. Optional — hosts without an engine skip
|
|
1036
|
+
* it. */
|
|
928
1037
|
_engine?: {
|
|
929
|
-
|
|
930
|
-
getState(): {
|
|
931
|
-
tracks: ReadonlyArray<{
|
|
932
|
-
id: string;
|
|
933
|
-
muted: boolean;
|
|
934
|
-
}>;
|
|
935
|
-
};
|
|
1038
|
+
setTrackRecording(trackId: string, recording: boolean): void;
|
|
936
1039
|
} | null;
|
|
937
1040
|
play?(startTime?: number): Promise<void>;
|
|
938
1041
|
stop?(): void;
|
|
@@ -957,6 +1060,8 @@ interface RecordingHost extends ReactiveControllerHost {
|
|
|
957
1060
|
declare class RecordingController implements ReactiveController {
|
|
958
1061
|
private _host;
|
|
959
1062
|
private _sessions;
|
|
1063
|
+
/** Each session's mic-unplug listener, aborted when the session ends. */
|
|
1064
|
+
private _trackEndedListeners;
|
|
960
1065
|
/** Track IDs with a startRecording in flight (session not yet in _sessions).
|
|
961
1066
|
* The session is only set after several awaits — without this, two rapid
|
|
962
1067
|
* start calls both pass the _sessions guard and build two capture
|
|
@@ -994,19 +1099,31 @@ declare class RecordingController implements ReactiveController {
|
|
|
994
1099
|
private _removeTrackEndedListener;
|
|
995
1100
|
private _dispatchRecordingError;
|
|
996
1101
|
/** Shared teardown for finalize paths that end without a take (no data
|
|
997
|
-
* captured / too short after latency compensation):
|
|
998
|
-
*
|
|
999
|
-
*
|
|
1102
|
+
* captured / too short after latency compensation): clear the take's mute, drop
|
|
1103
|
+
* the session, and notify via daw-recording-error so record buttons reset
|
|
1104
|
+
* their state. */
|
|
1000
1105
|
private _abandonFinalize;
|
|
1001
|
-
/**
|
|
1002
|
-
*
|
|
1003
|
-
|
|
1106
|
+
/** Clear the take's mute on the session's track, by its id. Each teardown
|
|
1107
|
+
* path calls this once, right before it drops the session from the map, so
|
|
1108
|
+
* a later path never reaches the same session; clearing an id that is not
|
|
1109
|
+
* set is a no-op in the engine. Another session's mute on another track is
|
|
1110
|
+
* left alone. */
|
|
1111
|
+
private _clearTakeMute;
|
|
1004
1112
|
/** @param notifyError dispatch daw-recording-error after cleanup — used by
|
|
1005
1113
|
* disposal paths that would otherwise discard the session silently. The
|
|
1006
1114
|
* startRecording catch path passes false (it dispatches its own error). */
|
|
1007
1115
|
private _cleanupSession;
|
|
1008
1116
|
}
|
|
1009
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
|
+
|
|
1010
1127
|
/** Snapshot of a clip's bounds for trim constraint computation. */
|
|
1011
1128
|
interface ClipBounds {
|
|
1012
1129
|
readonly offsetSamples: number;
|
|
@@ -1016,19 +1133,20 @@ interface ClipBounds {
|
|
|
1016
1133
|
}
|
|
1017
1134
|
/** Narrow engine contract for clip move/trim interactions. */
|
|
1018
1135
|
interface ClipEngineContract {
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
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
|
+
};
|
|
1022
1146
|
/** Get a clip's full bounds for trim constraint computation. */
|
|
1023
1147
|
getClipBounds(trackId: string, clipId: string): ClipBounds | null;
|
|
1024
1148
|
/** Constrain a trim delta using the engine's collision/bounds logic. */
|
|
1025
1149
|
constrainTrimDelta(trackId: string, clipId: string, boundary: 'left' | 'right', deltaSamples: number): number;
|
|
1026
|
-
/** Begin a transaction — groups mutations into one undo step. */
|
|
1027
|
-
beginTransaction(): void;
|
|
1028
|
-
/** Commit the transaction — pushes one undo step for all grouped mutations. */
|
|
1029
|
-
commitTransaction(): void;
|
|
1030
|
-
/** Abort the transaction — restores pre-transaction state without pushing to undo. */
|
|
1031
|
-
abortTransaction(): void;
|
|
1032
1150
|
}
|
|
1033
1151
|
/** Peak data returned by reextractClipPeaks for imperative waveform updates. */
|
|
1034
1152
|
interface ClipPeakSlice {
|
|
@@ -1065,11 +1183,14 @@ interface ClipPointerHost {
|
|
|
1065
1183
|
* Handles pointer interactions for clip move and trim drag operations.
|
|
1066
1184
|
* Converts pixel deltas to sample deltas and delegates to the engine.
|
|
1067
1185
|
*
|
|
1068
|
-
*
|
|
1069
|
-
*
|
|
1070
|
-
*
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
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.
|
|
1073
1194
|
*/
|
|
1074
1195
|
declare class ClipPointerHandler {
|
|
1075
1196
|
private _host;
|
|
@@ -1086,6 +1207,8 @@ declare class ClipPointerHandler {
|
|
|
1086
1207
|
private _originalOffsetSamples;
|
|
1087
1208
|
private _originalDurationSamples;
|
|
1088
1209
|
private _originalStartSample;
|
|
1210
|
+
private _moveClip;
|
|
1211
|
+
private _moveSorted;
|
|
1089
1212
|
constructor(host: ClipPointerHost);
|
|
1090
1213
|
/**
|
|
1091
1214
|
* Convert a pixel delta to samples, snapping in tick space when in beats mode.
|
|
@@ -1096,14 +1219,35 @@ declare class ClipPointerHandler {
|
|
|
1096
1219
|
* even if they started off-grid.
|
|
1097
1220
|
*/
|
|
1098
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;
|
|
1099
1225
|
/** Returns true if a drag interaction is currently in progress. */
|
|
1100
1226
|
get isActive(): boolean;
|
|
1227
|
+
/** True once the pointer of the current press has moved past the drag
|
|
1228
|
+
* threshold: a press that has not moved is not a drag (#848). */
|
|
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;
|
|
1101
1237
|
/**
|
|
1102
1238
|
* Attempts to handle a pointerdown event on the given target element.
|
|
1103
1239
|
* Returns true if the target is a recognized clip interaction element.
|
|
1104
1240
|
*/
|
|
1105
1241
|
tryHandle(target: Element, e: PointerEvent): boolean;
|
|
1106
1242
|
private _beginDrag;
|
|
1243
|
+
/**
|
|
1244
|
+
* The press has become a drag (the pointer passed the threshold): take the
|
|
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.
|
|
1249
|
+
*/
|
|
1250
|
+
private _startDrag;
|
|
1107
1251
|
/** Processes pointermove events during an active drag. */
|
|
1108
1252
|
onPointerMove(e: PointerEvent): void;
|
|
1109
1253
|
/** Processes pointerup events to finalize and dispatch result events. */
|
|
@@ -1112,20 +1256,18 @@ declare class ClipPointerHandler {
|
|
|
1112
1256
|
*
|
|
1113
1257
|
* pointercancel fires INSTEAD of pointerup on touch interruption, pen
|
|
1114
1258
|
* leaving hover range, or OS gestures. Without this handler the drag stays
|
|
1115
|
-
* armed (hover keeps moving the clip)
|
|
1116
|
-
*
|
|
1117
|
-
* per-frame skipAdapter moveClip mutations are never synced or rolled back
|
|
1118
|
-
* (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. */
|
|
1119
1261
|
onPointerCancel(_e: PointerEvent): void;
|
|
1120
1262
|
/** Re-extract peaks from cache and set on waveform elements during trim drag.
|
|
1121
1263
|
* Returns true if peaks were successfully updated. */
|
|
1122
1264
|
private _updateWaveformPeaks;
|
|
1123
1265
|
/** Restore clip container CSS AND waveform peaks to original values after
|
|
1124
|
-
* a
|
|
1266
|
+
* a drag's visual preview. Peaks matter: a trim wrote re-extracted peak
|
|
1125
1267
|
* arrays imperatively onto the <daw-waveform> elements (bypassing Lit), and
|
|
1126
|
-
* a cancelled/zero-delta
|
|
1268
|
+
* a cancelled/zero-delta drag makes no engine mutation — so no statechange
|
|
1127
1269
|
* re-render will ever repair them. */
|
|
1128
|
-
private
|
|
1270
|
+
private _restoreVisual;
|
|
1129
1271
|
private _reset;
|
|
1130
1272
|
}
|
|
1131
1273
|
|
|
@@ -1167,14 +1309,24 @@ interface DawTrackConnectedDetail {
|
|
|
1167
1309
|
interface DawTrackIdDetail {
|
|
1168
1310
|
trackId: string;
|
|
1169
1311
|
}
|
|
1312
|
+
interface DawTrackUpdateDetail {
|
|
1313
|
+
trackId: string;
|
|
1314
|
+
/**
|
|
1315
|
+
* The `<daw-track>` properties this update changed, by property name
|
|
1316
|
+
* (`'volume'`, `'pan'`, `'muted'`, `'soloed'`, `'src'`, `'name'`, `'kind'`,
|
|
1317
|
+
* `'renderMode'`, `'spectrogramConfig'`). The editor sends a mixer property
|
|
1318
|
+
* to the engine only when it is in this list, and one update is one undo
|
|
1319
|
+
* step (#843).
|
|
1320
|
+
*/
|
|
1321
|
+
changed: readonly string[];
|
|
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
|
+
*/
|
|
1170
1327
|
interface DawTrackErrorDetail {
|
|
1171
1328
|
trackId: string;
|
|
1172
1329
|
error: unknown;
|
|
1173
|
-
/** Present when the load was CANCELLED rather than failed: the track was
|
|
1174
|
-
* removed (or the editor disconnected) while its clips were still loading.
|
|
1175
|
-
* Consumer error UIs should filter these — nothing actually failed; the
|
|
1176
|
-
* event exists so addTrack()/loadMidi() awaiters settle. */
|
|
1177
|
-
reason?: 'removed' | 'disconnected';
|
|
1178
1330
|
}
|
|
1179
1331
|
interface DawFilesLoadErrorDetail {
|
|
1180
1332
|
file: File;
|
|
@@ -1188,6 +1340,12 @@ interface DawTrackControlDetail {
|
|
|
1188
1340
|
trackId: string;
|
|
1189
1341
|
prop: string;
|
|
1190
1342
|
value: number | boolean;
|
|
1343
|
+
/**
|
|
1344
|
+
* The slider's gesture id (#843): events of one volume or pan drag, or of
|
|
1345
|
+
* one key press, carry the same id and are one undo step. Mute and solo
|
|
1346
|
+
* send none: each click is a step.
|
|
1347
|
+
*/
|
|
1348
|
+
gesture?: string;
|
|
1191
1349
|
}
|
|
1192
1350
|
interface DawTrackRemoveDetail {
|
|
1193
1351
|
trackId: string;
|
|
@@ -1343,7 +1501,7 @@ interface DawEventMap {
|
|
|
1343
1501
|
'daw-time-format-change': CustomEvent<DawTimeFormatChangeDetail>;
|
|
1344
1502
|
'daw-track-select': CustomEvent<DawTrackSelectDetail>;
|
|
1345
1503
|
'daw-track-connected': CustomEvent<DawTrackConnectedDetail>;
|
|
1346
|
-
'daw-track-update': CustomEvent<
|
|
1504
|
+
'daw-track-update': CustomEvent<DawTrackUpdateDetail>;
|
|
1347
1505
|
'daw-track-ready': CustomEvent<DawTrackIdDetail>;
|
|
1348
1506
|
'daw-track-removed': CustomEvent<DawTrackIdDetail>;
|
|
1349
1507
|
'daw-track-error': CustomEvent<DawTrackErrorDetail>;
|
|
@@ -1395,8 +1553,8 @@ interface LoadFilesResult {
|
|
|
1395
1553
|
|
|
1396
1554
|
/**
|
|
1397
1555
|
* MIDI loading logic extracted from daw-editor. Operates on the editor via a
|
|
1398
|
-
* narrow host interface (`addTrack`
|
|
1399
|
-
* satisfies it
|
|
1556
|
+
* narrow host interface (`addTrack`, `_discardTrack`, `_operationSignal`) —
|
|
1557
|
+
* `<daw-editor>` satisfies it.
|
|
1400
1558
|
*
|
|
1401
1559
|
* Numbered steps below match the Data Flow diagram in
|
|
1402
1560
|
* `docs/specs/2026-05-23-dawcore-load-midi-design.md`.
|
|
@@ -1404,15 +1562,57 @@ interface LoadFilesResult {
|
|
|
1404
1562
|
|
|
1405
1563
|
/**
|
|
1406
1564
|
* Minimal host surface needed by `loadMidiImpl`. `<daw-editor>` satisfies this
|
|
1407
|
-
* structurally. `
|
|
1408
|
-
*
|
|
1409
|
-
*
|
|
1410
|
-
* fired `daw-track-error` — the latter aren't in the `addTrack` resolution
|
|
1411
|
-
* 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).
|
|
1412
1568
|
*/
|
|
1413
1569
|
interface MidiLoaderHost {
|
|
1414
|
-
|
|
1415
|
-
|
|
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;
|
|
1416
1616
|
}
|
|
1417
1617
|
|
|
1418
1618
|
interface ExportOptions {
|
|
@@ -1454,6 +1654,18 @@ interface ExportAudioHost {
|
|
|
1454
1654
|
getTrackEffectsState(trackId: string): Promise<SerializedEffectEntry[]>;
|
|
1455
1655
|
}
|
|
1456
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
|
+
};
|
|
1457
1669
|
declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
1458
1670
|
get samplesPerPixel(): number;
|
|
1459
1671
|
set samplesPerPixel(value: number);
|
|
@@ -1582,12 +1794,90 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1582
1794
|
/** True when the consumer provided BOTH tick conversion callbacks — the
|
|
1583
1795
|
* external tempo map is authoritative and `bpm` is display/grid-only (#407). */
|
|
1584
1796
|
get _hasTickCallbacks(): boolean;
|
|
1585
|
-
/**
|
|
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
|
+
*/
|
|
1586
1802
|
get sampleRate(): number;
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
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>;
|
|
1591
1881
|
_peaksData: Map<string, PeakData>;
|
|
1592
1882
|
_isPlaying: boolean;
|
|
1593
1883
|
_duration: number;
|
|
@@ -1600,9 +1890,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1600
1890
|
set adapter(value: PlayoutAdapter | null);
|
|
1601
1891
|
get adapter(): PlayoutAdapter | null;
|
|
1602
1892
|
private _externalAdapter;
|
|
1603
|
-
/** True after a disconnect disposed the consumer's adapter via the engine
|
|
1604
|
-
* — rebuild attempts fail loudly until a fresh adapter is set. */
|
|
1605
|
-
private _adapterConsumedByDispose;
|
|
1606
1893
|
private _effectsManager;
|
|
1607
1894
|
private get _effects();
|
|
1608
1895
|
/**
|
|
@@ -1685,8 +1972,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1685
1972
|
_engine: PlaylistEngine | null;
|
|
1686
1973
|
private _warnedMissingTicksToSeconds;
|
|
1687
1974
|
private _warnedMissingSecondsToTicks;
|
|
1688
|
-
private _enginePromise;
|
|
1689
|
-
_audioCache: Map<string, Promise<AudioBuffer>>;
|
|
1690
1975
|
private _peaksCache;
|
|
1691
1976
|
_clipBuffers: Map<string, AudioBuffer>;
|
|
1692
1977
|
_clipOffsets: Map<string, {
|
|
@@ -1697,11 +1982,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1697
1982
|
/** Coarsest scale from pre-computed peaks — zoom cannot go finer than this. 0 = no limit. */
|
|
1698
1983
|
private _minSamplesPerPixel;
|
|
1699
1984
|
private _trackElements;
|
|
1700
|
-
/** Track ids with a _loadTrack in flight. Distinct from `_engineTracks`
|
|
1701
|
-
* membership: the peaks-first path inserts a render-only PREVIEW track
|
|
1702
|
-
* into _engineTracks mid-load, so `has()` alone cannot answer "is this
|
|
1703
|
-
* track still loading?". */
|
|
1704
|
-
private _loadingTracks;
|
|
1705
1985
|
private _childObserver;
|
|
1706
1986
|
private _audioResume;
|
|
1707
1987
|
eagerResume?: string;
|
|
@@ -1741,12 +2021,15 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1741
2021
|
* Returns false for unknown track/clip IDs (defensive).
|
|
1742
2022
|
*/
|
|
1743
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;
|
|
1744
2028
|
private _pointer;
|
|
1745
2029
|
private _viewport;
|
|
1746
2030
|
private _scrollSync;
|
|
1747
2031
|
static styles: lit.CSSResult[];
|
|
1748
2032
|
get effectiveSampleRate(): number;
|
|
1749
|
-
resolveAudioContextSampleRate(rate: number): void;
|
|
1750
2033
|
/**
|
|
1751
2034
|
* In beats mode, derive samplesPerPixel from ticksPerPixel so that
|
|
1752
2035
|
* clip positions, waveforms, and the tick-space grid all align.
|
|
@@ -1764,7 +2047,80 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1764
2047
|
/** Grid height when no tracks exist — matches scroll area's rendered height. */
|
|
1765
2048
|
private get _emptyGridHeight();
|
|
1766
2049
|
_setSelectedTrackId(trackId: string | null): void;
|
|
2050
|
+
/**
|
|
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
|
+
*/
|
|
1767
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.
|
|
2069
|
+
*/
|
|
2070
|
+
_mixOf(trackId: string): TrackMixerValues;
|
|
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.
|
|
2117
|
+
*/
|
|
2118
|
+
private _writeMix;
|
|
2119
|
+
/**
|
|
2120
|
+
* Change the given mixer fields of a track as ONE undo step (#843): all
|
|
2121
|
+
* of them carry one fresh gesture id. A field left out is not sent.
|
|
2122
|
+
*/
|
|
2123
|
+
private _writeMixFields;
|
|
1768
2124
|
get selectedTrackId(): string | null;
|
|
1769
2125
|
get selection(): {
|
|
1770
2126
|
start: number;
|
|
@@ -1792,108 +2148,183 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1792
2148
|
private _onTrackConnected;
|
|
1793
2149
|
private _onTrackRemoved;
|
|
1794
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;
|
|
1795
2155
|
/** Drop the controller when no spectrogram tracks remain. */
|
|
1796
2156
|
private _disposeSpectrogramControllerIfEmpty;
|
|
1797
|
-
/** Reconcile `_tracks` descriptors with the engine's track list.
|
|
1798
|
-
*
|
|
1799
|
-
* ADD: engine.undo() restores removed tracks in ENGINE state only —
|
|
1800
|
-
* without a synthesized descriptor the track plays and renders but shows
|
|
1801
|
-
* "Untitled" controls and is missing from `editor.tracks`.
|
|
1802
|
-
* PRUNE (the symmetric half): redo removes the track from engine state
|
|
1803
|
-
* again — without pruning, the synthesized descriptor is a permanent
|
|
1804
|
-
* ghost that even removeTrack() can't clean (no element, no engine
|
|
1805
|
-
* entry). Never prunes tracks that are mid-load or element-backed —
|
|
1806
|
-
* their descriptors legitimately precede their engine entries. */
|
|
1807
|
-
_reconcileDescriptorsWithEngineTracks(tracks: readonly ClipTrack[]): void;
|
|
1808
|
-
/** Prune id-bearing drop descriptors the engine no longer has, and refresh
|
|
1809
|
-
* the rest from their engine clip. Returns the SAME array when nothing
|
|
1810
|
-
* changed, so an unchanged track never triggers a re-render. */
|
|
1811
|
-
private _reconcileIdentifiedDropClips;
|
|
1812
2157
|
private static _CONTROL_PROPS;
|
|
1813
2158
|
private _onTrackControl;
|
|
1814
2159
|
private _onTrackRemoveRequest;
|
|
1815
2160
|
private _onClipConnected;
|
|
1816
|
-
|
|
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;
|
|
1817
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
|
+
*/
|
|
1818
2175
|
private _loadAndAppendClip;
|
|
1819
2176
|
/**
|
|
1820
2177
|
* Resolve pre-computed peaks for a clip: fetch the .dat/.json, validate the
|
|
1821
2178
|
* sample rate matches the AudioContext, return the WaveformData or null.
|
|
1822
2179
|
* Warns on fetch failure and on sample-rate mismatch — never silent.
|
|
1823
2180
|
*
|
|
1824
|
-
*
|
|
1825
|
-
* `_loadAndAppendClip` (incremental late-append).
|
|
2181
|
+
* Used by `_requestPreview` for a clip that is still loading.
|
|
1826
2182
|
*/
|
|
1827
2183
|
private _resolvePeaks;
|
|
2184
|
+
/** Remove a single clip from all per-clip caches. Used by error rollbacks. */
|
|
2185
|
+
private _purgeClipCaches;
|
|
1828
2186
|
/**
|
|
1829
|
-
*
|
|
1830
|
-
*
|
|
1831
|
-
* `_clipBuffers` / `_clipOffsets`, generate peaks via the worker pipeline,
|
|
1832
|
-
* and populate `_peaksData`. Returns the finished AudioClip.
|
|
1833
|
-
*
|
|
1834
|
-
* Shared between `_loadTrack`'s standard path and `_loadAndAppendClip`.
|
|
1835
|
-
* Not used by `_loadTrack`'s peaks-first preview path because that path
|
|
1836
|
-
* uses sync `extractPeaks` and inserts a preview track BEFORE audio decode.
|
|
1837
|
-
*/
|
|
1838
|
-
private _finalizeAudioClip;
|
|
1839
|
-
/**
|
|
1840
|
-
* Filter MIDI notes to only those with finite, in-range fields. Logs a
|
|
1841
|
-
* warning for each dropped note. Used by _buildMidiClip and the
|
|
1842
|
-
* _applyClipUpdate MIDI branch to prevent NaN propagation through the
|
|
1843
|
-
* 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).
|
|
1844
2189
|
*/
|
|
1845
|
-
private
|
|
2190
|
+
private _replaceClip;
|
|
2191
|
+
private _applyClipUpdate;
|
|
1846
2192
|
/**
|
|
1847
|
-
* A clip
|
|
1848
|
-
*
|
|
1849
|
-
* with a 1s default span; notes upgrade via _applyClipUpdate). Warns when
|
|
1850
|
-
* a clip ambiguously has both src and midiNotes — the audio path runs
|
|
1851
|
-
* 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.
|
|
1852
2195
|
*/
|
|
1853
|
-
private
|
|
2196
|
+
private _updateLoadingClip;
|
|
2197
|
+
/** Remove a clip (loaded or still loading) from a track of the arrangement: an undo step. */
|
|
1854
2198
|
/**
|
|
1855
|
-
*
|
|
1856
|
-
*
|
|
1857
|
-
* 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.
|
|
1858
2201
|
*/
|
|
1859
|
-
private
|
|
1860
|
-
|
|
1861
|
-
|
|
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;
|
|
1862
2206
|
/**
|
|
1863
|
-
*
|
|
1864
|
-
*
|
|
1865
|
-
*
|
|
1866
|
-
*
|
|
1867
|
-
* 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).
|
|
1868
2211
|
*/
|
|
1869
|
-
private
|
|
1870
|
-
|
|
1871
|
-
private
|
|
2212
|
+
private _dropUnheldClip;
|
|
2213
|
+
/** The editor no longer holds anything for a clip of a track. */
|
|
2214
|
+
private _forgetClip;
|
|
1872
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;
|
|
1873
2285
|
/**
|
|
1874
|
-
* The
|
|
1875
|
-
*
|
|
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).
|
|
1876
2289
|
*/
|
|
1877
|
-
private _clipKindError;
|
|
1878
|
-
private _loadTrack;
|
|
1879
|
-
_fetchAndDecode(src: string): Promise<AudioBuffer>;
|
|
1880
|
-
private _fetchPeaks;
|
|
1881
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
|
+
*/
|
|
1882
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;
|
|
1883
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;
|
|
1884
2314
|
private _disposeEngine;
|
|
1885
2315
|
private _onDragOver;
|
|
1886
2316
|
private _onDragLeave;
|
|
1887
2317
|
private _onDrop;
|
|
1888
|
-
loadFiles(files: FileList | File[]): Promise<LoadFilesResult>;
|
|
2318
|
+
loadFiles(files: FileList | File[], options?: EditorCallOptions): Promise<LoadFilesResult>;
|
|
1889
2319
|
/**
|
|
1890
|
-
* Imperatively load a `.mid` file (URL or File) and
|
|
1891
|
-
*
|
|
1892
|
-
* every
|
|
1893
|
-
*
|
|
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.
|
|
1894
2324
|
*
|
|
1895
|
-
* `options.signal`
|
|
1896
|
-
*
|
|
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.
|
|
1897
2328
|
*
|
|
1898
2329
|
* Requires the optional `@dawcore/midi` peer dep — throws with an install
|
|
1899
2330
|
* hint (and `console.warn`s the original error) when the dynamic import
|
|
@@ -1907,69 +2338,91 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1907
2338
|
*/
|
|
1908
2339
|
ready(): Promise<PlaylistEngine>;
|
|
1909
2340
|
/**
|
|
1910
|
-
*
|
|
1911
|
-
*
|
|
1912
|
-
*
|
|
1913
|
-
*
|
|
1914
|
-
*
|
|
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.
|
|
1915
2357
|
*/
|
|
1916
|
-
|
|
2358
|
+
addTrack(config?: TrackConfig, options?: EditorCallOptions): Promise<string>;
|
|
1917
2359
|
/**
|
|
1918
|
-
*
|
|
1919
|
-
*
|
|
1920
|
-
*
|
|
1921
|
-
* 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).
|
|
1922
2363
|
*/
|
|
1923
|
-
|
|
2364
|
+
private _endEntryOnSwap;
|
|
2365
|
+
/** A track that has not entered leaves the queue and its wait rejects with `reason` (D4). */
|
|
2366
|
+
private _abortEntry;
|
|
1924
2367
|
/**
|
|
1925
|
-
* Remove a track by id
|
|
1926
|
-
* the
|
|
1927
|
-
*
|
|
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.
|
|
1928
2372
|
*/
|
|
1929
2373
|
removeTrack(trackId: string): void;
|
|
1930
2374
|
/**
|
|
1931
|
-
* Move a track to a
|
|
1932
|
-
*
|
|
1933
|
-
* the
|
|
1934
|
-
* 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.
|
|
1935
2378
|
*/
|
|
1936
2379
|
reorderTrack(trackId: string, toIndex: number): void;
|
|
1937
2380
|
private _onTrackReorder;
|
|
1938
2381
|
private _onTrackReorderGrab;
|
|
1939
2382
|
/**
|
|
1940
|
-
*
|
|
1941
|
-
*
|
|
1942
|
-
*
|
|
1943
|
-
*
|
|
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.
|
|
1944
2388
|
*/
|
|
1945
2389
|
updateTrack(trackId: string, partial: Partial<TrackConfig>): void;
|
|
1946
|
-
/**
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
*
|
|
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.
|
|
1950
2406
|
*/
|
|
1951
|
-
addClip(trackId: string, config: ClipConfig): Promise<string>;
|
|
2407
|
+
addClip(trackId: string, config: ClipConfig, options?: EditorCallOptions): Promise<string>;
|
|
1952
2408
|
/**
|
|
1953
|
-
* Remove a clip by id
|
|
1954
|
-
*
|
|
1955
|
-
*
|
|
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.
|
|
1956
2413
|
*/
|
|
1957
2414
|
removeClip(trackId: string, clipId: string): void;
|
|
1958
2415
|
/**
|
|
1959
|
-
*
|
|
1960
|
-
*
|
|
1961
|
-
*
|
|
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.
|
|
1962
2421
|
*
|
|
1963
2422
|
* Re-decoding (changing `src`) is not supported via this method — remove and
|
|
1964
2423
|
* re-add the clip instead.
|
|
1965
|
-
*
|
|
1966
|
-
* Note: `fadeIn` / `fadeOut` / `fadeType` on the partial are written to the
|
|
1967
|
-
* `<daw-clip>` element (so they round-trip in the descriptor), but engine-side
|
|
1968
|
-
* fade application from `<daw-clip>` properties is not yet implemented — see
|
|
1969
|
-
* the broader fade-engine integration tracked separately.
|
|
1970
2424
|
*/
|
|
1971
2425
|
updateClip(trackId: string, clipId: string, partial: Partial<ClipConfig>): void;
|
|
1972
|
-
private _buildClipElement;
|
|
1973
2426
|
/**
|
|
1974
2427
|
* Start playback, optionally seeking to `startTime` first. When `endTime`
|
|
1975
2428
|
* is provided, playback stops at that time (selection/annotation playback).
|
|
@@ -1988,9 +2441,30 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1988
2441
|
* subsequent stop-settle dispatch. */
|
|
1989
2442
|
private _withSeekSuppression;
|
|
1990
2443
|
seekTo(time: number): void;
|
|
1991
|
-
/**
|
|
2444
|
+
/**
|
|
2445
|
+
* A clip or track drag is in progress: undo and redo do nothing until it
|
|
2446
|
+
* ends (#848). A clip counts once its pointer has moved past the drag
|
|
2447
|
+
* threshold; annotation drags do not count (annotations are not in the
|
|
2448
|
+
* undo history).
|
|
2449
|
+
*/
|
|
2450
|
+
get _dragInProgress(): boolean;
|
|
2451
|
+
/**
|
|
2452
|
+
* Cancel every drag in progress, as a `pointercancel` would. Returns whether
|
|
2453
|
+
* one was. A clip or annotation press that has not moved is not a drag and
|
|
2454
|
+
* is left alone, unless `includePresses` (the editor's disconnect, which
|
|
2455
|
+
* ends every pointer interaction).
|
|
2456
|
+
*/
|
|
2457
|
+
_cancelDrags(includePresses?: boolean): boolean;
|
|
2458
|
+
/**
|
|
2459
|
+
* Escape during a drag cancels it and does nothing else: the default is
|
|
2460
|
+
* prevented, so `<daw-keyboard-shortcuts>` (core's `handleKeyboardEvent`)
|
|
2461
|
+
* does not also stop playback. No `stopPropagation`: an app's own listener
|
|
2462
|
+
* can read `defaultPrevented`.
|
|
2463
|
+
*/
|
|
2464
|
+
private _onDragEscape;
|
|
2465
|
+
/** Undo the last edit. Does nothing while a drag is in progress. */
|
|
1992
2466
|
undo(): void;
|
|
1993
|
-
/** Redo the last undone edit. */
|
|
2467
|
+
/** Redo the last undone edit. Does nothing while a drag is in progress. */
|
|
1994
2468
|
redo(): void;
|
|
1995
2469
|
/** Whether undo is available. */
|
|
1996
2470
|
get canUndo(): boolean;
|
|
@@ -2039,29 +2513,25 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
2039
2513
|
private get _showControls();
|
|
2040
2514
|
/** True when the ruler header band should be rendered (and its selector is valid). */
|
|
2041
2515
|
private get _showRuler();
|
|
2042
|
-
/**
|
|
2043
|
-
*
|
|
2044
|
-
*
|
|
2045
|
-
*
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
*
|
|
2052
|
-
* (
|
|
2053
|
-
|
|
2054
|
-
* engine→DOM direction (statechange handler) converges in one pass.
|
|
2055
|
-
*/
|
|
2056
|
-
_syncEngineOrderToDom(): void;
|
|
2057
|
-
/**
|
|
2058
|
-
* Engine → DOM: after an engine-initiated order change (undo/redo), move
|
|
2059
|
-
* `<daw-track>` elements to match engine order. The resulting mutations fire
|
|
2060
|
-
* the observer's _syncEngineOrderToDom, which finds the orders equal and
|
|
2061
|
-
* no-ops — converges in one pass (write-only-on-change).
|
|
2062
|
-
*/
|
|
2063
|
-
_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
|
+
*/
|
|
2064
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;
|
|
2065
2535
|
render(): lit.TemplateResult<1>;
|
|
2066
2536
|
}
|
|
2067
2537
|
declare global {
|
|
@@ -2086,6 +2556,8 @@ declare class DawRecordButtonElement extends DawTransportButton {
|
|
|
2086
2556
|
protected static requiredTargetMethods: readonly string[];
|
|
2087
2557
|
private _isRecording;
|
|
2088
2558
|
private _targetRef;
|
|
2559
|
+
/** The listeners on `_targetRef`, aborted when the target changes or the button disconnects. */
|
|
2560
|
+
private _targetListeners;
|
|
2089
2561
|
private _onStart;
|
|
2090
2562
|
private _onComplete;
|
|
2091
2563
|
private _onError;
|
|
@@ -2152,6 +2624,8 @@ declare class DawKeyboardShortcutsElement extends LitElement {
|
|
|
2152
2624
|
get shortcuts(): KeyboardShortcut[];
|
|
2153
2625
|
/** Invalidate cached shortcuts when Lit properties change. */
|
|
2154
2626
|
updated(): void;
|
|
2627
|
+
/** The listeners of this connection, aborted in disconnectedCallback. */
|
|
2628
|
+
private _listeners;
|
|
2155
2629
|
connectedCallback(): void;
|
|
2156
2630
|
disconnectedCallback(): void;
|
|
2157
2631
|
createRenderRoot(): this;
|
|
@@ -2224,6 +2698,8 @@ declare class DawTimeDisplayElement extends LitElement {
|
|
|
2224
2698
|
private get target();
|
|
2225
2699
|
private _onTimeUpdate;
|
|
2226
2700
|
private _onFormatChange;
|
|
2701
|
+
/** The listeners of this connection, aborted in disconnectedCallback. */
|
|
2702
|
+
private _listeners;
|
|
2227
2703
|
connectedCallback(): void;
|
|
2228
2704
|
disconnectedCallback(): void;
|
|
2229
2705
|
private _syncFromTarget;
|
|
@@ -2256,6 +2732,8 @@ declare class DawTimeFormatElement extends LitElement {
|
|
|
2256
2732
|
private _onFormatChange;
|
|
2257
2733
|
private _onPointerEnter;
|
|
2258
2734
|
private _onPointerDown;
|
|
2735
|
+
/** The listeners of this connection, aborted in disconnectedCallback. */
|
|
2736
|
+
private _listeners;
|
|
2259
2737
|
connectedCallback(): void;
|
|
2260
2738
|
disconnectedCallback(): void;
|
|
2261
2739
|
protected updated(): void;
|
|
@@ -2304,6 +2782,8 @@ declare class DawPlayerElement extends LitElement {
|
|
|
2304
2782
|
connectedCallback(): void;
|
|
2305
2783
|
render(): lit.TemplateResult<1>;
|
|
2306
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;
|
|
2307
2787
|
private _loadPeaks;
|
|
2308
2788
|
/** Recompute fit-to-width peaks from the loaded WaveformData. No-op without data. */
|
|
2309
2789
|
private _renderWaveform;
|
|
@@ -2400,6 +2880,8 @@ interface AudioResumeHost extends ReactiveControllerHost, HTMLElement {
|
|
|
2400
2880
|
declare class AudioResumeController implements ReactiveController {
|
|
2401
2881
|
private _host;
|
|
2402
2882
|
private _target;
|
|
2883
|
+
/** The gesture listeners on `_target`: one controller per attach. */
|
|
2884
|
+
private _listeners;
|
|
2403
2885
|
private _attached;
|
|
2404
2886
|
private _generation;
|
|
2405
2887
|
/** CSS selector, or 'document'. When undefined, controller is inert. */
|
|
@@ -2527,4 +3009,4 @@ interface SplitHost {
|
|
|
2527
3009
|
*/
|
|
2528
3010
|
declare function splitAtPlayhead(host: SplitHost): boolean;
|
|
2529
3011
|
|
|
2530
|
-
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, 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 };
|