@waveform-playlist/browser 11.2.0 → 11.3.1

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 CHANGED
@@ -41,6 +41,15 @@ interface TrackState$1 {
41
41
  volume: number;
42
42
  pan: number;
43
43
  }
44
+ /** Per-frame data passed to registered animation callbacks. */
45
+ interface FrameData {
46
+ /** Raw engine time (for state/logic — NOT for visual positioning). */
47
+ readonly time: number;
48
+ /** time - outputLatency (for DOM positioning — matches speaker output). */
49
+ readonly visualTime: number;
50
+ readonly sampleRate: number;
51
+ readonly samplesPerPixel: number;
52
+ }
44
53
  interface PlaybackAnimationContextValue {
45
54
  isPlaying: boolean;
46
55
  currentTime: number;
@@ -49,6 +58,10 @@ interface PlaybackAnimationContextValue {
49
58
  audioStartPositionRef: React__default.RefObject<number>;
50
59
  /** Returns current playback time from engine (auto-wraps at loop boundaries). */
51
60
  getPlaybackTime: () => number;
61
+ /** Register a per-frame callback driven by the single animation loop. */
62
+ registerFrameCallback: (id: string, cb: (data: FrameData) => void) => void;
63
+ /** Unregister a per-frame callback. */
64
+ unregisterFrameCallback: (id: string) => void;
52
65
  }
53
66
  interface PlaylistStateContextValue {
54
67
  continuousPlay: boolean;
@@ -949,7 +962,7 @@ type TrackEffectsFunction = (graphEnd: unknown, destination: unknown, isOffline:
949
962
  interface ExportOptions extends WavEncoderOptions {
950
963
  /** Filename for download (without extension) */
951
964
  filename?: string;
952
- /** Export mode: 'master' for stereo mix, 'individual' for single track */
965
+ /** Export mode: 'master' for full mixdown, 'individual' for single track */
953
966
  mode?: 'master' | 'individual';
954
967
  /** Track index for individual export (only used when mode is 'individual') */
955
968
  trackIndex?: number;
@@ -958,8 +971,8 @@ interface ExportOptions extends WavEncoderOptions {
958
971
  /** Whether to apply effects (fades, etc.) - defaults to true */
959
972
  applyEffects?: boolean;
960
973
  /**
961
- * Optional Tone.js effects function for master effects. When provided, export will use Tone.Offline
962
- * to render through the effects chain. The function receives isOffline=true.
974
+ * Optional Tone.js effects function for master effects. When provided, export renders
975
+ * through the effects chain. The function receives isOffline=true.
963
976
  */
964
977
  effectsFunction?: EffectsFunction;
965
978
  /**
@@ -996,8 +1009,8 @@ interface TrackState {
996
1009
  pan: number;
997
1010
  }
998
1011
  /**
999
- * Hook for exporting the waveform playlist to WAV format
1000
- * Uses OfflineAudioContext for fast, non-real-time rendering
1012
+ * Hook for exporting the waveform playlist to WAV format.
1013
+ * Uses Tone.Offline for non-real-time rendering, mirroring the live playback graph.
1001
1014
  */
1002
1015
  declare function useExportWav(): UseExportWavReturn;
1003
1016
 
@@ -1174,7 +1187,7 @@ declare const TimeFormatSelect: React__default.FC<{
1174
1187
  }>;
1175
1188
  /**
1176
1189
  * Audio position display that uses the playlist context.
1177
- * Uses requestAnimationFrame for smooth 60fps updates during playback.
1190
+ * Updates via the shared animation frame registry — no own rAF loop.
1178
1191
  * Direct DOM manipulation avoids React re-renders.
1179
1192
  */
1180
1193
  declare const AudioPosition: React__default.FC<{
@@ -1811,4 +1824,4 @@ declare function getWaveformDataMetadata(src: string): Promise<{
1811
1824
  bits: 8 | 16;
1812
1825
  }>;
1813
1826
 
1814
- export { type ActiveEffect, type AnnotationIntegration, AnnotationIntegrationProvider, AudioPosition, type AudioTrackConfig, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionProvider, type ClipInteractionProviderProps, ContinuousPlayCheckbox, DownloadAnnotationsButton, EditableCheckbox, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, FastForwardButton, type GetAnnotationBoxLabelFn, KeyboardShortcuts, type KeyboardShortcutsProps, LinkEndpointsCheckbox, LoopButton, MasterVolumeControl, type MasterVolumeControls, type MediaElementAnimationContextValue, MediaElementAnnotationList, type MediaElementAnnotationListProps, type MediaElementControlsContextValue, type MediaElementDataContextValue, MediaElementPlaylist, type MediaElementPlaylistProps, MediaElementPlaylistProvider, type MediaElementStateContextValue, type MediaElementTrackConfig, MediaElementWaveform, type MediaElementWaveformProps, type OnAnnotationUpdateFn, type ParameterType, PauseButton, PlayButton, PlaylistAnnotationList, type PlaylistAnnotationListProps, PlaylistVisualization, type PlaylistVisualizationProps, RewindButton, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type TrackState$1 as TrackState, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, type UseTrackDynamicEffectsReturn, Waveform, WaveformPlaylistProvider, type WaveformProps, type WaveformTrack, type ZoomControls, ZoomInButton, ZoomOutButton, createEffectChain, createEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, noDropAnimationPlugins, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAudioTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useDragSensors, useDynamicEffects, useDynamicTracks, useExportWav, useKeyboardShortcuts, useMasterAnalyser, useMasterVolume, useMediaElementAnimation, useMediaElementControls, useMediaElementData, useMediaElementState, useOutputMeter, usePlaybackAnimation, usePlaybackShortcuts, usePlaylistControls, usePlaylistData, usePlaylistState, useSpectrogramIntegration, useTimeFormat, useTrackDynamicEffects, useZoomControls, waveformDataToPeaks };
1827
+ export { type ActiveEffect, type AnnotationIntegration, AnnotationIntegrationProvider, AudioPosition, type AudioTrackConfig, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionProvider, type ClipInteractionProviderProps, ContinuousPlayCheckbox, DownloadAnnotationsButton, EditableCheckbox, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, FastForwardButton, type FrameData, type GetAnnotationBoxLabelFn, KeyboardShortcuts, type KeyboardShortcutsProps, LinkEndpointsCheckbox, LoopButton, MasterVolumeControl, type MasterVolumeControls, type MediaElementAnimationContextValue, MediaElementAnnotationList, type MediaElementAnnotationListProps, type MediaElementControlsContextValue, type MediaElementDataContextValue, MediaElementPlaylist, type MediaElementPlaylistProps, MediaElementPlaylistProvider, type MediaElementStateContextValue, type MediaElementTrackConfig, MediaElementWaveform, type MediaElementWaveformProps, type OnAnnotationUpdateFn, type ParameterType, PauseButton, PlayButton, PlaylistAnnotationList, type PlaylistAnnotationListProps, PlaylistVisualization, type PlaylistVisualizationProps, RewindButton, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type TrackState$1 as TrackState, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, type UseTrackDynamicEffectsReturn, Waveform, WaveformPlaylistProvider, type WaveformProps, type WaveformTrack, type ZoomControls, ZoomInButton, ZoomOutButton, createEffectChain, createEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, noDropAnimationPlugins, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAudioTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useDragSensors, useDynamicEffects, useDynamicTracks, useExportWav, useKeyboardShortcuts, useMasterAnalyser, useMasterVolume, useMediaElementAnimation, useMediaElementControls, useMediaElementData, useMediaElementState, useOutputMeter, usePlaybackAnimation, usePlaybackShortcuts, usePlaylistControls, usePlaylistData, usePlaylistState, useSpectrogramIntegration, useTimeFormat, useTrackDynamicEffects, useZoomControls, waveformDataToPeaks };
package/dist/index.d.ts CHANGED
@@ -41,6 +41,15 @@ interface TrackState$1 {
41
41
  volume: number;
42
42
  pan: number;
43
43
  }
44
+ /** Per-frame data passed to registered animation callbacks. */
45
+ interface FrameData {
46
+ /** Raw engine time (for state/logic — NOT for visual positioning). */
47
+ readonly time: number;
48
+ /** time - outputLatency (for DOM positioning — matches speaker output). */
49
+ readonly visualTime: number;
50
+ readonly sampleRate: number;
51
+ readonly samplesPerPixel: number;
52
+ }
44
53
  interface PlaybackAnimationContextValue {
45
54
  isPlaying: boolean;
46
55
  currentTime: number;
@@ -49,6 +58,10 @@ interface PlaybackAnimationContextValue {
49
58
  audioStartPositionRef: React__default.RefObject<number>;
50
59
  /** Returns current playback time from engine (auto-wraps at loop boundaries). */
51
60
  getPlaybackTime: () => number;
61
+ /** Register a per-frame callback driven by the single animation loop. */
62
+ registerFrameCallback: (id: string, cb: (data: FrameData) => void) => void;
63
+ /** Unregister a per-frame callback. */
64
+ unregisterFrameCallback: (id: string) => void;
52
65
  }
53
66
  interface PlaylistStateContextValue {
54
67
  continuousPlay: boolean;
@@ -949,7 +962,7 @@ type TrackEffectsFunction = (graphEnd: unknown, destination: unknown, isOffline:
949
962
  interface ExportOptions extends WavEncoderOptions {
950
963
  /** Filename for download (without extension) */
951
964
  filename?: string;
952
- /** Export mode: 'master' for stereo mix, 'individual' for single track */
965
+ /** Export mode: 'master' for full mixdown, 'individual' for single track */
953
966
  mode?: 'master' | 'individual';
954
967
  /** Track index for individual export (only used when mode is 'individual') */
955
968
  trackIndex?: number;
@@ -958,8 +971,8 @@ interface ExportOptions extends WavEncoderOptions {
958
971
  /** Whether to apply effects (fades, etc.) - defaults to true */
959
972
  applyEffects?: boolean;
960
973
  /**
961
- * Optional Tone.js effects function for master effects. When provided, export will use Tone.Offline
962
- * to render through the effects chain. The function receives isOffline=true.
974
+ * Optional Tone.js effects function for master effects. When provided, export renders
975
+ * through the effects chain. The function receives isOffline=true.
963
976
  */
964
977
  effectsFunction?: EffectsFunction;
965
978
  /**
@@ -996,8 +1009,8 @@ interface TrackState {
996
1009
  pan: number;
997
1010
  }
998
1011
  /**
999
- * Hook for exporting the waveform playlist to WAV format
1000
- * Uses OfflineAudioContext for fast, non-real-time rendering
1012
+ * Hook for exporting the waveform playlist to WAV format.
1013
+ * Uses Tone.Offline for non-real-time rendering, mirroring the live playback graph.
1001
1014
  */
1002
1015
  declare function useExportWav(): UseExportWavReturn;
1003
1016
 
@@ -1174,7 +1187,7 @@ declare const TimeFormatSelect: React__default.FC<{
1174
1187
  }>;
1175
1188
  /**
1176
1189
  * Audio position display that uses the playlist context.
1177
- * Uses requestAnimationFrame for smooth 60fps updates during playback.
1190
+ * Updates via the shared animation frame registry — no own rAF loop.
1178
1191
  * Direct DOM manipulation avoids React re-renders.
1179
1192
  */
1180
1193
  declare const AudioPosition: React__default.FC<{
@@ -1811,4 +1824,4 @@ declare function getWaveformDataMetadata(src: string): Promise<{
1811
1824
  bits: 8 | 16;
1812
1825
  }>;
1813
1826
 
1814
- export { type ActiveEffect, type AnnotationIntegration, AnnotationIntegrationProvider, AudioPosition, type AudioTrackConfig, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionProvider, type ClipInteractionProviderProps, ContinuousPlayCheckbox, DownloadAnnotationsButton, EditableCheckbox, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, FastForwardButton, type GetAnnotationBoxLabelFn, KeyboardShortcuts, type KeyboardShortcutsProps, LinkEndpointsCheckbox, LoopButton, MasterVolumeControl, type MasterVolumeControls, type MediaElementAnimationContextValue, MediaElementAnnotationList, type MediaElementAnnotationListProps, type MediaElementControlsContextValue, type MediaElementDataContextValue, MediaElementPlaylist, type MediaElementPlaylistProps, MediaElementPlaylistProvider, type MediaElementStateContextValue, type MediaElementTrackConfig, MediaElementWaveform, type MediaElementWaveformProps, type OnAnnotationUpdateFn, type ParameterType, PauseButton, PlayButton, PlaylistAnnotationList, type PlaylistAnnotationListProps, PlaylistVisualization, type PlaylistVisualizationProps, RewindButton, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type TrackState$1 as TrackState, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, type UseTrackDynamicEffectsReturn, Waveform, WaveformPlaylistProvider, type WaveformProps, type WaveformTrack, type ZoomControls, ZoomInButton, ZoomOutButton, createEffectChain, createEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, noDropAnimationPlugins, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAudioTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useDragSensors, useDynamicEffects, useDynamicTracks, useExportWav, useKeyboardShortcuts, useMasterAnalyser, useMasterVolume, useMediaElementAnimation, useMediaElementControls, useMediaElementData, useMediaElementState, useOutputMeter, usePlaybackAnimation, usePlaybackShortcuts, usePlaylistControls, usePlaylistData, usePlaylistState, useSpectrogramIntegration, useTimeFormat, useTrackDynamicEffects, useZoomControls, waveformDataToPeaks };
1827
+ export { type ActiveEffect, type AnnotationIntegration, AnnotationIntegrationProvider, AudioPosition, type AudioTrackConfig, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionProvider, type ClipInteractionProviderProps, ContinuousPlayCheckbox, DownloadAnnotationsButton, EditableCheckbox, type EffectDefinition, type EffectInstance, type EffectParameter, type ExportOptions, type ExportResult, ExportWavButton, type ExportWavButtonProps, FastForwardButton, type FrameData, type GetAnnotationBoxLabelFn, KeyboardShortcuts, type KeyboardShortcutsProps, LinkEndpointsCheckbox, LoopButton, MasterVolumeControl, type MasterVolumeControls, type MediaElementAnimationContextValue, MediaElementAnnotationList, type MediaElementAnnotationListProps, type MediaElementControlsContextValue, type MediaElementDataContextValue, MediaElementPlaylist, type MediaElementPlaylistProps, MediaElementPlaylistProvider, type MediaElementStateContextValue, type MediaElementTrackConfig, MediaElementWaveform, type MediaElementWaveformProps, type OnAnnotationUpdateFn, type ParameterType, PauseButton, PlayButton, PlaylistAnnotationList, type PlaylistAnnotationListProps, PlaylistVisualization, type PlaylistVisualizationProps, RewindButton, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackActiveEffect, type TrackEffectsState, type TrackLoadError, type TrackSource, type TrackState$1 as TrackState, type UseDynamicEffectsReturn, type UseDynamicTracksReturn, type UseExportWavReturn, type UseOutputMeterOptions, type UseOutputMeterReturn, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, type UseTrackDynamicEffectsReturn, Waveform, WaveformPlaylistProvider, type WaveformProps, type WaveformTrack, type ZoomControls, ZoomInButton, ZoomOutButton, createEffectChain, createEffectInstance, effectCategories, effectDefinitions, getEffectDefinition, getEffectsByCategory, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, noDropAnimationPlugins, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAudioTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useDragSensors, useDynamicEffects, useDynamicTracks, useExportWav, useKeyboardShortcuts, useMasterAnalyser, useMasterVolume, useMediaElementAnimation, useMediaElementControls, useMediaElementData, useMediaElementState, useOutputMeter, usePlaybackAnimation, usePlaybackShortcuts, usePlaylistControls, usePlaylistData, usePlaylistState, useSpectrogramIntegration, useTimeFormat, useTrackDynamicEffects, useZoomControls, waveformDataToPeaks };