pub mod action;
pub mod command;
pub mod config;
pub mod dispatch;
pub mod dj;
pub mod fx;
pub mod instance;
pub mod loops;
pub mod media;
pub mod message;
pub mod meter;
pub mod mix;
pub mod model;
pub mod persist;
pub mod sampler;
pub mod tape;
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum View {
Library,
Queue,
Selection,
Playlists,
Sampler,
Loops,
Tape,
Dj,
Mix,
}
impl View {
pub const ALL: [View; 9] = [
View::Library,
View::Queue,
View::Selection,
View::Playlists,
View::Sampler,
View::Loops,
View::Tape,
View::Dj,
View::Mix,
];
pub const TERMINAL: [View; 6] = [
View::Library,
View::Queue,
View::Selection,
View::Playlists,
View::Sampler,
View::Loops,
];
pub fn title(self) -> &'static str {
match self {
View::Library => "Library",
View::Selection => "Selection",
View::Playlists => "Playlists",
View::Sampler => "Sampler",
View::Loops => "Loops",
View::Queue => "Queue",
View::Tape => "Tape",
View::Dj => "DJ",
View::Mix => "Mix",
}
}
pub fn step(self, shown: &[View], by: isize) -> Self {
match shown.iter().position(|v| *v == self) {
Some(at) => shown[(at as isize + by).rem_euclid(shown.len() as isize) as usize],
None => shown[0],
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Theme {
System,
Light,
#[default]
Dark,
}
impl Theme {
pub const NAMES: [(&'static str, Theme); 3] = [
("system", Theme::System),
("light", Theme::Light),
("dark", Theme::Dark),
];
pub fn name(self) -> &'static str {
Theme::NAMES
.iter()
.find(|t| t.1 == self)
.expect("every theme")
.0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum Display {
#[default]
Envelope,
Decibels,
Braille,
Spectrogram,
}
impl Display {
pub fn name(self) -> &'static str {
match self {
Display::Envelope => "envelope",
Display::Decibels => "db",
Display::Braille => "braille",
Display::Spectrogram => "spectrogram",
}
}
pub fn next(self) -> Display {
match self {
Display::Envelope => Display::Decibels,
Display::Decibels => Display::Spectrogram,
Display::Spectrogram => Display::Braille,
Display::Braille => Display::Envelope,
}
}
}