feat: add custom audio sources

- Add capture_apps list of AudioSourceConfig (application, deviceOutput
  or deviceInput) to AudioSettings, serialized in the settings JSON
- Add IPC commands getAudioDevices, addAudioSource, removeAudioSource
  and updateAudioSource
- obs_context builds wasapi sources for the microphone and configured
  apps alongside the game-capture source
- Settings.vue gains an audio sources tab with device dropdowns and
  per-source volume
- getAudioDevices temporarily returns hardcoded defaults while the
  WASAPI enumeration crash is investigated; crash marker files around
  IPC and native call sites are part of that investigation
This commit is contained in:
vhaudiquet committed 2026-11-12 23:17:26 +01:00
1 parent 7468bdf5de
commit 4f9f84446d
13 files changed
+1711 -69

No files matched your search

+68
View File
@@ -54,6 +54,10 @@ pub mod commands {
pub const RESET_SETTINGS: &str = "resetSettings";
pub const GET_STATUS: &str = "getStatus";
pub const GET_ENCODERS: &str = "getEncoders";
pub const GET_AUDIO_DEVICES: &str = "getAudioDevices";
pub const ADD_AUDIO_SOURCE: &str = "addAudioSource";
pub const REMOVE_AUDIO_SOURCE: &str = "removeAudioSource";
pub const UPDATE_AUDIO_SOURCE: &str = "updateAudioSource";
pub const START_RECORDING: &str = "startRecording";
pub const STOP_RECORDING: &str = "stopRecording";
pub const SHUTDOWN: &str = "shutdown";
@@ -554,6 +558,70 @@ pub async fn daemon_shutdown() -> Result<serde_json::Value, String> {
}
}
/// Get available audio devices from the daemon.
#[tauri::command]
pub async fn daemon_get_audio_devices() -> Result<serde_json::Value, String> {
let client = IpcClient::new();
let response = client
.send_command(commands::GET_AUDIO_DEVICES, None)
.await
.map_err(|e| e)?;
if response.success {
Ok(response.data.unwrap_or(serde_json::Value::Null))
} else {
Err(response.error.unwrap_or_else(|| "Unknown error".to_string()))
}
}
/// Add an audio source to the daemon settings.
#[tauri::command]
pub async fn daemon_add_audio_source(source: serde_json::Value) -> Result<serde_json::Value, String> {
let client = IpcClient::new();
let response = client
.send_command(commands::ADD_AUDIO_SOURCE, Some(source))
.await
.map_err(|e| e)?;
if response.success {
Ok(response.data.unwrap_or(serde_json::Value::Null))
} else {
Err(response.error.unwrap_or_else(|| "Unknown error".to_string()))
}
}
/// Remove an audio source from the daemon settings.
#[tauri::command]
pub async fn daemon_remove_audio_source(id: String) -> Result<serde_json::Value, String> {
let client = IpcClient::new();
let response = client
.send_command(commands::REMOVE_AUDIO_SOURCE, Some(serde_json::json!({ "id": id })))
.await
.map_err(|e| e)?;
if response.success {
Ok(response.data.unwrap_or(serde_json::Value::Null))
} else {
Err(response.error.unwrap_or_else(|| "Unknown error".to_string()))
}
}
/// Update an audio source in the daemon settings.
#[tauri::command]
pub async fn daemon_update_audio_source(source: serde_json::Value) -> Result<serde_json::Value, String> {
let client = IpcClient::new();
let response = client
.send_command(commands::UPDATE_AUDIO_SOURCE, Some(source))
.await
.map_err(|e| e)?;
if response.success {
Ok(response.data.unwrap_or(serde_json::Value::Null))
} else {
Err(response.error.unwrap_or_else(|| "Unknown error".to_string()))
}
}
/// Get the daemon log file path.
#[tauri::command]
pub fn daemon_get_log_path() -> Result<String, String> {