Feat: continue refactoring
Some checks failed
Deploy Website / deploy (push) Failing after 4m48s

This commit is contained in:
2026-02-01 13:39:25 +01:00
parent dd853b8e1b
commit b47c789612
20 changed files with 766 additions and 581 deletions

View File

@@ -1,6 +1,8 @@
use doux::audio::AudioDeviceInfo;
use std::path::PathBuf;
use super::CyclicEnum;
#[derive(Clone, Copy, PartialEq, Eq, Default)]
pub enum RefreshRate {
#[default]
@@ -128,6 +130,10 @@ pub enum EngineSection {
Samples,
}
impl CyclicEnum for EngineSection {
const VARIANTS: &'static [Self] = &[Self::Devices, Self::Settings, Self::Samples];
}
#[derive(Clone, Copy, PartialEq, Eq, Default)]
pub enum DeviceKind {
#[default]
@@ -145,26 +151,14 @@ pub enum SettingKind {
Lookahead,
}
impl SettingKind {
pub fn next(self) -> Self {
match self {
Self::Channels => Self::BufferSize,
Self::BufferSize => Self::Polyphony,
Self::Polyphony => Self::Nudge,
Self::Nudge => Self::Lookahead,
Self::Lookahead => Self::Channels,
}
}
pub fn prev(self) -> Self {
match self {
Self::Channels => Self::Lookahead,
Self::BufferSize => Self::Channels,
Self::Polyphony => Self::BufferSize,
Self::Nudge => Self::Polyphony,
Self::Lookahead => Self::Nudge,
}
}
impl CyclicEnum for SettingKind {
const VARIANTS: &'static [Self] = &[
Self::Channels,
Self::BufferSize,
Self::Polyphony,
Self::Nudge,
Self::Lookahead,
];
}
pub struct Metrics {
@@ -242,19 +236,11 @@ impl AudioSettings {
}
pub fn next_section(&mut self) {
self.section = match self.section {
EngineSection::Devices => EngineSection::Settings,
EngineSection::Settings => EngineSection::Samples,
EngineSection::Samples => EngineSection::Devices,
};
self.section = self.section.next();
}
pub fn prev_section(&mut self) {
self.section = match self.section {
EngineSection::Devices => EngineSection::Samples,
EngineSection::Settings => EngineSection::Devices,
EngineSection::Samples => EngineSection::Settings,
};
self.section = self.section.prev();
}
pub fn current_output_device_index(&self) -> usize {