Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions src-tauri/resources/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,25 @@ <h2>Audio Output</h2>
<option value="">System Default</option>
</select>
</div>
<div class="setting-item">
<div class="setting-label">
<span>Volume control</span>
<small
>How volume is controlled during playback. Changing this will briefly interrupt
playback.</small
>
</div>
<select
id="volume-mode-select"
onchange="changeVolumeMode()"
title="Hardware volume is faster and higher quality. Software volume should only be used when hardware control is unavailable."
>
<option value="auto">Auto (hardware with software fallback)</option>
<option value="hardware">Hardware only</option>
<option value="software">Software only</option>
<option value="disabled">Disabled</option>
</select>
</div>
<div class="setting-item">
<div class="setting-label">
<span>Sync delay</span>
Expand Down Expand Up @@ -337,6 +356,12 @@ <h2>Audio Output</h2>
// Load audio devices
await loadAudioDevices(settings.audio_device_id);

// Set volume control mode
const volumeMode = settings.volume_control_mode || "auto";
const volumeSelect = document.getElementById("volume-mode-select");
volumeSelect.value = volumeMode;
volumeSelect.dataset.previous = volumeMode;

const version = await invoke("get_app_version");
document.getElementById("version").textContent = `Music Assistant Companion v${version}`;
} catch (e) {
Expand Down Expand Up @@ -401,6 +426,19 @@ <h2>Audio Output</h2>
await invoke("set_string_setting", { key: "audio_device_id", value: deviceId });
}

async function changeVolumeMode() {
const select = document.getElementById("volume-mode-select");
const previous = select.dataset.previous;
try {
await invoke("set_string_setting", { key: "volume_control_mode", value: select.value });
await invoke("restart_sendspin");
select.dataset.previous = select.value;
} catch (e) {
console.error("[Settings] Failed to change volume mode:", e);
select.value = previous;
}
}

async function changeSyncDelay() {
const slider = document.getElementById("sync-delay-slider");
const value = parseInt(slider.value, 10);
Expand Down
8 changes: 8 additions & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,13 @@ async fn stop_sendspin() {
sendspin::stop().await;
}

/// Restart the Sendspin client
#[tauri::command]
async fn restart_sendspin() -> Result<(), String> {
sendspin::restart().await;
Ok(())
}

/// Get Sendspin connection status
#[tauri::command]
fn get_sendspin_status() -> sendspin::ConnectionStatus {
Expand Down Expand Up @@ -511,6 +518,7 @@ pub fn run() {
// Sendspin commands
list_audio_devices,
stop_sendspin,
restart_sendspin,
get_sendspin_status,
sendspin_command,
get_sendspin_player_id,
Expand Down
Loading