@waveform-playlist/browser 17.0.0-next.0 → 17.0.0-next.10

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
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import react__default, { ReactNode, RefObject } from 'react';
3
3
  import { EffectsFunction, TrackEffectsFunction, SoundFontCache } from '@waveform-playlist/playout';
4
- import { PlaylistEngine, Arrangement, PlayoutAdapter, EngineState, LoadSource, ArrangementSourcesValue } from '@waveform-playlist/engine';
5
- import { ValueSourceHandle, AnnotationData, ClipTrack, PeakData, Fade, MidiNoteData, WaveformDataObject, KeyboardShortcut, ArrangementTrack, RecordingProgressSource, AnnotationAction, RenderAnnotationItemProps, TrackKind, RenderMode, AnnotationActionOptions, TrackSpectrogramOverrides, SpectrogramConfig, ColorMapValue, SpectrogramCanvasRegistration } from '@waveform-playlist/core';
4
+ import { MixerChangeOptions, PlaylistEngine, Arrangement, PlayoutAdapter, EngineState, LoadSource, ArrangementSourcesValue } from '@waveform-playlist/engine';
5
+ import { ValueSourceHandle, AnnotationData, AnnotationStore, ClipTrack, PeakData, Fade, MidiNoteData, WaveformDataObject, KeyboardShortcut, ArrangementTrack, AnnotationStoreOptions, RecordingProgressSource, AnnotationAction, RenderAnnotationItemProps, TrackKind, RenderMode, AnnotationActionOptions, TrackSpectrogramOverrides, SpectrogramConfig, ColorMapValue, SpectrogramCanvasRegistration } from '@waveform-playlist/core';
6
6
  import { TimeFormat, WaveformPlaylistTheme, RenderPlayheadFunction, TrackMenuItem, BeatsAndBarsSnapTo } from '@waveform-playlist/ui-components';
7
7
  import { FadeConfig, MediaElementPlayout } from '@waveform-playlist/media-element-playout';
8
8
  import * as _dnd_kit_abstract from '@dnd-kit/abstract';
