feat(recording): toggle_microphone_mute command + recording://mic event

This commit is contained in:
iamdoubz committed 2026-07-15 13:57:36 -05:00
1 parent 3c73ec1cd4
commit a71c17965f
1 file changed
+38
+38
View File
@@ -88,6 +88,7 @@ pub(crate) fn default_settings() -> Settings {
mcp_expose: "none".into(),
mcp_expose_recordings: false,
auto_start: false,
close_to_tray: true,
}
}
@@ -1048,6 +1049,43 @@ pub async fn resume_recording(
Ok(())
}
/// Toggle the microphone mute state for the active recording (FR-CAP-7): the
/// mic channel goes silent (recording + live transcript + meter) while loopback
/// keeps capturing. Bound to the "M" key in the UI. Returns the new muted state.
/// Errors if this meeting was started with the mic off (nothing to mute).
#[tauri::command]
pub async fn toggle_microphone_mute(
app: AppHandle,
state: State<'_, AppState>,
meeting_id: MeetingId,
) -> WaResult<bool> {
let guard = state.session.lock().await;
let session = guard
.as_ref()
.filter(|s| s.meeting_id == meeting_id)
.ok_or_else(|| WaError::new("recording", "no matching active recording"))?;
let mic = session
.mic_capture
.as_ref()
.ok_or_else(|| WaError::new("audio", "the microphone is off for this meeting"))?;
let muted = !mic.is_muted();
mic.set_muted(muted);
drop(guard);
let _ = app.emit(
"recording://mic",
serde_json::json!({ "meetingId": meeting_id, "muted": muted }),
);
crate::update_tray_tooltip(
&app,
if muted {
"WhispAssist — recording (mic muted)"
} else {
"WhispAssist — recording"
},
);
Ok(muted)
}
/// Toggle audio retention mid-meeting (ADR-0009, FR-REC-1).
#[tauri::command]
pub async fn set_recording_retention(