Make per-peer in-call volume continuous and persistent
The per-peer volume slider had no .step(), so iced's default step of 1.0 on a 0.0..=2.0 range meant it could only snap to 0%, 100%, or 200% — it felt like hard-left/hard-right only. Add .step(0.01) for smooth 1%-increment control (matching the Pan slider below it, which already set its own step). Also persist per-peer volume across sessions, mirroring peer_pan/peer_eq: - new AppConfig.peer_volume map (keyed by peer id string, serde default for back-compat; never sent over the wire) - replace the in-memory peer_volumes map with config-backed storage via a new set_peer_volume_config helper (clamps to range, drops at-unity entries so the config stays tidy) - replay saved volumes to core on startup alongside pan/eq - the slider writes to disk on release (AppMessage::PersistConfig) +1 unit test for the config helper; +1 config back-compat assertion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -255,6 +255,10 @@ pub struct AppConfig {
|
||||
/// keyed by peer node id string. Local preference only.
|
||||
#[serde(default)]
|
||||
pub peer_pan: HashMap<String, f32>,
|
||||
/// Per-peer listener-side volume/gain (`1.0` = unity), keyed by peer node id
|
||||
/// string. Local preference only; never sent to peers. Absent entry = unity.
|
||||
#[serde(default)]
|
||||
pub peer_volume: HashMap<String, f32>,
|
||||
/// Focused app-local keyboard shortcuts.
|
||||
#[serde(default)]
|
||||
pub hotkeys: crate::hotkeys::HotkeyMap,
|
||||
@@ -317,6 +321,7 @@ impl Default for AppConfig {
|
||||
recents: Vec::new(),
|
||||
peer_eq: HashMap::new(),
|
||||
peer_pan: HashMap::new(),
|
||||
peer_volume: HashMap::new(),
|
||||
hotkeys: crate::hotkeys::HotkeyMap::default(),
|
||||
window_width: default_window_width(),
|
||||
window_height: default_window_height(),
|
||||
@@ -457,6 +462,7 @@ mod tests {
|
||||
// shortcut settings.
|
||||
assert!(deserialized.peer_eq.is_empty());
|
||||
assert!(deserialized.peer_pan.is_empty());
|
||||
assert!(deserialized.peer_volume.is_empty());
|
||||
assert_eq!(
|
||||
crate::hotkeys::format_binding(
|
||||
deserialized
|
||||
|
||||
Reference in New Issue
Block a user