@waveform-playlist/browser 5.0.0-alpha.6 → 5.0.0-alpha.8

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.ts CHANGED
@@ -86,6 +86,13 @@ export declare interface AudioClip {
86
86
  name?: string;
87
87
  /** Optional color for visual distinction */
88
88
  color?: string;
89
+ /**
90
+ * Pre-computed waveform data from waveform-data.js library.
91
+ * When provided, the library will use this instead of computing peaks from the audioBuffer.
92
+ * Supports resampling to different zoom levels and slicing for clip trimming.
93
+ * Load with: `const waveformData = await loadWaveformData('/path/to/peaks.dat')`
94
+ */
95
+ waveformData?: WaveformDataObject;
89
96
  }
90
97
 
91
98
  /**
@@ -114,6 +121,7 @@ export declare interface AudioTrackConfig {
114
121
  offset?: number;
115
122
  fadeIn?: Fade;
116
123
  fadeOut?: Fade;
124
+ waveformData?: WaveformDataObject;
117
125
  }
118
126
 
119
127
  /**
@@ -589,6 +597,9 @@ declare interface PlaylistControlsContextValue {
589
597
  setAnnotations: (annotations: AnnotationData[]) => void;
590
598
  setActiveAnnotationId: (id: string | null) => void;
591
599
  setLoopEnabled: (enabled: boolean) => void;
600
+ setLoopRegion: (start: number, end: number) => void;
601
+ setLoopRegionFromSelection: () => void;
602
+ clearLoopRegion: () => void;
592
603
  }
593
604
 
594
605
  declare interface PlaylistDataContextValue {
@@ -628,6 +639,8 @@ declare interface PlaylistStateContextValue {
628
639
  selectionStart: number;
629
640
  selectionEnd: number;
630
641
  selectedTrackId: string | null;
642
+ loopStart: number;
643
+ loopEnd: number;
631
644
  }
632
645
 
633
646
  /**
@@ -648,6 +661,10 @@ export declare const SelectionTimeInputs: default_2.FC<{
648
661
  className?: string;
649
662
  }>;
650
663
 
664
+ export declare const SetLoopRegionButton: default_2.FC<{
665
+ className?: string;
666
+ }>;
667
+
651
668
  export declare const SkipBackwardButton: default_2.FC<{
652
669
  skipAmount?: number;
653
670
  className?: string;
@@ -777,17 +794,6 @@ declare type TrackClipPeaks = ClipPeaks[];
777
794
 
778
795
  export declare type TrackEffectsFunction = (graphEnd: Gain, masterGainNode: ToneAudioNode, isOffline: boolean) => void | (() => void);
779
796
 
780
- /**
781
- * Clip-Based Model Types
782
- *
783
- * These types support a professional multi-track editing model where:
784
- * - Each track can contain multiple audio clips
785
- * - Clips can be positioned anywhere on the timeline
786
- * - Clips have independent trim points (offset/duration)
787
- * - Gaps between clips are silent
788
- * - Clips can overlap (for crossfades)
789
- */
790
-
791
797
  /**
792
798
  * Generic effects function type for track-level audio processing.
793
799
  *
@@ -1364,6 +1370,56 @@ export declare const Waveform: default_2.FC<WaveformProps>;
1364
1370
  */
1365
1371
  declare type WaveformColor = string | WaveformGradient;
1366
1372
 
1373
+ /**
1374
+ * Clip-Based Model Types
1375
+ *
1376
+ * These types support a professional multi-track editing model where:
1377
+ * - Each track can contain multiple audio clips
1378
+ * - Clips can be positioned anywhere on the timeline
1379
+ * - Clips have independent trim points (offset/duration)
1380
+ * - Gaps between clips are silent
1381
+ * - Clips can overlap (for crossfades)
1382
+ */
1383
+
1384
+ /**
1385
+ * WaveformData object from waveform-data.js library.
1386
+ * Supports resample() and slice() for dynamic zoom levels.
1387
+ * See: https://github.com/bbc/waveform-data.js
1388
+ */
1389
+ declare interface WaveformDataObject {
1390
+ /** Sample rate of the original audio */
1391
+ readonly sample_rate: number;
1392
+ /** Number of audio samples per pixel */
1393
+ readonly scale: number;
1394
+ /** Length of waveform data in pixels */
1395
+ readonly length: number;
1396
+ /** Bit depth (8 or 16) */
1397
+ readonly bits: number;
1398
+ /** Duration in seconds */
1399
+ readonly duration: number;
1400
+ /** Number of channels */
1401
+ readonly channels: number;
1402
+ /** Get channel data */
1403
+ channel: (index: number) => {
1404
+ min_array: () => number[];
1405
+ max_array: () => number[];
1406
+ };
1407
+ /** Resample to different scale */
1408
+ resample: (options: {
1409
+ scale: number;
1410
+ } | {
1411
+ width: number;
1412
+ }) => WaveformDataObject;
1413
+ /** Slice a portion of the waveform */
1414
+ slice: (options: {
1415
+ startTime: number;
1416
+ endTime: number;
1417
+ } | {
1418
+ startIndex: number;
1419
+ endIndex: number;
1420
+ }) => WaveformDataObject;
1421
+ }
1422
+
1367
1423
  /**
1368
1424
  * Convert WaveformData to our internal Peaks format
1369
1425
  *
@@ -1496,6 +1552,8 @@ declare interface WaveformPlaylistTheme {
1496
1552
  timescaleBackgroundColor: string;
1497
1553
  playheadColor: string;
1498
1554
  selectionColor: string;
1555
+ loopRegionColor: string;
1556
+ loopMarkerColor: string;
1499
1557
  clipHeaderBackgroundColor: string;
1500
1558
  clipHeaderBorderColor: string;
1501
1559
  clipHeaderTextColor: string;