@dawcore/spectrogram 0.0.9-next.3 → 0.0.9-next.5
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 +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -0
- package/dist/index.mjs.map +1 -1
- package/dist/orchestrator/index.d.mts +9 -0
- package/dist/orchestrator/index.mjs +9 -0
- package/dist/orchestrator/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3557,6 +3557,7 @@ function createSpectrogramWorker(worker) {
|
|
|
3557
3557
|
worker.postMessage({ type: "unregister-canvas", canvasId });
|
|
3558
3558
|
},
|
|
3559
3559
|
registerAudioData(clipId, channelDataArrays, sampleRate) {
|
|
3560
|
+
if (terminated) return;
|
|
3560
3561
|
const transferableArrays = channelDataArrays.map((arr) => arr.slice());
|
|
3561
3562
|
const transferables = transferableArrays.map((arr) => arr.buffer);
|
|
3562
3563
|
worker.postMessage(
|
|
@@ -3566,11 +3567,16 @@ function createSpectrogramWorker(worker) {
|
|
|
3566
3567
|
registeredClipIds.add(clipId);
|
|
3567
3568
|
},
|
|
3568
3569
|
unregisterAudioData(clipId) {
|
|
3570
|
+
if (terminated) return;
|
|
3569
3571
|
worker.postMessage({ type: "unregister-audio-data", clipId });
|
|
3570
3572
|
registeredClipIds.delete(clipId);
|
|
3571
3573
|
},
|
|
3574
|
+
registeredAudioClipIds() {
|
|
3575
|
+
return [...registeredClipIds];
|
|
3576
|
+
},
|
|
3572
3577
|
terminate() {
|
|
3573
3578
|
terminated = true;
|
|
3579
|
+
registeredClipIds.clear();
|
|
3574
3580
|
worker.terminate();
|
|
3575
3581
|
for (const [, entry] of pending) {
|
|
3576
3582
|
entry.reject(new Error("Worker terminated"));
|
|
@@ -3729,6 +3735,9 @@ function createSpectrogramWorkerPool(createWorker, poolSize = defaultPoolSize())
|
|
|
3729
3735
|
w.unregisterAudioData(clipId);
|
|
3730
3736
|
}
|
|
3731
3737
|
},
|
|
3738
|
+
registeredAudioClipIds() {
|
|
3739
|
+
return [...registeredAudio.keys()];
|
|
3740
|
+
},
|
|
3732
3741
|
terminate() {
|
|
3733
3742
|
terminated = true;
|
|
3734
3743
|
registeredAudio.clear();
|