@@ -23,13 +23,18 @@ interface TrackDragPreview {
23
23
 
24
24
  /**
25
25
  * Where an annotation edge drag shows its moves while it is in progress:
26
- * the annotations as the drag would leave them, or `null` when no drag is
27
- * running. Both providers have one (`annotationPreview` in their controls).
26
+ * the store's current annotations with the drag's moves on top, or `null`
27
+ * when no drag is running. Both providers have one (`annotationPreview` in their controls).
28
28
  */
29
29
  type AnnotationPreviewHandle = ValueSourceHandle<AnnotationData[] | null>;
30
30
  interface UseAnnotationDragHandlersOptions {
31
- annotations: AnnotationData[];
32
- onAnnotationsChange: (annotations: AnnotationData[]) => void;
31
+ /**
32
+ * The owner of the annotations (`usePlaybackControls().annotationStore`).
33
+ * The drag writes only the bounds it moved, by id, onto the store's list
34
+ * as it is at the time of the write (#867). Without a store the handlers
35
+ * do nothing.
36
+ */
37
+ store: AnnotationStore | undefined;
33
38
  samplesPerPixel: number;
34
39
  /** Sample rate for pixel-to-time conversion. Providers pass the real rate from
35
40
  * context; defaults to 48000 (the engine default) for out-of-provider usage. */
@@ -39,9 +44,9 @@ interface UseAnnotationDragHandlersOptions {
39
44
  /**
40
45
  * Pass the provider's `annotationPreview` to keep the drag out of your own
41
46
  * state: each move is published there (the built-in annotation boxes and
42
- * list follow it), and `onAnnotationsChange` is called once, on release.
43
- * Without it `onAnnotationsChange` is called on every move, which
44
- * re-renders whatever holds the annotations for each one.
47
+ * list follow it), and the annotations are written once, on release.
48
+ * Without it they are written on every move, which re-renders whatever
49
+ * reads them for each one.
45
50
  */
46
51
  preview?: AnnotationPreviewHandle;
47
52
  }
@@ -54,10 +59,10 @@ interface UseAnnotationDragHandlersOptions {
54
59
  *
55
60
  * @example
56
61
  * ```tsx
62
+ * const { annotationStore, annotationPreview } = usePlaybackControls();
57
63
  * const { onDragStart, onDragMove, onDragEnd } = useAnnotationDragHandlers({
58
- * annotations,
59
- * onAnnotationsChange: setAnnotations,
60
- * preview: annotationPreview, // from usePlaybackControls()
64
+ * store: annotationStore,
65
+ * preview: annotationPreview,
61
66
  * samplesPerPixel,
62
67
  * sampleRate,
63
68
  * duration,
@@ -76,7 +81,7 @@ interface UseAnnotationDragHandlersOptions {
76
81
  * );
77
82
  * ```
78
83
  */
79
- declare function useAnnotationDragHandlers({ annotations, onAnnotationsChange, samplesPerPixel, sampleRate, duration, linkEndpoints, preview, }: UseAnnotationDragHandlersOptions): {
84
+ declare function useAnnotationDragHandlers({ store, samplesPerPixel, sampleRate, duration, linkEndpoints, preview, }: UseAnnotationDragHandlersOptions): {
80
85
  onDragStart: (event: DragStartEvent) => void;
81
86
  onDragMove: (event: DragMoveEvent) => void;
82
87
  onDragEnd: (event: DragEndEvent) => void;
@@ -155,7 +160,8 @@ interface ActiveAnnotationContextValue {
155
160
  * once, on release (its moves go through the preview source).
156
161
  */
157
162
  interface AnnotationsContextValue {
158
- annotations: AnnotationData[];
163
+ /** The annotation store's list: never write to it (frozen in development). */
164
+ annotations: readonly AnnotationData[];
159
165
  }
160
166
  /**
161
167
  * The three annotation options, under both providers (#686): whether
@@ -171,8 +177,9 @@ interface AnnotationOptionsContextValue {
171
177
  continuousPlay: boolean;
172
178
  }
173
179
  /**
174
- * The actions both providers have (#688). The value never changes, so reading
175
- * it never re-renders.
180
+ * The actions both providers have (#688). The value changes only when the
181
+ * provider's `annotationStore` prop does, so reading it does not re-render
182
+ * on playback, edits or option changes.
176
183
  */
177
184
  interface PlaybackControlsContextValue {
178
185
  /**
@@ -196,13 +203,18 @@ interface PlaybackControlsContextValue {
196
203
  setContinuousPlay: (enabled: boolean) => void;
197
204
  setAnnotationsEditable: (enabled: boolean) => void;
198
205
  setLinkEndpoints: (enabled: boolean) => void;
199
- setAnnotations: React.Dispatch<React.SetStateAction<AnnotationData[]>>;
200
206
  /**
201
207
  * Where an annotation edge drag shows its moves while it is in progress.
202
208
  * Pass it to `useAnnotationDragHandlers({ preview })`; read it in a custom
203
209
  * annotation renderer with `useAnnotationsWithPreview`. Stable identity.
204
210
  */
205
211
  annotationPreview: AnnotationPreviewHandle;
212
+ /**
213
+ * The provider's `annotationStore` prop, or `undefined` without one: the
214
+ * owner of the annotations. Change them with its `set` and `update`. Its
215
+ * identity changes only when the prop does.
216
+ */
217
+ annotationStore: AnnotationStore | undefined;
206
218
  setActiveAnnotationId: (id: string | null) => void;
207
219
  /**
208
220
  * What a click on an annotation does (its box, or its row in the list): the
@@ -272,20 +284,14 @@ interface EditorControlsContextValue {
272
284
  * from a control; this is for the view's own press and drag handling.
273
285
  */
274
286
  setCurrentTime: (time: number) => void;
275
- setTrackMute: (trackId: string, muted: boolean) => void;
276
- setTrackSolo: (trackId: string, soloed: boolean) => void;
277
- setTrackVolume: (trackId: string, volume: number) => void;
278
- setTrackPan: (trackId: string, pan: number) => void;
287
+ setTrackMute: (trackId: string, muted: boolean, options?: MixerChangeOptions) => void;
288
+ setTrackSolo: (trackId: string, soloed: boolean, options?: MixerChangeOptions) => void;
289
+ setTrackVolume: (trackId: string, volume: number, options?: MixerChangeOptions) => void;
290
+ setTrackPan: (trackId: string, pan: number, options?: MixerChangeOptions) => void;
279
291
  /** Move a track to a new index in the vertical track order. Purely
280
292
  * organizational — playback is not interrupted. An undo step of the
281
293
  * arrangement (#812). */
282
294
  reorderTrack: (trackId: string, toIndex: number) => void;
283
- /** Internal: call after every track-reorder DRAG interaction ends
284
- * (committed or canceled) to force the view's track-controls part to remount
285
- * its slots, discarding any @dnd-kit sortable-plugin DOM
286
- * corruption. Not needed for button-driven reorderTrack calls (they never
287
- * touch dnd-kit's DOM). See bumpTrackReorderEpoch in the provider. */
288
- bumpTrackReorderEpoch: () => void;
289
295
  /** INTERNAL wiring for ClipInteractionProvider: publishes/clears the live
290
296
  * track-reorder drag preview. Custom drag integrations may call it, but
291
297
  * most consumers only ever READ trackDragPreview from useTrackReorderPreview(). */
@@ -302,18 +308,21 @@ interface EditorControlsContextValue {
302
308
  redo: () => void;
303
309
  /** Mark a recording session active/inactive. While active: (1) the
304
310
  * end-of-audio auto-stop is suppressed so overdub playback runs past the
305
- * end of existing material, and (2) with an `armedTrackId`, that track is
306
- * muted in the arrangement's mix for the session (#812): punch-in
307
- * recording replaces whatever the take overlaps (#579), so the doomed
308
- * material must not play under the overdub. The mixer and the track's Mute
309
- * button show it muted, the built-in `<TrackMuteButton />` of that track
310
- * is disabled, and `useTrack().isRecordingArmed` is true for it. The mute
311
- * from before the session is written back when it ends or the armed track
312
- * changes, whatever was set in between; nothing is written for a track
313
- * that is no longer in the arrangement. `useRecordingSession` calls it for
314
- * the length of a take; overdub flows should also call it eagerly (before
315
- * `play()`). */
316
- setRecordingActive: (active: boolean, armedTrackId?: string | null) => void;
311
+ * end of existing material, and (2) with a `recordingTrackId`, that track
312
+ * is marked in the arrangement as the one the take is recording onto
313
+ * (`setTrackRecording`, #843): punch-in recording replaces whatever the
314
+ * take overlaps (#579), so the doomed material must not play under the
315
+ * overdub. The take's mute plays the track muted and is no undo step.
316
+ * `trackStates` and the track's Mute button show it muted, the built-in
317
+ * `<TrackMuteButton />` of that track is disabled, and
318
+ * `useTrack().isRecording` is true for it, while
319
+ * `arrangement.getMixer()` keeps the track's own mute: nothing is written
320
+ * to it, so a mute changed during the take stays after it. One track is
321
+ * recorded onto at a time: naming one clears any other, and
322
+ * `setRecordingActive(false)` clears every track. `useRecordingSession`
323
+ * calls it for the length of a take; overdub flows should also call it
324
+ * eagerly (before `play()`). */
325
+ setRecordingActive: (active: boolean, recordingTrackId?: string | null) => void;
317
326
  }
318
327
  /**
319
328
  * Refs and functions of the multitrack engine (#688). Like
@@ -395,11 +404,6 @@ interface TrackReorderPreviewContextValue {
395
404
  * layout from it; a track's panel can read it to mirror the preview in
396
405
  * its own UI. */
397
406
  trackDragPreview: TrackDragPreview | null;
398
- /** Internal: incremented after every track-reorder drag interaction ends.
399
- * The view's track-controls part folds this into each slot's `key` to
400
- * force a remount, working around @dnd-kit sortable-plugin DOM corruption
401
- * (see bumpTrackReorderEpoch in EditorControlsContextValue). */
402
- trackReorderEpoch: number;
403
407
  }
404
408
  /** The playback speed and its setter (#688). Changes when the speed does. */
405
409
  interface PlaybackRateContextValue {
@@ -466,8 +470,9 @@ declare const useAnnotations: () => AnnotationsContextValue;
466
470
  declare const useAnnotationOptions: () => AnnotationOptionsContextValue;
467
471
  /**
468
472
  * The actions both providers have: `play`, `pause`, `stop`, `seekTo`,
469
- * `setSelection`, and the annotation, scroll and time-format setters. The
470
- * value never changes, so calling this never re-renders.
473
+ * `setSelection`, the annotation store, and the annotation, scroll and
474
+ * time-format setters. The value changes only when the provider's
475
+ * `annotationStore` prop does.
471
476
  */
472
477
  declare const usePlaybackControls: () => PlaybackControlsContextValue;
473
478
  /**
@@ -516,7 +521,7 @@ declare const usePlaylistTimeline: () => PlaylistTimelineContextValue;
516
521
  */
517
522
  declare const usePlaylistMixer: () => PlaylistMixerContextValue;
518
523
  /**
519
- * `{ trackDragPreview, trackReorderEpoch }`. A component that calls this
524
+ * `{ trackDragPreview }`. A component that calls this
520
525
  * re-renders on every drag-over of a track reorder.
521
526
  */
522
527
  declare const useTrackReorderPreview: () => TrackReorderPreviewContextValue;
@@ -529,14 +534,14 @@ declare const usePlaybackRate: () => PlaybackRateContextValue;
529
534
  declare const useMediaElementTrack: () => MediaElementTrackContextValue;
530
535
 
531
536
  /**
532
- * The `annotationList` prop of both providers. The provider holds the three
533
- * options as state (`useAnnotationOptions()`, and the three setters of
537
+ * The `annotationList` prop of both providers: the three annotation options.
538
+ * The annotations themselves are the `annotationStore` prop's (#867). The
539
+ * provider holds the three options as state (`useAnnotationOptions()`, and the three setters of
534
540
  * `usePlaybackControls()`), and that state follows the prop: when the value
535
541
  * of a field changes, the option takes it. Between two changes of the prop a
536
542
  * setter (or one of the checkboxes) changes the option; the prop is not told.
537
543
  */
538
544
  interface AnnotationListProp {
539
- annotations?: AnnotationData[];
540
545
  /** Whether annotations can be edited (text, ids, edges). Default: false. */
541
546
  editable?: boolean;
542
547
  /** Whether a dragged edge takes the edge it touches along. Default: false. */
@@ -573,6 +578,7 @@ type TrackClipPeaks = ClipPeaks[];
573
578
 
574
579
  interface TrackState {
575
580
  name: string;
581
+ /** The track's own mute, or true while a take is recording onto it (#843). */
576
582
  muted: boolean;
577
583
  soloed: boolean;
578
584
  volume: number;
@@ -597,10 +603,17 @@ interface WaveformPlaylistProviderProps {
597
603
  automaticScroll?: boolean;
598
604
  theme?: Partial<WaveformPlaylistTheme>;
599
605
  /**
600
- * The annotations and the three annotation options (`editable`,
601
- * `linkEndpoints`, `isContinuousPlay`). The provider follows all four: an
602
- * option takes a new value of its field, and a setter or checkbox changes
603
- * it in between.
606
+ * The owner of the annotations (#867): make it with
607
+ * `useCreateAnnotationStore` and change the annotations with its methods.
608
+ * The provider publishes what it holds and writes nothing back. Without it
609
+ * there are no annotations.
610
+ */
611
+ annotationStore?: AnnotationStore;
612
+ /**
613
+ * The three annotation options (`editable`, `linkEndpoints`,
614
+ * `isContinuousPlay`); the annotations are `annotationStore`'s. The provider
615
+ * follows the three: an option takes a new value of its field, and a setter
616
+ * or checkbox changes it in between.
604
617
  */
605
618
  annotationList?: AnnotationListProp;
606
619
  /** Master effects chain (default Tone.js adapter only). A new function builds a new engine. */
@@ -629,8 +642,6 @@ interface WaveformPlaylistProviderProps {
629
642
  * fails to load is not reported here: see `useArrangementSources`. The
630
643
  * provider already logs the error; use this to surface it in your UI. */
631
644
  onError?: (err: Error) => void;
632
- /** Callback when annotations are changed (drag, edit, etc.) */
633
- onAnnotationsChange?: (annotations: AnnotationData[]) => void;
634
645
  /** SoundFont cache for sample-based MIDI playback. When provided, MIDI clips
635
646
  * use SoundFont samples instead of PolySynth synthesis. */
636
647
  soundFontCache?: SoundFontCache;
@@ -686,14 +697,19 @@ interface MediaElementPlaylistProviderProps {
686
697
  /** Theme configuration */
687
698
  theme?: Partial<WaveformPlaylistTheme>;
688
699
  /**
689
- * The annotations and the three annotation options (`editable`,
690
- * `linkEndpoints`, `isContinuousPlay`). The provider follows all four: an
691
- * option takes a new value of its field, and a setter or checkbox changes
692
- * it in between.
700
+ * The owner of the annotations (#867): make it with
701
+ * `useCreateAnnotationStore` and change the annotations with its methods.
702
+ * The provider publishes what it holds and writes nothing back. Without it
703
+ * there are no annotations.
704
+ */
705
+ annotationStore?: AnnotationStore;
706
+ /**
707
+ * The three annotation options (`editable`, `linkEndpoints`,
708
+ * `isContinuousPlay`); the annotations are `annotationStore`'s. The provider
709
+ * follows the three: an option takes a new value of its field, and a setter
710
+ * or checkbox changes it in between.
693
711
  */
694
712
  annotationList?: AnnotationListProp;
695
- /** Callback when annotations are changed (drag, edit, etc.) */
696
- onAnnotationsChange?: (annotations: AnnotationData[]) => void;
697
713
  /**
698
714
  * AudioContext for Web Audio routing (fades, effects).
699
715
  * When provided, audio routes through Web Audio nodes:
@@ -874,7 +890,7 @@ declare function useClipDragHandlers({ samplesPerPixel, snapSamplePosition, }: U
874
890
  * boxes), with `annotationPreview` from the provider's controls. Only that
875
891
  * component then re-renders per pointer move of the drag.
876
892
  */
877
- declare function useAnnotationsWithPreview(annotations: AnnotationData[], preview: AnnotationPreviewHandle): AnnotationData[];
893
+ declare function useAnnotationsWithPreview(annotations: readonly AnnotationData[], preview: AnnotationPreviewHandle): readonly AnnotationData[];
878
894
 
879
895
  /**
880
896
  * Hook for configuring @dnd-kit sensors for clip dragging
@@ -1044,9 +1060,14 @@ interface UsePlaybackShortcutsReturn {
1044
1060
  declare const usePlaybackShortcuts: (options?: UsePlaybackShortcutsOptions) => UsePlaybackShortcutsReturn;
1045
1061
 
1046
1062
  interface UseAnnotationKeyboardControlsOptions {
1047
- annotations: AnnotationData[];
1063
+ /**
1064
+ * The owner of the annotations (`usePlaybackControls().annotationStore`).
1065
+ * The keys read the store, and each boundary key changes the active
1066
+ * annotation, found by id, in the store's list as it is when the key is
1067
+ * pressed (#867). Without a store there is nothing to move or select.
1068
+ */
1069
+ store: AnnotationStore | undefined;
1048
1070
  activeAnnotationId: string | null;
1049
- onAnnotationsChange: (annotations: AnnotationData[]) => void;
1050
1071
  /** Callback to set the active annotation ID for selection */
1051
1072
  onActiveAnnotationChange?: (id: string | null) => void;
1052
1073
  duration: number;
@@ -1067,38 +1088,7 @@ interface UseAnnotationKeyboardControlsOptions {
1067
1088
  /** Sample rate for auto-scroll positioning. Falls back to context. */
1068
1089
  sampleRate?: number;
1069
1090
  }
1070
- /**
1071
- * Hook for keyboard-based annotation navigation and boundary editing
1072
- *
1073
- * Navigation Shortcuts:
1074
- * - ArrowUp / ArrowLeft = Select previous annotation
1075
- * - ArrowDown / ArrowRight = Select next annotation
1076
- * - Home = Select first annotation
1077
- * - End = Select last annotation
1078
- * - Escape = Deselect annotation
1079
- * - Enter = Play selected annotation
1080
- *
1081
- * Boundary Editing Shortcuts (requires active annotation):
1082
- * - [ = Move start boundary earlier (left)
1083
- * - ] = Move start boundary later (right)
1084
- * - Shift+[ = Move end boundary earlier (left)
1085
- * - Shift+] = Move end boundary later (right)
1086
- *
1087
- * Respects linkEndpoints and continuousPlay settings.
1088
- *
1089
- * @example
1090
- * ```tsx
1091
- * useAnnotationKeyboardControls({
1092
- * annotations,
1093
- * activeAnnotationId,
1094
- * onAnnotationsChange: setAnnotations,
1095
- * onActiveAnnotationChange: setActiveAnnotationId,
1096
- * duration,
1097
- * linkEndpoints,
1098
- * });
1099
- * ```
1100
- */
1101
- declare function useAnnotationKeyboardControls({ annotations, activeAnnotationId, onAnnotationsChange, onActiveAnnotationChange, duration, linkEndpoints, continuousPlay, enabled, scrollContainerRef, onPlay, samplesPerPixel: samplesPerPixelProp, sampleRate: sampleRateProp, }: UseAnnotationKeyboardControlsOptions): {
1091
+ declare function useAnnotationKeyboardControls({ store, activeAnnotationId, onActiveAnnotationChange, duration, linkEndpoints, continuousPlay, enabled, scrollContainerRef, onPlay, samplesPerPixel: samplesPerPixelProp, sampleRate: sampleRateProp, }: UseAnnotationKeyboardControlsOptions): {
1102
1092
  moveStartBoundary: (delta: number) => void;
1103
1093
  moveEndBoundary: (delta: number) => void;
1104
1094
  selectPrevious: () => void;
@@ -1144,6 +1134,28 @@ declare function useArrangementTracks(arrangement: Arrangement): readonly Arrang
1144
1134
  */
1145
1135
  declare function useArrangementSources(arrangement: Arrangement): ArrangementSourcesValue;
1146
1136
 
1137
+ /**
1138
+ * Create the `AnnotationStore` that owns an editor's annotations, one per
1139
+ * component instance. Give it to a provider's `annotationStore` prop and
1140
+ * read it with `useStoredAnnotations`. Returns the same store on every render.
1141
+ *
1142
+ * `init` is read once, on the first render; it may throw (an annotation
1143
+ * without numeric `start`/`end`, two with one id), and the throw goes to the
1144
+ * nearest error boundary. Unlike `init`, `options.beforeChange` is followed:
1145
+ * the store calls the function passed on the most recent committed render,
1146
+ * so a rule that reads the app's state sees its current value.
1147
+ *
1148
+ * Under StrictMode React calls the initializer twice and keeps one result.
1149
+ */
1150
+ declare function useCreateAnnotationStore(init?: () => readonly AnnotationData[], options?: AnnotationStoreOptions): AnnotationStore;
1151
+
1152
+ /**
1153
+ * The annotations of `store`, for the app's own components (inside or outside
1154
+ * a provider). The same array until the annotations change. Never write to
1155
+ * what it returns: change them with `store.set` or `store.update`.
1156
+ */
1157
+ declare function useStoredAnnotations(store: AnnotationStore): readonly AnnotationData[];
1158
+
1147
1159
  declare const PlayButton: react__default.FC<{
1148
1160
  className?: string;
1149
1161
  }>;
@@ -1562,7 +1574,7 @@ interface WaveformAnnotationBoxesProps {
1562
1574
  *
1563
1575
  * It wires the drag of a box's edges itself (#686): its own
1564
1576
  * `DragDropProvider` around the row, the moves shown through the provider's
1565
- * preview, one `onAnnotationsChange` on release. The edges can be dragged
1577
+ * preview, one write to the annotation store on release. The edges can be dragged
1566
1578
  * while the provider's `editable` option is on; `linkEndpoints` and
1567
1579
  * `continuousPlay` come from the same place (`useAnnotationOptions()`). The
1568
1580
  * touch setting of the drag is `ClipInteractionOptions`' `touchOptimized`.
@@ -1652,8 +1664,8 @@ interface AnnotationListProps {
1652
1664
  * The annotation text list, for both providers (#686). Render it anywhere
1653
1665
  * under the provider: below the view, in a sidebar, more than once. It reads
1654
1666
  * everything from the provider (the annotations, the active one, the
1655
- * `editable` / `linkEndpoints` / `continuousPlay` options) and reports edits
1656
- * through the provider's `onAnnotationsChange`. A click on a row plays the
1667
+ * `editable` / `linkEndpoints` / `continuousPlay` options) and writes edits
1668
+ * to the provider's annotation store. A click on a row plays the
1657
1669
  * annotation, as a click on its box does.
1658
1670
  *
1659
1671
  * Needs the annotation integration (`<AnnotationProvider>` from
@@ -1726,8 +1738,9 @@ declare const DefaultTrackControls: react__default.MemoExoticComponent<typeof De
1726
1738
  declare const TrackName: react__default.FC;
1727
1739
  /**
1728
1740
  * Mutes and unmutes the track. Disabled while a take is recorded onto the
1729
- * track (`useTrack().isRecordingArmed`): the track is muted for the take and
1730
- * its mute from before is written back when the take ends (#812).
1741
+ * track (`useTrack().isRecording`): the take plays the track muted and
1742
+ * the button shows it pressed, so a click would set the track's own mute
1743
+ * from the take's mute (#812, #843).
1731
1744
  */
1732
1745
  declare const TrackMuteButton: react__default.FC;
1733
1746
  /** Solos and unsolos the track. */
@@ -1769,6 +1782,7 @@ interface TrackContextValue {
1769
1782
  index: number;
1770
1783
  /** The track's name, or "Track N" (N is the position, from 1) when it has none and while it is loading. */
1771
1784
  name: string;
1785
+ /** The track's own mute, or true while a take is recording onto it (`isRecording`). */
1772
1786
  muted: boolean;
1773
1787
  soloed: boolean;
1774
1788
  /** 0 to 1. */
@@ -1788,16 +1802,18 @@ interface TrackContextValue {
1788
1802
  hasSpectrogram: boolean;
1789
1803
  /**
1790
1804
  * True while a take is being recorded onto this track (`setRecordingActive`,
1791
- * `useRecordingSession`). The track is muted for the take and its mute from
1792
- * before is written back when the take ends, so a change made meanwhile does
1793
- * not stay: the built-in `<TrackMuteButton />` is disabled while this is
1794
- * true, and an app's own mute control can do the same.
1805
+ * `useRecordingSession`). The track plays muted for the take and `muted` is
1806
+ * true, while the track's own mute (`arrangement.getMixer()`) is not
1807
+ * changed by the take: a mute set meanwhile stays after it (#843). The
1808
+ * built-in `<TrackMuteButton />` is disabled while this is true; an app's
1809
+ * own mute control can do the same, since toggling from `muted` here would
1810
+ * set the track's own mute from the take's mute.
1795
1811
  */
1796
- isRecordingArmed: boolean;
1797
- setMuted: (muted: boolean) => void;
1798
- setSoloed: (soloed: boolean) => void;
1799
- setVolume: (volume: number) => void;
1800
- setPan: (pan: number) => void;
1812
+ isRecording: boolean;
1813
+ setMuted: (muted: boolean, options?: MixerChangeOptions) => void;
1814
+ setSoloed: (soloed: boolean, options?: MixerChangeOptions) => void;
1815
+ setVolume: (volume: number, options?: MixerChangeOptions) => void;
1816
+ setPan: (pan: number, options?: MixerChangeOptions) => void;
1801
1817
  /** Makes this the selected track. */
1802
1818
  select: () => void;
1803
1819
  /** Moves the track one position up. Nothing happens for the first track. */
@@ -1830,7 +1846,8 @@ interface TrackReorderHandle {
1830
1846
  * calls for one track register the same sortable id twice.
1831
1847
  *
1832
1848
  * The item that moves is the slot `<WaveformTrackControls>` draws around the
1833
- * panel, not an element of the caller. The per-source modifiers REPLACE the
1849
+ * panel (the keyed element React reorders, #796), not an element of the
1850
+ * caller. The per-source modifiers REPLACE the
1834
1851
  * provider's clip modifiers for this operation, so track drags are
1835
1852
  * vertical-only and skip clip collision and snap. Data kind 'track-reorder'
1836
1853
  * is the discriminator the shared drag handlers branch on.
@@ -1846,20 +1863,21 @@ interface RecordingSessionOptions {
1846
1863
  /**
1847
1864
  * Tells the playlist that a take is being recorded into a track, for as long
1848
1865
  * as `isRecording` is true (#685). The provider then keeps playback running
1849
- * past the end of the audio and mutes the armed track in the arrangement for
1850
- * the take, so what it already holds does not play under a punch-in that
1851
- * replaces it (#812: the mixer shows the track muted, its built-in Mute
1852
- * button is disabled and `useTrack().isRecordingArmed` is true). The mute
1853
- * from before the take is written back when the take ends, the track changes
1854
- * or the component unmounts, whatever was set in between; the provider also
1855
- * writes it back in its own cleanup (its unmount or an `<Activity>` hide)
1856
- * while a track is still armed. An `<Activity>` hide of the component ends
1857
- * the session the same way, and the reveal starts it again from the track's
1858
- * mute at that moment.
1866
+ * past the end of the audio and marks the track in the arrangement as the
1867
+ * one the take is recording onto (`setTrackRecording`, #843), which plays it
1868
+ * muted for the take, so what it already holds does not play under a
1869
+ * punch-in that replaces it (`trackStates` shows the track muted, its
1870
+ * built-in Mute button is disabled and `useTrack().isRecording` is true).
1871
+ * The track's own mute is not written, so a mute changed during the take
1872
+ * stays after it. The take's mute is cleared when the take ends, the track
1873
+ * changes or the component unmounts; the provider also clears it in its own
1874
+ * cleanup (its unmount or an `<Activity>` hide) while a track is still
1875
+ * recording. An `<Activity>` hide of the component ends the session the same
1876
+ * way, and the reveal mutes the track again.
1859
1877
  *
1860
1878
  * Call it in the component that calls `useIntegratedRecording`, under
1861
1879
  * `WaveformPlaylistProvider`. `<WaveformRecordingPreview>` only draws the
1862
- * take: without this hook the armed track is not muted.
1880
+ * take: without this hook the track is not muted for the take and plays as it is.
1863
1881
  *
1864
1882
  * A handler that starts playback together with the recording should also call
1865
1883
  * `setRecordingActive(true, trackId)` (from `useEditorControls()`) before
@@ -1875,7 +1893,7 @@ declare function useRecordingSession({ isRecording, trackId }: RecordingSessionO
1875
1893
  * Mirrors what `AnnotationList` actually uses.
1876
1894
  */
1877
1895
  interface AnnotationTextIntegrationProps {
1878
- annotations: AnnotationData[];
1896
+ annotations: readonly AnnotationData[];
1879
1897
  activeAnnotationId?: string;
1880
1898
  shouldScrollToActive?: boolean;
1881
1899
  scrollActivePosition?: ScrollLogicalPosition;
@@ -1886,7 +1904,8 @@ interface AnnotationTextIntegrationProps {
1886
1904
  height?: number;
1887
1905
  /** A click on a row (not in a field being edited, not on an action button). */
1888
1906
  onAnnotationClick?: (annotation: AnnotationData) => void;
1889
- onAnnotationUpdate?: (updatedAnnotations: AnnotationData[]) => void;
1907
+ /** Where the list's edits are written: the provider's annotation store. */
1908
+ store?: AnnotationStore;
1890
1909
  renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;
1891
1910
  }
1892
1911
  /**
@@ -2129,4 +2148,4 @@ declare function getWaveformDataMetadata(src: string): Promise<{
2129
2148
  bits: 8 | 16;
2130
2149
  }>;
2131
2150
 
2132
- export { type ActiveAnnotationContextValue, type AnnotationIntegration, AnnotationIntegrationProvider, AnnotationList, type AnnotationListProp, type AnnotationListProps, type AnnotationOptionsContextValue, type AnnotationPreviewHandle, type AnnotationsContextValue, AudioPosition, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionOptions, type ClipInteractionOptionsProps, ClipInteractionProvider, type ClipInteractionProviderProps, type ClipPeaks, type CurrentTimeContextValue, DefaultTrackControls, type DefaultTrackControlsProps, type EditorControlsContextValue, type EngineRefsContextValue, FastForwardButton, type FrameData, type GetAnnotationBoxLabelFn, type IsPlayingContextValue, KeyboardShortcuts, type KeyboardShortcutsProps, LoopButton, type LoopContextValue, MasterVolumeControl, type MasterVolumeControls, MediaElementPlaylistProvider, type MediaElementTrackConfig, type MediaElementTrackContextValue, MediaElementWaveform, type MediaElementWaveformProps, MediaElementWaveformRoot, type MediaElementWaveformRootProps, PauseButton, PlayButton, type PlaybackControlsContextValue, type PlaybackRateContextValue, PlaybackRateSelect, type PlaybackRefsContextValue, type PlaylistMixerContextValue, type PlaylistSettingsContextValue, type PlaylistTimelineContextValue, type PlaylistViewContextValue, type PlaylistZoomContextValue, type RecordingSessionOptions, RewindButton, type SelectedTrackIdContextValue, type SelectionContextValue, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackClipPeaks, type TrackContextValue, type TrackDragPreview, TrackMenuButton, TrackMuteButton, TrackName, TrackPanSlider, TrackRemoveButton, type TrackRemoveButtonProps, TrackReorderGrip, type TrackReorderHandle, type TrackReorderPreviewContextValue, TrackSoloButton, type TrackState, TrackVolumeSlider, type UndoRedoContextValue, type UseCreateArrangementOptions, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, Waveform, WaveformAnnotationBoxes, type WaveformAnnotationBoxesProps, WaveformClipHeaders, WaveformEditor, type WaveformEditorProps, WaveformFades, WaveformLoopRegion, WaveformPlayhead, type WaveformPlayheadProps, WaveformPlaylistProvider, type WaveformProps, WaveformRecordingPreview, type WaveformRecordingPreviewProps, type WaveformRecordingState, WaveformRoot, type WaveformRootProps, WaveformSelection, WaveformTimescale, type WaveformTimescaleProps, WaveformTrackControls, type WaveformTrackControlsProps, WaveformTracks, type WaveformTracksProps, WaveformViewOptions, type WaveformViewOptionsProps, type ZoomControls, ZoomInButton, ZoomOutButton, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, useActiveAnnotation, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAnnotationOptions, useAnnotations, useAnnotationsWithPreview, useArrangement, useArrangementSources, useArrangementTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useCreateArrangement, useCurrentTime, useDragSensors, useEditorControls, useEngineRefs, useIsPlaying, useKeyboardShortcuts, useLoop, useMasterVolume, useMediaElementTrack, usePlaybackControls, usePlaybackRate, usePlaybackRefs, usePlaybackShortcuts, usePlaylistMixer, usePlaylistSettings, usePlaylistTimeline, usePlaylistView, usePlaylistZoom, useRecordingSession, useSelectedTrackId, useSelection, useSpectrogramIntegration, useTimeFormat, useTrack, useTrackReorderHandle, useTrackReorderPreview, useUndoRedo, useZoomControls, waveformDataToPeaks };
2151
+ export { type ActiveAnnotationContextValue, type AnnotationIntegration, AnnotationIntegrationProvider, AnnotationList, type AnnotationListProp, type AnnotationListProps, type AnnotationOptionsContextValue, type AnnotationPreviewHandle, type AnnotationsContextValue, AudioPosition, AutomaticScrollCheckbox, ClearAllButton, type ClearAllButtonProps, ClipCollisionModifier, ClipInteractionOptions, type ClipInteractionOptionsProps, ClipInteractionProvider, type ClipInteractionProviderProps, type ClipPeaks, type CurrentTimeContextValue, DefaultTrackControls, type DefaultTrackControlsProps, type EditorControlsContextValue, type EngineRefsContextValue, FastForwardButton, type FrameData, type GetAnnotationBoxLabelFn, type IsPlayingContextValue, KeyboardShortcuts, type KeyboardShortcutsProps, LoopButton, type LoopContextValue, MasterVolumeControl, type MasterVolumeControls, MediaElementPlaylistProvider, type MediaElementTrackConfig, type MediaElementTrackContextValue, MediaElementWaveform, type MediaElementWaveformProps, MediaElementWaveformRoot, type MediaElementWaveformRootProps, PauseButton, PlayButton, type PlaybackControlsContextValue, type PlaybackRateContextValue, PlaybackRateSelect, type PlaybackRefsContextValue, type PlaylistMixerContextValue, type PlaylistSettingsContextValue, type PlaylistTimelineContextValue, type PlaylistViewContextValue, type PlaylistZoomContextValue, type RecordingSessionOptions, RewindButton, type SelectedTrackIdContextValue, type SelectionContextValue, SelectionTimeInputs, SetLoopRegionButton, SkipBackwardButton, SkipForwardButton, SnapToGridModifier, type SpectrogramIntegration, SpectrogramIntegrationProvider, StopButton, type TimeFormatControls, TimeFormatSelect, type TrackClipPeaks, type TrackContextValue, type TrackDragPreview, TrackMenuButton, TrackMuteButton, TrackName, TrackPanSlider, TrackRemoveButton, type TrackRemoveButtonProps, TrackReorderGrip, type TrackReorderHandle, type TrackReorderPreviewContextValue, TrackSoloButton, type TrackState, TrackVolumeSlider, type UndoRedoContextValue, type UseCreateArrangementOptions, type UsePlaybackShortcutsOptions, type UsePlaybackShortcutsReturn, Waveform, WaveformAnnotationBoxes, type WaveformAnnotationBoxesProps, WaveformClipHeaders, WaveformEditor, type WaveformEditorProps, WaveformFades, WaveformLoopRegion, WaveformPlayhead, type WaveformPlayheadProps, WaveformPlaylistProvider, type WaveformProps, WaveformRecordingPreview, type WaveformRecordingPreviewProps, type WaveformRecordingState, WaveformRoot, type WaveformRootProps, WaveformSelection, WaveformTimescale, type WaveformTimescaleProps, WaveformTrackControls, type WaveformTrackControlsProps, WaveformTracks, type WaveformTracksProps, WaveformViewOptions, type WaveformViewOptionsProps, type ZoomControls, ZoomInButton, ZoomOutButton, getWaveformDataMetadata, loadPeaksFromWaveformData, loadWaveformData, useActiveAnnotation, useAnnotationDragHandlers, useAnnotationIntegration, useAnnotationKeyboardControls, useAnnotationOptions, useAnnotations, useAnnotationsWithPreview, useArrangement, useArrangementSources, useArrangementTracks, useClipDragHandlers, useClipInteractionEnabled, useClipSplitting, useCreateAnnotationStore, useCreateArrangement, useCurrentTime, useDragSensors, useEditorControls, useEngineRefs, useIsPlaying, useKeyboardShortcuts, useLoop, useMasterVolume, useMediaElementTrack, usePlaybackControls, usePlaybackRate, usePlaybackRefs, usePlaybackShortcuts, usePlaylistMixer, usePlaylistSettings, usePlaylistTimeline, usePlaylistView, usePlaylistZoom, useRecordingSession, useSelectedTrackId, useSelection, useSpectrogramIntegration, useStoredAnnotations, useTimeFormat, useTrack, useTrackReorderHandle, useTrackReorderPreview, useUndoRedo, useZoomControls, waveformDataToPeaks };