@dawcore/spectrogram 0.0.2 → 0.0.3
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 +34 -26
- package/dist/index.d.ts +34 -26
- package/dist/index.js +150 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +150 -34
- package/dist/index.mjs.map +1 -1
- package/dist/orchestrator/index.d.mts +34 -26
- package/dist/orchestrator/index.mjs +150 -34
- package/dist/orchestrator/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -66,10 +66,10 @@ interface CanvasMeta {
|
|
|
66
66
|
widthPx: number;
|
|
67
67
|
}
|
|
68
68
|
interface ViewportBounds {
|
|
69
|
-
visibleStartPx: number;
|
|
70
|
-
visibleEndPx: number;
|
|
71
|
-
bufferStartPx: number;
|
|
72
|
-
bufferEndPx: number;
|
|
69
|
+
readonly visibleStartPx: number;
|
|
70
|
+
readonly visibleEndPx: number;
|
|
71
|
+
readonly bufferStartPx: number;
|
|
72
|
+
readonly bufferEndPx: number;
|
|
73
73
|
}
|
|
74
74
|
interface ClassifiedTiers<T extends CanvasMeta> {
|
|
75
75
|
viewport: T[];
|
|
@@ -79,33 +79,33 @@ interface ClassifiedTiers<T extends CanvasMeta> {
|
|
|
79
79
|
declare function classifyViewport<T extends CanvasMeta>(canvases: T[], bounds: ViewportBounds): ClassifiedTiers<T>;
|
|
80
80
|
|
|
81
81
|
interface SpectrogramOrchestratorOptions {
|
|
82
|
-
workerFactory: () => Worker;
|
|
83
|
-
workerPoolSize?: number;
|
|
84
|
-
config: SpectrogramConfig;
|
|
85
|
-
colorMap?: ColorMapValue;
|
|
86
|
-
devicePixelRatio?: number;
|
|
82
|
+
readonly workerFactory: () => Worker;
|
|
83
|
+
readonly workerPoolSize?: number;
|
|
84
|
+
readonly config: SpectrogramConfig;
|
|
85
|
+
readonly colorMap?: ColorMapValue;
|
|
86
|
+
readonly devicePixelRatio?: number;
|
|
87
87
|
}
|
|
88
88
|
interface ClipRegistration {
|
|
89
|
-
clipId: string;
|
|
90
|
-
trackId: string;
|
|
91
|
-
channelData: Float32Array
|
|
92
|
-
sampleRate: number;
|
|
93
|
-
durationSamples: number;
|
|
94
|
-
offsetSamples: number;
|
|
89
|
+
readonly clipId: string;
|
|
90
|
+
readonly trackId: string;
|
|
91
|
+
readonly channelData: ReadonlyArray<Float32Array>;
|
|
92
|
+
readonly sampleRate: number;
|
|
93
|
+
readonly durationSamples: number;
|
|
94
|
+
readonly offsetSamples: number;
|
|
95
95
|
}
|
|
96
96
|
interface CanvasRegistration {
|
|
97
|
-
canvasId: string;
|
|
98
|
-
canvas: OffscreenCanvas;
|
|
99
|
-
clipId: string;
|
|
100
|
-
trackId: string;
|
|
101
|
-
channelIndex: number;
|
|
102
|
-
chunkIndex: number;
|
|
103
|
-
globalPixelOffset: number;
|
|
104
|
-
widthPx: number;
|
|
105
|
-
heightPx: number;
|
|
97
|
+
readonly canvasId: string;
|
|
98
|
+
readonly canvas: OffscreenCanvas;
|
|
99
|
+
readonly clipId: string;
|
|
100
|
+
readonly trackId: string;
|
|
101
|
+
readonly channelIndex: number;
|
|
102
|
+
readonly chunkIndex: number;
|
|
103
|
+
readonly globalPixelOffset: number;
|
|
104
|
+
readonly widthPx: number;
|
|
105
|
+
readonly heightPx: number;
|
|
106
106
|
}
|
|
107
107
|
interface ViewportState extends ViewportBounds {
|
|
108
|
-
samplesPerPixel: number;
|
|
108
|
+
readonly samplesPerPixel: number;
|
|
109
109
|
}
|
|
110
110
|
interface ClipEntry {
|
|
111
111
|
trackId: string;
|
|
@@ -152,8 +152,16 @@ declare class SpectrogramOrchestrator extends EventTarget {
|
|
|
152
152
|
protected yieldUntilIdle(): Promise<void>;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
/**
|
|
156
|
+
* `viewport-ready` fires at most once per `(generation, trackId)` pair after
|
|
157
|
+
* the viewport-tier FFT completes. Generation bumps (setViewport with a real
|
|
158
|
+
* change, setConfig, setColorMap, setDevicePixelRatio) reset the dispatched-set
|
|
159
|
+
* so the event re-fires on the next render. The `generation` field lets
|
|
160
|
+
* consumers correlate ready events to their own state.
|
|
161
|
+
*/
|
|
155
162
|
interface ViewportReadyDetail {
|
|
156
|
-
trackId: string;
|
|
163
|
+
readonly trackId: string;
|
|
164
|
+
readonly generation: number;
|
|
157
165
|
}
|
|
158
166
|
|
|
159
167
|
interface ChunkLike {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/orchestrator/SpectrogramOrchestrator.ts
|
|
2
|
+
import { SPECTROGRAM_DEFAULTS, DEFAULT_SPECTROGRAM_COLOR_MAP } from "@waveform-playlist/core";
|
|
3
|
+
|
|
1
4
|
// src/worker/createSpectrogramWorker.ts
|
|
2
5
|
var SpectrogramAbortError = class extends Error {
|
|
3
6
|
constructor() {
|
|
@@ -38,11 +41,19 @@ function createSpectrogramWorker(worker) {
|
|
|
38
41
|
};
|
|
39
42
|
worker.onerror = (e) => {
|
|
40
43
|
terminated = true;
|
|
41
|
-
|
|
42
|
-
|
|
44
|
+
console.error(
|
|
45
|
+
"[dawcore-spectrogram] worker crashed with " + pending.size + " pending operations: " + (e.message || "unknown error")
|
|
46
|
+
);
|
|
47
|
+
for (const [id, entry] of pending) {
|
|
48
|
+
entry.reject(new Error("Worker crashed (id=" + id + "): " + (e.message || "unknown error")));
|
|
43
49
|
}
|
|
44
50
|
pending.clear();
|
|
45
51
|
};
|
|
52
|
+
worker.onmessageerror = (e) => {
|
|
53
|
+
console.warn(
|
|
54
|
+
"[dawcore-spectrogram] worker postMessage clone failure: " + (e.data ? JSON.stringify(e.data) : "no data")
|
|
55
|
+
);
|
|
56
|
+
};
|
|
46
57
|
return {
|
|
47
58
|
computeFFT(params, generation = 0) {
|
|
48
59
|
if (terminated) return Promise.reject(new Error("Worker terminated"));
|
|
@@ -134,28 +145,45 @@ function createSpectrogramWorker(worker) {
|
|
|
134
145
|
// src/worker/createSpectrogramWorkerPool.ts
|
|
135
146
|
function parseChannelFromCanvasId(canvasId) {
|
|
136
147
|
const match = canvasId.match(/-ch(\d+)-/);
|
|
137
|
-
|
|
148
|
+
if (!match) {
|
|
149
|
+
console.warn(
|
|
150
|
+
"[dawcore-spectrogram] canvas ID missing -ch{N}- segment, routing to worker 0: " + canvasId
|
|
151
|
+
);
|
|
152
|
+
return 0;
|
|
153
|
+
}
|
|
154
|
+
return parseInt(match[1], 10);
|
|
138
155
|
}
|
|
139
156
|
function defaultPoolSize() {
|
|
140
157
|
return 2;
|
|
141
158
|
}
|
|
142
159
|
function createSpectrogramWorkerPool(createWorker, poolSize = defaultPoolSize()) {
|
|
143
160
|
const workers = [];
|
|
161
|
+
let failedAt = -1;
|
|
144
162
|
try {
|
|
145
163
|
for (let i = 0; i < poolSize; i++) {
|
|
164
|
+
failedAt = i;
|
|
146
165
|
workers.push(createSpectrogramWorker(createWorker()));
|
|
147
166
|
}
|
|
167
|
+
failedAt = -1;
|
|
148
168
|
} catch (err) {
|
|
149
169
|
for (const w of workers) {
|
|
150
|
-
|
|
170
|
+
try {
|
|
171
|
+
w.terminate();
|
|
172
|
+
} catch (terminateErr) {
|
|
173
|
+
console.warn(
|
|
174
|
+
"[dawcore-spectrogram] pool constructor cleanup: terminate failed for worker \u2014 " + String(terminateErr)
|
|
175
|
+
);
|
|
176
|
+
}
|
|
151
177
|
}
|
|
152
|
-
throw
|
|
178
|
+
throw new Error(
|
|
179
|
+
"Failed to create spectrogram worker pool (size=" + poolSize + ") at worker " + failedAt + ": " + (err instanceof Error ? err.message : String(err))
|
|
180
|
+
);
|
|
153
181
|
}
|
|
154
182
|
function getWorkerForChannel(channelIndex) {
|
|
155
183
|
return workers[channelIndex % workers.length];
|
|
156
184
|
}
|
|
157
185
|
return {
|
|
158
|
-
computeFFT(params, generation = 0) {
|
|
186
|
+
async computeFFT(params, generation = 0) {
|
|
159
187
|
if (params.mono) {
|
|
160
188
|
return workers[0].computeFFT(params, generation);
|
|
161
189
|
}
|
|
@@ -164,7 +192,17 @@ function createSpectrogramWorkerPool(createWorker, poolSize = defaultPoolSize())
|
|
|
164
192
|
const promises = activeWorkers.map(
|
|
165
193
|
(w, i) => w.computeFFT({ ...params, channelFilter: i }, generation)
|
|
166
194
|
);
|
|
167
|
-
|
|
195
|
+
const settled = await Promise.allSettled(promises);
|
|
196
|
+
const failures = settled.filter((s) => s.status === "rejected");
|
|
197
|
+
if (failures.length > 0) {
|
|
198
|
+
for (let i = 1; i < failures.length; i++) {
|
|
199
|
+
console.warn(
|
|
200
|
+
"[dawcore-spectrogram] additional channel FFT failure (" + i + "): " + (failures[i].reason instanceof Error ? failures[i].reason.message : String(failures[i].reason))
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
throw failures[0].reason;
|
|
204
|
+
}
|
|
205
|
+
return settled[0].value;
|
|
168
206
|
},
|
|
169
207
|
renderChunks(params, generation = 0) {
|
|
170
208
|
const worker = getWorkerForChannel(params.channelIndex);
|
|
@@ -3419,36 +3457,55 @@ var SpectrogramOrchestrator = class extends EventTarget {
|
|
|
3419
3457
|
this.disposed = false;
|
|
3420
3458
|
this.renderInFlight = false;
|
|
3421
3459
|
// Tracks which trackIds have already emitted `viewport-ready` for the
|
|
3422
|
-
// current generation. Cleared on every generation bump (setViewport
|
|
3423
|
-
// setConfig
|
|
3424
|
-
//
|
|
3425
|
-
// loading — would re-fire the
|
|
3460
|
+
// current generation. Cleared on every generation bump (setViewport with a
|
|
3461
|
+
// real change, setConfig, setColorMap, setDevicePixelRatio) AND in dispose().
|
|
3462
|
+
// Without this, every render — including those triggered by late
|
|
3463
|
+
// `registerCanvas` calls during track-by-track loading — would re-fire the
|
|
3464
|
+
// event for every track in the canvas map (N×N-ish ascending fan-in:
|
|
3465
|
+
// 3 tracks → 4+3+2+1 = 10 events; the dedup reduces this to 3).
|
|
3426
3466
|
this.readyDispatched = /* @__PURE__ */ new Set();
|
|
3427
3467
|
const poolSize = opts.workerPoolSize ?? 2;
|
|
3428
3468
|
this.pool = createSpectrogramWorkerPool(opts.workerFactory, poolSize);
|
|
3429
3469
|
this.config = opts.config;
|
|
3430
|
-
this.colorMap = opts.colorMap ??
|
|
3470
|
+
this.colorMap = opts.colorMap ?? DEFAULT_SPECTROGRAM_COLOR_MAP;
|
|
3431
3471
|
this.devicePixelRatio = opts.devicePixelRatio ?? (typeof window !== "undefined" ? window.devicePixelRatio : 1);
|
|
3432
3472
|
}
|
|
3433
3473
|
registerClip(reg) {
|
|
3434
3474
|
if (this.disposed) return;
|
|
3475
|
+
const channelData = [...reg.channelData];
|
|
3435
3476
|
this.clips.set(reg.clipId, {
|
|
3436
3477
|
trackId: reg.trackId,
|
|
3437
|
-
channelData
|
|
3478
|
+
channelData,
|
|
3438
3479
|
sampleRate: reg.sampleRate,
|
|
3439
3480
|
durationSamples: reg.durationSamples,
|
|
3440
3481
|
offsetSamples: reg.offsetSamples
|
|
3441
3482
|
});
|
|
3442
|
-
this.pool.registerAudioData(reg.clipId,
|
|
3483
|
+
this.pool.registerAudioData(reg.clipId, channelData, reg.sampleRate);
|
|
3484
|
+
if (this.viewport) {
|
|
3485
|
+
for (const canvas of this.canvases.values()) {
|
|
3486
|
+
if (canvas.clipId === reg.clipId) {
|
|
3487
|
+
this.scheduleRender();
|
|
3488
|
+
break;
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
}
|
|
3443
3492
|
}
|
|
3444
3493
|
unregisterClip(clipId) {
|
|
3445
3494
|
if (this.disposed) return;
|
|
3446
|
-
if (!this.clips.has(clipId))
|
|
3495
|
+
if (!this.clips.has(clipId)) {
|
|
3496
|
+
console.warn("[dawcore-spectrogram] unregisterClip: unknown clip " + clipId);
|
|
3497
|
+
return;
|
|
3498
|
+
}
|
|
3447
3499
|
this.clips.delete(clipId);
|
|
3448
3500
|
this.pool.unregisterAudioData(clipId);
|
|
3449
3501
|
}
|
|
3450
3502
|
registerCanvas(reg) {
|
|
3451
|
-
if (this.disposed)
|
|
3503
|
+
if (this.disposed) {
|
|
3504
|
+
console.warn(
|
|
3505
|
+
"[dawcore-spectrogram] registerCanvas after dispose \u2014 canvas " + reg.canvasId + " will not render (OffscreenCanvas is now dead)"
|
|
3506
|
+
);
|
|
3507
|
+
return;
|
|
3508
|
+
}
|
|
3452
3509
|
this.canvases.set(reg.canvasId, {
|
|
3453
3510
|
canvasId: reg.canvasId,
|
|
3454
3511
|
globalPixelOffset: reg.globalPixelOffset,
|
|
@@ -3464,12 +3521,21 @@ var SpectrogramOrchestrator = class extends EventTarget {
|
|
|
3464
3521
|
}
|
|
3465
3522
|
unregisterCanvas(canvasId) {
|
|
3466
3523
|
if (this.disposed) return;
|
|
3467
|
-
if (!this.canvases.has(canvasId))
|
|
3524
|
+
if (!this.canvases.has(canvasId)) {
|
|
3525
|
+
console.warn("[dawcore-spectrogram] unregisterCanvas: unknown canvas " + canvasId);
|
|
3526
|
+
return;
|
|
3527
|
+
}
|
|
3468
3528
|
this.canvases.delete(canvasId);
|
|
3469
3529
|
this.pool.unregisterCanvas(canvasId);
|
|
3470
3530
|
}
|
|
3471
3531
|
setViewport(state) {
|
|
3472
3532
|
if (this.disposed) return;
|
|
3533
|
+
if (!Number.isFinite(state.visibleStartPx) || !Number.isFinite(state.visibleEndPx) || !Number.isFinite(state.bufferStartPx) || !Number.isFinite(state.bufferEndPx) || !Number.isFinite(state.samplesPerPixel) || state.samplesPerPixel <= 0 || state.visibleStartPx > state.visibleEndPx || state.bufferStartPx > state.bufferEndPx) {
|
|
3534
|
+
console.warn(
|
|
3535
|
+
"[dawcore-spectrogram] setViewport: invalid state \u2014 ignored (" + JSON.stringify(state) + ")"
|
|
3536
|
+
);
|
|
3537
|
+
return;
|
|
3538
|
+
}
|
|
3473
3539
|
if (this.viewport && viewportsEqual(this.viewport, state)) return;
|
|
3474
3540
|
const prevGeneration = this.generation;
|
|
3475
3541
|
this.generation += 1;
|
|
@@ -3498,7 +3564,20 @@ var SpectrogramOrchestrator = class extends EventTarget {
|
|
|
3498
3564
|
this.scheduleRender();
|
|
3499
3565
|
}
|
|
3500
3566
|
setDevicePixelRatio(dpr) {
|
|
3567
|
+
if (this.disposed) return;
|
|
3568
|
+
if (!Number.isFinite(dpr) || dpr <= 0) {
|
|
3569
|
+
console.warn(
|
|
3570
|
+
"[dawcore-spectrogram] setDevicePixelRatio: invalid value " + dpr + " \u2014 ignored"
|
|
3571
|
+
);
|
|
3572
|
+
return;
|
|
3573
|
+
}
|
|
3574
|
+
if (this.devicePixelRatio === dpr) return;
|
|
3501
3575
|
this.devicePixelRatio = dpr;
|
|
3576
|
+
const prevGeneration = this.generation;
|
|
3577
|
+
this.generation += 1;
|
|
3578
|
+
this.readyDispatched.clear();
|
|
3579
|
+
this.pool.abortGeneration(prevGeneration);
|
|
3580
|
+
this.scheduleRender();
|
|
3502
3581
|
}
|
|
3503
3582
|
dispose() {
|
|
3504
3583
|
if (this.disposed) return;
|
|
@@ -3516,7 +3595,12 @@ var SpectrogramOrchestrator = class extends EventTarget {
|
|
|
3516
3595
|
this.renderInFlight = true;
|
|
3517
3596
|
queueMicrotask(() => {
|
|
3518
3597
|
this.renderInFlight = false;
|
|
3519
|
-
|
|
3598
|
+
this.runRender(this.generation).catch((err) => {
|
|
3599
|
+
if (err instanceof SpectrogramAbortError) return;
|
|
3600
|
+
console.warn(
|
|
3601
|
+
"[dawcore-spectrogram] runRender unhandled rejection (generation " + this.generation + "): " + (err instanceof Error ? err.message : String(err))
|
|
3602
|
+
);
|
|
3603
|
+
});
|
|
3520
3604
|
});
|
|
3521
3605
|
}
|
|
3522
3606
|
async runRender(generation) {
|
|
@@ -3530,16 +3614,34 @@ var SpectrogramOrchestrator = class extends EventTarget {
|
|
|
3530
3614
|
canvasesByTrack.set(c.trackId, list);
|
|
3531
3615
|
}
|
|
3532
3616
|
for (const [trackId, trackCanvases] of canvasesByTrack) {
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
this.readyDispatched.
|
|
3538
|
-
|
|
3617
|
+
try {
|
|
3618
|
+
const tiers = classifyViewport(trackCanvases, viewport);
|
|
3619
|
+
await this.renderTier(tiers.viewport, generation, viewport);
|
|
3620
|
+
if (this.generation !== generation || this.disposed) return;
|
|
3621
|
+
if (!this.readyDispatched.has(trackId)) {
|
|
3622
|
+
this.readyDispatched.add(trackId);
|
|
3623
|
+
this.dispatchEvent(
|
|
3624
|
+
new CustomEvent("viewport-ready", { detail: { trackId, generation } })
|
|
3625
|
+
);
|
|
3626
|
+
}
|
|
3627
|
+
await this.renderTier(tiers.buffer, generation, viewport);
|
|
3628
|
+
if (this.generation !== generation || this.disposed) return;
|
|
3629
|
+
await this.renderRemainingViaIdle(tiers.remaining, generation, viewport);
|
|
3630
|
+
} catch (err) {
|
|
3631
|
+
if (this.generation !== generation || this.disposed) return;
|
|
3632
|
+
if (err instanceof SpectrogramAbortError) {
|
|
3633
|
+
return;
|
|
3634
|
+
}
|
|
3635
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
3636
|
+
console.warn(
|
|
3637
|
+
"[dawcore-spectrogram] render failed for track " + trackId + " (generation " + generation + "): " + error.message
|
|
3638
|
+
);
|
|
3639
|
+
this.dispatchEvent(
|
|
3640
|
+
new CustomEvent("viewport-error", {
|
|
3641
|
+
detail: { trackId, generation, error }
|
|
3642
|
+
})
|
|
3643
|
+
);
|
|
3539
3644
|
}
|
|
3540
|
-
await this.renderTier(tiers.buffer, generation, viewport);
|
|
3541
|
-
if (this.generation !== generation || this.disposed) return;
|
|
3542
|
-
await this.renderRemainingViaIdle(tiers.remaining, generation, viewport);
|
|
3543
3645
|
}
|
|
3544
3646
|
}
|
|
3545
3647
|
async renderTier(canvases, generation, viewport) {
|
|
@@ -3554,8 +3656,13 @@ var SpectrogramOrchestrator = class extends EventTarget {
|
|
|
3554
3656
|
if (group.length === 0) return;
|
|
3555
3657
|
const first = group[0];
|
|
3556
3658
|
const clip = this.clips.get(first.clipId);
|
|
3557
|
-
if (!clip)
|
|
3558
|
-
|
|
3659
|
+
if (!clip) {
|
|
3660
|
+
console.warn(
|
|
3661
|
+
"[dawcore-spectrogram] renderGroup: no clip audio for " + first.clipId + " (canvas " + first.canvasId + ") \u2014 canvas will stay black until registerClip is called"
|
|
3662
|
+
);
|
|
3663
|
+
return;
|
|
3664
|
+
}
|
|
3665
|
+
const fftSize = this.config.fftSize ?? SPECTROGRAM_DEFAULTS.fftSize;
|
|
3559
3666
|
const startPx = Math.min(...group.map((c) => c.globalPixelOffset));
|
|
3560
3667
|
const endPx = Math.max(...group.map((c) => c.globalPixelOffset + c.widthPx));
|
|
3561
3668
|
const startSample = clip.offsetSamples + Math.floor(startPx * viewport.samplesPerPixel);
|
|
@@ -3590,11 +3697,11 @@ var SpectrogramOrchestrator = class extends EventTarget {
|
|
|
3590
3697
|
devicePixelRatio: this.devicePixelRatio,
|
|
3591
3698
|
samplesPerPixel: viewport.samplesPerPixel,
|
|
3592
3699
|
colorLUT,
|
|
3593
|
-
frequencyScale: String(this.config.frequencyScale ??
|
|
3594
|
-
minFrequency: this.config.minFrequency ??
|
|
3700
|
+
frequencyScale: String(this.config.frequencyScale ?? SPECTROGRAM_DEFAULTS.frequencyScale),
|
|
3701
|
+
minFrequency: this.config.minFrequency ?? SPECTROGRAM_DEFAULTS.minFrequency,
|
|
3595
3702
|
maxFrequency: this.config.maxFrequency ?? clip.sampleRate / 2,
|
|
3596
|
-
gainDb: this.config.gainDb ??
|
|
3597
|
-
rangeDb: this.config.rangeDb ??
|
|
3703
|
+
gainDb: this.config.gainDb ?? SPECTROGRAM_DEFAULTS.gainDb,
|
|
3704
|
+
rangeDb: this.config.rangeDb ?? SPECTROGRAM_DEFAULTS.rangeDb,
|
|
3598
3705
|
channelIndex: first.channelIndex
|
|
3599
3706
|
},
|
|
3600
3707
|
generation
|
|
@@ -3607,7 +3714,16 @@ var SpectrogramOrchestrator = class extends EventTarget {
|
|
|
3607
3714
|
if (this.generation !== generation || this.disposed) return;
|
|
3608
3715
|
await this.yieldUntilIdle();
|
|
3609
3716
|
if (this.generation !== generation || this.disposed) return;
|
|
3610
|
-
|
|
3717
|
+
try {
|
|
3718
|
+
await this.renderGroup(group, generation, viewport);
|
|
3719
|
+
} catch (err) {
|
|
3720
|
+
if (this.generation !== generation || this.disposed) return;
|
|
3721
|
+
if (err instanceof SpectrogramAbortError) return;
|
|
3722
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
3723
|
+
console.warn(
|
|
3724
|
+
"[dawcore-spectrogram] remaining-tier render failed for canvas group: " + error.message
|
|
3725
|
+
);
|
|
3726
|
+
}
|
|
3611
3727
|
}
|
|
3612
3728
|
}
|
|
3613
3729
|
yieldUntilIdle() {
|