wip: big flat

This commit is contained in:
🪞👃🪞 2024-12-30 15:56:56 +01:00
parent 8cbe621b07
commit 4a3de618d0
20 changed files with 305 additions and 336 deletions

View file

@ -1,69 +1,50 @@
#![allow(unused)]
#![allow(clippy::unit_arg)]
pub mod core; pub use self::core::*;
pub mod time; pub(crate) use self::time::*;
pub use self::time::HasClock;
pub mod space; pub(crate) use self::space::*;
pub use self::space::Measure;
pub mod tui; pub(crate) use self::tui::*;
pub use tui::*;
pub mod jack; pub(crate) use self::jack::*;
pub use self::jack::*;
pub mod midi; pub(crate) use self::midi::*;
pub mod meter; pub(crate) use self::meter::*;
pub mod piano_h; pub(crate) use self::piano_h::*;
pub mod transport; pub(crate) use self::transport::*;
pub use self::transport::TransportTui;
pub mod sequencer; pub(crate) use self::sequencer::*;
pub use self::sequencer::SequencerTui;
pub mod arranger; pub(crate) use self::arranger::*;
pub use self::arranger::ArrangerTui;
pub mod sampler; pub(crate) use self::sampler::*;
pub use self::sampler::{SamplerTui, Sampler, Sample, Voice};
pub mod mixer; pub(crate) use self::mixer::*;
pub use self::mixer::{Mixer, MixerTrack, MixerTrackDevice};
pub mod plugin; pub(crate) use self::plugin::*;
pub use self::plugin::*;
pub mod groovebox; pub(crate) use self::groovebox::*;
pub use self::groovebox::Groovebox;
pub mod pool; pub(crate) use self::pool::*;
pub use self::pool::PoolModel;
pub mod status; pub(crate) use self::status::*;
pub use ::better_panic; pub(crate) use better_panic::{Settings, Verbosity};
pub use ::atomic_float; pub(crate) use atomic_float::*;
pub(crate) use std::sync::{Arc, Mutex, RwLock};
pub(crate) use std::sync::atomic::Ordering;
pub(crate) use std::sync::atomic::{AtomicBool, AtomicUsize};
pub(crate) use std::collections::BTreeMap;
pub(crate) use std::marker::PhantomData;
pub(crate) use std::thread::{spawn, JoinHandle};
pub(crate) use std::path::PathBuf;
pub(crate) use std::ffi::OsString;
pub(crate) use std::time::Duration;
pub(crate) use std::io::{Stdout, stdout};
pub(crate) use std::ops::{Add, Sub, Mul, Div, Rem};
pub(crate) use std::cmp::{Ord, Eq, PartialEq};
pub(crate) use std::collections::BTreeMap;
pub(crate) use std::error::Error;
pub(crate) use std::ffi::OsString;
pub(crate) use std::fmt::{Debug, Display, Formatter};
pub(crate) use std::io::{Stdout, stdout};
pub(crate) use std::marker::PhantomData;
pub(crate) use std::ops::{Add, Sub, Mul, Div, Rem};
pub(crate) use std::path::PathBuf;
pub(crate) use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering::{self, *}};
pub(crate) use std::sync::{Arc, Mutex, RwLock};
pub(crate) use std::thread::{spawn, JoinHandle};
pub(crate) use std::time::Duration;
pub mod arranger; pub use self::arranger::*;
pub mod color; pub use self::color::*;
pub mod command; pub use self::command::*;
pub mod engine; pub use self::engine::*;
pub mod event; pub use self::event::*;
pub mod file; pub use self::file::*;
pub mod focus; pub use self::focus::*;
pub mod groovebox; pub use self::groovebox::*;
pub mod input; pub use self::input::*;
pub mod jack; pub use self::jack::*;
pub mod meter; pub use self::meter::*;
pub mod midi; pub use self::midi::*;
pub mod mixer; pub use self::mixer::*;
pub mod output; pub use self::output::*;
pub mod piano_h; pub use self::piano_h::*;
pub mod plugin; pub use self::plugin::*;
pub mod pool; pub use self::pool::*;
pub mod sampler; pub use self::sampler::*;
pub mod sequencer; pub use self::sequencer::*;
pub mod space; pub use self::space::*;
pub mod status; pub use self::status::*;
pub mod time; pub use self::time::*;
pub mod transport; pub use self::transport::*;
pub mod tui; pub use self::tui::*;
pub use ::better_panic;
pub(crate) use better_panic::{Settings, Verbosity};
pub use ::atomic_float;
pub(crate) use atomic_float::*;
pub use ::crossterm;
pub(crate) use crossterm::{ExecutableCommand};
@ -93,3 +74,55 @@ pub(crate) use ::palette::{
};
testmod! { test }
/// Standard result type.
pub type Usually<T> = Result<T, Box<dyn Error>>;
/// Standard optional result type.
pub type Perhaps<T> = Result<Option<T>, Box<dyn Error>>;
/// Define test modules.
#[macro_export] macro_rules! testmod {
($($name:ident)*) => { $(#[cfg(test)] mod $name;)* };
}
/// Prototypal case of implementor macro.
/// Saves 4loc per data pats.
#[macro_export] macro_rules! from {
($(<$($lt:lifetime),+>)?|$state:ident:$Source:ty|$Target:ty=$cb:expr) => {
impl $(<$($lt),+>)? From<$Source> for $Target {
fn from ($state:$Source) -> Self { $cb }
}
};
}
pub trait Gettable<T> {
/// Returns current value
fn get (&self) -> T;
}
pub trait Mutable<T>: Gettable<T> {
/// Sets new value, returns old
fn set (&mut self, value: T) -> T;
}
pub trait InteriorMutable<T>: Gettable<T> {
/// Sets new value, returns old
fn set (&self, value: T) -> T;
}
impl Gettable<bool> for AtomicBool {
fn get (&self) -> bool { self.load(Relaxed) }
}
impl InteriorMutable<bool> for AtomicBool {
fn set (&self, value: bool) -> bool { self.swap(value, Relaxed) }
}
impl Gettable<usize> for AtomicUsize {
fn get (&self) -> usize { self.load(Relaxed) }
}
impl InteriorMutable<usize> for AtomicUsize {
fn set (&self, value: usize) -> usize { self.swap(value, Relaxed) }
}