WIP: better precision?
This commit is contained in:
@@ -59,6 +59,7 @@ pub struct AudioConfig {
|
||||
pub refresh_rate: RefreshRate,
|
||||
pub show_scope: bool,
|
||||
pub show_spectrum: bool,
|
||||
pub lookahead_ms: u32,
|
||||
}
|
||||
|
||||
impl Default for AudioConfig {
|
||||
@@ -75,6 +76,7 @@ impl Default for AudioConfig {
|
||||
refresh_rate: RefreshRate::default(),
|
||||
show_scope: true,
|
||||
show_spectrum: true,
|
||||
lookahead_ms: 15,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,6 +142,7 @@ pub enum SettingKind {
|
||||
BufferSize,
|
||||
Polyphony,
|
||||
Nudge,
|
||||
Lookahead,
|
||||
}
|
||||
|
||||
impl SettingKind {
|
||||
@@ -148,16 +151,18 @@ impl SettingKind {
|
||||
Self::Channels => Self::BufferSize,
|
||||
Self::BufferSize => Self::Polyphony,
|
||||
Self::Polyphony => Self::Nudge,
|
||||
Self::Nudge => Self::Channels,
|
||||
Self::Nudge => Self::Lookahead,
|
||||
Self::Lookahead => Self::Channels,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn prev(self) -> Self {
|
||||
match self {
|
||||
Self::Channels => Self::Nudge,
|
||||
Self::Channels => Self::Lookahead,
|
||||
Self::BufferSize => Self::Channels,
|
||||
Self::Polyphony => Self::BufferSize,
|
||||
Self::Nudge => Self::Polyphony,
|
||||
Self::Lookahead => Self::Nudge,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -297,6 +302,11 @@ impl AudioSettings {
|
||||
self.config.max_voices = new_val;
|
||||
}
|
||||
|
||||
pub fn adjust_lookahead(&mut self, delta: i32) {
|
||||
let new_val = (self.config.lookahead_ms as i32 + delta).clamp(0, 50) as u32;
|
||||
self.config.lookahead_ms = new_val;
|
||||
}
|
||||
|
||||
pub fn toggle_refresh_rate(&mut self) {
|
||||
self.config.refresh_rate = self.config.refresh_rate.toggle();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user