Fix: UI/UX
Some checks failed
CI / check (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Failing after 1m21s
Deploy Website / deploy (push) Has been skipped
CI / check (macos-14, aarch64-apple-darwin) (push) Has been cancelled
CI / check (windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled

This commit is contained in:
2026-03-01 00:58:26 +01:00
parent 2868e28ecc
commit 971d06ba31
22 changed files with 197 additions and 74 deletions

View File

@@ -113,7 +113,7 @@ pub struct AudioConfig {
pub sample_rate: f32,
pub host_name: String,
pub sample_paths: Vec<PathBuf>,
pub sample_count: usize,
pub sample_counts: Vec<usize>,
pub refresh_rate: RefreshRate,
pub show_scope: bool,
pub show_spectrum: bool,
@@ -140,7 +140,7 @@ impl Default for AudioConfig {
sample_rate: 44100.0,
host_name: String::new(),
sample_paths: Vec::new(),
sample_count: 0,
sample_counts: Vec::new(),
refresh_rate: RefreshRate::default(),
show_scope: true,
show_spectrum: true,
@@ -275,6 +275,7 @@ pub struct AudioSettings {
pub input_devices: Vec<AudioDeviceInfo>,
pub output_list: ListSelectState,
pub input_list: ListSelectState,
pub sample_list: ListSelectState,
pub restart_pending: bool,
pub error: Option<String>,
pub sample_registry: Option<std::sync::Arc<doux::SampleRegistry>>,
@@ -297,6 +298,10 @@ impl Default for AudioSettings {
cursor: 0,
scroll_offset: 0,
},
sample_list: ListSelectState {
cursor: 0,
scroll_offset: 0,
},
restart_pending: false,
error: None,
sample_registry: None,
@@ -321,6 +326,10 @@ impl AudioSettings {
cursor: 0,
scroll_offset: 0,
},
sample_list: ListSelectState {
cursor: 0,
scroll_offset: 0,
},
restart_pending: false,
error: None,
sample_registry: None,
@@ -429,14 +438,29 @@ impl AudioSettings {
self.config.refresh_rate = self.config.refresh_rate.toggle();
}
pub fn add_sample_path(&mut self, path: PathBuf) {
pub fn total_sample_count(&self) -> usize {
self.config.sample_counts.iter().sum()
}
pub fn add_sample_path(&mut self, path: PathBuf, count: usize) {
if !self.config.sample_paths.contains(&path) {
self.config.sample_paths.push(path);
self.config.sample_counts.push(count);
}
}
pub fn remove_last_sample_path(&mut self) {
self.config.sample_paths.pop();
pub fn remove_sample_path(&mut self, index: usize) {
if index < self.config.sample_paths.len() {
self.config.sample_paths.remove(index);
self.config.sample_counts.remove(index);
let len = self.config.sample_paths.len();
if len == 0 {
self.sample_list.cursor = 0;
self.sample_list.scroll_offset = 0;
} else if self.sample_list.cursor >= len {
self.sample_list.cursor = len - 1;
}
}
}
pub fn trigger_restart(&mut self) {