@waveform-playlist/browser 13.1.3 → 14.0.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 +34 -433
- package/dist/index.d.ts +34 -433
- package/dist/index.js +610 -2371
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +507 -2291
- package/dist/index.mjs.map +1 -1
- package/dist/tone.d.mts +429 -0
- package/dist/tone.d.ts +429 -0
- package/dist/tone.js +1963 -0
- package/dist/tone.js.map +1 -0
- package/dist/tone.mjs +1958 -0
- package/dist/tone.mjs.map +1 -0
- package/package.json +23 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as tone from 'tone';
|
|
3
|
-
export { tone as Tone };
|
|
4
|
-
import { EffectsFunction, SoundFontCache, TrackEffectsFunction as TrackEffectsFunction$1 } from '@waveform-playlist/playout';
|
|
1
|
+
import { EffectsFunction, SoundFontCache, TrackEffectsFunction } from '@waveform-playlist/playout';
|
|
5
2
|
export { EffectsFunction, TrackEffectsFunction } from '@waveform-playlist/playout';
|
|
6
3
|
import * as React$1 from 'react';
|
|
7
4
|
import React__default, { ReactNode, RefObject } from 'react';
|
|
8
|
-
import { PlaylistEngine, EngineState } from '@waveform-playlist/engine';
|
|
9
|
-
import { PeakData, Fade, MidiNoteData, ClipTrack, AnnotationData, AnnotationAction, WaveformDataObject,
|
|
5
|
+
import { PlayoutAdapter, PlaylistEngine, EngineState } from '@waveform-playlist/engine';
|
|
6
|
+
import { PeakData, Fade, MidiNoteData, ClipTrack, AnnotationData, AnnotationAction, WaveformDataObject, KeyboardShortcut, AnnotationActionOptions, RenderAnnotationItemProps, TrackSpectrogramOverrides, SpectrogramConfig, ColorMapValue, RenderMode } from '@waveform-playlist/core';
|
|
10
7
|
export { AnnotationData, AudioClip, ClipTrack, Fade, getShortcutLabel } from '@waveform-playlist/core';
|
|
11
8
|
import { WaveformPlaylistTheme, TimeFormat, RenderPlayheadFunction, TrackMenuItem, SnapTo } from '@waveform-playlist/ui-components';
|
|
12
9
|
export { TimeFormat } from '@waveform-playlist/ui-components';
|
|
@@ -32,9 +29,9 @@ type TrackClipPeaks = ClipPeaks[];
|
|
|
32
29
|
interface WaveformTrack {
|
|
33
30
|
src: string | AudioBuffer;
|
|
34
31
|
name?: string;
|
|
35
|
-
effects?: TrackEffectsFunction
|
|
32
|
+
effects?: TrackEffectsFunction;
|
|
36
33
|
}
|
|
37
|
-
interface TrackState
|
|
34
|
+
interface TrackState {
|
|
38
35
|
name: string;
|
|
39
36
|
muted: boolean;
|
|
40
37
|
soloed: boolean;
|
|
@@ -66,12 +63,19 @@ interface PlaybackAnimationContextValue {
|
|
|
66
63
|
audioStartPositionRef: React__default.RefObject<number>;
|
|
67
64
|
/** Returns raw playback time from engine (auto-wraps at loop boundaries). */
|
|
68
65
|
getPlaybackTime: () => number;
|
|
66
|
+
/** Current time of the adapter's AudioContext, in seconds. */
|
|
67
|
+
getAudioContextTime: () => number;
|
|
69
68
|
/**
|
|
70
69
|
* Returns the current adapter scheduler lookahead (Tone ~0.1s, native 0).
|
|
71
70
|
* Use this for any audible-latency calculation that must match the playhead
|
|
72
71
|
* (e.g., recording live-preview peak slicing).
|
|
73
72
|
*/
|
|
74
73
|
getLookAhead: () => number;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the adapter AudioContext's output latency in seconds.
|
|
76
|
+
* Use this for audible-latency calculations (e.g., recording live-preview peak slicing).
|
|
77
|
+
*/
|
|
78
|
+
getOutputLatency: () => number;
|
|
75
79
|
/** Register a per-frame callback driven by the single animation loop. */
|
|
76
80
|
registerFrameCallback: (id: string, cb: (data: FrameData) => void) => void;
|
|
77
81
|
/** Unregister a per-frame callback. */
|
|
@@ -133,7 +137,7 @@ interface PlaylistDataContextValue {
|
|
|
133
137
|
duration: number;
|
|
134
138
|
audioBuffers: AudioBuffer[];
|
|
135
139
|
peaksDataArray: TrackClipPeaks[];
|
|
136
|
-
trackStates: TrackState
|
|
140
|
+
trackStates: TrackState[];
|
|
137
141
|
tracks: ClipTrack[];
|
|
138
142
|
sampleRate: number;
|
|
139
143
|
waveHeight: number;
|
|
@@ -184,6 +188,10 @@ interface WaveformPlaylistProviderProps {
|
|
|
184
188
|
};
|
|
185
189
|
effects?: EffectsFunction;
|
|
186
190
|
onReady?: () => void;
|
|
191
|
+
/** Called when audio/engine initialization fails (e.g. a missing optional peer,
|
|
192
|
+
* a throwing `createAdapter`, or an invalid `zoomLevels`/`samplesPerPixel`). The
|
|
193
|
+
* provider already logs the error; use this to surface it in your UI. */
|
|
194
|
+
onError?: (err: Error) => void;
|
|
187
195
|
/** @deprecated Use onAnnotationsChange instead */
|
|
188
196
|
onAnnotationUpdate?: (annotations: AnnotationData[]) => void;
|
|
189
197
|
/** Callback when annotations are changed (drag, edit, etc.) */
|
|
@@ -217,6 +225,13 @@ interface WaveformPlaylistProviderProps {
|
|
|
217
225
|
* this rate via standardized-audio-context. Pre-computed peaks (.dat files)
|
|
218
226
|
* render instantly when they match. On mismatch, falls back to worker. */
|
|
219
227
|
sampleRate?: number;
|
|
228
|
+
/** Factory for a custom PlayoutAdapter. When omitted, the Tone.js engine
|
|
229
|
+
* (@waveform-playlist/playout) is dynamically imported — so a custom adapter
|
|
230
|
+
* lets a consumer use neither @waveform-playlist/playout nor tone. Called once
|
|
231
|
+
* per engine rebuild; the provider owns and disposes the returned instance.
|
|
232
|
+
* Pass a stable reference (module-level or useCallback) — it is read directly
|
|
233
|
+
* inside the curated `loadAudio` effect, not via its dependency array. */
|
|
234
|
+
createAdapter?: () => PlayoutAdapter;
|
|
220
235
|
children: ReactNode;
|
|
221
236
|
}
|
|
222
237
|
declare const WaveformPlaylistProvider: React__default.FC<WaveformPlaylistProviderProps>;
|
|
@@ -335,6 +350,13 @@ interface MediaElementPlaylistProviderProps {
|
|
|
335
350
|
audioContext?: AudioContext;
|
|
336
351
|
/** Callback when audio is ready */
|
|
337
352
|
onReady?: () => void;
|
|
353
|
+
/** Called when playout initialization fails (e.g. a missing optional peer,
|
|
354
|
+
* a throwing `createPlayout`, or an `addTrack` error). The provider already
|
|
355
|
+
* logs the error; use this to surface it in your UI. */
|
|
356
|
+
onError?: (err: Error) => void;
|
|
357
|
+
/** Factory for a custom MediaElement playout. When omitted, the bundled engine
|
|
358
|
+
* (@waveform-playlist/media-element-playout) is dynamically imported. */
|
|
359
|
+
createPlayout?: () => MediaElementPlayout;
|
|
338
360
|
children: ReactNode;
|
|
339
361
|
}
|
|
340
362
|
/**
|
|
@@ -429,122 +451,6 @@ declare function useMasterVolume({ engineRef, initialVolume, }: UseMasterVolumeP
|
|
|
429
451
|
onEngineState: (state: EngineState) => void;
|
|
430
452
|
};
|
|
431
453
|
|
|
432
|
-
/**
|
|
433
|
-
* Hook for master effects with frequency analyzer
|
|
434
|
-
* Returns the analyser ref and the effects function to pass to WaveformPlaylistProvider
|
|
435
|
-
*
|
|
436
|
-
* For more advanced effects (reverb, delay, filters, etc.), use useDynamicEffects instead.
|
|
437
|
-
*/
|
|
438
|
-
declare const useMasterAnalyser: (fftSize?: number) => {
|
|
439
|
-
analyserRef: React$1.MutableRefObject<Analyser | null>;
|
|
440
|
-
masterEffects: EffectsFunction;
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Configuration for a single audio track to load
|
|
445
|
-
*
|
|
446
|
-
* Audio can be provided in three ways:
|
|
447
|
-
* 1. `src` - URL to fetch and decode (standard loading)
|
|
448
|
-
* 2. `audioBuffer` - Pre-loaded AudioBuffer (skip fetch/decode)
|
|
449
|
-
* 3. `waveformData` only - Peaks-first rendering (audio loads later)
|
|
450
|
-
*
|
|
451
|
-
* For peaks-first rendering, just provide `waveformData` - the sample rate
|
|
452
|
-
* and duration are derived from the waveform data automatically.
|
|
453
|
-
*/
|
|
454
|
-
interface AudioTrackConfig {
|
|
455
|
-
/** URL to audio file - used if audioBuffer not provided */
|
|
456
|
-
src?: string;
|
|
457
|
-
/** Pre-loaded AudioBuffer - skips fetch/decode if provided */
|
|
458
|
-
audioBuffer?: AudioBuffer;
|
|
459
|
-
name?: string;
|
|
460
|
-
muted?: boolean;
|
|
461
|
-
soloed?: boolean;
|
|
462
|
-
volume?: number;
|
|
463
|
-
pan?: number;
|
|
464
|
-
color?: string;
|
|
465
|
-
effects?: TrackEffectsFunction$2;
|
|
466
|
-
startTime?: number;
|
|
467
|
-
duration?: number;
|
|
468
|
-
offset?: number;
|
|
469
|
-
fadeIn?: Fade;
|
|
470
|
-
fadeOut?: Fade;
|
|
471
|
-
waveformData?: WaveformDataObject;
|
|
472
|
-
/** Visualization render mode: 'waveform' | 'spectrogram' | 'both'. Default: 'waveform' */
|
|
473
|
-
renderMode?: RenderMode;
|
|
474
|
-
/** Spectrogram configuration (FFT size, window, frequency scale, etc.) */
|
|
475
|
-
spectrogramConfig?: SpectrogramConfig;
|
|
476
|
-
/** Spectrogram color map name or custom color array */
|
|
477
|
-
spectrogramColorMap?: ColorMapValue;
|
|
478
|
-
}
|
|
479
|
-
/**
|
|
480
|
-
* Options for useAudioTracks hook
|
|
481
|
-
*/
|
|
482
|
-
interface UseAudioTracksOptions {
|
|
483
|
-
/**
|
|
484
|
-
* When true, all tracks render immediately as placeholders with clip geometry
|
|
485
|
-
* from the config. Audio fills in progressively as files decode, and peaks
|
|
486
|
-
* render as each buffer becomes available. Use with `deferEngineRebuild={loading}`
|
|
487
|
-
* on the provider for a single engine build when all tracks are ready.
|
|
488
|
-
*
|
|
489
|
-
* Requires `duration` or `waveformData` in each config so clip dimensions are known upfront.
|
|
490
|
-
* Default: false
|
|
491
|
-
*/
|
|
492
|
-
immediate?: boolean;
|
|
493
|
-
/** @deprecated Use `immediate` instead. */
|
|
494
|
-
progressive?: boolean;
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Hook to load audio from URLs and convert to ClipTrack format
|
|
498
|
-
*
|
|
499
|
-
* This hook fetches audio files, decodes them, and creates ClipTrack objects
|
|
500
|
-
* with a single clip per track. Supports custom positioning for multi-clip arrangements.
|
|
501
|
-
*
|
|
502
|
-
* @param configs - Array of audio track configurations
|
|
503
|
-
* @param options - Optional configuration for loading behavior
|
|
504
|
-
* @returns Object with tracks array, loading state, and progress info
|
|
505
|
-
*
|
|
506
|
-
* @example
|
|
507
|
-
* ```typescript
|
|
508
|
-
* // Basic usage (clips positioned at start)
|
|
509
|
-
* const { tracks, loading, error } = useAudioTracks([
|
|
510
|
-
* { src: 'audio/vocals.mp3', name: 'Vocals' },
|
|
511
|
-
* { src: 'audio/drums.mp3', name: 'Drums' },
|
|
512
|
-
* ]);
|
|
513
|
-
*
|
|
514
|
-
* // Immediate rendering with deferred engine build (recommended for multi-track)
|
|
515
|
-
* const { tracks, loading } = useAudioTracks(
|
|
516
|
-
* [
|
|
517
|
-
* { src: 'audio/vocals.mp3', name: 'Vocals', duration: 30 },
|
|
518
|
-
* { src: 'audio/drums.mp3', name: 'Drums', duration: 30 },
|
|
519
|
-
* ],
|
|
520
|
-
* { immediate: true }
|
|
521
|
-
* );
|
|
522
|
-
* // All tracks render instantly as placeholders, peaks fill in as files load
|
|
523
|
-
* return (
|
|
524
|
-
* <WaveformPlaylistProvider tracks={tracks} deferEngineRebuild={loading}>
|
|
525
|
-
* ...
|
|
526
|
-
* </WaveformPlaylistProvider>
|
|
527
|
-
* );
|
|
528
|
-
*
|
|
529
|
-
* // Pre-loaded AudioBuffer (skip fetch/decode)
|
|
530
|
-
* const { tracks } = useAudioTracks([
|
|
531
|
-
* { audioBuffer: myPreloadedBuffer, name: 'Pre-loaded' },
|
|
532
|
-
* ]);
|
|
533
|
-
*
|
|
534
|
-
* // Peaks-first rendering (instant visual, audio loads later)
|
|
535
|
-
* const { tracks } = useAudioTracks([
|
|
536
|
-
* { waveformData: preloadedPeaks, name: 'Peaks Only' }, // Renders immediately
|
|
537
|
-
* ]);
|
|
538
|
-
* ```
|
|
539
|
-
*/
|
|
540
|
-
declare function useAudioTracks(configs: AudioTrackConfig[], options?: UseAudioTracksOptions): {
|
|
541
|
-
tracks: ClipTrack[];
|
|
542
|
-
loading: boolean;
|
|
543
|
-
error: string | null;
|
|
544
|
-
loadedCount: number;
|
|
545
|
-
totalCount: number;
|
|
546
|
-
};
|
|
547
|
-
|
|
548
454
|
interface UseClipDragHandlersOptions {
|
|
549
455
|
tracks: ClipTrack[];
|
|
550
456
|
onTracksChange: (tracks: ClipTrack[]) => void;
|
|
@@ -605,7 +511,8 @@ interface UseAnnotationDragHandlersOptions {
|
|
|
605
511
|
annotations: AnnotationData[];
|
|
606
512
|
onAnnotationsChange: (annotations: AnnotationData[]) => void;
|
|
607
513
|
samplesPerPixel: number;
|
|
608
|
-
/** Sample rate for pixel-to-time conversion.
|
|
514
|
+
/** Sample rate for pixel-to-time conversion. Providers pass the real rate from
|
|
515
|
+
* context; defaults to 48000 (the engine default) for out-of-provider usage. */
|
|
609
516
|
sampleRate?: number;
|
|
610
517
|
duration: number;
|
|
611
518
|
linkEndpoints: boolean;
|
|
@@ -883,280 +790,6 @@ declare function useAnnotationKeyboardControls({ annotations, activeAnnotationId
|
|
|
883
790
|
playActiveAnnotation: () => void;
|
|
884
791
|
};
|
|
885
792
|
|
|
886
|
-
/**
|
|
887
|
-
* Effect definitions for all available Tone.js effects
|
|
888
|
-
* Each effect has parameters with min/max/default values for UI controls
|
|
889
|
-
*/
|
|
890
|
-
type ParameterType = 'number' | 'select' | 'boolean';
|
|
891
|
-
interface EffectParameter {
|
|
892
|
-
name: string;
|
|
893
|
-
label: string;
|
|
894
|
-
type: ParameterType;
|
|
895
|
-
min?: number;
|
|
896
|
-
max?: number;
|
|
897
|
-
step?: number;
|
|
898
|
-
default: number | string | boolean;
|
|
899
|
-
unit?: string;
|
|
900
|
-
options?: {
|
|
901
|
-
value: string | number;
|
|
902
|
-
label: string;
|
|
903
|
-
}[];
|
|
904
|
-
}
|
|
905
|
-
interface EffectDefinition {
|
|
906
|
-
id: string;
|
|
907
|
-
name: string;
|
|
908
|
-
category: 'delay' | 'reverb' | 'modulation' | 'distortion' | 'filter' | 'dynamics' | 'spatial';
|
|
909
|
-
description: string;
|
|
910
|
-
parameters: EffectParameter[];
|
|
911
|
-
}
|
|
912
|
-
declare const effectDefinitions: EffectDefinition[];
|
|
913
|
-
declare const getEffectDefinition: (id: string) => EffectDefinition | undefined;
|
|
914
|
-
declare const getEffectsByCategory: (category: EffectDefinition["category"]) => EffectDefinition[];
|
|
915
|
-
declare const effectCategories: {
|
|
916
|
-
id: EffectDefinition['category'];
|
|
917
|
-
name: string;
|
|
918
|
-
}[];
|
|
919
|
-
|
|
920
|
-
interface ActiveEffect {
|
|
921
|
-
instanceId: string;
|
|
922
|
-
effectId: string;
|
|
923
|
-
definition: EffectDefinition;
|
|
924
|
-
params: Record<string, number | string | boolean>;
|
|
925
|
-
bypassed: boolean;
|
|
926
|
-
}
|
|
927
|
-
interface UseDynamicEffectsReturn {
|
|
928
|
-
activeEffects: ActiveEffect[];
|
|
929
|
-
availableEffects: EffectDefinition[];
|
|
930
|
-
addEffect: (effectId: string) => void;
|
|
931
|
-
removeEffect: (instanceId: string) => void;
|
|
932
|
-
updateParameter: (instanceId: string, paramName: string, value: number | string | boolean) => void;
|
|
933
|
-
toggleBypass: (instanceId: string) => void;
|
|
934
|
-
reorderEffects: (fromIndex: number, toIndex: number) => void;
|
|
935
|
-
clearAllEffects: () => void;
|
|
936
|
-
masterEffects: EffectsFunction;
|
|
937
|
-
/**
|
|
938
|
-
* Creates a fresh effects function for offline rendering.
|
|
939
|
-
* This creates new effect instances that work in the offline AudioContext.
|
|
940
|
-
*/
|
|
941
|
-
createOfflineEffectsFunction: () => EffectsFunction | undefined;
|
|
942
|
-
analyserRef: React.RefObject<Analyser | null>;
|
|
943
|
-
}
|
|
944
|
-
/**
|
|
945
|
-
* Hook for managing a dynamic chain of audio effects with real-time parameter updates
|
|
946
|
-
*/
|
|
947
|
-
declare function useDynamicEffects(fftSize?: number): UseDynamicEffectsReturn;
|
|
948
|
-
|
|
949
|
-
interface TrackActiveEffect {
|
|
950
|
-
instanceId: string;
|
|
951
|
-
effectId: string;
|
|
952
|
-
definition: EffectDefinition;
|
|
953
|
-
params: Record<string, number | string | boolean>;
|
|
954
|
-
bypassed: boolean;
|
|
955
|
-
}
|
|
956
|
-
interface TrackEffectsState {
|
|
957
|
-
trackId: string;
|
|
958
|
-
activeEffects: TrackActiveEffect[];
|
|
959
|
-
}
|
|
960
|
-
interface UseTrackDynamicEffectsReturn {
|
|
961
|
-
trackEffectsState: Map<string, TrackActiveEffect[]>;
|
|
962
|
-
addEffectToTrack: (trackId: string, effectId: string) => void;
|
|
963
|
-
removeEffectFromTrack: (trackId: string, instanceId: string) => void;
|
|
964
|
-
updateTrackEffectParameter: (trackId: string, instanceId: string, paramName: string, value: number | string | boolean) => void;
|
|
965
|
-
toggleBypass: (trackId: string, instanceId: string) => void;
|
|
966
|
-
clearTrackEffects: (trackId: string) => void;
|
|
967
|
-
getTrackEffectsFunction: (trackId: string) => TrackEffectsFunction$1 | undefined;
|
|
968
|
-
/**
|
|
969
|
-
* Creates a fresh effects function for a track for offline rendering.
|
|
970
|
-
* This creates new effect instances that work in the offline AudioContext.
|
|
971
|
-
*/
|
|
972
|
-
createOfflineTrackEffectsFunction: (trackId: string) => TrackEffectsFunction$1 | undefined;
|
|
973
|
-
availableEffects: EffectDefinition[];
|
|
974
|
-
}
|
|
975
|
-
/**
|
|
976
|
-
* Hook for managing dynamic effects per track with real-time parameter updates
|
|
977
|
-
*/
|
|
978
|
-
declare function useTrackDynamicEffects(): UseTrackDynamicEffectsReturn;
|
|
979
|
-
|
|
980
|
-
/**
|
|
981
|
-
* WAV file encoder
|
|
982
|
-
* Converts AudioBuffer to WAV format Blob
|
|
983
|
-
*/
|
|
984
|
-
interface WavEncoderOptions {
|
|
985
|
-
/** Bit depth: 16 or 32. Default: 16 */
|
|
986
|
-
bitDepth?: 16 | 32;
|
|
987
|
-
}
|
|
988
|
-
|
|
989
|
-
/** Function type for per-track effects (same as in @waveform-playlist/core) */
|
|
990
|
-
type TrackEffectsFunction = (graphEnd: unknown, destination: unknown, isOffline: boolean) => void | (() => void);
|
|
991
|
-
interface ExportOptions extends WavEncoderOptions {
|
|
992
|
-
/** Filename for download (without extension) */
|
|
993
|
-
filename?: string;
|
|
994
|
-
/** Export mode: 'master' for full mixdown, 'individual' for single track */
|
|
995
|
-
mode?: 'master' | 'individual';
|
|
996
|
-
/** Track index for individual export (only used when mode is 'individual') */
|
|
997
|
-
trackIndex?: number;
|
|
998
|
-
/** Whether to trigger automatic download */
|
|
999
|
-
autoDownload?: boolean;
|
|
1000
|
-
/** Whether to apply effects (fades, etc.) - defaults to true */
|
|
1001
|
-
applyEffects?: boolean;
|
|
1002
|
-
/**
|
|
1003
|
-
* Optional Tone.js effects function for master effects. When provided, export renders
|
|
1004
|
-
* through the effects chain. The function receives isOffline=true.
|
|
1005
|
-
*/
|
|
1006
|
-
effectsFunction?: EffectsFunction;
|
|
1007
|
-
/**
|
|
1008
|
-
* Optional function to create offline track effects.
|
|
1009
|
-
* Takes a trackId and returns a TrackEffectsFunction for offline rendering.
|
|
1010
|
-
* This is used instead of track.effects to avoid AudioContext mismatch issues.
|
|
1011
|
-
*/
|
|
1012
|
-
createOfflineTrackEffects?: (trackId: string) => TrackEffectsFunction | undefined;
|
|
1013
|
-
/** Progress callback (0-1) */
|
|
1014
|
-
onProgress?: (progress: number) => void;
|
|
1015
|
-
}
|
|
1016
|
-
interface ExportResult {
|
|
1017
|
-
/** The rendered audio buffer */
|
|
1018
|
-
audioBuffer: AudioBuffer;
|
|
1019
|
-
/** The WAV file as a Blob */
|
|
1020
|
-
blob: Blob;
|
|
1021
|
-
/** Duration in seconds */
|
|
1022
|
-
duration: number;
|
|
1023
|
-
}
|
|
1024
|
-
interface UseExportWavReturn {
|
|
1025
|
-
/** Export the playlist to WAV */
|
|
1026
|
-
exportWav: (tracks: ClipTrack[], trackStates: TrackState[], options?: ExportOptions) => Promise<ExportResult>;
|
|
1027
|
-
/** Whether export is in progress */
|
|
1028
|
-
isExporting: boolean;
|
|
1029
|
-
/** Export progress (0-1) */
|
|
1030
|
-
progress: number;
|
|
1031
|
-
/** Error message if export failed */
|
|
1032
|
-
error: string | null;
|
|
1033
|
-
}
|
|
1034
|
-
interface TrackState {
|
|
1035
|
-
muted: boolean;
|
|
1036
|
-
soloed: boolean;
|
|
1037
|
-
volume: number;
|
|
1038
|
-
pan: number;
|
|
1039
|
-
}
|
|
1040
|
-
/**
|
|
1041
|
-
* Hook for exporting the waveform playlist to WAV format.
|
|
1042
|
-
* Uses Tone.Offline for non-real-time rendering, mirroring the live playback graph.
|
|
1043
|
-
*/
|
|
1044
|
-
declare function useExportWav(): UseExportWavReturn;
|
|
1045
|
-
|
|
1046
|
-
/**
|
|
1047
|
-
* useDynamicTracks — imperative hook for runtime track additions.
|
|
1048
|
-
*
|
|
1049
|
-
* Complements `useAudioTracks` (declarative, configs-driven) with an
|
|
1050
|
-
* imperative `addTracks()` API for dynamic loading (drag-and-drop, file pickers).
|
|
1051
|
-
*
|
|
1052
|
-
* Placeholder tracks appear instantly while audio decodes in parallel.
|
|
1053
|
-
*/
|
|
1054
|
-
|
|
1055
|
-
/** A source that can be decoded into a track. */
|
|
1056
|
-
type TrackSource = File | Blob | string | {
|
|
1057
|
-
src: string;
|
|
1058
|
-
name?: string;
|
|
1059
|
-
};
|
|
1060
|
-
/** Info about a track that failed to load. */
|
|
1061
|
-
interface TrackLoadError {
|
|
1062
|
-
/** Display name of the source that failed. */
|
|
1063
|
-
name: string;
|
|
1064
|
-
/** The underlying error. */
|
|
1065
|
-
error: Error;
|
|
1066
|
-
}
|
|
1067
|
-
interface UseDynamicTracksReturn {
|
|
1068
|
-
/**
|
|
1069
|
-
* Current tracks array (placeholders + loaded). Pass to WaveformPlaylistProvider.
|
|
1070
|
-
* Placeholder tracks have `clips: []` and names ending with " (loading...)".
|
|
1071
|
-
*/
|
|
1072
|
-
tracks: ClipTrack[];
|
|
1073
|
-
/** Add one or more sources — creates placeholder tracks immediately. */
|
|
1074
|
-
addTracks: (sources: TrackSource[]) => void;
|
|
1075
|
-
/** Remove a track by its id. Aborts in-flight fetch/decode if still loading. */
|
|
1076
|
-
removeTrack: (trackId: string) => void;
|
|
1077
|
-
/** Number of sources currently decoding. */
|
|
1078
|
-
loadingCount: number;
|
|
1079
|
-
/** True when any source is still decoding. */
|
|
1080
|
-
isLoading: boolean;
|
|
1081
|
-
/** Tracks that failed to load (removed from `tracks` automatically). */
|
|
1082
|
-
errors: TrackLoadError[];
|
|
1083
|
-
}
|
|
1084
|
-
declare function useDynamicTracks(): UseDynamicTracksReturn;
|
|
1085
|
-
|
|
1086
|
-
/**
|
|
1087
|
-
* Hook for monitoring master output levels
|
|
1088
|
-
*
|
|
1089
|
-
* Connects an AudioWorklet meter processor to the Destination node for
|
|
1090
|
-
* real-time output level monitoring. Computes sample-accurate peak and
|
|
1091
|
-
* RMS via the meter worklet — no transient is missed.
|
|
1092
|
-
*
|
|
1093
|
-
* IMPORTANT: Uses getGlobalContext() from playout to ensure the meter
|
|
1094
|
-
* is created on the same AudioContext as the audio engine. Tone.js's
|
|
1095
|
-
* getContext()/getDestination() return the DEFAULT context, which is
|
|
1096
|
-
* replaced when getGlobalContext() calls setContext() on first audio init.
|
|
1097
|
-
*/
|
|
1098
|
-
interface UseOutputMeterOptions {
|
|
1099
|
-
/**
|
|
1100
|
-
* Number of channels to meter.
|
|
1101
|
-
* Default: 2 (stereo output)
|
|
1102
|
-
*/
|
|
1103
|
-
channelCount?: number;
|
|
1104
|
-
/**
|
|
1105
|
-
* How often to update the levels (in Hz).
|
|
1106
|
-
* Default: 60 (60fps)
|
|
1107
|
-
*/
|
|
1108
|
-
updateRate?: number;
|
|
1109
|
-
/**
|
|
1110
|
-
* Whether audio is currently playing. When this transitions to false,
|
|
1111
|
-
* all levels (current, peak, RMS) and smoothed state are reset to zero.
|
|
1112
|
-
* Without this, the browser's tail-time optimization stops calling the
|
|
1113
|
-
* worklet's process() when no audio flows, leaving the last non-zero
|
|
1114
|
-
* levels frozen in state.
|
|
1115
|
-
* Default: false
|
|
1116
|
-
*/
|
|
1117
|
-
isPlaying?: boolean;
|
|
1118
|
-
}
|
|
1119
|
-
interface UseOutputMeterReturn {
|
|
1120
|
-
/** Per-channel peak output levels (0-1) */
|
|
1121
|
-
levels: number[];
|
|
1122
|
-
/** Per-channel held peak levels (0-1) */
|
|
1123
|
-
peakLevels: number[];
|
|
1124
|
-
/** Per-channel RMS output levels (0-1) */
|
|
1125
|
-
rmsLevels: number[];
|
|
1126
|
-
/** Reset all held peak levels to 0 */
|
|
1127
|
-
resetPeak: () => void;
|
|
1128
|
-
/** Error from meter setup (worklet load failure, context issues, etc.) */
|
|
1129
|
-
error: Error | null;
|
|
1130
|
-
}
|
|
1131
|
-
declare function useOutputMeter(options?: UseOutputMeterOptions): UseOutputMeterReturn;
|
|
1132
|
-
|
|
1133
|
-
/**
|
|
1134
|
-
* Factory for creating Tone.js effect instances from effect definitions
|
|
1135
|
-
*/
|
|
1136
|
-
|
|
1137
|
-
interface EffectInstance {
|
|
1138
|
-
effect: ToneAudioNode;
|
|
1139
|
-
id: string;
|
|
1140
|
-
instanceId: string;
|
|
1141
|
-
dispose: () => void;
|
|
1142
|
-
setParameter: (name: string, value: number | string | boolean) => void;
|
|
1143
|
-
getParameter: (name: string) => number | string | boolean | undefined;
|
|
1144
|
-
connect: (destination: InputNode) => void;
|
|
1145
|
-
disconnect: () => void;
|
|
1146
|
-
}
|
|
1147
|
-
/**
|
|
1148
|
-
* Create an effect instance from a definition with initial parameter values
|
|
1149
|
-
*/
|
|
1150
|
-
declare function createEffectInstance(definition: EffectDefinition, initialParams?: Record<string, number | string | boolean>): EffectInstance;
|
|
1151
|
-
/**
|
|
1152
|
-
* Create a chain of effects connected in series
|
|
1153
|
-
*/
|
|
1154
|
-
declare function createEffectChain(effects: EffectInstance[]): {
|
|
1155
|
-
input: ToneAudioNode;
|
|
1156
|
-
output: ToneAudioNode;
|
|
1157
|
-
dispose: () => void;
|
|
1158
|
-
};
|
|
1159
|
-
|
|
1160
793
|
declare const PlayButton: React__default.FC<{
|
|
1161
794
|
className?: string;
|
|
1162
795
|
}>;
|
|
@@ -1266,38 +899,6 @@ declare const DownloadAnnotationsButton: React__default.FC<{
|
|
|
1266
899
|
className?: string;
|
|
1267
900
|
}>;
|
|
1268
901
|
|
|
1269
|
-
interface ExportWavButtonProps {
|
|
1270
|
-
/** Button label */
|
|
1271
|
-
label?: string;
|
|
1272
|
-
/** Filename for the downloaded file (without extension) */
|
|
1273
|
-
filename?: string;
|
|
1274
|
-
/** Export mode: 'master' for stereo mix, 'individual' for single track */
|
|
1275
|
-
mode?: 'master' | 'individual';
|
|
1276
|
-
/** Track index for individual export */
|
|
1277
|
-
trackIndex?: number;
|
|
1278
|
-
/** Bit depth: 16 or 32 */
|
|
1279
|
-
bitDepth?: 16 | 32;
|
|
1280
|
-
/** Whether to apply effects (fades, etc.) - defaults to true */
|
|
1281
|
-
applyEffects?: boolean;
|
|
1282
|
-
/**
|
|
1283
|
-
* Optional Tone.js effects function for master effects. When provided, export will use Tone.Offline
|
|
1284
|
-
* to render through the effects chain. The function receives isOffline=true.
|
|
1285
|
-
*/
|
|
1286
|
-
effectsFunction?: EffectsFunction;
|
|
1287
|
-
/**
|
|
1288
|
-
* Optional function to create offline track effects.
|
|
1289
|
-
* Takes a trackId and returns a TrackEffectsFunction for offline rendering.
|
|
1290
|
-
*/
|
|
1291
|
-
createOfflineTrackEffects?: (trackId: string) => TrackEffectsFunction | undefined;
|
|
1292
|
-
/** CSS class name */
|
|
1293
|
-
className?: string;
|
|
1294
|
-
/** Callback when export completes */
|
|
1295
|
-
onExportComplete?: (blob: Blob) => void;
|
|
1296
|
-
/** Callback when export fails */
|
|
1297
|
-
onExportError?: (error: Error) => void;
|
|
1298
|
-
}
|
|
1299
|
-
declare const ExportWavButton: React__default.FC<ExportWavButtonProps>;
|
|
1300
|
-
|
|
1301
902
|
/**
|
|
1302
903
|
* Shared annotation types used across Waveform components
|
|
1303
904
|
*/
|
|
@@ -1865,4 +1466,4 @@ declare function getWaveformDataMetadata(src: string): Promise<{
|
|
|
1865
1466
|
bits: 8 | 16;
|
|
1866
1467
|
}>;
|
|
1867
1468
|
|
|
1868
|
-
export { type
|
|
1469
|
+
export { type AnnotationIntegration, AnnotationIntegrationProvider, AudioPosition, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionProvider, type ClipInteractionProviderProps, ContinuousPlayCheckbox, DownloadAnnotationsButton, EditableCheckbox, 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, PauseButton, PlayButton, PlaylistAnnotationList, type PlaylistAnnotationListProps, PlaylistVisualization, type PlaylistVisualizationProps, RewindButton, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramCanvasRegistration, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackState, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, Waveform, WaveformPlaylistProvider, type WaveformProps, type WaveformTrack, type ZoomControls, ZoomInButton, ZoomOutButton, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, noDropAnimationPlugins, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useDragSensors, useKeyboardShortcuts, useMasterVolume, useMediaElementAnimation, useMediaElementControls, useMediaElementData, useMediaElementState, usePlaybackAnimation, usePlaybackShortcuts, usePlaylistControls, usePlaylistData, usePlaylistDataOptional, usePlaylistState, useSpectrogramIntegration, useTimeFormat, useZoomControls, waveformDataToPeaks };
|