@waveform-playlist/browser 13.0.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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +36 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -15
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) => {
|