@dawcore/components 0.0.16 → 0.0.17
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/dist/index.d.mts +136 -3
- package/dist/index.d.ts +136 -3
- package/dist/index.js +474 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +473 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, PropertyValues, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
|
-
import { MidiNoteData, FadeType, Peaks, Bits, PeakData, MeterEntry, SnapTo, ClipTrack, KeyboardShortcut } from '@waveform-playlist/core';
|
|
3
|
+
import { MidiNoteData, SpectrogramConfig, FadeType, Peaks, Bits, PeakData, MeterEntry, SnapTo, ColorMapValue, ClipTrack, KeyboardShortcut } from '@waveform-playlist/core';
|
|
4
4
|
import WaveformData from 'waveform-data';
|
|
5
5
|
import { PlayoutAdapter, PlaylistEngine } from '@waveform-playlist/engine';
|
|
6
|
+
import { ClipRegistration, CanvasRegistration, ViewportState } from '@dawcore/spectrogram';
|
|
6
7
|
|
|
7
8
|
declare class DawClipElement extends LitElement {
|
|
8
9
|
src: string;
|
|
@@ -38,7 +39,7 @@ declare global {
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
type TrackRenderMode = 'waveform' | 'piano-roll';
|
|
42
|
+
type TrackRenderMode = 'waveform' | 'piano-roll' | 'spectrogram';
|
|
42
43
|
interface TrackDescriptor {
|
|
43
44
|
name: string;
|
|
44
45
|
src: string;
|
|
@@ -47,6 +48,7 @@ interface TrackDescriptor {
|
|
|
47
48
|
muted: boolean;
|
|
48
49
|
soloed: boolean;
|
|
49
50
|
renderMode: TrackRenderMode;
|
|
51
|
+
spectrogramConfig?: SpectrogramConfig | null;
|
|
50
52
|
clips: ClipDescriptor[];
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
@@ -104,6 +106,7 @@ interface TrackConfig {
|
|
|
104
106
|
muted?: boolean;
|
|
105
107
|
soloed?: boolean;
|
|
106
108
|
renderMode?: TrackRenderMode;
|
|
109
|
+
spectrogramConfig?: SpectrogramConfig | null;
|
|
107
110
|
clips?: ClipConfig[];
|
|
108
111
|
/**
|
|
109
112
|
* Convenience: creates a single piano-roll `<daw-clip>` child with these
|
|
@@ -151,6 +154,7 @@ declare class DawTrackElement extends LitElement {
|
|
|
151
154
|
muted: boolean;
|
|
152
155
|
soloed: boolean;
|
|
153
156
|
renderMode: TrackRenderMode;
|
|
157
|
+
spectrogramConfig: SpectrogramConfig | null;
|
|
154
158
|
readonly trackId: `${string}-${string}-${string}-${string}-${string}`;
|
|
155
159
|
createRenderRoot(): this;
|
|
156
160
|
connectedCallback(): void;
|
|
@@ -779,6 +783,9 @@ interface DawClipSplitDetail {
|
|
|
779
783
|
readonly leftClipId: string;
|
|
780
784
|
readonly rightClipId: string;
|
|
781
785
|
}
|
|
786
|
+
interface DawSpectrogramReadyDetail {
|
|
787
|
+
trackId: string;
|
|
788
|
+
}
|
|
782
789
|
interface DawEventMap {
|
|
783
790
|
'daw-selection': CustomEvent<DawSelectionDetail>;
|
|
784
791
|
'daw-seek': CustomEvent<DawSeekDetail>;
|
|
@@ -806,6 +813,7 @@ interface DawEventMap {
|
|
|
806
813
|
'daw-clip-move': CustomEvent<DawClipMoveDetail>;
|
|
807
814
|
'daw-clip-trim': CustomEvent<DawClipTrimDetail>;
|
|
808
815
|
'daw-clip-split': CustomEvent<DawClipSplitDetail>;
|
|
816
|
+
'daw-spectrogram-ready': CustomEvent<DawSpectrogramReadyDetail>;
|
|
809
817
|
}
|
|
810
818
|
type DawEvent<K extends keyof DawEventMap> = DawEventMap[K];
|
|
811
819
|
interface LoadFilesResult {
|
|
@@ -836,6 +844,44 @@ declare class DawEditorElement extends LitElement {
|
|
|
836
844
|
* floor already provides this; this attribute controls the temporal mode.
|
|
837
845
|
*/
|
|
838
846
|
indefinitePlayback: boolean;
|
|
847
|
+
/**
|
|
848
|
+
* Default spectrogram FFT/render config inherited by tracks with
|
|
849
|
+
* `render-mode="spectrogram"` that do not set their own. Wired into the
|
|
850
|
+
* orchestrator by `SpectrogramController` in Task 14.
|
|
851
|
+
*/
|
|
852
|
+
get spectrogramConfig(): SpectrogramConfig | null;
|
|
853
|
+
set spectrogramConfig(value: SpectrogramConfig | null);
|
|
854
|
+
private _spectrogramConfig;
|
|
855
|
+
/**
|
|
856
|
+
* Default color map for spectrogram tracks. Tracks may override via
|
|
857
|
+
* their own per-track property in a future iteration. Separate from
|
|
858
|
+
* `spectrogramConfig` because `ColorMapValue` is not part of the
|
|
859
|
+
* `SpectrogramConfig` shape.
|
|
860
|
+
*/
|
|
861
|
+
get spectrogramColorMap(): ColorMapValue | null;
|
|
862
|
+
set spectrogramColorMap(value: ColorMapValue | null);
|
|
863
|
+
private _spectrogramColorMap;
|
|
864
|
+
private _ensureSpectrogramController;
|
|
865
|
+
/** Called by <daw-spectrogram> after transferControlToOffscreen. */
|
|
866
|
+
_spectrogramRegisterCanvas(reg: {
|
|
867
|
+
canvasId: string;
|
|
868
|
+
canvas: OffscreenCanvas;
|
|
869
|
+
clipId: string;
|
|
870
|
+
trackId: string;
|
|
871
|
+
channelIndex: number;
|
|
872
|
+
chunkIndex: number;
|
|
873
|
+
globalPixelOffset: number;
|
|
874
|
+
widthPx: number;
|
|
875
|
+
heightPx: number;
|
|
876
|
+
}): void;
|
|
877
|
+
/** Called by <daw-spectrogram> on chunk unmount / element disconnect. */
|
|
878
|
+
_spectrogramUnregisterCanvas(canvasId: string): void;
|
|
879
|
+
/**
|
|
880
|
+
* Push a clip's decoded audio into the spectrogram controller. No-op
|
|
881
|
+
* unless the track is in spectrogram render-mode and the controller
|
|
882
|
+
* already exists (it bootstraps from canvas registration).
|
|
883
|
+
*/
|
|
884
|
+
private _maybeRegisterSpectrogramClipAudio;
|
|
839
885
|
scaleMode: 'temporal' | 'beats';
|
|
840
886
|
get ticksPerPixel(): number;
|
|
841
887
|
set ticksPerPixel(value: number);
|
|
@@ -892,6 +938,7 @@ declare class DawEditorElement extends LitElement {
|
|
|
892
938
|
private _audioResume;
|
|
893
939
|
eagerResume?: string;
|
|
894
940
|
private _recordingController;
|
|
941
|
+
private _spectrogramController;
|
|
895
942
|
private _clipPointer;
|
|
896
943
|
get _clipHandler(): ClipPointerHandler | null;
|
|
897
944
|
get engine(): PlaylistEngine | null;
|
|
@@ -932,9 +979,12 @@ declare class DawEditorElement extends LitElement {
|
|
|
932
979
|
connectedCallback(): void;
|
|
933
980
|
disconnectedCallback(): void;
|
|
934
981
|
willUpdate(changedProperties: Map<string, unknown>): void;
|
|
982
|
+
protected updated(_changed: Map<string, unknown>): void;
|
|
935
983
|
private _onTrackConnected;
|
|
936
984
|
private _onTrackRemoved;
|
|
937
985
|
private _onTrackUpdate;
|
|
986
|
+
/** Drop the controller when no spectrogram tracks remain. */
|
|
987
|
+
private _disposeSpectrogramControllerIfEmpty;
|
|
938
988
|
private static _CONTROL_PROPS;
|
|
939
989
|
private _onTrackControl;
|
|
940
990
|
private _onTrackRemoveRequest;
|
|
@@ -1228,6 +1278,89 @@ declare global {
|
|
|
1228
1278
|
}
|
|
1229
1279
|
}
|
|
1230
1280
|
|
|
1281
|
+
declare class DawSpectrogramElement extends LitElement {
|
|
1282
|
+
clipId: string;
|
|
1283
|
+
trackId: string;
|
|
1284
|
+
channelIndex: number;
|
|
1285
|
+
length: number;
|
|
1286
|
+
waveHeight: number;
|
|
1287
|
+
get samplesPerPixel(): number;
|
|
1288
|
+
set samplesPerPixel(value: number);
|
|
1289
|
+
private _samplesPerPixel;
|
|
1290
|
+
get sampleRate(): number;
|
|
1291
|
+
set sampleRate(value: number);
|
|
1292
|
+
private _sampleRate;
|
|
1293
|
+
clipOffsetSeconds: number;
|
|
1294
|
+
visibleStart: number;
|
|
1295
|
+
visibleEnd: number;
|
|
1296
|
+
originX: number;
|
|
1297
|
+
static styles: lit.CSSResult;
|
|
1298
|
+
private _canvases;
|
|
1299
|
+
private _registeredCanvasIds;
|
|
1300
|
+
/**
|
|
1301
|
+
* Walk up to the editor host. `closest('daw-editor')` does NOT cross
|
|
1302
|
+
* shadow boundaries — and this element lives inside the editor's shadow
|
|
1303
|
+
* DOM — so use getRootNode().host to step out.
|
|
1304
|
+
*/
|
|
1305
|
+
private _findHostEditor;
|
|
1306
|
+
willUpdate(changed: PropertyValues): void;
|
|
1307
|
+
private _rebuildChunks;
|
|
1308
|
+
protected updated(_changed: PropertyValues): void;
|
|
1309
|
+
private _registerCanvases;
|
|
1310
|
+
private _unregisterAllCanvases;
|
|
1311
|
+
disconnectedCallback(): void;
|
|
1312
|
+
render(): lit.TemplateResult<1>;
|
|
1313
|
+
}
|
|
1314
|
+
declare global {
|
|
1315
|
+
interface HTMLElementTagNameMap {
|
|
1316
|
+
'daw-spectrogram': DawSpectrogramElement;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
interface SpectrogramControllerHost extends ReactiveControllerHost {
|
|
1321
|
+
dispatchEvent(event: Event): boolean;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Lit reactive controller that owns a `SpectrogramOrchestrator` for the
|
|
1325
|
+
* `<daw-editor>` host. Creates the orchestrator lazily on first canvas
|
|
1326
|
+
* registration so editors without spectrogram tracks pay nothing.
|
|
1327
|
+
*
|
|
1328
|
+
* Holds editor-level defaults and per-track overrides separately; merges
|
|
1329
|
+
* them down to a single (config, colorMap) pair for the orchestrator on
|
|
1330
|
+
* each change.
|
|
1331
|
+
*
|
|
1332
|
+
* v1 limitation: orchestrator accepts ONE config / colorMap at a time, so
|
|
1333
|
+
* the "first registered track wins" rule applies when multiple tracks are
|
|
1334
|
+
* in spectrogram mode with different overrides. Multi-track per-clip
|
|
1335
|
+
* configs are deferred to a follow-up.
|
|
1336
|
+
*/
|
|
1337
|
+
declare class SpectrogramController implements ReactiveController {
|
|
1338
|
+
private host;
|
|
1339
|
+
private workerFactory;
|
|
1340
|
+
private orchestrator;
|
|
1341
|
+
private editorConfig;
|
|
1342
|
+
private editorColorMap;
|
|
1343
|
+
private trackConfigs;
|
|
1344
|
+
private trackColorMaps;
|
|
1345
|
+
constructor(host: SpectrogramControllerHost, workerFactory: () => Worker);
|
|
1346
|
+
hostConnected(): void;
|
|
1347
|
+
hostDisconnected(): void;
|
|
1348
|
+
setEditorConfig(config: SpectrogramConfig | null): void;
|
|
1349
|
+
setEditorColorMap(colorMap: ColorMapValue | null): void;
|
|
1350
|
+
setTrackConfig(trackId: string, config: SpectrogramConfig | null): void;
|
|
1351
|
+
setTrackColorMap(trackId: string, colorMap: ColorMapValue | null): void;
|
|
1352
|
+
registerClipAudio(reg: ClipRegistration): void;
|
|
1353
|
+
unregisterClipAudio(clipId: string): void;
|
|
1354
|
+
registerCanvas(reg: CanvasRegistration): void;
|
|
1355
|
+
unregisterCanvas(canvasId: string): void;
|
|
1356
|
+
setViewport(state: ViewportState): void;
|
|
1357
|
+
dispose(): void;
|
|
1358
|
+
private ensureOrchestrator;
|
|
1359
|
+
private reapply;
|
|
1360
|
+
private mergedConfig;
|
|
1361
|
+
private mergedColorMap;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1231
1364
|
interface AudioResumeHost extends ReactiveControllerHost, HTMLElement {
|
|
1232
1365
|
/** Returns the AudioContext to resume on user gesture */
|
|
1233
1366
|
readonly audioContext: AudioContext;
|
|
@@ -1284,4 +1417,4 @@ interface SplitHost {
|
|
|
1284
1417
|
*/
|
|
1285
1418
|
declare function splitAtPlayhead(host: SplitHost): boolean;
|
|
1286
1419
|
|
|
1287
|
-
export { AudioResumeController, type ClipConfig, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, type DawClipConnectedDetail, DawClipElement, type DawClipErrorDetail, type DawClipIdDetail, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, type DawClipUpdateDetail, DawEditorElement, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawGridElement, DawKeyboardShortcutsElement, DawPauseButtonElement, DawPianoRollElement, DawPlayButtonElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawStopButtonElement, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type DomClipDescriptor, type DropClipDescriptor, type KeyBinding, type LoadFilesResult, type PlaybackShortcutMap, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, type SplitEngineContract, type SplitHost, type SplittingShortcutMap, type TrackConfig, type TrackDescriptor, type TrackRenderMode, type UndoShortcutMap, type WaveformSegment, isDomClip, splitAtPlayhead };
|
|
1420
|
+
export { AudioResumeController, type ClipConfig, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, type DawClipConnectedDetail, DawClipElement, type DawClipErrorDetail, type DawClipIdDetail, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, type DawClipUpdateDetail, DawEditorElement, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawGridElement, DawKeyboardShortcutsElement, DawPauseButtonElement, DawPianoRollElement, DawPlayButtonElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawSpectrogramElement, DawStopButtonElement, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type DomClipDescriptor, type DropClipDescriptor, type KeyBinding, type LoadFilesResult, type PlaybackShortcutMap, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, SpectrogramController, type SplitEngineContract, type SplitHost, type SplittingShortcutMap, type TrackConfig, type TrackDescriptor, type TrackRenderMode, type UndoShortcutMap, type WaveformSegment, isDomClip, splitAtPlayhead };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as lit from 'lit';
|
|
2
2
|
import { LitElement, PropertyValues, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
|
-
import { MidiNoteData, FadeType, Peaks, Bits, PeakData, MeterEntry, SnapTo, ClipTrack, KeyboardShortcut } from '@waveform-playlist/core';
|
|
3
|
+
import { MidiNoteData, SpectrogramConfig, FadeType, Peaks, Bits, PeakData, MeterEntry, SnapTo, ColorMapValue, ClipTrack, KeyboardShortcut } from '@waveform-playlist/core';
|
|
4
4
|
import WaveformData from 'waveform-data';
|
|
5
5
|
import { PlayoutAdapter, PlaylistEngine } from '@waveform-playlist/engine';
|
|
6
|
+
import { ClipRegistration, CanvasRegistration, ViewportState } from '@dawcore/spectrogram';
|
|
6
7
|
|
|
7
8
|
declare class DawClipElement extends LitElement {
|
|
8
9
|
src: string;
|
|
@@ -38,7 +39,7 @@ declare global {
|
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
type TrackRenderMode = 'waveform' | 'piano-roll';
|
|
42
|
+
type TrackRenderMode = 'waveform' | 'piano-roll' | 'spectrogram';
|
|
42
43
|
interface TrackDescriptor {
|
|
43
44
|
name: string;
|
|
44
45
|
src: string;
|
|
@@ -47,6 +48,7 @@ interface TrackDescriptor {
|
|
|
47
48
|
muted: boolean;
|
|
48
49
|
soloed: boolean;
|
|
49
50
|
renderMode: TrackRenderMode;
|
|
51
|
+
spectrogramConfig?: SpectrogramConfig | null;
|
|
50
52
|
clips: ClipDescriptor[];
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
@@ -104,6 +106,7 @@ interface TrackConfig {
|
|
|
104
106
|
muted?: boolean;
|
|
105
107
|
soloed?: boolean;
|
|
106
108
|
renderMode?: TrackRenderMode;
|
|
109
|
+
spectrogramConfig?: SpectrogramConfig | null;
|
|
107
110
|
clips?: ClipConfig[];
|
|
108
111
|
/**
|
|
109
112
|
* Convenience: creates a single piano-roll `<daw-clip>` child with these
|
|
@@ -151,6 +154,7 @@ declare class DawTrackElement extends LitElement {
|
|
|
151
154
|
muted: boolean;
|
|
152
155
|
soloed: boolean;
|
|
153
156
|
renderMode: TrackRenderMode;
|
|
157
|
+
spectrogramConfig: SpectrogramConfig | null;
|
|
154
158
|
readonly trackId: `${string}-${string}-${string}-${string}-${string}`;
|
|
155
159
|
createRenderRoot(): this;
|
|
156
160
|
connectedCallback(): void;
|
|
@@ -779,6 +783,9 @@ interface DawClipSplitDetail {
|
|
|
779
783
|
readonly leftClipId: string;
|
|
780
784
|
readonly rightClipId: string;
|
|
781
785
|
}
|
|
786
|
+
interface DawSpectrogramReadyDetail {
|
|
787
|
+
trackId: string;
|
|
788
|
+
}
|
|
782
789
|
interface DawEventMap {
|
|
783
790
|
'daw-selection': CustomEvent<DawSelectionDetail>;
|
|
784
791
|
'daw-seek': CustomEvent<DawSeekDetail>;
|
|
@@ -806,6 +813,7 @@ interface DawEventMap {
|
|
|
806
813
|
'daw-clip-move': CustomEvent<DawClipMoveDetail>;
|
|
807
814
|
'daw-clip-trim': CustomEvent<DawClipTrimDetail>;
|
|
808
815
|
'daw-clip-split': CustomEvent<DawClipSplitDetail>;
|
|
816
|
+
'daw-spectrogram-ready': CustomEvent<DawSpectrogramReadyDetail>;
|
|
809
817
|
}
|
|
810
818
|
type DawEvent<K extends keyof DawEventMap> = DawEventMap[K];
|
|
811
819
|
interface LoadFilesResult {
|
|
@@ -836,6 +844,44 @@ declare class DawEditorElement extends LitElement {
|
|
|
836
844
|
* floor already provides this; this attribute controls the temporal mode.
|
|
837
845
|
*/
|
|
838
846
|
indefinitePlayback: boolean;
|
|
847
|
+
/**
|
|
848
|
+
* Default spectrogram FFT/render config inherited by tracks with
|
|
849
|
+
* `render-mode="spectrogram"` that do not set their own. Wired into the
|
|
850
|
+
* orchestrator by `SpectrogramController` in Task 14.
|
|
851
|
+
*/
|
|
852
|
+
get spectrogramConfig(): SpectrogramConfig | null;
|
|
853
|
+
set spectrogramConfig(value: SpectrogramConfig | null);
|
|
854
|
+
private _spectrogramConfig;
|
|
855
|
+
/**
|
|
856
|
+
* Default color map for spectrogram tracks. Tracks may override via
|
|
857
|
+
* their own per-track property in a future iteration. Separate from
|
|
858
|
+
* `spectrogramConfig` because `ColorMapValue` is not part of the
|
|
859
|
+
* `SpectrogramConfig` shape.
|
|
860
|
+
*/
|
|
861
|
+
get spectrogramColorMap(): ColorMapValue | null;
|
|
862
|
+
set spectrogramColorMap(value: ColorMapValue | null);
|
|
863
|
+
private _spectrogramColorMap;
|
|
864
|
+
private _ensureSpectrogramController;
|
|
865
|
+
/** Called by <daw-spectrogram> after transferControlToOffscreen. */
|
|
866
|
+
_spectrogramRegisterCanvas(reg: {
|
|
867
|
+
canvasId: string;
|
|
868
|
+
canvas: OffscreenCanvas;
|
|
869
|
+
clipId: string;
|
|
870
|
+
trackId: string;
|
|
871
|
+
channelIndex: number;
|
|
872
|
+
chunkIndex: number;
|
|
873
|
+
globalPixelOffset: number;
|
|
874
|
+
widthPx: number;
|
|
875
|
+
heightPx: number;
|
|
876
|
+
}): void;
|
|
877
|
+
/** Called by <daw-spectrogram> on chunk unmount / element disconnect. */
|
|
878
|
+
_spectrogramUnregisterCanvas(canvasId: string): void;
|
|
879
|
+
/**
|
|
880
|
+
* Push a clip's decoded audio into the spectrogram controller. No-op
|
|
881
|
+
* unless the track is in spectrogram render-mode and the controller
|
|
882
|
+
* already exists (it bootstraps from canvas registration).
|
|
883
|
+
*/
|
|
884
|
+
private _maybeRegisterSpectrogramClipAudio;
|
|
839
885
|
scaleMode: 'temporal' | 'beats';
|
|
840
886
|
get ticksPerPixel(): number;
|
|
841
887
|
set ticksPerPixel(value: number);
|
|
@@ -892,6 +938,7 @@ declare class DawEditorElement extends LitElement {
|
|
|
892
938
|
private _audioResume;
|
|
893
939
|
eagerResume?: string;
|
|
894
940
|
private _recordingController;
|
|
941
|
+
private _spectrogramController;
|
|
895
942
|
private _clipPointer;
|
|
896
943
|
get _clipHandler(): ClipPointerHandler | null;
|
|
897
944
|
get engine(): PlaylistEngine | null;
|
|
@@ -932,9 +979,12 @@ declare class DawEditorElement extends LitElement {
|
|
|
932
979
|
connectedCallback(): void;
|
|
933
980
|
disconnectedCallback(): void;
|
|
934
981
|
willUpdate(changedProperties: Map<string, unknown>): void;
|
|
982
|
+
protected updated(_changed: Map<string, unknown>): void;
|
|
935
983
|
private _onTrackConnected;
|
|
936
984
|
private _onTrackRemoved;
|
|
937
985
|
private _onTrackUpdate;
|
|
986
|
+
/** Drop the controller when no spectrogram tracks remain. */
|
|
987
|
+
private _disposeSpectrogramControllerIfEmpty;
|
|
938
988
|
private static _CONTROL_PROPS;
|
|
939
989
|
private _onTrackControl;
|
|
940
990
|
private _onTrackRemoveRequest;
|
|
@@ -1228,6 +1278,89 @@ declare global {
|
|
|
1228
1278
|
}
|
|
1229
1279
|
}
|
|
1230
1280
|
|
|
1281
|
+
declare class DawSpectrogramElement extends LitElement {
|
|
1282
|
+
clipId: string;
|
|
1283
|
+
trackId: string;
|
|
1284
|
+
channelIndex: number;
|
|
1285
|
+
length: number;
|
|
1286
|
+
waveHeight: number;
|
|
1287
|
+
get samplesPerPixel(): number;
|
|
1288
|
+
set samplesPerPixel(value: number);
|
|
1289
|
+
private _samplesPerPixel;
|
|
1290
|
+
get sampleRate(): number;
|
|
1291
|
+
set sampleRate(value: number);
|
|
1292
|
+
private _sampleRate;
|
|
1293
|
+
clipOffsetSeconds: number;
|
|
1294
|
+
visibleStart: number;
|
|
1295
|
+
visibleEnd: number;
|
|
1296
|
+
originX: number;
|
|
1297
|
+
static styles: lit.CSSResult;
|
|
1298
|
+
private _canvases;
|
|
1299
|
+
private _registeredCanvasIds;
|
|
1300
|
+
/**
|
|
1301
|
+
* Walk up to the editor host. `closest('daw-editor')` does NOT cross
|
|
1302
|
+
* shadow boundaries — and this element lives inside the editor's shadow
|
|
1303
|
+
* DOM — so use getRootNode().host to step out.
|
|
1304
|
+
*/
|
|
1305
|
+
private _findHostEditor;
|
|
1306
|
+
willUpdate(changed: PropertyValues): void;
|
|
1307
|
+
private _rebuildChunks;
|
|
1308
|
+
protected updated(_changed: PropertyValues): void;
|
|
1309
|
+
private _registerCanvases;
|
|
1310
|
+
private _unregisterAllCanvases;
|
|
1311
|
+
disconnectedCallback(): void;
|
|
1312
|
+
render(): lit.TemplateResult<1>;
|
|
1313
|
+
}
|
|
1314
|
+
declare global {
|
|
1315
|
+
interface HTMLElementTagNameMap {
|
|
1316
|
+
'daw-spectrogram': DawSpectrogramElement;
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
interface SpectrogramControllerHost extends ReactiveControllerHost {
|
|
1321
|
+
dispatchEvent(event: Event): boolean;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Lit reactive controller that owns a `SpectrogramOrchestrator` for the
|
|
1325
|
+
* `<daw-editor>` host. Creates the orchestrator lazily on first canvas
|
|
1326
|
+
* registration so editors without spectrogram tracks pay nothing.
|
|
1327
|
+
*
|
|
1328
|
+
* Holds editor-level defaults and per-track overrides separately; merges
|
|
1329
|
+
* them down to a single (config, colorMap) pair for the orchestrator on
|
|
1330
|
+
* each change.
|
|
1331
|
+
*
|
|
1332
|
+
* v1 limitation: orchestrator accepts ONE config / colorMap at a time, so
|
|
1333
|
+
* the "first registered track wins" rule applies when multiple tracks are
|
|
1334
|
+
* in spectrogram mode with different overrides. Multi-track per-clip
|
|
1335
|
+
* configs are deferred to a follow-up.
|
|
1336
|
+
*/
|
|
1337
|
+
declare class SpectrogramController implements ReactiveController {
|
|
1338
|
+
private host;
|
|
1339
|
+
private workerFactory;
|
|
1340
|
+
private orchestrator;
|
|
1341
|
+
private editorConfig;
|
|
1342
|
+
private editorColorMap;
|
|
1343
|
+
private trackConfigs;
|
|
1344
|
+
private trackColorMaps;
|
|
1345
|
+
constructor(host: SpectrogramControllerHost, workerFactory: () => Worker);
|
|
1346
|
+
hostConnected(): void;
|
|
1347
|
+
hostDisconnected(): void;
|
|
1348
|
+
setEditorConfig(config: SpectrogramConfig | null): void;
|
|
1349
|
+
setEditorColorMap(colorMap: ColorMapValue | null): void;
|
|
1350
|
+
setTrackConfig(trackId: string, config: SpectrogramConfig | null): void;
|
|
1351
|
+
setTrackColorMap(trackId: string, colorMap: ColorMapValue | null): void;
|
|
1352
|
+
registerClipAudio(reg: ClipRegistration): void;
|
|
1353
|
+
unregisterClipAudio(clipId: string): void;
|
|
1354
|
+
registerCanvas(reg: CanvasRegistration): void;
|
|
1355
|
+
unregisterCanvas(canvasId: string): void;
|
|
1356
|
+
setViewport(state: ViewportState): void;
|
|
1357
|
+
dispose(): void;
|
|
1358
|
+
private ensureOrchestrator;
|
|
1359
|
+
private reapply;
|
|
1360
|
+
private mergedConfig;
|
|
1361
|
+
private mergedColorMap;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1231
1364
|
interface AudioResumeHost extends ReactiveControllerHost, HTMLElement {
|
|
1232
1365
|
/** Returns the AudioContext to resume on user gesture */
|
|
1233
1366
|
readonly audioContext: AudioContext;
|
|
@@ -1284,4 +1417,4 @@ interface SplitHost {
|
|
|
1284
1417
|
*/
|
|
1285
1418
|
declare function splitAtPlayhead(host: SplitHost): boolean;
|
|
1286
1419
|
|
|
1287
|
-
export { AudioResumeController, type ClipConfig, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, type DawClipConnectedDetail, DawClipElement, type DawClipErrorDetail, type DawClipIdDetail, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, type DawClipUpdateDetail, DawEditorElement, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawGridElement, DawKeyboardShortcutsElement, DawPauseButtonElement, DawPianoRollElement, DawPlayButtonElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawStopButtonElement, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type DomClipDescriptor, type DropClipDescriptor, type KeyBinding, type LoadFilesResult, type PlaybackShortcutMap, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, type SplitEngineContract, type SplitHost, type SplittingShortcutMap, type TrackConfig, type TrackDescriptor, type TrackRenderMode, type UndoShortcutMap, type WaveformSegment, isDomClip, splitAtPlayhead };
|
|
1420
|
+
export { AudioResumeController, type ClipConfig, type ClipDescriptor, type ClipEngineContract, ClipPointerHandler, type ClipPointerHost, type DawClipConnectedDetail, DawClipElement, type DawClipErrorDetail, type DawClipIdDetail, type DawClipMoveDetail, type DawClipSplitDetail, type DawClipTrimDetail, type DawClipUpdateDetail, DawEditorElement, type DawErrorDetail, type DawEvent, type DawEventMap, type DawFilesLoadErrorDetail, DawGridElement, DawKeyboardShortcutsElement, DawPauseButtonElement, DawPianoRollElement, DawPlayButtonElement, DawPlayheadElement, DawRecordButtonElement, type DawRecordingCompleteDetail, type DawRecordingErrorDetail, type DawRecordingStartDetail, DawRulerElement, type DawSeekDetail, type DawSelectionDetail, DawSelectionElement, DawSpectrogramElement, DawStopButtonElement, type DawTrackConnectedDetail, type DawTrackControlDetail, DawTrackControlsElement, DawTrackElement, type DawTrackErrorDetail, type DawTrackIdDetail, type DawTrackRemoveDetail, type DawTrackSelectDetail, DawTransportButton, DawTransportElement, DawWaveformElement, type DomClipDescriptor, type DropClipDescriptor, type KeyBinding, type LoadFilesResult, type PlaybackShortcutMap, type PointerEngineContract, RecordingController, type RecordingOptions, type RecordingSession, SpectrogramController, type SplitEngineContract, type SplitHost, type SplittingShortcutMap, type TrackConfig, type TrackDescriptor, type TrackRenderMode, type UndoShortcutMap, type WaveformSegment, isDomClip, splitAtPlayhead };
|