Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(project): add ClipSpeedAudioMode to timeline segments
Richie McIlroyea4bf87094bc
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.tsindex 323ef5580..c29ce47cd 100644--- a/apps/desktop/src/utils/tauri.ts+++ b/apps/desktop/src/utils/tauri.ts@@ -691,6 +691,7 @@ export type ClipConfiguration = { index: number; offsets: ClipOffsets;*/offsetsAutoCalculated?: boolean }export type ClipOffsets = { camera?: number; mic?: number; system_audio?: number }+export type ClipSpeedAudioMode = "mute" | "maintainPitch" | "matchSpeed"export type ClipTransition = { segmentIndex: number; type: ClipTransitionType; duration: number }export type ClipTransitionType = "cross-fade" | "fade-through-black"export type ClipboardSource = "raw" | "rendered"@@ -918,7 +919,7 @@ export type SystemDiagnostics = { macosVersion: MacOSVersionInfo | null; availabexport type TargetUnderCursor = { display_id: DisplayId | null; window: WindowUnderCursor | null }export type TextSegment = { start: number; end: number; track?: number; enabled?: boolean; content?: string; center?: XY<number>; size?: XY<number>; fontFamily?: string; fontSize?: number; fontWeight?: number; italic?: boolean; color?: string; fadeDuration?: number }export type TimelineConfiguration = { segments: TimelineSegment[]; transitions: ClipTransition[]; zoomSegments: ZoomSegment[]; sceneSegments?: SceneSegment[]; maskSegments?: MaskSegment[]; textSegments?: TextSegment[]; captionSegments?: CaptionTrackSegment[]; keyboardSegments?: KeyboardTrackSegment[]; audioSegments?: AudioTrackSegment[] }-export type TimelineSegment = { recordingSegment?: number; timescale: number; start: number; end: number; name?: string | null }+export type TimelineSegment = { recordingSegment?: number; timescale: number; start: number; end: number; name?: string | null; speedAudioMode?: ClipSpeedAudioMode | null }export type TranscriptionEngine = "Whisper" | "Parakeet"export type Trigger = "screenshotTaken" | "studioRecordingFinished" | "instantRecordingFinished" | "recordingStarted" | "uploadCompleted" | "videoImported" | "recordingDeleted"export type UpdateChannel = "stable" | "nightly"diff --git a/crates/project/src/configuration.rs b/crates/project/src/configuration.rsindex d1b47bc4f..9f5661a8e 100644--- a/crates/project/src/configuration.rs+++ b/crates/project/src/configuration.rs@@ -691,6 +691,17 @@ pub struct TimelineSegment {pub end: f64,#[serde(default)]pub name: Option<String>,+ #[serde(default, skip_serializing_if = "Option::is_none")]+ pub speed_audio_mode: Option<ClipSpeedAudioMode>,+}++#[derive(Type, Serialize, Deserialize, Clone, Copy, Debug, Default, PartialEq, Eq)]+#[serde(rename_all = "camelCase")]+pub enum ClipSpeedAudioMode {+ #[default]+ Mute,+ MaintainPitch,+ MatchSpeed,}impl TimelineSegment {@@ -1817,6 +1828,7 @@ mod tests {start: 0.0,end: 4.0,name: None,+ speed_audio_mode: None,},TimelineSegment {recording_clip: 1,@@ -1824,6 +1836,7 @@ mod tests {start: 10.0,end: 16.0,name: None,+ speed_audio_mode: None,},],transitions,@@ -1888,6 +1901,34 @@ mod tests {));}+ #[test]+ fn timeline_segment_speed_audio_mode_is_backward_compatible() {+ let legacy: TimelineSegment = serde_json::from_value(serde_json::json!({+ "recordingSegment": 0,+ "timescale": 2.0,+ "start": 0.0,+ "end": 4.0+ }))+ .unwrap();+ assert_eq!(legacy.speed_audio_mode, None);++ let serialized = serde_json::to_value(&legacy).unwrap();+ assert!(serialized.get("speedAudioMode").is_none());++ let maintain_pitch: TimelineSegment = serde_json::from_value(serde_json::json!({+ "recordingSegment": 0,+ "timescale": 2.0,+ "start": 0.0,+ "end": 4.0,+ "speedAudioMode": "maintainPitch"+ }))+ .unwrap();+ assert_eq!(+ maintain_pitch.speed_audio_mode,+ Some(ClipSpeedAudioMode::MaintainPitch)+ );+ }+#[test]fn timeline_clamps_transition_to_half_the_shorter_clip() {let timeline = timeline_with_transitions(vec![ClipTransition {