@waveform-playlist/core 13.0.0-next.2 → 13.0.0-next.4
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 +42 -2
- package/dist/index.d.ts +42 -2
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1257,7 +1257,9 @@ declare function keyBelongsToFocusedControl(event: KeyboardEvent): boolean;
|
|
|
1257
1257
|
* Pure function, no framework dependency.
|
|
1258
1258
|
*
|
|
1259
1259
|
* Shortcuts do not fire for a key the focused control uses itself; see
|
|
1260
|
-
* `keyBelongsToFocusedControl`.
|
|
1260
|
+
* `keyBelongsToFocusedControl`. Nor for an Escape whose default something
|
|
1261
|
+
* other than a shortcut already prevented (a drag cancelled it): an Escape that
|
|
1262
|
+
* cancelled a drag does nothing else.
|
|
1261
1263
|
*/
|
|
1262
1264
|
declare function handleKeyboardEvent(event: KeyboardEvent, shortcuts: KeyboardShortcut[], enabled: boolean): void;
|
|
1263
1265
|
|
|
@@ -1578,6 +1580,44 @@ interface AudioTrackOptions {
|
|
|
1578
1580
|
*/
|
|
1579
1581
|
declare function audioTrack(options: AudioTrackOptions): ArrangementTrack;
|
|
1580
1582
|
|
|
1583
|
+
/**
|
|
1584
|
+
* One gesture on a mixer control (a fader drag, a held arrow key) as one
|
|
1585
|
+
* undo step (#843). The mixer setters join changes that carry the same
|
|
1586
|
+
* `gesture` id into one step; this helper makes the id, and ends the gesture
|
|
1587
|
+
* so that the next change starts a new one.
|
|
1588
|
+
*
|
|
1589
|
+
* Framework-free: React's sliders and dawcore's elements both use it. One
|
|
1590
|
+
* helper per control, so two sliders never share an id. It lives in core,
|
|
1591
|
+
* not beside the setters in the engine, because `<daw-editor>` loads the
|
|
1592
|
+
* engine with a dynamic `import()`: a value import of the engine would put
|
|
1593
|
+
* it back in dawcore's first bundle.
|
|
1594
|
+
*/
|
|
1595
|
+
interface MixerGesture {
|
|
1596
|
+
/** The id to pass while a gesture is going on. */
|
|
1597
|
+
readonly id: string;
|
|
1598
|
+
/** The gesture is over: the next change starts a new one. */
|
|
1599
|
+
end(): void;
|
|
1600
|
+
/** Ends the gesture on the input's own events; returns the detach function. */
|
|
1601
|
+
attach(input: HTMLInputElement): () => void;
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Make the gesture helper of one mixer control.
|
|
1605
|
+
*
|
|
1606
|
+
* ```ts
|
|
1607
|
+
* const gesture = createMixerGesture();
|
|
1608
|
+
* const detach = gesture.attach(slider);
|
|
1609
|
+
* slider.addEventListener('input', () =>
|
|
1610
|
+
* engine.setTrackVolume(trackId, slider.valueAsNumber, { gesture: gesture.id })
|
|
1611
|
+
* );
|
|
1612
|
+
* ```
|
|
1613
|
+
*
|
|
1614
|
+
* `attach` ends the gesture on the input's `change` (the end of a pointer
|
|
1615
|
+
* drag), except while a key that moves the input is held down; then on that
|
|
1616
|
+
* key's `keyup`. A `blur` ends it too. Mute and solo buttons need no helper:
|
|
1617
|
+
* each click is a step of its own.
|
|
1618
|
+
*/
|
|
1619
|
+
declare function createMixerGesture(): MixerGesture;
|
|
1620
|
+
|
|
1581
1621
|
/**
|
|
1582
1622
|
* The effect registry shared by `<daw-editor>` and the React effects hooks:
|
|
1583
1623
|
* one `registerEffect()` call makes a custom effect (an AudioWorklet, or any
|
|
@@ -1686,4 +1726,4 @@ declare function needsPrepare(type: string, audioContext: BaseAudioContext): boo
|
|
|
1686
1726
|
declare function ensureEffectPrepared(type: string, audioContext: BaseAudioContext): Promise<void>;
|
|
1687
1727
|
declare function createEffectInstance(type: string, audioContext: BaseAudioContext, params?: Record<string, number>): CreatedNativeEffect;
|
|
1688
1728
|
|
|
1689
|
-
export { ANNOTATION_LINK_THRESHOLD_TICKS, type AnnotationAction, type AnnotationActionOptions, type AnnotationBoundaryOptions, type AnnotationBoundaryUpdate, type AnnotationBoundsChange, type AnnotationData, type AnnotationEventMap, type AnnotationFormat, type AnnotationListOptions, type AnnotationShortcutAction, type AnnotationShortcutMap, type AnnotationStore, type AnnotationStoreOptions, type ArrangementTrack, type AudioBuffer$1 as AudioBuffer, type AudioClip, type AudioTrackOptions, type Bits, type ClipSource, type ClipTrack, type ColorMapEntry, type ColorMapName, type ColorMapValue, type CreateClipOptions, type CreateClipOptionsSeconds, type CreateClipOptionsTicks, type CreateTrackOptions, type CreatedNativeEffect, DEFAULT_ANNOTATION_SHORTCUTS, DEFAULT_SPECTROGRAM_COLOR_MAP, type EffectParamDef, type FFTSize, type Fade, type FadeConfig, type FadeType, type Gap, InteractionState, type KeyBinding, type KeyboardShortcut, LINK_THRESHOLD, type LoadingClip, MAX_CANVAS_WIDTH, METER_PEAK_DECAY, MIN_ANNOTATION_DURATION, MIN_PIXELS_PER_UNIT, type MeterEntry, type MeterLevels, type MeterReading, type MeterSource, type MicrophoneDeviceInfo, type MicrophoneEnumeration, type MidiNoteData, type MusicalTick, type MusicalTickData, type MusicalTickParams, type NativeEffectDefinition, type NativeEffectInstance, PPQN, type PanMatrix, type PanStage, type PanStageContext, type PeakData, type Peaks, type PlaylistConfig, type PlayoutState, type RangeSupport, type ReadMeterMessageParams, type RecordingProgress, type RecordingProgressSource, type RenderAnnotationItemProps, type RenderMode, SPECTROGRAM_DEFAULTS, type SnapTo, type SourceLoader, type SourceState, type SpectrogramCanvasIdParts, type SpectrogramCanvasRegistration, type SpectrogramComputeConfig, type SpectrogramConfig, type SpectrogramData, type SpectrogramDisplayConfig, type TickType, type TimeSelection, type Timeline, type Track, type TrackChannelSource, type TrackKind, type TrackSpectrogramOverrides, type ValueSource, type ValueSourceHandle, type WaveformConfig, type WaveformDataObject, type ZoomLevel, annotationMinDurationTicks, appendPeaks, appendToAudioBuffer, applyAnnotationBounds, applyFadeIn, applyFadeOut, assertTrackKind, audibleLatencySamples, audioTrack, buildSpectrogramCanvasId, calculateDuration, carveClipRange, clipDurationTime, clipEndTime, clipKind, clipOffsetTime, clipPixelWidth, clipStartTime, clipsOverlap, computeMusicalTicks, concatenateAudioData, createAnnotationStore, createAudioBuffer, createClip, createClipFromSeconds, createClipFromTicks, createEffectInstance, createPanStage, createSourceLoader, createTimeline, createTrack, createValueSource, dBToNormalized, detectMeterChanges, ensureEffectPrepared, enumerateMicrophones, exponentialCurve, findGaps, gainToDb, gainToNormalized, generateCurve, generatePeaks, getClipsAtSample, getClipsInRange, getEffectDefinitions, handleKeyboardEvent, isLoadingClip, keyBelongsToFocusedControl, linearCurve, logarithmicCurve, matchesKeyBinding, needsPrepare, normalizedToDb, panMatrix, parseSpectrogramCanvasId, pixelsToSamples, pixelsToSeconds, prepareEffect, probeRangeSupport, readMeterMessage, registerEffect, resolveAnnotationShortcuts, resolveRecordingOffsetSamples, sCurveCurve, samplesToPixels, samplesToSeconds, samplesToTicks, secondsToPixels, secondsToSamples, silentMeterLevels, snapTickToGrid, snapToGrid, snapToTicks, sortClipsByTime, splitTrackByKind, ticksPerBar, ticksPerBeat, ticksToBarBeat, ticksToSamples, trackChannelCount, trackKind, unregisterEffect, updateAnnotationBoundaries, watchMicrophoneDevices };
|
|
1729
|
+
export { ANNOTATION_LINK_THRESHOLD_TICKS, type AnnotationAction, type AnnotationActionOptions, type AnnotationBoundaryOptions, type AnnotationBoundaryUpdate, type AnnotationBoundsChange, type AnnotationData, type AnnotationEventMap, type AnnotationFormat, type AnnotationListOptions, type AnnotationShortcutAction, type AnnotationShortcutMap, type AnnotationStore, type AnnotationStoreOptions, type ArrangementTrack, type AudioBuffer$1 as AudioBuffer, type AudioClip, type AudioTrackOptions, type Bits, type ClipSource, type ClipTrack, type ColorMapEntry, type ColorMapName, type ColorMapValue, type CreateClipOptions, type CreateClipOptionsSeconds, type CreateClipOptionsTicks, type CreateTrackOptions, type CreatedNativeEffect, DEFAULT_ANNOTATION_SHORTCUTS, DEFAULT_SPECTROGRAM_COLOR_MAP, type EffectParamDef, type FFTSize, type Fade, type FadeConfig, type FadeType, type Gap, InteractionState, type KeyBinding, type KeyboardShortcut, LINK_THRESHOLD, type LoadingClip, MAX_CANVAS_WIDTH, METER_PEAK_DECAY, MIN_ANNOTATION_DURATION, MIN_PIXELS_PER_UNIT, type MeterEntry, type MeterLevels, type MeterReading, type MeterSource, type MicrophoneDeviceInfo, type MicrophoneEnumeration, type MidiNoteData, type MixerGesture, type MusicalTick, type MusicalTickData, type MusicalTickParams, type NativeEffectDefinition, type NativeEffectInstance, PPQN, type PanMatrix, type PanStage, type PanStageContext, type PeakData, type Peaks, type PlaylistConfig, type PlayoutState, type RangeSupport, type ReadMeterMessageParams, type RecordingProgress, type RecordingProgressSource, type RenderAnnotationItemProps, type RenderMode, SPECTROGRAM_DEFAULTS, type SnapTo, type SourceLoader, type SourceState, type SpectrogramCanvasIdParts, type SpectrogramCanvasRegistration, type SpectrogramComputeConfig, type SpectrogramConfig, type SpectrogramData, type SpectrogramDisplayConfig, type TickType, type TimeSelection, type Timeline, type Track, type TrackChannelSource, type TrackKind, type TrackSpectrogramOverrides, type ValueSource, type ValueSourceHandle, type WaveformConfig, type WaveformDataObject, type ZoomLevel, annotationMinDurationTicks, appendPeaks, appendToAudioBuffer, applyAnnotationBounds, applyFadeIn, applyFadeOut, assertTrackKind, audibleLatencySamples, audioTrack, buildSpectrogramCanvasId, calculateDuration, carveClipRange, clipDurationTime, clipEndTime, clipKind, clipOffsetTime, clipPixelWidth, clipStartTime, clipsOverlap, computeMusicalTicks, concatenateAudioData, createAnnotationStore, createAudioBuffer, createClip, createClipFromSeconds, createClipFromTicks, createEffectInstance, createMixerGesture, createPanStage, createSourceLoader, createTimeline, createTrack, createValueSource, dBToNormalized, detectMeterChanges, ensureEffectPrepared, enumerateMicrophones, exponentialCurve, findGaps, gainToDb, gainToNormalized, generateCurve, generatePeaks, getClipsAtSample, getClipsInRange, getEffectDefinitions, handleKeyboardEvent, isLoadingClip, keyBelongsToFocusedControl, linearCurve, logarithmicCurve, matchesKeyBinding, needsPrepare, normalizedToDb, panMatrix, parseSpectrogramCanvasId, pixelsToSamples, pixelsToSeconds, prepareEffect, probeRangeSupport, readMeterMessage, registerEffect, resolveAnnotationShortcuts, resolveRecordingOffsetSamples, sCurveCurve, samplesToPixels, samplesToSeconds, samplesToTicks, secondsToPixels, secondsToSamples, silentMeterLevels, snapTickToGrid, snapToGrid, snapToTicks, sortClipsByTime, splitTrackByKind, ticksPerBar, ticksPerBeat, ticksToBarBeat, ticksToSamples, trackChannelCount, trackKind, unregisterEffect, updateAnnotationBoundaries, watchMicrophoneDevices };
|
package/dist/index.d.ts
CHANGED
|
@@ -1257,7 +1257,9 @@ declare function keyBelongsToFocusedControl(event: KeyboardEvent): boolean;
|
|
|
1257
1257
|
* Pure function, no framework dependency.
|
|
1258
1258
|
*
|
|
1259
1259
|
* Shortcuts do not fire for a key the focused control uses itself; see
|
|
1260
|
-
* `keyBelongsToFocusedControl`.
|
|
1260
|
+
* `keyBelongsToFocusedControl`. Nor for an Escape whose default something
|
|
1261
|
+
* other than a shortcut already prevented (a drag cancelled it): an Escape that
|
|
1262
|
+
* cancelled a drag does nothing else.
|
|
1261
1263
|
*/
|
|
1262
1264
|
declare function handleKeyboardEvent(event: KeyboardEvent, shortcuts: KeyboardShortcut[], enabled: boolean): void;
|
|
1263
1265
|
|
|
@@ -1578,6 +1580,44 @@ interface AudioTrackOptions {
|
|
|
1578
1580
|
*/
|
|
1579
1581
|
declare function audioTrack(options: AudioTrackOptions): ArrangementTrack;
|
|
1580
1582
|
|
|
1583
|
+
/**
|
|
1584
|
+
* One gesture on a mixer control (a fader drag, a held arrow key) as one
|
|
1585
|
+
* undo step (#843). The mixer setters join changes that carry the same
|
|
1586
|
+
* `gesture` id into one step; this helper makes the id, and ends the gesture
|
|
1587
|
+
* so that the next change starts a new one.
|
|
1588
|
+
*
|
|
1589
|
+
* Framework-free: React's sliders and dawcore's elements both use it. One
|
|
1590
|
+
* helper per control, so two sliders never share an id. It lives in core,
|
|
1591
|
+
* not beside the setters in the engine, because `<daw-editor>` loads the
|
|
1592
|
+
* engine with a dynamic `import()`: a value import of the engine would put
|
|
1593
|
+
* it back in dawcore's first bundle.
|
|
1594
|
+
*/
|
|
1595
|
+
interface MixerGesture {
|
|
1596
|
+
/** The id to pass while a gesture is going on. */
|
|
1597
|
+
readonly id: string;
|
|
1598
|
+
/** The gesture is over: the next change starts a new one. */
|
|
1599
|
+
end(): void;
|
|
1600
|
+
/** Ends the gesture on the input's own events; returns the detach function. */
|
|
1601
|
+
attach(input: HTMLInputElement): () => void;
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Make the gesture helper of one mixer control.
|
|
1605
|
+
*
|
|
1606
|
+
* ```ts
|
|
1607
|
+
* const gesture = createMixerGesture();
|
|
1608
|
+
* const detach = gesture.attach(slider);
|
|
1609
|
+
* slider.addEventListener('input', () =>
|
|
1610
|
+
* engine.setTrackVolume(trackId, slider.valueAsNumber, { gesture: gesture.id })
|
|
1611
|
+
* );
|
|
1612
|
+
* ```
|
|
1613
|
+
*
|
|
1614
|
+
* `attach` ends the gesture on the input's `change` (the end of a pointer
|
|
1615
|
+
* drag), except while a key that moves the input is held down; then on that
|
|
1616
|
+
* key's `keyup`. A `blur` ends it too. Mute and solo buttons need no helper:
|
|
1617
|
+
* each click is a step of its own.
|
|
1618
|
+
*/
|
|
1619
|
+
declare function createMixerGesture(): MixerGesture;
|
|
1620
|
+
|
|
1581
1621
|
/**
|
|
1582
1622
|
* The effect registry shared by `<daw-editor>` and the React effects hooks:
|
|
1583
1623
|
* one `registerEffect()` call makes a custom effect (an AudioWorklet, or any
|
|
@@ -1686,4 +1726,4 @@ declare function needsPrepare(type: string, audioContext: BaseAudioContext): boo
|
|
|
1686
1726
|
declare function ensureEffectPrepared(type: string, audioContext: BaseAudioContext): Promise<void>;
|
|
1687
1727
|
declare function createEffectInstance(type: string, audioContext: BaseAudioContext, params?: Record<string, number>): CreatedNativeEffect;
|
|
1688
1728
|
|
|
1689
|
-
export { ANNOTATION_LINK_THRESHOLD_TICKS, type AnnotationAction, type AnnotationActionOptions, type AnnotationBoundaryOptions, type AnnotationBoundaryUpdate, type AnnotationBoundsChange, type AnnotationData, type AnnotationEventMap, type AnnotationFormat, type AnnotationListOptions, type AnnotationShortcutAction, type AnnotationShortcutMap, type AnnotationStore, type AnnotationStoreOptions, type ArrangementTrack, type AudioBuffer$1 as AudioBuffer, type AudioClip, type AudioTrackOptions, type Bits, type ClipSource, type ClipTrack, type ColorMapEntry, type ColorMapName, type ColorMapValue, type CreateClipOptions, type CreateClipOptionsSeconds, type CreateClipOptionsTicks, type CreateTrackOptions, type CreatedNativeEffect, DEFAULT_ANNOTATION_SHORTCUTS, DEFAULT_SPECTROGRAM_COLOR_MAP, type EffectParamDef, type FFTSize, type Fade, type FadeConfig, type FadeType, type Gap, InteractionState, type KeyBinding, type KeyboardShortcut, LINK_THRESHOLD, type LoadingClip, MAX_CANVAS_WIDTH, METER_PEAK_DECAY, MIN_ANNOTATION_DURATION, MIN_PIXELS_PER_UNIT, type MeterEntry, type MeterLevels, type MeterReading, type MeterSource, type MicrophoneDeviceInfo, type MicrophoneEnumeration, type MidiNoteData, type MusicalTick, type MusicalTickData, type MusicalTickParams, type NativeEffectDefinition, type NativeEffectInstance, PPQN, type PanMatrix, type PanStage, type PanStageContext, type PeakData, type Peaks, type PlaylistConfig, type PlayoutState, type RangeSupport, type ReadMeterMessageParams, type RecordingProgress, type RecordingProgressSource, type RenderAnnotationItemProps, type RenderMode, SPECTROGRAM_DEFAULTS, type SnapTo, type SourceLoader, type SourceState, type SpectrogramCanvasIdParts, type SpectrogramCanvasRegistration, type SpectrogramComputeConfig, type SpectrogramConfig, type SpectrogramData, type SpectrogramDisplayConfig, type TickType, type TimeSelection, type Timeline, type Track, type TrackChannelSource, type TrackKind, type TrackSpectrogramOverrides, type ValueSource, type ValueSourceHandle, type WaveformConfig, type WaveformDataObject, type ZoomLevel, annotationMinDurationTicks, appendPeaks, appendToAudioBuffer, applyAnnotationBounds, applyFadeIn, applyFadeOut, assertTrackKind, audibleLatencySamples, audioTrack, buildSpectrogramCanvasId, calculateDuration, carveClipRange, clipDurationTime, clipEndTime, clipKind, clipOffsetTime, clipPixelWidth, clipStartTime, clipsOverlap, computeMusicalTicks, concatenateAudioData, createAnnotationStore, createAudioBuffer, createClip, createClipFromSeconds, createClipFromTicks, createEffectInstance, createPanStage, createSourceLoader, createTimeline, createTrack, createValueSource, dBToNormalized, detectMeterChanges, ensureEffectPrepared, enumerateMicrophones, exponentialCurve, findGaps, gainToDb, gainToNormalized, generateCurve, generatePeaks, getClipsAtSample, getClipsInRange, getEffectDefinitions, handleKeyboardEvent, isLoadingClip, keyBelongsToFocusedControl, linearCurve, logarithmicCurve, matchesKeyBinding, needsPrepare, normalizedToDb, panMatrix, parseSpectrogramCanvasId, pixelsToSamples, pixelsToSeconds, prepareEffect, probeRangeSupport, readMeterMessage, registerEffect, resolveAnnotationShortcuts, resolveRecordingOffsetSamples, sCurveCurve, samplesToPixels, samplesToSeconds, samplesToTicks, secondsToPixels, secondsToSamples, silentMeterLevels, snapTickToGrid, snapToGrid, snapToTicks, sortClipsByTime, splitTrackByKind, ticksPerBar, ticksPerBeat, ticksToBarBeat, ticksToSamples, trackChannelCount, trackKind, unregisterEffect, updateAnnotationBoundaries, watchMicrophoneDevices };
|
|
1729
|
+
export { ANNOTATION_LINK_THRESHOLD_TICKS, type AnnotationAction, type AnnotationActionOptions, type AnnotationBoundaryOptions, type AnnotationBoundaryUpdate, type AnnotationBoundsChange, type AnnotationData, type AnnotationEventMap, type AnnotationFormat, type AnnotationListOptions, type AnnotationShortcutAction, type AnnotationShortcutMap, type AnnotationStore, type AnnotationStoreOptions, type ArrangementTrack, type AudioBuffer$1 as AudioBuffer, type AudioClip, type AudioTrackOptions, type Bits, type ClipSource, type ClipTrack, type ColorMapEntry, type ColorMapName, type ColorMapValue, type CreateClipOptions, type CreateClipOptionsSeconds, type CreateClipOptionsTicks, type CreateTrackOptions, type CreatedNativeEffect, DEFAULT_ANNOTATION_SHORTCUTS, DEFAULT_SPECTROGRAM_COLOR_MAP, type EffectParamDef, type FFTSize, type Fade, type FadeConfig, type FadeType, type Gap, InteractionState, type KeyBinding, type KeyboardShortcut, LINK_THRESHOLD, type LoadingClip, MAX_CANVAS_WIDTH, METER_PEAK_DECAY, MIN_ANNOTATION_DURATION, MIN_PIXELS_PER_UNIT, type MeterEntry, type MeterLevels, type MeterReading, type MeterSource, type MicrophoneDeviceInfo, type MicrophoneEnumeration, type MidiNoteData, type MixerGesture, type MusicalTick, type MusicalTickData, type MusicalTickParams, type NativeEffectDefinition, type NativeEffectInstance, PPQN, type PanMatrix, type PanStage, type PanStageContext, type PeakData, type Peaks, type PlaylistConfig, type PlayoutState, type RangeSupport, type ReadMeterMessageParams, type RecordingProgress, type RecordingProgressSource, type RenderAnnotationItemProps, type RenderMode, SPECTROGRAM_DEFAULTS, type SnapTo, type SourceLoader, type SourceState, type SpectrogramCanvasIdParts, type SpectrogramCanvasRegistration, type SpectrogramComputeConfig, type SpectrogramConfig, type SpectrogramData, type SpectrogramDisplayConfig, type TickType, type TimeSelection, type Timeline, type Track, type TrackChannelSource, type TrackKind, type TrackSpectrogramOverrides, type ValueSource, type ValueSourceHandle, type WaveformConfig, type WaveformDataObject, type ZoomLevel, annotationMinDurationTicks, appendPeaks, appendToAudioBuffer, applyAnnotationBounds, applyFadeIn, applyFadeOut, assertTrackKind, audibleLatencySamples, audioTrack, buildSpectrogramCanvasId, calculateDuration, carveClipRange, clipDurationTime, clipEndTime, clipKind, clipOffsetTime, clipPixelWidth, clipStartTime, clipsOverlap, computeMusicalTicks, concatenateAudioData, createAnnotationStore, createAudioBuffer, createClip, createClipFromSeconds, createClipFromTicks, createEffectInstance, createMixerGesture, createPanStage, createSourceLoader, createTimeline, createTrack, createValueSource, dBToNormalized, detectMeterChanges, ensureEffectPrepared, enumerateMicrophones, exponentialCurve, findGaps, gainToDb, gainToNormalized, generateCurve, generatePeaks, getClipsAtSample, getClipsInRange, getEffectDefinitions, handleKeyboardEvent, isLoadingClip, keyBelongsToFocusedControl, linearCurve, logarithmicCurve, matchesKeyBinding, needsPrepare, normalizedToDb, panMatrix, parseSpectrogramCanvasId, pixelsToSamples, pixelsToSeconds, prepareEffect, probeRangeSupport, readMeterMessage, registerEffect, resolveAnnotationShortcuts, resolveRecordingOffsetSamples, sCurveCurve, samplesToPixels, samplesToSeconds, samplesToTicks, secondsToPixels, secondsToSamples, silentMeterLevels, snapTickToGrid, snapToGrid, snapToTicks, sortClipsByTime, splitTrackByKind, ticksPerBar, ticksPerBeat, ticksToBarBeat, ticksToSamples, trackChannelCount, trackKind, unregisterEffect, updateAnnotationBoundaries, watchMicrophoneDevices };
|
package/dist/index.js
CHANGED
|
@@ -58,6 +58,7 @@ __export(index_exports, {
|
|
|
58
58
|
createClipFromSeconds: () => createClipFromSeconds,
|
|
59
59
|
createClipFromTicks: () => createClipFromTicks,
|
|
60
60
|
createEffectInstance: () => createEffectInstance,
|
|
61
|
+
createMixerGesture: () => createMixerGesture,
|
|
61
62
|
createPanStage: () => createPanStage,
|
|
62
63
|
createSourceLoader: () => createSourceLoader,
|
|
63
64
|
createTimeline: () => createTimeline,
|
|
@@ -1119,14 +1120,17 @@ function keyBelongsToFocusedControl(event) {
|
|
|
1119
1120
|
if (ownsAllKeys(focused)) return true;
|
|
1120
1121
|
return activates(focused, event.key);
|
|
1121
1122
|
}
|
|
1123
|
+
var preventedByShortcut = /* @__PURE__ */ new WeakSet();
|
|
1122
1124
|
function handleKeyboardEvent(event, shortcuts, enabled) {
|
|
1123
1125
|
if (!enabled) return;
|
|
1124
1126
|
if (event.repeat) return;
|
|
1127
|
+
if (event.key === "Escape" && event.defaultPrevented && !preventedByShortcut.has(event)) return;
|
|
1125
1128
|
if (keyBelongsToFocusedControl(event)) return;
|
|
1126
1129
|
const matchingShortcut = shortcuts.find((shortcut) => matchesKeyBinding(event, shortcut));
|
|
1127
1130
|
if (matchingShortcut) {
|
|
1128
1131
|
if (matchingShortcut.preventDefault !== false) {
|
|
1129
1132
|
event.preventDefault();
|
|
1133
|
+
preventedByShortcut.add(event);
|
|
1130
1134
|
}
|
|
1131
1135
|
matchingShortcut.action();
|
|
1132
1136
|
}
|
|
@@ -1724,6 +1728,66 @@ function audioTrack(options) {
|
|
|
1724
1728
|
return track;
|
|
1725
1729
|
}
|
|
1726
1730
|
|
|
1731
|
+
// src/mixerGesture.ts
|
|
1732
|
+
var RANGE_KEYS = /* @__PURE__ */ new Set([
|
|
1733
|
+
"ArrowUp",
|
|
1734
|
+
"ArrowDown",
|
|
1735
|
+
"ArrowLeft",
|
|
1736
|
+
"ArrowRight",
|
|
1737
|
+
"PageUp",
|
|
1738
|
+
"PageDown",
|
|
1739
|
+
"Home",
|
|
1740
|
+
"End"
|
|
1741
|
+
]);
|
|
1742
|
+
var ID_PREFIX = Math.random().toString(36).slice(2, 10);
|
|
1743
|
+
var idCount = 0;
|
|
1744
|
+
function nextId() {
|
|
1745
|
+
idCount += 1;
|
|
1746
|
+
return `mg-${ID_PREFIX}-${idCount}`;
|
|
1747
|
+
}
|
|
1748
|
+
function createMixerGesture() {
|
|
1749
|
+
let id = nextId();
|
|
1750
|
+
const end = () => {
|
|
1751
|
+
id = nextId();
|
|
1752
|
+
};
|
|
1753
|
+
const attach = (input) => {
|
|
1754
|
+
let heldKey = null;
|
|
1755
|
+
const onKeyDown = (event) => {
|
|
1756
|
+
const { key } = event;
|
|
1757
|
+
if (RANGE_KEYS.has(key)) heldKey = key;
|
|
1758
|
+
};
|
|
1759
|
+
const onKeyUp = (event) => {
|
|
1760
|
+
if (event.key !== heldKey) return;
|
|
1761
|
+
heldKey = null;
|
|
1762
|
+
end();
|
|
1763
|
+
};
|
|
1764
|
+
const onChange = () => {
|
|
1765
|
+
if (heldKey === null) end();
|
|
1766
|
+
};
|
|
1767
|
+
const onBlur = () => {
|
|
1768
|
+
heldKey = null;
|
|
1769
|
+
end();
|
|
1770
|
+
};
|
|
1771
|
+
input.addEventListener("keydown", onKeyDown);
|
|
1772
|
+
input.addEventListener("keyup", onKeyUp);
|
|
1773
|
+
input.addEventListener("change", onChange);
|
|
1774
|
+
input.addEventListener("blur", onBlur);
|
|
1775
|
+
return () => {
|
|
1776
|
+
input.removeEventListener("keydown", onKeyDown);
|
|
1777
|
+
input.removeEventListener("keyup", onKeyUp);
|
|
1778
|
+
input.removeEventListener("change", onChange);
|
|
1779
|
+
input.removeEventListener("blur", onBlur);
|
|
1780
|
+
};
|
|
1781
|
+
};
|
|
1782
|
+
return {
|
|
1783
|
+
get id() {
|
|
1784
|
+
return id;
|
|
1785
|
+
},
|
|
1786
|
+
end,
|
|
1787
|
+
attach
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1727
1791
|
// src/effects/registry.ts
|
|
1728
1792
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("@waveform-playlist/core/effect-registry/v1");
|
|
1729
1793
|
function registryState() {
|
|
@@ -1866,6 +1930,7 @@ function createEffectInstance(type, audioContext, params = {}) {
|
|
|
1866
1930
|
createClipFromSeconds,
|
|
1867
1931
|
createClipFromTicks,
|
|
1868
1932
|
createEffectInstance,
|
|
1933
|
+
createMixerGesture,
|
|
1869
1934
|
createPanStage,
|
|
1870
1935
|
createSourceLoader,
|
|
1871
1936
|
createTimeline,
|