@waveform-playlist/browser 12.1.0 → 13.1.0
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 +23 -11
- package/dist/index.d.ts +23 -11
- package/dist/index.js +38 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -16
package/dist/index.mjs
CHANGED
|
@@ -238,6 +238,13 @@ function extractPeaksFromWaveformDataFull(waveformData, samplesPerPixel, isMono,
|
|
|
238
238
|
};
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
// src/soundFontSync.ts
|
|
242
|
+
import { isToneAdapter } from "@waveform-playlist/playout";
|
|
243
|
+
function syncSoundFontCacheToAdapter(adapter, cache) {
|
|
244
|
+
if (!isToneAdapter(adapter)) return;
|
|
245
|
+
adapter.setSoundFontCache(cache);
|
|
246
|
+
}
|
|
247
|
+
|
|
241
248
|
// src/hooks/useTimeFormat.ts
|
|
242
249
|
import { useState } from "react";
|
|
243
250
|
import {
|
|
@@ -3629,6 +3636,7 @@ var WaveformPlaylistProvider = ({
|
|
|
3629
3636
|
const [annotationsEditable, setAnnotationsEditable] = useState15((_c = annotationList == null ? void 0 : annotationList.editable) != null ? _c : false);
|
|
3630
3637
|
const [isReady, setIsReady] = useState15(false);
|
|
3631
3638
|
const engineRef = useRef15(null);
|
|
3639
|
+
const adapterRef = useRef15(null);
|
|
3632
3640
|
const audioInitializedRef = useRef15(false);
|
|
3633
3641
|
const isPlayingRef = useRef15(false);
|
|
3634
3642
|
isPlayingRef.current = isPlaying;
|
|
@@ -3857,6 +3865,7 @@ var WaveformPlaylistProvider = ({
|
|
|
3857
3865
|
if (engineRef.current) {
|
|
3858
3866
|
engineRef.current.dispose();
|
|
3859
3867
|
engineRef.current = null;
|
|
3868
|
+
adapterRef.current = null;
|
|
3860
3869
|
}
|
|
3861
3870
|
prevTracksRef.current = tracks;
|
|
3862
3871
|
return;
|
|
@@ -3911,6 +3920,7 @@ var WaveformPlaylistProvider = ({
|
|
|
3911
3920
|
engineTracksRef.current = null;
|
|
3912
3921
|
audioInitializedRef.current = false;
|
|
3913
3922
|
const adapter = createToneAdapter({ effects, soundFontCache: soundFontCacheRef.current });
|
|
3923
|
+
adapterRef.current = adapter;
|
|
3914
3924
|
const engine = new PlaylistEngine({
|
|
3915
3925
|
adapter,
|
|
3916
3926
|
samplesPerPixel: samplesPerPixelRef.current,
|
|
@@ -3979,6 +3989,7 @@ var WaveformPlaylistProvider = ({
|
|
|
3979
3989
|
stopAnimationFrameLoop();
|
|
3980
3990
|
if (engineRef.current) {
|
|
3981
3991
|
engineRef.current.dispose();
|
|
3992
|
+
adapterRef.current = null;
|
|
3982
3993
|
}
|
|
3983
3994
|
};
|
|
3984
3995
|
}, [
|
|
@@ -3989,6 +4000,9 @@ var WaveformPlaylistProvider = ({
|
|
|
3989
4000
|
// isPlaying is intentionally excluded — read from isPlayingRef inside the
|
|
3990
4001
|
// effect body. Including it causes a full engine+playout rebuild on every
|
|
3991
4002
|
// play/pause/stop, destroying and recreating all audio Players.
|
|
4003
|
+
// soundFontCache is deliberately excluded — late cache changes are forwarded
|
|
4004
|
+
// to the live adapter by the sync effect below; only adapter creation reads it
|
|
4005
|
+
// (via soundFontCacheRef).
|
|
3992
4006
|
onReady,
|
|
3993
4007
|
effects,
|
|
3994
4008
|
stopAnimationFrameLoop,
|
|
@@ -4006,9 +4020,11 @@ var WaveformPlaylistProvider = ({
|
|
|
4006
4020
|
loopEndRef,
|
|
4007
4021
|
isLoopEnabledRef,
|
|
4008
4022
|
stableZoomLevels,
|
|
4009
|
-
soundFontCache,
|
|
4010
4023
|
deferEngineRebuild
|
|
4011
4024
|
]);
|
|
4025
|
+
useEffect10(() => {
|
|
4026
|
+
syncSoundFontCacheToAdapter(adapterRef.current, soundFontCache);
|
|
4027
|
+
}, [soundFontCache]);
|
|
4012
4028
|
useEffect10(() => {
|
|
4013
4029
|
if (tracks.length === 0) return;
|
|
4014
4030
|
const allTrackPeaks = tracks.map((track) => {
|
|
@@ -5802,17 +5818,6 @@ var PlaylistVisualization = ({
|
|
|
5802
5818
|
});
|
|
5803
5819
|
return helpers;
|
|
5804
5820
|
}, [tracks, spectrogram]);
|
|
5805
|
-
const workerCanvasApi = useMemo6(() => {
|
|
5806
|
-
if (!(spectrogram == null ? void 0 : spectrogram.spectrogramWorkerApi)) return void 0;
|
|
5807
|
-
return {
|
|
5808
|
-
registerCanvas: spectrogram.spectrogramWorkerApi.registerCanvas.bind(
|
|
5809
|
-
spectrogram.spectrogramWorkerApi
|
|
5810
|
-
),
|
|
5811
|
-
unregisterCanvas: spectrogram.spectrogramWorkerApi.unregisterCanvas.bind(
|
|
5812
|
-
spectrogram.spectrogramWorkerApi
|
|
5813
|
-
)
|
|
5814
|
-
};
|
|
5815
|
-
}, [spectrogram == null ? void 0 : spectrogram.spectrogramWorkerApi]);
|
|
5816
5821
|
const [settingsModalTrackId, setSettingsModalTrackId] = useState17(null);
|
|
5817
5822
|
const [isSelecting, setIsSelecting] = useState17(false);
|
|
5818
5823
|
const mouseDownTimeRef = useRef20(0);
|
|
@@ -6178,16 +6183,9 @@ var PlaylistVisualization = ({
|
|
|
6178
6183
|
clipSampleRate: clip.sampleRate,
|
|
6179
6184
|
clipOffsetSeconds: clip.offsetSamples != null ? clip.offsetSamples / (clip.sampleRate || sampleRate) : 0,
|
|
6180
6185
|
samplesPerPixel,
|
|
6181
|
-
spectrogramWorkerApi: workerCanvasApi,
|
|
6182
6186
|
spectrogramClipId: clip.clipId,
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
clip.clipId,
|
|
6186
|
-
channelIndex,
|
|
6187
|
-
canvasIds,
|
|
6188
|
-
canvasWidths
|
|
6189
|
-
);
|
|
6190
|
-
} : void 0
|
|
6187
|
+
spectrogramOnCanvasRegister: spectrogram ? spectrogram.registerSpectrogramCanvas : void 0,
|
|
6188
|
+
spectrogramOnCanvasUnregister: spectrogram ? spectrogram.unregisterSpectrogramCanvas : void 0
|
|
6191
6189
|
},
|
|
6192
6190
|
`${clip.clipId}-${channelIndex}`
|
|
6193
6191
|
);
|