@dawcore/components 0.0.26 → 0.0.27
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 +38 -12
- package/dist/index.d.ts +38 -12
- package/dist/index.js +98 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -392,6 +392,12 @@ interface TrackDescriptor {
|
|
|
392
392
|
spectrogramConfig?: SpectrogramConfig | null;
|
|
393
393
|
clips: ClipDescriptor[];
|
|
394
394
|
}
|
|
395
|
+
/** A `TrackDescriptor` plus its `trackId` — the shape returned by `editor.tracks`
|
|
396
|
+
* so consumers can map a track's name to the `trackId` the per-track APIs
|
|
397
|
+
* (`addTrackEffect`, `removeTrack`, `updateTrack`, …) are keyed by. */
|
|
398
|
+
type TrackWithId = TrackDescriptor & {
|
|
399
|
+
trackId: string;
|
|
400
|
+
};
|
|
395
401
|
/**
|
|
396
402
|
* Common fields shared by all clip descriptors regardless of source.
|
|
397
403
|
*/
|
|
@@ -1028,6 +1034,7 @@ interface DawEventMap {
|
|
|
1028
1034
|
'daw-track-connected': CustomEvent<DawTrackConnectedDetail>;
|
|
1029
1035
|
'daw-track-update': CustomEvent<DawTrackIdDetail>;
|
|
1030
1036
|
'daw-track-ready': CustomEvent<DawTrackIdDetail>;
|
|
1037
|
+
'daw-track-removed': CustomEvent<DawTrackIdDetail>;
|
|
1031
1038
|
'daw-track-error': CustomEvent<DawTrackErrorDetail>;
|
|
1032
1039
|
'daw-files-load-error': CustomEvent<DawFilesLoadErrorDetail>;
|
|
1033
1040
|
'daw-play': CustomEvent<void>;
|
|
@@ -1275,18 +1282,37 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1275
1282
|
* with their live state). Returns the rendered AudioBuffer.
|
|
1276
1283
|
*/
|
|
1277
1284
|
exportAudio(options?: ExportOptions): Promise<AudioBuffer>;
|
|
1278
|
-
/**
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1285
|
+
/** Add a native registry effect to a track's chain. */
|
|
1286
|
+
addTrackEffect(trackId: string, type: string, params?: Record<string, number>): string;
|
|
1287
|
+
/** Snapshot of a track's effect chain (empty array for an unknown track). */
|
|
1288
|
+
trackEffects(trackId: string): EffectState[];
|
|
1289
|
+
removeTrackEffect(trackId: string, effectId: string): void;
|
|
1290
|
+
setTrackEffectParams(trackId: string, effectId: string, params: Record<string, number>): void;
|
|
1291
|
+
setTrackEffectBypassed(trackId: string, effectId: string, bypassed: boolean): void;
|
|
1292
|
+
moveTrackEffect(trackId: string, effectId: string, newIndex: number): void;
|
|
1293
|
+
/** Load a WAM plugin (via the optional @dawcore/wam peer) into a track's chain. */
|
|
1294
|
+
addTrackWamPlugin(trackId: string, url: string, initialState?: unknown): Promise<string>;
|
|
1295
|
+
/** Compile Faust DSP (via the optional @dawcore/faust peer) into a track's chain. */
|
|
1296
|
+
addTrackFaustEffect(trackId: string, dspCode: string, options?: {
|
|
1284
1297
|
name?: string;
|
|
1285
1298
|
}): Promise<string>;
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1299
|
+
/** Open (lazily creating) the GUI for a track-chain effect into a container. */
|
|
1300
|
+
openTrackEffectGui(trackId: string, effectId: string, container: HTMLElement): Promise<HTMLElement>;
|
|
1301
|
+
/** Hide a track-chain effect's GUI (cached for reopen — never destroys). */
|
|
1302
|
+
closeTrackEffectGui(_trackId: string, effectId: string): void;
|
|
1303
|
+
/** Snapshot a track's chain in its persisted form (see dawcore README). */
|
|
1304
|
+
getTrackEffectsState(trackId: string): Promise<SerializedEffectEntry[]>;
|
|
1305
|
+
/** Replace a track's chain from a persisted snapshot. */
|
|
1306
|
+
setTrackEffectsState(trackId: string, entries: SerializedEffectEntry[]): Promise<void>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Event-dispatch source for a per-track effect op: the track's `<daw-track>`
|
|
1309
|
+
* element when one exists (so `daw-effect-*` bubble from it exactly as the
|
|
1310
|
+
* element-method path does), else the editor itself for element-less tracks
|
|
1311
|
+
* (drag-dropped / programmatic). Reads the `_trackElements` index the editor
|
|
1312
|
+
* already maintains across the track connect/remove lifecycle — O(1), and the
|
|
1313
|
+
* same resolution `removeTrack` uses — rather than re-querying the DOM per op.
|
|
1314
|
+
*/
|
|
1315
|
+
private _trackEventTarget;
|
|
1290
1316
|
get audioContext(): AudioContext;
|
|
1291
1317
|
_engine: PlaylistEngine | null;
|
|
1292
1318
|
private _warnedMissingTicksToSeconds;
|
|
@@ -1347,7 +1373,7 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1347
1373
|
/** Grid height when no tracks exist — matches scroll area's rendered height. */
|
|
1348
1374
|
private get _emptyGridHeight();
|
|
1349
1375
|
_setSelectedTrackId(trackId: string | null): void;
|
|
1350
|
-
get tracks():
|
|
1376
|
+
get tracks(): TrackWithId[];
|
|
1351
1377
|
get selectedTrackId(): string | null;
|
|
1352
1378
|
get selection(): {
|
|
1353
1379
|
start: number;
|
|
@@ -1949,4 +1975,4 @@ declare function registerEffect(type: string, definition: EffectDefinition): voi
|
|
|
1949
1975
|
declare function getEffectDefinitions(): Map<string, EffectDefinition>;
|
|
1950
1976
|
declare function createEffectInstance(type: string, audioContext: BaseAudioContext, params?: Record<string, number>): CreatedEffect;
|
|
1951
1977
|
|
|
1952
|
-
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 DawEffectAddDetail, type DawEffectBypassDetail, type DawEffectChangeDetail, type DawEffectErrorDetail, type DawEffectRemoveDetail, type DawEffectReorderDetail, 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, 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 EffectDefinition, type EffectInstance, type EffectParamDef, 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 UndoShortcutMap, type WaveformSegment, createEffectInstance, formatDisplayTime, getEffectDefinitions, isDomClip, isTimeDisplayFormat, parseDisplayTime, registerEffect, resolveTransportTarget, splitAtPlayhead, targetSupports, warnOnce, warnUnsupportedOnce };
|
|
1978
|
+
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 DawEffectAddDetail, type DawEffectBypassDetail, type DawEffectChangeDetail, type DawEffectErrorDetail, type DawEffectRemoveDetail, type DawEffectReorderDetail, 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, 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 EffectDefinition, type EffectInstance, type EffectParamDef, 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, createEffectInstance, formatDisplayTime, getEffectDefinitions, isDomClip, isTimeDisplayFormat, parseDisplayTime, registerEffect, resolveTransportTarget, splitAtPlayhead, targetSupports, warnOnce, warnUnsupportedOnce };
|
package/dist/index.d.ts
CHANGED
|
@@ -392,6 +392,12 @@ interface TrackDescriptor {
|
|
|
392
392
|
spectrogramConfig?: SpectrogramConfig | null;
|
|
393
393
|
clips: ClipDescriptor[];
|
|
394
394
|
}
|
|
395
|
+
/** A `TrackDescriptor` plus its `trackId` — the shape returned by `editor.tracks`
|
|
396
|
+
* so consumers can map a track's name to the `trackId` the per-track APIs
|
|
397
|
+
* (`addTrackEffect`, `removeTrack`, `updateTrack`, …) are keyed by. */
|
|
398
|
+
type TrackWithId = TrackDescriptor & {
|
|
399
|
+
trackId: string;
|
|
400
|
+
};
|
|
395
401
|
/**
|
|
396
402
|
* Common fields shared by all clip descriptors regardless of source.
|
|
397
403
|
*/
|
|
@@ -1028,6 +1034,7 @@ interface DawEventMap {
|
|
|
1028
1034
|
'daw-track-connected': CustomEvent<DawTrackConnectedDetail>;
|
|
1029
1035
|
'daw-track-update': CustomEvent<DawTrackIdDetail>;
|
|
1030
1036
|
'daw-track-ready': CustomEvent<DawTrackIdDetail>;
|
|
1037
|
+
'daw-track-removed': CustomEvent<DawTrackIdDetail>;
|
|
1031
1038
|
'daw-track-error': CustomEvent<DawTrackErrorDetail>;
|
|
1032
1039
|
'daw-files-load-error': CustomEvent<DawFilesLoadErrorDetail>;
|
|
1033
1040
|
'daw-play': CustomEvent<void>;
|
|
@@ -1275,18 +1282,37 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1275
1282
|
* with their live state). Returns the rendered AudioBuffer.
|
|
1276
1283
|
*/
|
|
1277
1284
|
exportAudio(options?: ExportOptions): Promise<AudioBuffer>;
|
|
1278
|
-
/**
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1285
|
+
/** Add a native registry effect to a track's chain. */
|
|
1286
|
+
addTrackEffect(trackId: string, type: string, params?: Record<string, number>): string;
|
|
1287
|
+
/** Snapshot of a track's effect chain (empty array for an unknown track). */
|
|
1288
|
+
trackEffects(trackId: string): EffectState[];
|
|
1289
|
+
removeTrackEffect(trackId: string, effectId: string): void;
|
|
1290
|
+
setTrackEffectParams(trackId: string, effectId: string, params: Record<string, number>): void;
|
|
1291
|
+
setTrackEffectBypassed(trackId: string, effectId: string, bypassed: boolean): void;
|
|
1292
|
+
moveTrackEffect(trackId: string, effectId: string, newIndex: number): void;
|
|
1293
|
+
/** Load a WAM plugin (via the optional @dawcore/wam peer) into a track's chain. */
|
|
1294
|
+
addTrackWamPlugin(trackId: string, url: string, initialState?: unknown): Promise<string>;
|
|
1295
|
+
/** Compile Faust DSP (via the optional @dawcore/faust peer) into a track's chain. */
|
|
1296
|
+
addTrackFaustEffect(trackId: string, dspCode: string, options?: {
|
|
1284
1297
|
name?: string;
|
|
1285
1298
|
}): Promise<string>;
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1299
|
+
/** Open (lazily creating) the GUI for a track-chain effect into a container. */
|
|
1300
|
+
openTrackEffectGui(trackId: string, effectId: string, container: HTMLElement): Promise<HTMLElement>;
|
|
1301
|
+
/** Hide a track-chain effect's GUI (cached for reopen — never destroys). */
|
|
1302
|
+
closeTrackEffectGui(_trackId: string, effectId: string): void;
|
|
1303
|
+
/** Snapshot a track's chain in its persisted form (see dawcore README). */
|
|
1304
|
+
getTrackEffectsState(trackId: string): Promise<SerializedEffectEntry[]>;
|
|
1305
|
+
/** Replace a track's chain from a persisted snapshot. */
|
|
1306
|
+
setTrackEffectsState(trackId: string, entries: SerializedEffectEntry[]): Promise<void>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Event-dispatch source for a per-track effect op: the track's `<daw-track>`
|
|
1309
|
+
* element when one exists (so `daw-effect-*` bubble from it exactly as the
|
|
1310
|
+
* element-method path does), else the editor itself for element-less tracks
|
|
1311
|
+
* (drag-dropped / programmatic). Reads the `_trackElements` index the editor
|
|
1312
|
+
* already maintains across the track connect/remove lifecycle — O(1), and the
|
|
1313
|
+
* same resolution `removeTrack` uses — rather than re-querying the DOM per op.
|
|
1314
|
+
*/
|
|
1315
|
+
private _trackEventTarget;
|
|
1290
1316
|
get audioContext(): AudioContext;
|
|
1291
1317
|
_engine: PlaylistEngine | null;
|
|
1292
1318
|
private _warnedMissingTicksToSeconds;
|
|
@@ -1347,7 +1373,7 @@ declare class DawEditorElement extends LitElement implements MidiLoaderHost {
|
|
|
1347
1373
|
/** Grid height when no tracks exist — matches scroll area's rendered height. */
|
|
1348
1374
|
private get _emptyGridHeight();
|
|
1349
1375
|
_setSelectedTrackId(trackId: string | null): void;
|
|
1350
|
-
get tracks():
|
|
1376
|
+
get tracks(): TrackWithId[];
|
|
1351
1377
|
get selectedTrackId(): string | null;
|
|
1352
1378
|
get selection(): {
|
|
1353
1379
|
start: number;
|
|
@@ -1949,4 +1975,4 @@ declare function registerEffect(type: string, definition: EffectDefinition): voi
|
|
|
1949
1975
|
declare function getEffectDefinitions(): Map<string, EffectDefinition>;
|
|
1950
1976
|
declare function createEffectInstance(type: string, audioContext: BaseAudioContext, params?: Record<string, number>): CreatedEffect;
|
|
1951
1977
|
|
|
1952
|
-
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 DawEffectAddDetail, type DawEffectBypassDetail, type DawEffectChangeDetail, type DawEffectErrorDetail, type DawEffectRemoveDetail, type DawEffectReorderDetail, 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, 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 EffectDefinition, type EffectInstance, type EffectParamDef, 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 UndoShortcutMap, type WaveformSegment, createEffectInstance, formatDisplayTime, getEffectDefinitions, isDomClip, isTimeDisplayFormat, parseDisplayTime, registerEffect, resolveTransportTarget, splitAtPlayhead, targetSupports, warnOnce, warnUnsupportedOnce };
|
|
1978
|
+
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 DawEffectAddDetail, type DawEffectBypassDetail, type DawEffectChangeDetail, type DawEffectErrorDetail, type DawEffectRemoveDetail, type DawEffectReorderDetail, 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, 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 EffectDefinition, type EffectInstance, type EffectParamDef, 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, createEffectInstance, formatDisplayTime, getEffectDefinitions, isDomClip, isTimeDisplayFormat, parseDisplayTime, registerEffect, resolveTransportTarget, splitAtPlayhead, targetSupports, warnOnce, warnUnsupportedOnce };
|
package/dist/index.js
CHANGED
|
@@ -273,11 +273,11 @@ var DawTrackElement = class extends import_lit2.LitElement {
|
|
|
273
273
|
}
|
|
274
274
|
// --- Effects API (delegates to the owning <daw-editor>) ---
|
|
275
275
|
addEffect(type, params) {
|
|
276
|
-
return this._effectsEditor().
|
|
276
|
+
return this._effectsEditor().addTrackEffect(this.trackId, type, params);
|
|
277
277
|
}
|
|
278
278
|
/** Load a WAM plugin (via the optional @dawcore/wam peer) into this track's chain. */
|
|
279
279
|
addWamPlugin(url, initialState) {
|
|
280
|
-
return this._effectsEditor().
|
|
280
|
+
return this._effectsEditor().addTrackWamPlugin(this.trackId, url, initialState);
|
|
281
281
|
}
|
|
282
282
|
/**
|
|
283
283
|
* Compile Faust DSP source in the browser (via the optional @dawcore/faust
|
|
@@ -285,16 +285,16 @@ var DawTrackElement = class extends import_lit2.LitElement {
|
|
|
285
285
|
* keep their Faust line/column diagnostics and leave the chain untouched.
|
|
286
286
|
*/
|
|
287
287
|
addFaustEffect(dspCode, options) {
|
|
288
|
-
return this._effectsEditor().
|
|
288
|
+
return this._effectsEditor().addTrackFaustEffect(this.trackId, dspCode, options);
|
|
289
289
|
}
|
|
290
290
|
/** Snapshot this track's chain in its persisted form (see dawcore README). */
|
|
291
291
|
getEffectsState() {
|
|
292
292
|
const editor = this.closest("daw-editor");
|
|
293
|
-
return editor?.
|
|
293
|
+
return editor?.getTrackEffectsState(this.trackId) ?? Promise.resolve([]);
|
|
294
294
|
}
|
|
295
295
|
/** Replace this track's chain with a persisted snapshot. */
|
|
296
296
|
setEffectsState(entries) {
|
|
297
|
-
return this._effectsEditor().
|
|
297
|
+
return this._effectsEditor().setTrackEffectsState(this.trackId, entries);
|
|
298
298
|
}
|
|
299
299
|
/**
|
|
300
300
|
* Open (lazily creating) the GUI for one of this track's effects into a
|
|
@@ -302,27 +302,27 @@ var DawTrackElement = class extends import_lit2.LitElement {
|
|
|
302
302
|
* the element is cached for reopen. See <daw-editor>.openEffectGui.
|
|
303
303
|
*/
|
|
304
304
|
openEffectGui(effectId, container) {
|
|
305
|
-
return this._effectsEditor().
|
|
305
|
+
return this._effectsEditor().openTrackEffectGui(this.trackId, effectId, container);
|
|
306
306
|
}
|
|
307
307
|
/** Hide an effect's GUI (cached for reopen — never destroys). */
|
|
308
308
|
closeEffectGui(effectId) {
|
|
309
|
-
this._effectsEditor().
|
|
309
|
+
this._effectsEditor().closeTrackEffectGui(this.trackId, effectId);
|
|
310
310
|
}
|
|
311
311
|
removeEffect(effectId) {
|
|
312
|
-
this._effectsEditor().
|
|
312
|
+
this._effectsEditor().removeTrackEffect(this.trackId, effectId);
|
|
313
313
|
}
|
|
314
314
|
setEffectParams(effectId, params) {
|
|
315
|
-
this._effectsEditor().
|
|
315
|
+
this._effectsEditor().setTrackEffectParams(this.trackId, effectId, params);
|
|
316
316
|
}
|
|
317
317
|
setEffectBypassed(effectId, bypassed) {
|
|
318
|
-
this._effectsEditor().
|
|
318
|
+
this._effectsEditor().setTrackEffectBypassed(this.trackId, effectId, bypassed);
|
|
319
319
|
}
|
|
320
320
|
moveEffect(effectId, newIndex) {
|
|
321
|
-
this._effectsEditor().
|
|
321
|
+
this._effectsEditor().moveTrackEffect(this.trackId, effectId, newIndex);
|
|
322
322
|
}
|
|
323
323
|
get effects() {
|
|
324
324
|
const editor = this.closest("daw-editor");
|
|
325
|
-
return editor?.
|
|
325
|
+
return editor?.trackEffects(this.trackId) ?? [];
|
|
326
326
|
}
|
|
327
327
|
_effectsEditor() {
|
|
328
328
|
const editor = this.closest("daw-editor");
|
|
@@ -6129,38 +6129,92 @@ var DawEditorElement = class extends import_lit15.LitElement {
|
|
|
6129
6129
|
duration: this._duration,
|
|
6130
6130
|
tracks: [...this._engineTracks.values()],
|
|
6131
6131
|
getMasterEffectsState: () => this.getEffectsState(),
|
|
6132
|
-
getTrackEffectsState: (trackId) => this.
|
|
6132
|
+
getTrackEffectsState: (trackId) => this.getTrackEffectsState(trackId)
|
|
6133
6133
|
},
|
|
6134
6134
|
options
|
|
6135
6135
|
);
|
|
6136
6136
|
}
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6137
|
+
// --- Per-track effects API (public, keyed by trackId) ---
|
|
6138
|
+
// Mirrors the master-chain methods above and the <daw-track> element methods,
|
|
6139
|
+
// but addresses a track by id so element-less tracks (drag-dropped, or
|
|
6140
|
+
// programmatic tracks the consumer doesn't hold an element for) can carry
|
|
6141
|
+
// their own insert chain. Effect events dispatch from the track's <daw-track>
|
|
6142
|
+
// element when one exists, else from the editor (see _trackEventTarget).
|
|
6143
|
+
/** Add a native registry effect to a track's chain. */
|
|
6144
|
+
addTrackEffect(trackId, type, params) {
|
|
6145
|
+
return this._effects.addTrackEffect(trackId, this._trackEventTarget(trackId), type, params);
|
|
6146
|
+
}
|
|
6147
|
+
/** Snapshot of a track's effect chain (empty array for an unknown track). */
|
|
6148
|
+
trackEffects(trackId) {
|
|
6149
|
+
return this._effectsManager?.trackEffects(trackId) ?? [];
|
|
6140
6150
|
}
|
|
6141
|
-
|
|
6142
|
-
this._effects.trackOp(trackId,
|
|
6151
|
+
removeTrackEffect(trackId, effectId) {
|
|
6152
|
+
this._effects.trackOp(trackId, this._trackEventTarget(trackId), "remove", effectId);
|
|
6143
6153
|
}
|
|
6144
|
-
|
|
6145
|
-
|
|
6154
|
+
setTrackEffectParams(trackId, effectId, params) {
|
|
6155
|
+
this._effects.trackOp(trackId, this._trackEventTarget(trackId), "setParams", effectId, params);
|
|
6146
6156
|
}
|
|
6147
|
-
|
|
6148
|
-
|
|
6157
|
+
setTrackEffectBypassed(trackId, effectId, bypassed) {
|
|
6158
|
+
this._effects.trackOp(
|
|
6159
|
+
trackId,
|
|
6160
|
+
this._trackEventTarget(trackId),
|
|
6161
|
+
"setBypassed",
|
|
6162
|
+
effectId,
|
|
6163
|
+
bypassed
|
|
6164
|
+
);
|
|
6149
6165
|
}
|
|
6150
|
-
|
|
6151
|
-
|
|
6166
|
+
moveTrackEffect(trackId, effectId, newIndex) {
|
|
6167
|
+
this._effects.trackOp(trackId, this._trackEventTarget(trackId), "move", effectId, newIndex);
|
|
6152
6168
|
}
|
|
6153
|
-
|
|
6154
|
-
|
|
6169
|
+
/** Load a WAM plugin (via the optional @dawcore/wam peer) into a track's chain. */
|
|
6170
|
+
addTrackWamPlugin(trackId, url, initialState) {
|
|
6171
|
+
return this._effects.addTrackWamPlugin(
|
|
6172
|
+
trackId,
|
|
6173
|
+
this._trackEventTarget(trackId),
|
|
6174
|
+
url,
|
|
6175
|
+
initialState
|
|
6176
|
+
);
|
|
6177
|
+
}
|
|
6178
|
+
/** Compile Faust DSP (via the optional @dawcore/faust peer) into a track's chain. */
|
|
6179
|
+
addTrackFaustEffect(trackId, dspCode, options) {
|
|
6180
|
+
return this._effects.addTrackFaustEffect(
|
|
6181
|
+
trackId,
|
|
6182
|
+
this._trackEventTarget(trackId),
|
|
6183
|
+
dspCode,
|
|
6184
|
+
options
|
|
6185
|
+
);
|
|
6186
|
+
}
|
|
6187
|
+
/** Open (lazily creating) the GUI for a track-chain effect into a container. */
|
|
6188
|
+
openTrackEffectGui(trackId, effectId, container) {
|
|
6189
|
+
return this._effects.openTrackEffectGui(
|
|
6190
|
+
trackId,
|
|
6191
|
+
this._trackEventTarget(trackId),
|
|
6192
|
+
effectId,
|
|
6193
|
+
container
|
|
6194
|
+
);
|
|
6155
6195
|
}
|
|
6156
|
-
|
|
6196
|
+
/** Hide a track-chain effect's GUI (cached for reopen — never destroys). */
|
|
6197
|
+
closeTrackEffectGui(_trackId, effectId) {
|
|
6157
6198
|
this._effects.closeEffectGui(effectId);
|
|
6158
6199
|
}
|
|
6159
|
-
|
|
6200
|
+
/** Snapshot a track's chain in its persisted form (see dawcore README). */
|
|
6201
|
+
getTrackEffectsState(trackId) {
|
|
6160
6202
|
return this._effectsManager?.getTrackEffectsState(trackId) ?? Promise.resolve([]);
|
|
6161
6203
|
}
|
|
6162
|
-
|
|
6163
|
-
|
|
6204
|
+
/** Replace a track's chain from a persisted snapshot. */
|
|
6205
|
+
setTrackEffectsState(trackId, entries) {
|
|
6206
|
+
return this._effects.setTrackEffectsState(trackId, this._trackEventTarget(trackId), entries);
|
|
6207
|
+
}
|
|
6208
|
+
/**
|
|
6209
|
+
* Event-dispatch source for a per-track effect op: the track's `<daw-track>`
|
|
6210
|
+
* element when one exists (so `daw-effect-*` bubble from it exactly as the
|
|
6211
|
+
* element-method path does), else the editor itself for element-less tracks
|
|
6212
|
+
* (drag-dropped / programmatic). Reads the `_trackElements` index the editor
|
|
6213
|
+
* already maintains across the track connect/remove lifecycle — O(1), and the
|
|
6214
|
+
* same resolution `removeTrack` uses — rather than re-querying the DOM per op.
|
|
6215
|
+
*/
|
|
6216
|
+
_trackEventTarget(trackId) {
|
|
6217
|
+
return this._trackElements.get(trackId) ?? this;
|
|
6164
6218
|
}
|
|
6165
6219
|
get audioContext() {
|
|
6166
6220
|
if (!this._externalAdapter) {
|
|
@@ -6271,7 +6325,10 @@ var DawEditorElement = class extends import_lit15.LitElement {
|
|
|
6271
6325
|
this._selectedTrackId = trackId;
|
|
6272
6326
|
}
|
|
6273
6327
|
get tracks() {
|
|
6274
|
-
return [...this._tracks.
|
|
6328
|
+
return [...this._tracks.entries()].map(([trackId, descriptor]) => ({
|
|
6329
|
+
trackId,
|
|
6330
|
+
...descriptor
|
|
6331
|
+
}));
|
|
6275
6332
|
}
|
|
6276
6333
|
get selectedTrackId() {
|
|
6277
6334
|
return this._selectedTrackId;
|
|
@@ -6409,6 +6466,7 @@ var DawEditorElement = class extends import_lit15.LitElement {
|
|
|
6409
6466
|
}
|
|
6410
6467
|
}
|
|
6411
6468
|
_onTrackRemoved(trackId) {
|
|
6469
|
+
const existed = this._tracks.has(trackId);
|
|
6412
6470
|
this._trackElements.delete(trackId);
|
|
6413
6471
|
this._effectsManager?.disposeTrackChain(trackId);
|
|
6414
6472
|
const removedTrack = this._engineTracks.get(trackId);
|
|
@@ -6438,6 +6496,15 @@ var DawEditorElement = class extends import_lit15.LitElement {
|
|
|
6438
6496
|
this._currentTime = 0;
|
|
6439
6497
|
this._stopPlayhead();
|
|
6440
6498
|
}
|
|
6499
|
+
if (existed && this.isConnected) {
|
|
6500
|
+
this.dispatchEvent(
|
|
6501
|
+
new CustomEvent("daw-track-removed", {
|
|
6502
|
+
bubbles: true,
|
|
6503
|
+
composed: true,
|
|
6504
|
+
detail: { trackId }
|
|
6505
|
+
})
|
|
6506
|
+
);
|
|
6507
|
+
}
|
|
6441
6508
|
}
|
|
6442
6509
|
/** Drop the controller when no spectrogram tracks remain. */
|
|
6443
6510
|
_disposeSpectrogramControllerIfEmpty() {
|