Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(project): persist Studio Sound isolation strength

Richie McIlroyd7fa7a2725a4
diff --git a/apps/desktop/src/routes/screenshot-editor/context.tsx b/apps/desktop/src/routes/screenshot-editor/context.tsx
index b7e5bcef3..c5930fe71 100644
--- a/apps/desktop/src/routes/screenshot-editor/context.tsx
+++ b/apps/desktop/src/routes/screenshot-editor/context.tsx
@@ -126,6 +126,7 @@ const DEFAULT_CAMERA: Camera = {
const DEFAULT_AUDIO: AudioConfiguration = {
mute: false,
improve: false,
+ isolation: "balanced",
micVolumeDb: 0,
micStereoMode: "stereo",
systemVolumeDb: 0,
diff --git a/apps/desktop/src/utils/tauri.ts b/apps/desktop/src/utils/tauri.ts
index 69c9d0543..fa2ca178c 100644
--- a/apps/desktop/src/utils/tauri.ts
+++ b/apps/desktop/src/utils/tauri.ts
@@ -655,7 +655,7 @@ export type AnnotationType = "arrow" | "circle" | "rectangle" | "text" | "mask"
export type AppTheme = "system" | "light" | "dark"
export type AspectRatio = "wide" | "vertical" | "square" | "classic" | "tall"
export type Audio = { duration: number; sample_rate: number; channels: number; start_time: number }
-export type AudioConfiguration = { mute: boolean; improve: boolean; micVolumeDb: number; micStereoMode: StereoMode; systemVolumeDb: number }
+export type AudioConfiguration = { mute: boolean; improve: boolean; isolation: VoiceIsolation; micVolumeDb: number; micStereoMode: StereoMode; systemVolumeDb: number }
/**
* Overlap-trim accounting captured by the recorder's audio gap tracker, persisted so the
* editor can compensate for stale-startup audio drift from typed data instead of scraping
@@ -1312,6 +1312,7 @@ export type VideoImportProgress = { project_path: string; stage: ImportStage; pr
export type VideoMeta = { path: string; fps?: number; start_time?: number | null; device_id?: string | null }
export type VideoRecordingMetadata = { duration: number; size: number }
export type VideoUploadInfo = { id: string; link: string; config: S3UploadMeta }
+export type VoiceIsolation = "light" | "balanced" | "strong"
export type WindowExclusion = { bundleIdentifier?: string | null; ownerName?: string | null; windowTitle?: string | null }
export type WindowId = string
export type WindowPosition = { x: number; y: number; displayId?: DisplayId | null }
diff --git a/crates/project/src/configuration.rs b/crates/project/src/configuration.rs
index df1421d62..994786fad 100644
--- a/crates/project/src/configuration.rs
+++ b/crates/project/src/configuration.rs
@@ -621,11 +621,31 @@ pub enum StereoMode {
MonoR,
}
+#[derive(Type, Serialize, Deserialize, Clone, Copy, Debug, Default, PartialEq, Eq)]
+#[serde(rename_all = "camelCase")]
+pub enum VoiceIsolation {
+ Light,
+ #[default]
+ Balanced,
+ Strong,
+}
+
+impl VoiceIsolation {
+ pub fn strength(self) -> f32 {
+ match self {
+ Self::Light => 0.7,
+ Self::Balanced => 0.9,
+ Self::Strong => 0.98,
+ }
+ }
+}
+
#[derive(Type, Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "camelCase", default)]
pub struct AudioConfiguration {
pub mute: bool,
pub improve: bool,
+ pub isolation: VoiceIsolation,
pub mic_volume_db: f32,
pub mic_stereo_mode: StereoMode,
pub system_volume_db: f32,
@@ -636,6 +656,7 @@ impl Default for AudioConfiguration {
Self {
mute: false,
improve: false,
+ isolation: VoiceIsolation::default(),
mic_volume_db: 0.0,
mic_stereo_mode: StereoMode::default(),
system_volume_db: 0.0,