scene and track colors; random_color_near

This commit is contained in:
🪞👃🪞 2024-10-11 18:02:03 +03:00
parent f500c717a2
commit 6bee5b0bcd
5 changed files with 80 additions and 38 deletions

View file

@ -158,20 +158,6 @@ impl<E: Engine> PhraseEditor<E> {
}
}
}
pub fn random_color () -> Color {
let mut rng = thread_rng();
let color: Okhsl<f32> = Okhsl::new(
rng.gen::<f32>() * 360f32 - 180f32,
rng.gen::<f32>() * 0.5 + 0.4,
rng.gen::<f32>() * 0.5 + 0.15,
);
let color: Srgb<f32> = Srgb::from_color_unclamped(color);
Color::Rgb(
(color.red * 255.0) as u8,
(color.green * 255.0) as u8,
(color.blue * 255.0) as u8,
)
}
impl Phrase {
pub fn new (
name: impl AsRef<str>,
@ -257,19 +243,19 @@ impl std::cmp::PartialEq for Phrase {
}
impl Eq for Phrase {}
impl<E: Engine> PhrasePlayer<E> {
pub fn new (name: &str) -> Self {
pub fn new () -> Self {
Self {
_engine: Default::default(),
phrase: None,
notes_in: Arc::new(RwLock::new([false;128])),
notes_out: Arc::new(RwLock::new([false;128])),
monitoring: false,
recording: false,
overdub: true,
midi_out: None,
midi_out_buf: vec![Vec::with_capacity(16);16384],
reset: true,
now: 0,
_engine: Default::default(),
phrase: None,
notes_in: Arc::new(RwLock::new([false;128])),
notes_out: Arc::new(RwLock::new([false;128])),
monitoring: false,
recording: false,
overdub: true,
midi_out: None,
midi_out_buf: vec![Vec::with_capacity(16);16384],
reset: true,
now: 0,
}
}
pub fn toggle_monitor (&mut self) {