@dawcore/components 0.0.39-next.4 → 0.0.39-next.6
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 +6 -2
- package/dist/index.d.mts +226 -115
- package/dist/index.d.ts +226 -115
- package/dist/index.js +1182 -776
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1154 -750
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -436,10 +436,12 @@ Add `<daw-keyboard-shortcuts>` as a child of `<daw-editor>`:
|
|
|
436
436
|
|
|
437
437
|
| Attribute | Shortcuts |
|
|
438
438
|
|-----------|-----------|
|
|
439
|
-
| `playback` | Space (play/pause),
|
|
439
|
+
| `playback` | Space (play/pause), Escape (stop), 0 (rewind to start) |
|
|
440
440
|
| `splitting` | S (split at playhead) |
|
|
441
441
|
| `undo` | Cmd/Ctrl+Z (undo), Cmd/Ctrl+Shift+Z (redo) |
|
|
442
442
|
|
|
443
|
+
During a clip move or trim, or a track-reorder drag, undo and redo do nothing (the keys and `editor.undo()` / `redo()`), and Escape only cancels the drag: it does not also stop playback.
|
|
444
|
+
|
|
443
445
|
Custom shortcuts via JS properties: `playbackShortcuts`, `splittingShortcuts`, `undoShortcuts`, `customShortcuts`.
|
|
444
446
|
|
|
445
447
|
## CSS Theming
|
|
@@ -459,6 +461,8 @@ daw-editor {
|
|
|
459
461
|
--daw-controls-text: #e0d4c8;
|
|
460
462
|
--daw-clip-header-background: rgba(0, 0, 0, 0.4);
|
|
461
463
|
--daw-clip-header-text: #e0d4c8;
|
|
464
|
+
--daw-placeholder-clip-opacity: 0.5; /* a clip whose audio is still loading */
|
|
465
|
+
--daw-clip-failed-color: #e06c75; /* the outline and tint of a clip whose audio failed */
|
|
462
466
|
--daw-controls-width: 180px;
|
|
463
467
|
--daw-min-height: 200px;
|
|
464
468
|
--daw-piano-roll-note-color: #2a7070;
|
|
@@ -508,7 +512,7 @@ Methods:
|
|
|
508
512
|
|
|
509
513
|
### `<daw-track>`
|
|
510
514
|
|
|
511
|
-
Declarative track data. Attributes: `src`, `name`, `volume`, `pan`, `muted`, `soloed`, `kind` (`'audio' | 'midi'`, default `'audio'`: what the track holds; set it before the track is added), `render-mode` (`'waveform' | 'spectrogram'`, default `'waveform'`: how an audio track is drawn; a MIDI track is always a piano roll). JS property: `spectrogramConfig` (per-track spectrogram override). Also exposes the per-track effects API (see [Effects](#effects)). Fires `daw-track-update` `{ trackId, changed }` after a property changes (`changed` names them). A `volume`, `pan`, `muted` or `soloed` change
|
|
515
|
+
Declarative track data. Attributes: `src`, `name`, `volume`, `pan`, `muted`, `soloed`, `kind` (`'audio' | 'midi'`, default `'audio'`: what the track holds; set it before the track is added), `render-mode` (`'waveform' | 'spectrogram'`, default `'waveform'`: how an audio track is drawn; a MIDI track is always a piano roll). JS property: `spectrogramConfig` (per-track spectrogram override). Also exposes the per-track effects API (see [Effects](#effects)). Fires `daw-track-update` `{ trackId, changed }` after a property changes (`changed` names them). A `volume`, `pan`, `muted` or `soloed` change is one undo step per update, also while the track loads. The editor does not write the element back after an Undo: read the restored mix from `editor.tracks`. Loading does not clear the undo history.
|
|
512
516
|
|
|
513
517
|
### `<daw-clip>`
|
|
514
518
|
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as lit from 'lit';
|
|
|
2
2
|
import { LitElement, PropertyValues, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
3
|
import { AnnotationData, AnnotationShortcutMap, MidiNoteData, TrackKind, RenderMode, SpectrogramConfig, Peaks, Bits, FadeType, PeakData, MeterEntry, SnapTo, ColorMapValue, ClipTrack, KeyboardShortcut } from '@waveform-playlist/core';
|
|
4
4
|
import WaveformData from 'waveform-data';
|
|
5
|
-
import {
|
|
5
|
+
import { Arrangement, PlayoutAdapter, PlaylistEngine, TrackMixerValues } from '@waveform-playlist/engine';
|
|
6
6
|
import { MidiLoadOptions, MidiLoadResult } from '@dawcore/midi';
|
|
7
7
|
import { ClipRegistration, CanvasRegistration, ViewportState } from '@dawcore/spectrogram';
|
|
8
8
|
|
|
@@ -590,8 +590,8 @@ interface BaseClipDescriptor {
|
|
|
590
590
|
/**
|
|
591
591
|
* A clip descriptor sourced from a `<daw-clip>` DOM element. `clipId` is
|
|
592
592
|
* always set — `<daw-clip>.clipId` is a `crypto.randomUUID()` generated at
|
|
593
|
-
* construction.
|
|
594
|
-
*
|
|
593
|
+
* construction. The arrangement clip's id is this id (`buildArrangementTrack`,
|
|
594
|
+
* `_loadAndAppendClip`), so the DOM and the arrangement name the same clip.
|
|
595
595
|
*/
|
|
596
596
|
interface DomClipDescriptor extends BaseClipDescriptor {
|
|
597
597
|
kind: 'dom';
|
|
@@ -600,16 +600,18 @@ interface DomClipDescriptor extends BaseClipDescriptor {
|
|
|
600
600
|
/**
|
|
601
601
|
* A clip descriptor synthesized from a non-DOM source — file drops, the
|
|
602
602
|
* `<daw-track src>` shorthand fallback, or recording-clip insertion. There
|
|
603
|
-
* is no DOM element to align with
|
|
604
|
-
* clip-creation time.
|
|
603
|
+
* is no DOM element to align with.
|
|
605
604
|
*
|
|
606
|
-
* `clipId` is
|
|
607
|
-
*
|
|
608
|
-
* `editor.updateClip()` / `removeClip()` to
|
|
605
|
+
* `clipId` is the arrangement clip's id: set at creation for a recorded take
|
|
606
|
+
* (#659), and written in when a dropped file or the shorthand enters the
|
|
607
|
+
* arrangement (#848). Pass it to `editor.updateClip()` / `removeClip()` to
|
|
608
|
+
* address the clip.
|
|
609
609
|
*/
|
|
610
610
|
interface DropClipDescriptor extends BaseClipDescriptor {
|
|
611
611
|
kind: 'drop';
|
|
612
612
|
clipId?: string;
|
|
613
|
+
/** A dropped file the clip loads (`src` is then ''): a File cannot be an attribute (#848). */
|
|
614
|
+
file?: File;
|
|
613
615
|
}
|
|
614
616
|
type ClipDescriptor = DomClipDescriptor | DropClipDescriptor;
|
|
615
617
|
/**
|
|
@@ -940,7 +942,6 @@ interface RecordingHost extends ReactiveControllerHost {
|
|
|
940
942
|
* position and misplaces punch-in (record-during-playback) clips. */
|
|
941
943
|
readonly currentTime: number;
|
|
942
944
|
readonly shadowRoot: ShadowRoot | null;
|
|
943
|
-
resolveAudioContextSampleRate(rate: number): void;
|
|
944
945
|
_addRecordedClip?(trackId: string, buf: AudioBuffer, startSample: number, durSamples: number, offsetSamples?: number, clipName?: string): void;
|
|
945
946
|
/** Structural view of the editor's engine for the take's mute (#843):
|
|
946
947
|
* punch-in replaces the overlapped content, so the recorded-over track's
|
|
@@ -1118,12 +1119,24 @@ declare class ClipPointerHandler {
|
|
|
1118
1119
|
private _snapDeltaToSamples;
|
|
1119
1120
|
/** Returns true if a drag interaction is currently in progress. */
|
|
1120
1121
|
get isActive(): boolean;
|
|
1122
|
+
/** True once the pointer of the current press has moved past the drag
|
|
1123
|
+
* threshold: a press that has not moved is not a drag (#848). */
|
|
1124
|
+
get isDragging(): boolean;
|
|
1121
1125
|
/**
|
|
1122
1126
|
* Attempts to handle a pointerdown event on the given target element.
|
|
1123
1127
|
* Returns true if the target is a recognized clip interaction element.
|
|
1124
1128
|
*/
|
|
1125
1129
|
tryHandle(target: Element, e: PointerEvent): boolean;
|
|
1126
1130
|
private _beginDrag;
|
|
1131
|
+
/**
|
|
1132
|
+
* The press has become a drag (the pointer passed the threshold): take the
|
|
1133
|
+
* clip's bounds and open the transaction now, not at the press. An undo
|
|
1134
|
+
* made during the press (it is not a drag, so undo works) then has no
|
|
1135
|
+
* transaction to abort, and the drag that follows starts from the clip as
|
|
1136
|
+
* the undo left it, one undo step (#848, review of #915). Returns false
|
|
1137
|
+
* when the clip is gone (the undo removed it): the press is dropped.
|
|
1138
|
+
*/
|
|
1139
|
+
private _startDrag;
|
|
1127
1140
|
/** Processes pointermove events during an active drag. */
|
|
1128
1141
|
onPointerMove(e: PointerEvent): void;
|
|
1129
1142
|
/** Processes pointerup events to finalize and dispatch result events. */
|
|
@@ -1198,14 +1211,13 @@ interface DawTrackUpdateDetail {
|
|
|
1198
1211
|
*/
|
|
1199
1212
|
changed: readonly string[];
|
|
1200
1213
|
}
|
|
1214
|
+
/**
|
|
1215
|
+
* `daw-track-error`: every clip of the track failed to load or was refused
|
|
1216
|
+
* for its kind. The track stays in the editor; `retryTrack` loads it again.
|
|
1217
|
+
*/
|
|
1201
1218
|
interface DawTrackErrorDetail {
|
|
1202
1219
|
trackId: string;
|
|
1203
1220
|
error: unknown;
|
|
1204
|
-
/** Present when the load was CANCELLED rather than failed: the track was
|
|
1205
|
-
* removed (or the editor disconnected) while its clips were still loading.
|
|
1206
|
-
* Consumer error UIs should filter these — nothing actually failed; the
|
|
1207
|
-
* event exists so addTrack()/loadMidi() awaiters settle. */
|
|
1208
|
-
reason?: 'removed' | 'disconnected';
|
|
1209
1221
|
}
|
|
1210
1222
|
interface DawFilesLoadErrorDetail {
|
|
1211
1223
|
file: File;
|
|
@@ -1443,12 +1455,13 @@ interface LoadFilesResult {
|
|
|
1443
1455
|
* Minimal host surface needed by `loadMidiImpl`. `<daw-editor>` satisfies this
|
|
1444
1456
|
* structurally. `querySelectorAll` is needed for cleanup-on-failure so the
|
|
1445
1457
|
* loader can identify `<daw-track>` elements appended during this call (both
|
|
1446
|
-
* those whose `addTrack` resolved and those
|
|
1447
|
-
*
|
|
1448
|
-
*
|
|
1458
|
+
* those whose `addTrack` resolved and those whose entry was refused — the
|
|
1459
|
+
* latter aren't in the `addTrack` resolution value, so we need DOM
|
|
1460
|
+
* observation to find them).
|
|
1449
1461
|
*/
|
|
1450
1462
|
interface MidiLoaderHost {
|
|
1451
|
-
|
|
1463
|
+
/** Resolves with the track id once the track has entered (#848). */
|
|
1464
|
+
addTrack(config: TrackConfig): Promise<string>;
|
|
1452
1465
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
1453
1466
|
}
|
|
1454
1467
|
|
|
@@ -1619,19 +1632,45 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1619
1632
|
/** True when the consumer provided BOTH tick conversion callbacks — the
|
|
1620
1633
|
* external tempo map is authoritative and `bpm` is display/grid-only (#407). */
|
|
1621
1634
|
get _hasTickCallbacks(): boolean;
|
|
1622
|
-
/**
|
|
1635
|
+
/**
|
|
1636
|
+
* Sample rate: the adapter's AudioContext rate. Without an adapter (after a
|
|
1637
|
+
* disconnect let it go), the rate of the loaded clips the arrangement holds,
|
|
1638
|
+
* else 48000. Decoded audio is at the context's rate, so the two agree.
|
|
1639
|
+
*/
|
|
1623
1640
|
get sampleRate(): number;
|
|
1624
|
-
|
|
1625
|
-
|
|
1641
|
+
private _loadedClipSampleRate;
|
|
1642
|
+
/**
|
|
1643
|
+
* The one owner of the tracks, the clips, the mix, the undo history and
|
|
1644
|
+
* loading (#848). Made with the editor, kept across a disconnect; the
|
|
1645
|
+
* engine plays it once there is an adapter.
|
|
1646
|
+
*/
|
|
1647
|
+
_arrangement: Arrangement;
|
|
1648
|
+
/** Sends the load events, read from the arrangement (#848). */
|
|
1649
|
+
private _announcer;
|
|
1650
|
+
constructor();
|
|
1651
|
+
/**
|
|
1652
|
+
* Ids of tracks registered (a `<daw-track>` connected, a file dropped) and
|
|
1653
|
+
* not yet in the arrangement: they enter at the next flush, once there is
|
|
1654
|
+
* an engine (#848).
|
|
1655
|
+
*/
|
|
1656
|
+
private _entryQueue;
|
|
1657
|
+
private _entryFlushScheduled;
|
|
1658
|
+
/**
|
|
1659
|
+
* Clips an `addClip()` is waiting for, with their track and the way to
|
|
1660
|
+
* reject the call: a removal of the clip or of its track before the clip
|
|
1661
|
+
* loads settles it here, without a public event (#917).
|
|
1662
|
+
*/
|
|
1663
|
+
private _awaitedClips;
|
|
1664
|
+
/** Reject the `addClip()` calls waiting for clips that match `which`. */
|
|
1665
|
+
private _rejectAwaitedClips;
|
|
1666
|
+
/** `<daw-track>` elements `addTrack()` made: every other one is the page's (the history rule). */
|
|
1667
|
+
private _editorMadeTracks;
|
|
1668
|
+
/** `.dat` peaks drawn for a clip still loading, by clip id (an editor-only render cache). */
|
|
1669
|
+
_previewPeaks: Map<string, PeakData>;
|
|
1670
|
+
/** The `.dat` data of those clips, handed to the peak pipeline when the audio arrives. */
|
|
1671
|
+
private _previewWaveforms;
|
|
1626
1672
|
/** Per-track descriptors, without the mix: the arrangement owns that (#843). */
|
|
1627
1673
|
_tracks: Map<string, StoredTrackDescriptor>;
|
|
1628
|
-
/**
|
|
1629
|
-
* The mix of a track the engine does not hold yet: what it will enter the
|
|
1630
|
-
* arrangement with (from the `<daw-track>` element or the `addTrack` config,
|
|
1631
|
-
* changed by a control or `updateTrack` while it loads). Deleted once
|
|
1632
|
-
* `engine.getState().tracks` holds the id; read only through `_mixOf`.
|
|
1633
|
-
*/
|
|
1634
|
-
_seedMix: Map<string, TrackMixerValues>;
|
|
1635
1674
|
_engineTracks: Map<string, ClipTrack>;
|
|
1636
1675
|
_peaksData: Map<string, PeakData>;
|
|
1637
1676
|
_isPlaying: boolean;
|
|
@@ -1645,9 +1684,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1645
1684
|
set adapter(value: PlayoutAdapter | null);
|
|
1646
1685
|
get adapter(): PlayoutAdapter | null;
|
|
1647
1686
|
private _externalAdapter;
|
|
1648
|
-
/** True after a disconnect disposed the consumer's adapter via the engine
|
|
1649
|
-
* — rebuild attempts fail loudly until a fresh adapter is set. */
|
|
1650
|
-
private _adapterConsumedByDispose;
|
|
1651
1687
|
private _effectsManager;
|
|
1652
1688
|
private get _effects();
|
|
1653
1689
|
/**
|
|
@@ -1730,8 +1766,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1730
1766
|
_engine: PlaylistEngine | null;
|
|
1731
1767
|
private _warnedMissingTicksToSeconds;
|
|
1732
1768
|
private _warnedMissingSecondsToTicks;
|
|
1733
|
-
private _enginePromise;
|
|
1734
|
-
_audioCache: Map<string, Promise<AudioBuffer>>;
|
|
1735
1769
|
private _peaksCache;
|
|
1736
1770
|
_clipBuffers: Map<string, AudioBuffer>;
|
|
1737
1771
|
_clipOffsets: Map<string, {
|
|
@@ -1742,11 +1776,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1742
1776
|
/** Coarsest scale from pre-computed peaks — zoom cannot go finer than this. 0 = no limit. */
|
|
1743
1777
|
private _minSamplesPerPixel;
|
|
1744
1778
|
private _trackElements;
|
|
1745
|
-
/** Track ids with a _loadTrack in flight. Distinct from `_engineTracks`
|
|
1746
|
-
* membership: the peaks-first path inserts a render-only PREVIEW track
|
|
1747
|
-
* into _engineTracks mid-load, so `has()` alone cannot answer "is this
|
|
1748
|
-
* track still loading?". */
|
|
1749
|
-
private _loadingTracks;
|
|
1750
1779
|
private _childObserver;
|
|
1751
1780
|
private _audioResume;
|
|
1752
1781
|
eagerResume?: string;
|
|
@@ -1791,7 +1820,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1791
1820
|
private _scrollSync;
|
|
1792
1821
|
static styles: lit.CSSResult[];
|
|
1793
1822
|
get effectiveSampleRate(): number;
|
|
1794
|
-
resolveAudioContextSampleRate(rate: number): void;
|
|
1795
1823
|
/**
|
|
1796
1824
|
* In beats mode, derive samplesPerPixel from ticksPerPixel so that
|
|
1797
1825
|
* clip positions, waveforms, and the tick-space grid all align.
|
|
@@ -1809,20 +1837,23 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1809
1837
|
/** Grid height when no tracks exist — matches scroll area's rendered height. */
|
|
1810
1838
|
private get _emptyGridHeight();
|
|
1811
1839
|
_setSelectedTrackId(trackId: string | null): void;
|
|
1840
|
+
/**
|
|
1841
|
+
* Every track: those in the arrangement, in its order, then those still
|
|
1842
|
+
* waiting to enter (#848). A `<daw-track>` whose track an Undo took out of
|
|
1843
|
+
* the arrangement is not listed (its descriptor stays for a Redo).
|
|
1844
|
+
*/
|
|
1812
1845
|
get tracks(): TrackWithId[];
|
|
1813
1846
|
/**
|
|
1814
|
-
* A track's mix, from its one owner
|
|
1815
|
-
*
|
|
1816
|
-
*
|
|
1847
|
+
* A track's mix, from its one owner, the arrangement (#843), as the engine
|
|
1848
|
+
* plays it: its projection carries the take's mute, which `getMixer()`
|
|
1849
|
+
* leaves out (the stored mute comes back when the take ends). A track still
|
|
1850
|
+
* waiting to enter shows what its element declares.
|
|
1817
1851
|
*/
|
|
1818
1852
|
_mixOf(trackId: string): TrackMixerValues;
|
|
1819
|
-
/** Replace a track's seed (a new Map: `_seedMix` is reactive state). */
|
|
1820
|
-
private _setSeedMix;
|
|
1821
|
-
private _deleteSeedMix;
|
|
1822
1853
|
/**
|
|
1823
|
-
* Change one mixer field of a track: the
|
|
1824
|
-
* (
|
|
1825
|
-
*
|
|
1854
|
+
* Change one mixer field of a track: the arrangement's setter with
|
|
1855
|
+
* `options` (an undo step; changes with one `gesture` id are one step). A
|
|
1856
|
+
* track that has not entered yet changes nothing.
|
|
1826
1857
|
*/
|
|
1827
1858
|
private _writeMix;
|
|
1828
1859
|
/**
|
|
@@ -1830,8 +1861,6 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1830
1861
|
* of them carry one fresh gesture id. A field left out is not sent.
|
|
1831
1862
|
*/
|
|
1832
1863
|
private _writeMixFields;
|
|
1833
|
-
/** The ordered tracks for `engine.setTracks`, a loading track with its seed. */
|
|
1834
|
-
private _tracksForEngine;
|
|
1835
1864
|
get selectedTrackId(): string | null;
|
|
1836
1865
|
get selection(): {
|
|
1837
1866
|
start: number;
|
|
@@ -1882,72 +1911,126 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1882
1911
|
private _onClipConnected;
|
|
1883
1912
|
private _onClipUpdate;
|
|
1884
1913
|
private _onClipRemovedFromDom;
|
|
1914
|
+
/**
|
|
1915
|
+
* A `<daw-clip>` appended to a track that has entered: the clip goes in as
|
|
1916
|
+
* a loading clip (a loaded one for MIDI), one undo step. Its audio loads
|
|
1917
|
+
* like any other; `daw-clip-ready` or `daw-clip-error` follows (#848).
|
|
1918
|
+
*/
|
|
1885
1919
|
private _loadAndAppendClip;
|
|
1886
1920
|
/**
|
|
1887
1921
|
* Resolve pre-computed peaks for a clip: fetch the .dat/.json, validate the
|
|
1888
1922
|
* sample rate matches the AudioContext, return the WaveformData or null.
|
|
1889
1923
|
* Warns on fetch failure and on sample-rate mismatch — never silent.
|
|
1890
1924
|
*
|
|
1891
|
-
*
|
|
1892
|
-
* `_loadAndAppendClip` (incremental late-append).
|
|
1925
|
+
* Used by `_requestPreview` for a clip that is still loading.
|
|
1893
1926
|
*/
|
|
1894
1927
|
private _resolvePeaks;
|
|
1895
|
-
/**
|
|
1896
|
-
* Construct an AudioClip from a decoded buffer (and optional WaveformData),
|
|
1897
|
-
* align its id with the source `<daw-clip>.clipId` when present, populate
|
|
1898
|
-
* `_clipBuffers` / `_clipOffsets`, generate peaks via the worker pipeline,
|
|
1899
|
-
* and populate `_peaksData`. Returns the finished AudioClip.
|
|
1900
|
-
*
|
|
1901
|
-
* Shared between `_loadTrack`'s standard path and `_loadAndAppendClip`.
|
|
1902
|
-
* Not used by `_loadTrack`'s peaks-first preview path because that path
|
|
1903
|
-
* uses sync `extractPeaks` and inserts a preview track BEFORE audio decode.
|
|
1904
|
-
*/
|
|
1905
|
-
private _finalizeAudioClip;
|
|
1906
|
-
/**
|
|
1907
|
-
* Filter MIDI notes to only those with finite, in-range fields. Logs a
|
|
1908
|
-
* warning for each dropped note. Used by _buildMidiClip and the
|
|
1909
|
-
* _applyClipUpdate MIDI branch to prevent NaN propagation through the
|
|
1910
|
-
* timeline.
|
|
1911
|
-
*/
|
|
1912
|
-
private _validMidiNotes;
|
|
1913
|
-
/**
|
|
1914
|
-
* A clip descriptor is treated as MIDI when it has no audio src.
|
|
1915
|
-
* Includes placeholder MIDI clips (no notes, no duration yet — registered
|
|
1916
|
-
* with a 1s default span; notes upgrade via _applyClipUpdate). Warns when
|
|
1917
|
-
* a clip ambiguously has both src and midiNotes — the audio path runs
|
|
1918
|
-
* and notes would be silently ignored.
|
|
1919
|
-
*/
|
|
1920
|
-
private _isMidiDescriptor;
|
|
1921
|
-
/**
|
|
1922
|
-
* Build an engine clip from a MIDI clip descriptor. Always returns a clip
|
|
1923
|
-
* — empty notes / no declared duration get a 1-second placeholder span so
|
|
1924
|
-
* the clip is reachable via `engine.updateTrack` once notes arrive.
|
|
1925
|
-
*/
|
|
1926
|
-
private _buildMidiClip;
|
|
1927
1928
|
/** Remove a single clip from all per-clip caches. Used by error rollbacks. */
|
|
1928
1929
|
private _purgeClipCaches;
|
|
1929
1930
|
/**
|
|
1930
|
-
*
|
|
1931
|
-
*
|
|
1932
|
-
* clip-level mutation (addClip, updateClip, removeClip, _applyClipUpdate).
|
|
1933
|
-
* Use the engine's incremental updateTrack when available; otherwise fall
|
|
1934
|
-
* back to full setTracks (legacy adapters).
|
|
1931
|
+
* Replace one loaded clip of a track in the arrangement: an undo step. The
|
|
1932
|
+
* function form, so the track's loading clips stay as they are (#848).
|
|
1935
1933
|
*/
|
|
1936
|
-
private
|
|
1934
|
+
private _replaceClip;
|
|
1937
1935
|
private _applyClipUpdate;
|
|
1936
|
+
/** Remove a clip (loaded or still loading) from a track of the arrangement: an undo step. */
|
|
1938
1937
|
private _removeClipFromTrack;
|
|
1939
1938
|
private _readTrackDescriptor;
|
|
1939
|
+
private _readClipDescriptor;
|
|
1940
|
+
private _isEntered;
|
|
1941
|
+
/** Queue a registered track for the next flush. */
|
|
1942
|
+
_queueEntry(trackId: string): void;
|
|
1943
|
+
/**
|
|
1944
|
+
* Enter the queued tracks into the arrangement, in DOM order. Without an
|
|
1945
|
+
* engine they wait (the sample rate of a MIDI clip comes from the
|
|
1946
|
+
* adapter); the engine's build flushes again. The page's tracks entering
|
|
1947
|
+
* while the arrangement has no history are not undo steps: the history is
|
|
1948
|
+
* cleared after them, so Undo right after load removes nothing (and the
|
|
1949
|
+
* next page track finds it empty again).
|
|
1950
|
+
*/
|
|
1951
|
+
_flushTrackEntries(): void;
|
|
1952
|
+
private _waitingForDragEnd;
|
|
1953
|
+
/** Flush the queue once the drag in progress has ended (its pointer or key is released). */
|
|
1954
|
+
private _flushAfterDrag;
|
|
1955
|
+
/** Enter one registered track. False when it is gone, already in, or refused. */
|
|
1956
|
+
private _enterTrack;
|
|
1957
|
+
/**
|
|
1958
|
+
* The `<daw-track src>` shorthand changed its src: the entered track gets a
|
|
1959
|
+
* new loading clip for it, one undo step. A track whose clips are
|
|
1960
|
+
* `<daw-clip>` children keeps them. A track still queued reads the new
|
|
1961
|
+
* descriptor when it enters.
|
|
1962
|
+
*/
|
|
1963
|
+
private _replaceShorthandClips;
|
|
1964
|
+
/** Run the load announcements over the arrangement's current state. */
|
|
1965
|
+
private _announceLoading;
|
|
1966
|
+
/**
|
|
1967
|
+
* Fetch a loading clip's `.dat` peaks and draw them until its audio
|
|
1968
|
+
* arrives (an editor-only cache, not the arrangement: writing the clip
|
|
1969
|
+
* after it entered would be an undo step).
|
|
1970
|
+
*/
|
|
1971
|
+
private _requestPreview;
|
|
1972
|
+
/** The peak sync made a clip's peaks: its zoom floor holds, its preview goes. */
|
|
1973
|
+
_clipPeaksReady(clipId: string, audioBuffer: AudioBuffer): void;
|
|
1974
|
+
/** Who waits for a track to enter (addTrack, a dropped file). */
|
|
1975
|
+
private _entryWaiters;
|
|
1976
|
+
private _waitForEntry;
|
|
1977
|
+
/** Settle the wait for a track's entry: entered (`null`), or refused or gone. */
|
|
1978
|
+
private _settleEntry;
|
|
1979
|
+
/**
|
|
1980
|
+
* A dropped file as a track with no element (a File cannot be an attribute):
|
|
1981
|
+
* one loading clip whose source is the file. Resolves with the track id once
|
|
1982
|
+
* it has entered, an undo step like any track an editor method adds.
|
|
1983
|
+
*/
|
|
1984
|
+
_addDroppedFile(file: File): Promise<string>;
|
|
1985
|
+
/**
|
|
1986
|
+
* Take a track out for good: no undo step, and no undo or redo brings it
|
|
1987
|
+
* back (a dropped file that could not be loaded was never a declaration).
|
|
1988
|
+
*/
|
|
1989
|
+
_discardTrack(trackId: string): void;
|
|
1990
|
+
/** Ends the waits of `_whenTrackLoaded` (as loaded) when the editor is disconnected. */
|
|
1991
|
+
private _loadWaitEnds;
|
|
1992
|
+
/**
|
|
1993
|
+
* Resolves once the track has loaded (`daw-track-ready`), or when the
|
|
1994
|
+
* editor is disconnected meanwhile (the track is kept and loads after a
|
|
1995
|
+
* reparent); rejects when its audio failed (`daw-track-error`).
|
|
1996
|
+
*/
|
|
1997
|
+
_whenTrackLoaded(trackId: string): Promise<void>;
|
|
1998
|
+
/**
|
|
1999
|
+
* Load again every failed source the track's clips name (#848). A track
|
|
2000
|
+
* whose audio failed stays in the editor, like a broken `<img>`;
|
|
2001
|
+
* `daw-track-ready` follows when it loads.
|
|
2002
|
+
*/
|
|
2003
|
+
retryTrack(trackId: string): void;
|
|
2004
|
+
private _fetchPeaks;
|
|
1940
2005
|
/**
|
|
1941
|
-
* The
|
|
1942
|
-
*
|
|
2006
|
+
* The timeline's duration, the one writer of `_duration`: the loaded clips,
|
|
2007
|
+
* and the clips still loading whose length is known (a duration, or `.dat`
|
|
2008
|
+
* peaks), so the timeline is as wide as what is drawn (#848).
|
|
1943
2009
|
*/
|
|
1944
|
-
private _clipKindError;
|
|
1945
|
-
private _loadTrack;
|
|
1946
|
-
_fetchAndDecode(src: string): Promise<AudioBuffer>;
|
|
1947
|
-
private _fetchPeaks;
|
|
1948
2010
|
_recomputeDuration(): void;
|
|
2011
|
+
/** How long a loading clip is drawn: its duration, else what its `.dat` peaks cover; null when unknown. */
|
|
2012
|
+
private _placeholderSeconds;
|
|
2013
|
+
/**
|
|
2014
|
+
* The engine, built now when the editor is connected with an adapter.
|
|
2015
|
+
* Rejects without an adapter, and on a detached editor (an engine built
|
|
2016
|
+
* there would hold the adapter's graph with nothing to dispose it).
|
|
2017
|
+
*/
|
|
1949
2018
|
_ensureEngine(): Promise<PlaylistEngine>;
|
|
2019
|
+
/** Build the engine from the adapter setter or a connect: a failure is reported, not thrown. */
|
|
2020
|
+
private _buildEngineReporting;
|
|
2021
|
+
/** Last versions the statechange handler worked from; reset for each engine. */
|
|
2022
|
+
private _lastTracksVersion;
|
|
2023
|
+
private _lastMixerVersion;
|
|
1950
2024
|
private _buildEngine;
|
|
2025
|
+
/**
|
|
2026
|
+
* Clips whose audio has just arrived: a `.dat` preview's data goes to the
|
|
2027
|
+
* peak pipeline (no worker run), a spectrogram track gets the audio. The
|
|
2028
|
+
* peak sync then makes their peaks.
|
|
2029
|
+
*/
|
|
2030
|
+
private _adoptLoadedClips;
|
|
2031
|
+
/** The engine's state changed: follow it (the one writer of `_engineTracks`). */
|
|
2032
|
+
private _onEngineState;
|
|
2033
|
+
private _onEngineStop;
|
|
1951
2034
|
private _disposeEngine;
|
|
1952
2035
|
private _onDragOver;
|
|
1953
2036
|
private _onDragLeave;
|
|
@@ -1974,20 +2057,15 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1974
2057
|
*/
|
|
1975
2058
|
ready(): Promise<PlaylistEngine>;
|
|
1976
2059
|
/**
|
|
1977
|
-
*
|
|
1978
|
-
* the
|
|
1979
|
-
*
|
|
1980
|
-
*
|
|
1981
|
-
*
|
|
2060
|
+
* Append a `<daw-track>` element built from `config` and resolve with its
|
|
2061
|
+
* track id once the track has entered the arrangement (#848), before its
|
|
2062
|
+
* audio has loaded. To follow loading, add the `daw-track-ready` /
|
|
2063
|
+
* `daw-track-error` listener BEFORE calling: for a track with nothing to
|
|
2064
|
+
* fetch, or whose audio is already loaded, it fires before this resolves.
|
|
2065
|
+
* Without `editor.adapter` it waits for one. Rejects when the track is
|
|
2066
|
+
* refused by the arrangement or removed before it enters.
|
|
1982
2067
|
*/
|
|
1983
|
-
|
|
1984
|
-
/**
|
|
1985
|
-
* Append a `<daw-track>` element built from `config` and resolve once the
|
|
1986
|
-
* track finishes loading (or reject on `daw-track-error`). Goes through
|
|
1987
|
-
* the same `_loadTrack` pipeline as declarative tracks, so descriptors,
|
|
1988
|
-
* peaks, and clip buffers are populated correctly.
|
|
1989
|
-
*/
|
|
1990
|
-
addTrack(config?: TrackConfig): Promise<DawTrackElement>;
|
|
2068
|
+
addTrack(config?: TrackConfig): Promise<string>;
|
|
1991
2069
|
/**
|
|
1992
2070
|
* Remove a track by id. Equivalent to `trackElement.remove()` —
|
|
1993
2071
|
* the editor's MutationObserver handles engine and cache cleanup.
|
|
@@ -2005,16 +2083,18 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
2005
2083
|
private _onTrackReorderGrab;
|
|
2006
2084
|
/**
|
|
2007
2085
|
* Update reflected attributes on a track. The mixer fields go to their
|
|
2008
|
-
* owner as one undo step (#843
|
|
2009
|
-
*
|
|
2086
|
+
* owner, the arrangement, as one undo step (#843; also while the track
|
|
2087
|
+
* loads, #848). For DOM-element tracks the
|
|
2010
2088
|
* changes are also written to the `<daw-track>` element; for tracks
|
|
2011
2089
|
* without a DOM element (file drops) the descriptor is updated in place.
|
|
2012
2090
|
*/
|
|
2013
2091
|
updateTrack(trackId: string, partial: Partial<TrackConfig>): void;
|
|
2014
2092
|
/**
|
|
2015
2093
|
* Append a clip to an existing track. Builds a `<daw-clip>` from `config`
|
|
2016
|
-
* and appends it to the track's DOM element
|
|
2017
|
-
*
|
|
2094
|
+
* and appends it to the track's DOM element; resolves with the new clip's
|
|
2095
|
+
* id once its audio has loaded (`daw-clip-ready`, before its peaks are
|
|
2096
|
+
* drawn); rejects when it fails to load, is refused, or leaves the
|
|
2097
|
+
* arrangement before it loads (a removal, an Undo).
|
|
2018
2098
|
*/
|
|
2019
2099
|
addClip(trackId: string, config: ClipConfig): Promise<string>;
|
|
2020
2100
|
/**
|
|
@@ -2056,9 +2136,30 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
2056
2136
|
* subsequent stop-settle dispatch. */
|
|
2057
2137
|
private _withSeekSuppression;
|
|
2058
2138
|
seekTo(time: number): void;
|
|
2059
|
-
/**
|
|
2139
|
+
/**
|
|
2140
|
+
* A clip or track drag is in progress: undo and redo do nothing until it
|
|
2141
|
+
* ends (#848). A clip counts once its pointer has moved past the drag
|
|
2142
|
+
* threshold; annotation drags do not count (annotations are not in the
|
|
2143
|
+
* undo history).
|
|
2144
|
+
*/
|
|
2145
|
+
get _dragInProgress(): boolean;
|
|
2146
|
+
/**
|
|
2147
|
+
* Cancel every drag in progress, as a `pointercancel` would. Returns whether
|
|
2148
|
+
* one was. A clip or annotation press that has not moved is not a drag and
|
|
2149
|
+
* is left alone, unless `includePresses` (the editor's disconnect, which
|
|
2150
|
+
* ends every pointer interaction).
|
|
2151
|
+
*/
|
|
2152
|
+
_cancelDrags(includePresses?: boolean): boolean;
|
|
2153
|
+
/**
|
|
2154
|
+
* Escape during a drag cancels it and does nothing else: the default is
|
|
2155
|
+
* prevented, so `<daw-keyboard-shortcuts>` (core's `handleKeyboardEvent`)
|
|
2156
|
+
* does not also stop playback. No `stopPropagation`: an app's own listener
|
|
2157
|
+
* can read `defaultPrevented`.
|
|
2158
|
+
*/
|
|
2159
|
+
private _onDragEscape;
|
|
2160
|
+
/** Undo the last edit. Does nothing while a drag is in progress. */
|
|
2060
2161
|
undo(): void;
|
|
2061
|
-
/** Redo the last undone edit. */
|
|
2162
|
+
/** Redo the last undone edit. Does nothing while a drag is in progress. */
|
|
2062
2163
|
redo(): void;
|
|
2063
2164
|
/** Whether undo is available. */
|
|
2064
2165
|
get canUndo(): boolean;
|
|
@@ -2129,7 +2230,17 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
2129
2230
|
* no-ops — converges in one pass (write-only-on-change).
|
|
2130
2231
|
*/
|
|
2131
2232
|
_syncDomToEngineOrder(tracks: readonly ClipTrack[]): void;
|
|
2233
|
+
/**
|
|
2234
|
+
* The rows, in the arrangement's order (#848): each track's loaded clips
|
|
2235
|
+
* (the engine's projection, with the current mix) and the clips still loading.
|
|
2236
|
+
*/
|
|
2132
2237
|
private _getOrderedTracks;
|
|
2238
|
+
/**
|
|
2239
|
+
* A clip still loading: a placeholder box where its length is known, with
|
|
2240
|
+
* its `.dat` peaks when they came, drawn failed when its source failed. Its
|
|
2241
|
+
* header carries no clip id, so it cannot be dragged.
|
|
2242
|
+
*/
|
|
2243
|
+
private _renderPlaceholder;
|
|
2133
2244
|
render(): lit.TemplateResult<1>;
|
|
2134
2245
|
}
|
|
2135
2246
|
declare global {
|