@waveform-playlist/browser 17.0.0-next.7 → 17.0.0-next.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/README.md +4 -4
- package/dist/index.d.mts +48 -39
- package/dist/index.d.ts +48 -39
- package/dist/index.js +103 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +131 -102
- package/dist/index.mjs.map +1 -1
- package/dist/tone.js +2 -2
- package/dist/tone.js.map +1 -1
- package/dist/tone.mjs +2 -2
- package/dist/tone.mjs.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -184,7 +184,7 @@ __export(index_exports, {
|
|
|
184
184
|
module.exports = __toCommonJS(index_exports);
|
|
185
185
|
|
|
186
186
|
// <define:__INSTALL_SPECS__>
|
|
187
|
-
var define_INSTALL_SPECS_default = { "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0", "@dnd-kit/abstract": "@dnd-kit/abstract@^0.5.0", "@dnd-kit/dom": "@dnd-kit/dom@^0.5.0", "@dnd-kit/react": "@dnd-kit/react@^0.5.0", "@waveform-playlist/annotations": "@waveform-playlist/annotations@^14.0.0-next.
|
|
187
|
+
var define_INSTALL_SPECS_default = { "@dawcore/wam": "@dawcore/wam@^0.0.5-next.0", "@dnd-kit/abstract": "@dnd-kit/abstract@^0.5.0", "@dnd-kit/dom": "@dnd-kit/dom@^0.5.0", "@dnd-kit/react": "@dnd-kit/react@^0.5.0", "@waveform-playlist/annotations": "@waveform-playlist/annotations@^14.0.0-next.5", "@waveform-playlist/media-element-playout": "@waveform-playlist/media-element-playout@^12.4.0-next.3", "@waveform-playlist/playout": "@waveform-playlist/playout@^13.0.0-next.3", "@waveform-playlist/recording": "@waveform-playlist/recording@^14.0.0-next.5", react: "react@^19.0.0", "react-dom": "react-dom@^19.0.0", "styled-components": "styled-components@^6.0.0", tone: "tone@^15.0.0", "@waveform-playlist/spectrogram": "@waveform-playlist/spectrogram@^15.0.0-next.3" };
|
|
188
188
|
|
|
189
189
|
// src/WaveformPlaylistContext.tsx
|
|
190
190
|
var import_react35 = require("react");
|
|
@@ -541,7 +541,7 @@ var PlaylistMixerContext = slot();
|
|
|
541
541
|
var TrackReorderPreviewContext = slot();
|
|
542
542
|
var TrimPreviewContext = slot();
|
|
543
543
|
var TrimPreviewPeaksContext = slot();
|
|
544
|
-
var
|
|
544
|
+
var RecordingTrackContext = slot();
|
|
545
545
|
var PlaybackRateContext = slot();
|
|
546
546
|
var MediaElementTrackContext = slot();
|
|
547
547
|
function useSlot(context, hookName, needs) {
|
|
@@ -579,7 +579,7 @@ var useUndoRedo = () => useSlot(UndoRedoContext, "useUndoRedo", WEB_AUDIO);
|
|
|
579
579
|
var usePlaylistTimeline = () => useSlot(PlaylistTimelineContext, "usePlaylistTimeline", WEB_AUDIO);
|
|
580
580
|
var usePlaylistMixer = () => useSlot(PlaylistMixerContext, "usePlaylistMixer", WEB_AUDIO);
|
|
581
581
|
var useTrackReorderPreview = () => useSlot(TrackReorderPreviewContext, "useTrackReorderPreview", WEB_AUDIO);
|
|
582
|
-
var
|
|
582
|
+
var useRecordingTrack = () => useSlot(RecordingTrackContext, "useRecordingTrack", WEB_AUDIO);
|
|
583
583
|
var usePlaybackRate = () => useSlot(PlaybackRateContext, "usePlaybackRate", MEDIA_ELEMENT);
|
|
584
584
|
var useMediaElementTrack = () => useSlot(MediaElementTrackContext, "useMediaElementTrack", MEDIA_ELEMENT);
|
|
585
585
|
var useWebAudioProviderOnly = (hookName) => {
|
|
@@ -2827,19 +2827,20 @@ function deriveRows(tracks, inputs, previous) {
|
|
|
2827
2827
|
});
|
|
2828
2828
|
return { byTrackId, result: sameItems(previous.result, rows) ? previous.result : rows };
|
|
2829
2829
|
}
|
|
2830
|
-
function sameState(a, name, mix) {
|
|
2831
|
-
return a.name === name && a.volume === mix.volume && a.muted ===
|
|
2830
|
+
function sameState(a, name, mix, muted) {
|
|
2831
|
+
return a.name === name && a.volume === mix.volume && a.muted === muted && a.soloed === mix.soloed && a.pan === mix.pan;
|
|
2832
2832
|
}
|
|
2833
|
-
function deriveTrackStates(tracks, mixer, previous) {
|
|
2833
|
+
function deriveTrackStates(tracks, mixer, recordingTrackIds, previous) {
|
|
2834
2834
|
const byTrackId = /* @__PURE__ */ new Map();
|
|
2835
2835
|
const states = tracks.map((track) => {
|
|
2836
2836
|
var _a;
|
|
2837
2837
|
const mix = (_a = mixer.get(track.id)) != null ? _a : DEFAULT_MIX;
|
|
2838
|
+
const muted = mix.muted || recordingTrackIds.has(track.id);
|
|
2838
2839
|
const before = previous.byTrackId.get(track.id);
|
|
2839
|
-
const state = before && sameState(before, track.name, mix) ? before : {
|
|
2840
|
+
const state = before && sameState(before, track.name, mix, muted) ? before : {
|
|
2840
2841
|
name: track.name,
|
|
2841
2842
|
volume: mix.volume,
|
|
2842
|
-
muted
|
|
2843
|
+
muted,
|
|
2843
2844
|
soloed: mix.soloed,
|
|
2844
2845
|
pan: mix.pan
|
|
2845
2846
|
};
|
|
@@ -2859,12 +2860,14 @@ function useArrangementValue(arrangement, read) {
|
|
|
2859
2860
|
return (0, import_react31.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
2860
2861
|
}
|
|
2861
2862
|
var readMixer = (arrangement) => arrangement.getMixer();
|
|
2863
|
+
var readRecordingTrackIds = (arrangement) => arrangement.recordingTrackIds;
|
|
2862
2864
|
var readCanUndo = (arrangement) => arrangement.canUndo;
|
|
2863
2865
|
var readCanRedo = (arrangement) => arrangement.canRedo;
|
|
2864
2866
|
function useArrangementView(arrangement, options) {
|
|
2865
2867
|
const { samplesPerPixel, mono, baseScale, placeholderSampleRate } = options;
|
|
2866
2868
|
const arrangementTracks = useArrangementTracks(arrangement);
|
|
2867
2869
|
const mixer = useArrangementValue(arrangement, readMixer);
|
|
2870
|
+
const recordingTrackIds = useArrangementValue(arrangement, readRecordingTrackIds);
|
|
2868
2871
|
const canUndo = useArrangementValue(arrangement, readCanUndo);
|
|
2869
2872
|
const canRedo = useArrangementValue(arrangement, readCanRedo);
|
|
2870
2873
|
const loadedCacheRef = (0, import_react31.useRef)(EMPTY_LOADED_TRACKS);
|
|
@@ -2894,10 +2897,15 @@ function useArrangementView(arrangement, options) {
|
|
|
2894
2897
|
const duration = (0, import_react31.useMemo)(() => timelineDuration(tracks), [tracks]);
|
|
2895
2898
|
const statesCacheRef = (0, import_react31.useRef)(EMPTY_STATES);
|
|
2896
2899
|
const trackStates = (0, import_react31.useMemo)(() => {
|
|
2897
|
-
const next = deriveTrackStates(
|
|
2900
|
+
const next = deriveTrackStates(
|
|
2901
|
+
arrangementTracks,
|
|
2902
|
+
mixer,
|
|
2903
|
+
recordingTrackIds,
|
|
2904
|
+
statesCacheRef.current
|
|
2905
|
+
);
|
|
2898
2906
|
statesCacheRef.current = next;
|
|
2899
2907
|
return next.result;
|
|
2900
|
-
}, [arrangementTracks, mixer]);
|
|
2908
|
+
}, [arrangementTracks, mixer, recordingTrackIds]);
|
|
2901
2909
|
return {
|
|
2902
2910
|
tracks,
|
|
2903
2911
|
peaksDataArray,
|
|
@@ -2970,7 +2978,6 @@ function useReadyOnce(options) {
|
|
|
2970
2978
|
|
|
2971
2979
|
// src/providerInternals/useArrangementEditing.ts
|
|
2972
2980
|
var import_react33 = require("react");
|
|
2973
|
-
var import_core8 = require("@waveform-playlist/core");
|
|
2974
2981
|
|
|
2975
2982
|
// src/components/partWarnings.ts
|
|
2976
2983
|
var warned = /* @__PURE__ */ new Set();
|
|
@@ -2990,63 +2997,71 @@ function isTrackId(setter, trackId) {
|
|
|
2990
2997
|
);
|
|
2991
2998
|
return false;
|
|
2992
2999
|
}
|
|
3000
|
+
var readRecordingTrackId = (arrangement) => {
|
|
3001
|
+
for (const id of arrangement.recordingTrackIds) return id;
|
|
3002
|
+
return null;
|
|
3003
|
+
};
|
|
3004
|
+
function clearRecordingTracks(arrangement, keep = null) {
|
|
3005
|
+
for (const id of [...arrangement.recordingTrackIds]) {
|
|
3006
|
+
if (id !== keep) arrangement.setTrackRecording(id, false);
|
|
3007
|
+
}
|
|
3008
|
+
}
|
|
2993
3009
|
function useRecordingActive(arrangement) {
|
|
2994
3010
|
const recordingActiveRef = (0, import_react33.useRef)(false);
|
|
2995
|
-
const [armed] = (0, import_react33.useState)(() => (0, import_core8.createValueSource)(null));
|
|
2996
3011
|
const setRecordingActive = (0, import_react33.useCallback)(
|
|
2997
|
-
(active,
|
|
2998
|
-
var _a, _b;
|
|
3012
|
+
(active, recordingTrackId2) => {
|
|
2999
3013
|
recordingActiveRef.current = active;
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
armed.publish({ trackId: armedTrackId2, prevMuted });
|
|
3006
|
-
arrangement.setTrackMute(armedTrackId2, true);
|
|
3007
|
-
} else if (!active && current) {
|
|
3008
|
-
arrangement.setTrackMute(current.trackId, current.prevMuted);
|
|
3009
|
-
armed.publish(null);
|
|
3014
|
+
if (active && recordingTrackId2) {
|
|
3015
|
+
clearRecordingTracks(arrangement, recordingTrackId2);
|
|
3016
|
+
arrangement.setTrackRecording(recordingTrackId2, true);
|
|
3017
|
+
} else if (!active) {
|
|
3018
|
+
clearRecordingTracks(arrangement);
|
|
3010
3019
|
}
|
|
3011
3020
|
},
|
|
3012
|
-
[arrangement
|
|
3021
|
+
[arrangement]
|
|
3013
3022
|
);
|
|
3014
3023
|
(0, import_react33.useEffect)(
|
|
3015
3024
|
() => () => {
|
|
3016
|
-
if (
|
|
3025
|
+
if (arrangement.recordingTrackIds.size > 0) setRecordingActive(false);
|
|
3017
3026
|
},
|
|
3018
|
-
[
|
|
3027
|
+
[arrangement, setRecordingActive]
|
|
3019
3028
|
);
|
|
3020
|
-
const
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
const
|
|
3025
|
-
const
|
|
3026
|
-
|
|
3029
|
+
const subscribe = (0, import_react33.useCallback)(
|
|
3030
|
+
(listener) => arrangement.subscribe(listener),
|
|
3031
|
+
[arrangement]
|
|
3032
|
+
);
|
|
3033
|
+
const getRecordingTrackId = (0, import_react33.useCallback)(() => readRecordingTrackId(arrangement), [arrangement]);
|
|
3034
|
+
const recordingTrackId = (0, import_react33.useSyncExternalStore)(
|
|
3035
|
+
subscribe,
|
|
3036
|
+
getRecordingTrackId,
|
|
3037
|
+
getRecordingTrackId
|
|
3038
|
+
);
|
|
3039
|
+
const recordingTrack = (0, import_react33.useMemo)(() => ({ recordingTrackId }), [recordingTrackId]);
|
|
3040
|
+
return { setRecordingActive, recordingActiveRef, recordingTrack };
|
|
3027
3041
|
}
|
|
3028
3042
|
function useArrangementEditing(arrangement) {
|
|
3029
3043
|
const setTrackMute = (0, import_react33.useCallback)(
|
|
3030
|
-
(trackId, muted) => {
|
|
3031
|
-
if (isTrackId("setTrackMute", trackId)) arrangement.setTrackMute(trackId, muted);
|
|
3044
|
+
(trackId, muted, options) => {
|
|
3045
|
+
if (isTrackId("setTrackMute", trackId)) arrangement.setTrackMute(trackId, muted, options);
|
|
3032
3046
|
},
|
|
3033
3047
|
[arrangement]
|
|
3034
3048
|
);
|
|
3035
3049
|
const setTrackSolo = (0, import_react33.useCallback)(
|
|
3036
|
-
(trackId, soloed) => {
|
|
3037
|
-
if (isTrackId("setTrackSolo", trackId)) arrangement.setTrackSolo(trackId, soloed);
|
|
3050
|
+
(trackId, soloed, options) => {
|
|
3051
|
+
if (isTrackId("setTrackSolo", trackId)) arrangement.setTrackSolo(trackId, soloed, options);
|
|
3038
3052
|
},
|
|
3039
3053
|
[arrangement]
|
|
3040
3054
|
);
|
|
3041
3055
|
const setTrackVolume = (0, import_react33.useCallback)(
|
|
3042
|
-
(trackId, volume) => {
|
|
3043
|
-
if (isTrackId("setTrackVolume", trackId))
|
|
3056
|
+
(trackId, volume, options) => {
|
|
3057
|
+
if (isTrackId("setTrackVolume", trackId))
|
|
3058
|
+
arrangement.setTrackVolume(trackId, volume, options);
|
|
3044
3059
|
},
|
|
3045
3060
|
[arrangement]
|
|
3046
3061
|
);
|
|
3047
3062
|
const setTrackPan = (0, import_react33.useCallback)(
|
|
3048
|
-
(trackId, pan) => {
|
|
3049
|
-
if (isTrackId("setTrackPan", trackId)) arrangement.setTrackPan(trackId, pan);
|
|
3063
|
+
(trackId, pan, options) => {
|
|
3064
|
+
if (isTrackId("setTrackPan", trackId)) arrangement.setTrackPan(trackId, pan, options);
|
|
3050
3065
|
},
|
|
3051
3066
|
[arrangement]
|
|
3052
3067
|
);
|
|
@@ -3056,7 +3071,7 @@ function useArrangementEditing(arrangement) {
|
|
|
3056
3071
|
);
|
|
3057
3072
|
const undo = (0, import_react33.useCallback)(() => arrangement.undo(), [arrangement]);
|
|
3058
3073
|
const redo = (0, import_react33.useCallback)(() => arrangement.redo(), [arrangement]);
|
|
3059
|
-
const { setRecordingActive, recordingActiveRef,
|
|
3074
|
+
const { setRecordingActive, recordingActiveRef, recordingTrack } = useRecordingActive(arrangement);
|
|
3060
3075
|
return {
|
|
3061
3076
|
setTrackMute,
|
|
3062
3077
|
setTrackSolo,
|
|
@@ -3067,7 +3082,7 @@ function useArrangementEditing(arrangement) {
|
|
|
3067
3082
|
redo,
|
|
3068
3083
|
setRecordingActive,
|
|
3069
3084
|
recordingActiveRef,
|
|
3070
|
-
|
|
3085
|
+
recordingTrack
|
|
3071
3086
|
};
|
|
3072
3087
|
}
|
|
3073
3088
|
|
|
@@ -3944,9 +3959,9 @@ var ProviderOnArrangement = ({
|
|
|
3944
3959
|
{
|
|
3945
3960
|
value: timelineValue,
|
|
3946
3961
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
3947
|
-
|
|
3962
|
+
RecordingTrackContext,
|
|
3948
3963
|
{
|
|
3949
|
-
value: editing.
|
|
3964
|
+
value: editing.recordingTrack,
|
|
3950
3965
|
children
|
|
3951
3966
|
}
|
|
3952
3967
|
)
|
|
@@ -4530,7 +4545,7 @@ var MediaElementPlaylistProvider = ({
|
|
|
4530
4545
|
ActiveAnnotationContext,
|
|
4531
4546
|
{
|
|
4532
4547
|
value: activeAnnotationValue,
|
|
4533
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SelectionContext, { value: selection, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SelectedRowContext, { value: ONLY_ROW_SELECTED, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
4548
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CurrentTimeContext, { value: currentTimeValue, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SelectionContext, { value: selection, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SelectedRowContext, { value: ONLY_ROW_SELECTED, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RecordingTrackContext, { value: BLOCKED, children }) }) }) })
|
|
4534
4549
|
}
|
|
4535
4550
|
) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) });
|
|
4536
4551
|
};
|
|
@@ -4914,10 +4929,10 @@ function useSpectrogramIntegration() {
|
|
|
4914
4929
|
}
|
|
4915
4930
|
|
|
4916
4931
|
// src/utils/trackRenderMode.ts
|
|
4917
|
-
var
|
|
4932
|
+
var import_core8 = require("@waveform-playlist/core");
|
|
4918
4933
|
function trackRenderMode(track, override) {
|
|
4919
4934
|
var _a;
|
|
4920
|
-
if ((0,
|
|
4935
|
+
if ((0, import_core8.trackKind)(track) === "midi") return "waveform";
|
|
4921
4936
|
return (_a = override != null ? override : track.renderMode) != null ? _a : "waveform";
|
|
4922
4937
|
}
|
|
4923
4938
|
|
|
@@ -4971,7 +4986,7 @@ var import_ui_components14 = require("@waveform-playlist/ui-components");
|
|
|
4971
4986
|
|
|
4972
4987
|
// src/hooks/useSelectionDrag.ts
|
|
4973
4988
|
var import_react44 = require("react");
|
|
4974
|
-
var
|
|
4989
|
+
var import_core9 = require("@waveform-playlist/core");
|
|
4975
4990
|
|
|
4976
4991
|
// src/hooks/useWindowDrag.ts
|
|
4977
4992
|
var import_react43 = require("react");
|
|
@@ -5056,7 +5071,7 @@ function useSelectionDrag({
|
|
|
5056
5071
|
const { setSelection } = usePlaybackControls();
|
|
5057
5072
|
const [isSelecting, setIsSelecting] = (0, import_react44.useState)(false);
|
|
5058
5073
|
const automaticScrollRef = (0, import_react44.useRef)(false);
|
|
5059
|
-
const previewHandle = (0, import_react44.useMemo)(() => (0,
|
|
5074
|
+
const previewHandle = (0, import_react44.useMemo)(() => (0, import_core9.createValueSource)(null), []);
|
|
5060
5075
|
const pressTimeRef = (0, import_react44.useRef)(0);
|
|
5061
5076
|
const wroteSelectionRef = (0, import_react44.useRef)(false);
|
|
5062
5077
|
const dragElementRef = (0, import_react44.useRef)(null);
|
|
@@ -5148,7 +5163,7 @@ var import_ui_components13 = require("@waveform-playlist/ui-components");
|
|
|
5148
5163
|
// src/components/TrackRows.tsx
|
|
5149
5164
|
var import_react48 = __toESM(require("react"));
|
|
5150
5165
|
var import_ui_components7 = require("@waveform-playlist/ui-components");
|
|
5151
|
-
var
|
|
5166
|
+
var import_core11 = require("@waveform-playlist/core");
|
|
5152
5167
|
|
|
5153
5168
|
// src/contexts/ClipInteractionContext.tsx
|
|
5154
5169
|
var import_react46 = require("react");
|
|
@@ -5176,7 +5191,7 @@ function useClipInteractionEnabled() {
|
|
|
5176
5191
|
// src/components/ChannelWithProgress.tsx
|
|
5177
5192
|
var import_react47 = require("react");
|
|
5178
5193
|
var import_styled_components5 = __toESM(require("styled-components"));
|
|
5179
|
-
var
|
|
5194
|
+
var import_core10 = require("@waveform-playlist/core");
|
|
5180
5195
|
var import_ui_components6 = require("@waveform-playlist/ui-components");
|
|
5181
5196
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
5182
5197
|
var ChannelWrapper = import_styled_components5.default.div`
|
|
@@ -5238,7 +5253,7 @@ var ClipProgress = ({
|
|
|
5238
5253
|
useCurrentTime();
|
|
5239
5254
|
const { sampleRate } = usePlaylistView();
|
|
5240
5255
|
const { samplesPerPixel } = usePlaylistZoom();
|
|
5241
|
-
const clipPixelWidth = (0,
|
|
5256
|
+
const clipPixelWidth = (0, import_core10.clipPixelWidth)(
|
|
5242
5257
|
clipStartSample,
|
|
5243
5258
|
clipDurationSamples,
|
|
5244
5259
|
samplesPerPixel
|
|
@@ -5469,7 +5484,7 @@ var RecordingPreviewClip = ({
|
|
|
5469
5484
|
const getSnapshot = (0, import_react48.useCallback)(() => source.getSnapshot(), [source]);
|
|
5470
5485
|
const progress = (0, import_react48.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
5471
5486
|
const durationSamples = Math.floor(progress.duration * sampleRate);
|
|
5472
|
-
const latencyOffsetSamples = (0,
|
|
5487
|
+
const latencyOffsetSamples = (0, import_core11.resolveRecordingOffsetSamples)({
|
|
5473
5488
|
overrideSeconds: recordingState.latencyOffset,
|
|
5474
5489
|
outputLatency: getOutputLatency(),
|
|
5475
5490
|
lookAhead: getLookAhead(),
|
|
@@ -5691,8 +5706,8 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
|
|
|
5691
5706
|
var _a, _b;
|
|
5692
5707
|
const track = rowList[trackIndex];
|
|
5693
5708
|
if (!track) return null;
|
|
5694
|
-
const
|
|
5695
|
-
const recordingChannels =
|
|
5709
|
+
const isRecordingTrack = (recordingState == null ? void 0 : recordingState.isRecording) === true && recordingState.trackId === track.id;
|
|
5710
|
+
const recordingChannels = isRecordingTrack ? recordingChannelCount : 0;
|
|
5696
5711
|
const helpers = spectrogramHelpersById.get(track.id);
|
|
5697
5712
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
5698
5713
|
TrackRow,
|
|
@@ -5710,7 +5725,7 @@ var WaveformTracks = ({ gainScaled = false, children }) => {
|
|
|
5710
5725
|
numChannels: getTrackChannelCount(trackClipPeaks, recordingChannels),
|
|
5711
5726
|
waveHeight,
|
|
5712
5727
|
mono,
|
|
5713
|
-
recordingState:
|
|
5728
|
+
recordingState: isRecordingTrack ? recordingState : void 0,
|
|
5714
5729
|
spectrogramConfig: helpers == null ? void 0 : helpers.config,
|
|
5715
5730
|
frequencyScaleFn: helpers == null ? void 0 : helpers.frequencyScaleFn,
|
|
5716
5731
|
samplesPerPixel,
|
|
@@ -5732,6 +5747,7 @@ var import_ui_components9 = require("@waveform-playlist/ui-components");
|
|
|
5732
5747
|
|
|
5733
5748
|
// src/components/TrackControlPieces.tsx
|
|
5734
5749
|
var import_react51 = require("react");
|
|
5750
|
+
var import_core12 = require("@waveform-playlist/core");
|
|
5735
5751
|
var import_ui_components8 = require("@waveform-playlist/ui-components");
|
|
5736
5752
|
|
|
5737
5753
|
// src/components/trackContext.ts
|
|
@@ -5876,13 +5892,13 @@ var TrackName = () => {
|
|
|
5876
5892
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "data-track-name": "", style: NAME_STYLE, children: name });
|
|
5877
5893
|
};
|
|
5878
5894
|
var TrackMuteButton = () => {
|
|
5879
|
-
const { muted, setMuted,
|
|
5895
|
+
const { muted, setMuted, isRecording } = useTrack();
|
|
5880
5896
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
5881
5897
|
import_ui_components8.Button,
|
|
5882
5898
|
{
|
|
5883
5899
|
$variant: muted ? "danger" : "outline",
|
|
5884
5900
|
"aria-pressed": muted,
|
|
5885
|
-
disabled:
|
|
5901
|
+
disabled: isRecording,
|
|
5886
5902
|
onClick: () => setMuted(!muted),
|
|
5887
5903
|
children: "Mute"
|
|
5888
5904
|
}
|
|
@@ -5900,8 +5916,18 @@ var TrackSoloButton = () => {
|
|
|
5900
5916
|
}
|
|
5901
5917
|
);
|
|
5902
5918
|
};
|
|
5919
|
+
function useSliderGesture() {
|
|
5920
|
+
const [gesture] = (0, import_react51.useState)(import_core12.createMixerGesture);
|
|
5921
|
+
const ref = (0, import_react51.useRef)(null);
|
|
5922
|
+
(0, import_react51.useEffect)(() => {
|
|
5923
|
+
const input = ref.current;
|
|
5924
|
+
return input ? gesture.attach(input) : void 0;
|
|
5925
|
+
}, [gesture]);
|
|
5926
|
+
return { gesture, ref };
|
|
5927
|
+
}
|
|
5903
5928
|
var TrackVolumeSlider = () => {
|
|
5904
5929
|
const { volume, setVolume } = useTrack();
|
|
5930
|
+
const { gesture, ref } = useSliderGesture();
|
|
5905
5931
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_ui_components8.SliderWrapper, { children: [
|
|
5906
5932
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui_components8.VolumeDownIcon, {}),
|
|
5907
5933
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5910,9 +5936,10 @@ var TrackVolumeSlider = () => {
|
|
|
5910
5936
|
min: "0",
|
|
5911
5937
|
max: "1",
|
|
5912
5938
|
step: "0.01",
|
|
5939
|
+
ref,
|
|
5913
5940
|
value: volume,
|
|
5914
5941
|
"aria-label": "Volume",
|
|
5915
|
-
onChange: (e) => setVolume(parseFloat(e.target.value))
|
|
5942
|
+
onChange: (e) => setVolume(parseFloat(e.target.value), { gesture: gesture.id })
|
|
5916
5943
|
}
|
|
5917
5944
|
),
|
|
5918
5945
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_ui_components8.VolumeUpIcon, {})
|
|
@@ -5920,6 +5947,7 @@ var TrackVolumeSlider = () => {
|
|
|
5920
5947
|
};
|
|
5921
5948
|
var TrackPanSlider = () => {
|
|
5922
5949
|
const { pan, setPan } = useTrack();
|
|
5950
|
+
const { gesture, ref } = useSliderGesture();
|
|
5923
5951
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_ui_components8.SliderWrapper, { children: [
|
|
5924
5952
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "L" }),
|
|
5925
5953
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -5928,9 +5956,10 @@ var TrackPanSlider = () => {
|
|
|
5928
5956
|
min: "-1",
|
|
5929
5957
|
max: "1",
|
|
5930
5958
|
step: "0.01",
|
|
5959
|
+
ref,
|
|
5931
5960
|
value: pan,
|
|
5932
5961
|
"aria-label": "Pan",
|
|
5933
|
-
onChange: (e) => setPan(parseFloat(e.target.value))
|
|
5962
|
+
onChange: (e) => setPan(parseFloat(e.target.value), { gesture: gesture.id })
|
|
5934
5963
|
}
|
|
5935
5964
|
),
|
|
5936
5965
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: "R" })
|
|
@@ -6077,7 +6106,7 @@ function TrackControlsSlotImpl({
|
|
|
6077
6106
|
isLast,
|
|
6078
6107
|
renderMode,
|
|
6079
6108
|
hasSpectrogram,
|
|
6080
|
-
|
|
6109
|
+
isRecording,
|
|
6081
6110
|
height,
|
|
6082
6111
|
top,
|
|
6083
6112
|
animate,
|
|
@@ -6096,10 +6125,10 @@ function TrackControlsSlotImpl({
|
|
|
6096
6125
|
indexRef.current = index;
|
|
6097
6126
|
const actions = (0, import_react54.useMemo)(
|
|
6098
6127
|
() => ({
|
|
6099
|
-
setMuted: (value2) => setTrackMute(trackId, value2),
|
|
6100
|
-
setSoloed: (value2) => setTrackSolo(trackId, value2),
|
|
6101
|
-
setVolume: (value2) => setTrackVolume(trackId, value2),
|
|
6102
|
-
setPan: (value2) => setTrackPan(trackId, value2),
|
|
6128
|
+
setMuted: (value2, options) => setTrackMute(trackId, value2, options),
|
|
6129
|
+
setSoloed: (value2, options) => setTrackSolo(trackId, value2, options),
|
|
6130
|
+
setVolume: (value2, options) => setTrackVolume(trackId, value2, options),
|
|
6131
|
+
setPan: (value2, options) => setTrackPan(trackId, value2, options),
|
|
6103
6132
|
select: () => setSelectedTrackId(trackId),
|
|
6104
6133
|
// The engine clamps the target and ignores a move to the same place.
|
|
6105
6134
|
moveUp: () => reorderTrack(trackId, indexRef.current - 1),
|
|
@@ -6133,7 +6162,7 @@ function TrackControlsSlotImpl({
|
|
|
6133
6162
|
isFirst,
|
|
6134
6163
|
isLast,
|
|
6135
6164
|
hasSpectrogram,
|
|
6136
|
-
|
|
6165
|
+
isRecording
|
|
6137
6166
|
}, actions),
|
|
6138
6167
|
[
|
|
6139
6168
|
trackId,
|
|
@@ -6149,7 +6178,7 @@ function TrackControlsSlotImpl({
|
|
|
6149
6178
|
isFirst,
|
|
6150
6179
|
isLast,
|
|
6151
6180
|
hasSpectrogram,
|
|
6152
|
-
|
|
6181
|
+
isRecording,
|
|
6153
6182
|
actions
|
|
6154
6183
|
]
|
|
6155
6184
|
);
|
|
@@ -6190,7 +6219,7 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6190
6219
|
);
|
|
6191
6220
|
}
|
|
6192
6221
|
const { selectedTrackId } = useSelectedTrackId();
|
|
6193
|
-
const {
|
|
6222
|
+
const { recordingTrackId } = useRecordingTrack();
|
|
6194
6223
|
const spectrogram = (0, import_react54.use)(SpectrogramIntegrationContext);
|
|
6195
6224
|
const { trackStates } = usePlaylistMixer();
|
|
6196
6225
|
const template = useStableTemplate(children != null ? children : DEFAULT_TEMPLATE);
|
|
@@ -6233,7 +6262,7 @@ function WaveformTrackControlsImpl({ children }) {
|
|
|
6233
6262
|
isLast: trackIndex === tracks.length - 1,
|
|
6234
6263
|
renderMode: (_a = renderModeById.get(track.id)) != null ? _a : "waveform",
|
|
6235
6264
|
hasSpectrogram: spectrogram !== null && track.kind !== "midi",
|
|
6236
|
-
|
|
6265
|
+
isRecording: track.id === recordingTrackId,
|
|
6237
6266
|
height: (_b = trackHeightById.get(track.id)) != null ? _b : 0,
|
|
6238
6267
|
top: (_c = trackLayout.topById.get(track.id)) != null ? _c : 0,
|
|
6239
6268
|
animate: animateTrackLayout && dragSourceTrackId !== null,
|
|
@@ -7246,12 +7275,12 @@ var KeyboardShortcuts = ({
|
|
|
7246
7275
|
var import_react67 = require("react");
|
|
7247
7276
|
function useRecordingSession({ isRecording, trackId }) {
|
|
7248
7277
|
const { setRecordingActive } = useEditorControls();
|
|
7249
|
-
const
|
|
7278
|
+
const recordingTrackId = trackId != null ? trackId : null;
|
|
7250
7279
|
(0, import_react67.useEffect)(() => {
|
|
7251
7280
|
if (!isRecording) return void 0;
|
|
7252
|
-
setRecordingActive(true,
|
|
7281
|
+
setRecordingActive(true, recordingTrackId);
|
|
7253
7282
|
return () => setRecordingActive(false);
|
|
7254
|
-
}, [isRecording,
|
|
7283
|
+
}, [isRecording, recordingTrackId, setRecordingActive]);
|
|
7255
7284
|
}
|
|
7256
7285
|
|
|
7257
7286
|
// src/components/ClipInteractionProvider.tsx
|