mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-11-09 07:23:14 +00:00
fix: audio peak data inside timelineTypes
This commit is contained in:
1 parent
0eb3cc1197
commit
c67baa0a0a
5 files changed
+9
-12
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { useTimelineContext } from "dnd-timeline";
|
||||
import { memo, useCallback, useEffect, useRef, useState } from "react";
|
||||
import type { AudioPeaksData } from "./useAudioPeaks";
|
||||
import type { AudioPeaksData } from "./core/timelineTypes";
|
||||
|
||||
interface AudioWaveformProps {
|
||||
peaks: AudioPeaksData;
|
||||
|
||||
@@ -7,8 +7,7 @@ import {
|
||||
getTimelineViewportStretchFactor,
|
||||
TIMELINE_AXIS_HEIGHT_PX,
|
||||
} from "../../timelineLayout";
|
||||
import type { AudioPeaksData } from "../../useAudioPeaks";
|
||||
import type { TimelineRenderItem } from "../../core/timelineTypes";
|
||||
import type { AudioPeaksData, TimelineRenderItem } from "../../core/timelineTypes";
|
||||
import { isAnnotationTrackRowId, isAudioTrackRowId } from "../../core/rows";
|
||||
import TimelineAxis from "../axis/TimelineAxis";
|
||||
import PlaybackCursor from "../playhead/PlaybackCursor";
|
||||
|
||||
@@ -6,7 +6,7 @@ import glassStyles from "../../ItemGlass.module.css";
|
||||
import Item from "../../Item";
|
||||
import Row from "../../Row";
|
||||
import { CLIP_ROW_ID, ZOOM_ROW_ID } from "../../core/constants";
|
||||
import type { TimelineRenderItem } from "../../core/timelineTypes";
|
||||
import type { AudioPeaksData, TimelineRenderItem } from "../../core/timelineTypes";
|
||||
import {
|
||||
getAnnotationTrackIndex,
|
||||
getAnnotationTrackRowId,
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
isAnnotationTrackRowId,
|
||||
isAudioTrackRowId,
|
||||
} from "../../core/rows";
|
||||
import type { AudioPeaksData } from "../../useAudioPeaks";
|
||||
import ClipMarkerOverlay from "../overlays/ClipMarkerOverlay";
|
||||
|
||||
const HINT_CLIP = "Press C to split clip";
|
||||
|
||||
@@ -37,3 +37,8 @@ export interface TimelineRenderItem {
|
||||
speedValue?: number;
|
||||
variant: "zoom" | "trim" | "clip" | "annotation" | "speed" | "audio";
|
||||
}
|
||||
|
||||
export interface AudioPeaksData {
|
||||
durationMs: number;
|
||||
peaks: Float32Array;
|
||||
}
|
||||
@@ -1,15 +1,9 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import type { AudioPeaksData } from "./core/timelineTypes";
|
||||
|
||||
/** Number of peak bins to produce — enough for smooth display at any zoom. */
|
||||
const TARGET_PEAK_COUNT = 2048;
|
||||
|
||||
export interface AudioPeaksData {
|
||||
/** One normalised amplitude value (0–1) per bin, covering the full duration. */
|
||||
peaks: Float32Array;
|
||||
/** Total duration of the decoded audio in milliseconds. */
|
||||
durationMs: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode audio from a media file URL and produce a fixed-length array of peak
|
||||
* amplitudes suitable for waveform visualisation.
|
||||
|
||||
Reference in new issue
Block a user