mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
fix some of the many lints and warnings
This commit is contained in:
parent
c37cc8840e
commit
498acac9cc
19 changed files with 41 additions and 54 deletions
|
|
@ -28,8 +28,9 @@ uuid = { version = "1.10.0", features = [ "v4" ] }
|
|||
wavers = "1.4.3"
|
||||
#winit = { version = "0.30.4", features = [ "x11" ] }
|
||||
|
||||
[dev-dependencies]
|
||||
#tek_app = { version = "0.1.0", path = "../tek_app" }
|
||||
[lib]
|
||||
name = "tek_lib"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "tek_arranger"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::unit_arg)]
|
||||
|
||||
include!("../lib.rs");
|
||||
|
||||
pub fn main () -> Usually<()> {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::unit_arg)]
|
||||
|
||||
include!("../lib.rs");
|
||||
|
||||
pub fn main () -> Usually<()> {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ pub use ratatui::prelude::Color;
|
|||
|
||||
pub trait HasColor {
|
||||
fn color (&self) -> ItemColor;
|
||||
fn color_mut (&self) -> &mut ItemColor;
|
||||
fn color_mut (&mut self) -> &mut ItemColor;
|
||||
}
|
||||
|
||||
/// A color in OKHSL and RGB representations.
|
||||
|
|
@ -50,20 +50,20 @@ impl ItemColor {
|
|||
}
|
||||
from!(|base: Color|ItemPalette = Self::from(ItemColor::from(base)));
|
||||
from!(|base: ItemColor|ItemPalette = {
|
||||
let mut light = base.okhsl.clone();
|
||||
let mut light = base.okhsl;
|
||||
light.lightness = (light.lightness * 1.3).min(Okhsl::<f32>::max_lightness());
|
||||
let mut lighter = light.clone();
|
||||
let mut lighter = light;
|
||||
lighter.lightness = (lighter.lightness * 1.3).min(Okhsl::<f32>::max_lightness());
|
||||
let mut lightest = lighter.clone();
|
||||
let mut lightest = lighter;
|
||||
lightest.lightness = (lightest.lightness * 1.3).min(Okhsl::<f32>::max_lightness());
|
||||
|
||||
let mut dark = base.okhsl.clone();
|
||||
let mut dark = base.okhsl;
|
||||
dark.lightness = (dark.lightness * 0.75).max(Okhsl::<f32>::min_lightness());
|
||||
dark.saturation = (dark.saturation * 0.75).max(Okhsl::<f32>::min_saturation());
|
||||
let mut darker = dark.clone();
|
||||
let mut darker = dark;
|
||||
darker.lightness = (darker.lightness * 0.66).max(Okhsl::<f32>::min_lightness());
|
||||
darker.saturation = (darker.saturation * 0.66).max(Okhsl::<f32>::min_saturation());
|
||||
let mut darkest = darker.clone();
|
||||
let mut darkest = darker;
|
||||
darkest.lightness = (darkest.lightness * 0.50).max(Okhsl::<f32>::min_lightness());
|
||||
darkest.saturation = (darkest.saturation * 0.50).max(Okhsl::<f32>::min_saturation());
|
||||
|
||||
|
|
|
|||
|
|
@ -5,14 +5,11 @@ pub(crate) mod client; pub(crate) use self::client::*;
|
|||
pub(crate) mod jack_event; pub(crate) use self::jack_event::*;
|
||||
pub(crate) mod ports; pub(crate) use self::ports::*;
|
||||
pub(crate) use ::jack::{
|
||||
contrib::ClosureProcessHandler,
|
||||
contrib::ClosureProcessHandler, NotificationHandler,
|
||||
Client, AsyncClient, ClientOptions, ClientStatus,
|
||||
ProcessScope, Control, CycleTimes,
|
||||
Port, PortId,
|
||||
PortSpec, MidiIn, MidiOut, AudioIn, AudioOut, Unowned,
|
||||
Transport, TransportState, MidiIter, RawMidi,
|
||||
Frames,
|
||||
NotificationHandler,
|
||||
ProcessScope, Control, CycleTimes, Frames,
|
||||
Port, PortId, PortSpec, Unowned, MidiIn, MidiOut, AudioIn, AudioOut,
|
||||
Transport, TransportState, MidiIter, MidiWriter, RawMidi,
|
||||
};
|
||||
|
||||
/// Implement [TryFrom<&Arc<RwLock<JackClient>>>]: create app state from wrapped JACK handle.
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
const FOO: () = ();
|
||||
|
||||
pub mod core; pub use self::core::*;
|
||||
pub mod time; pub(crate) use self::time::*;
|
||||
pub mod space; pub(crate) use self::space::*;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ pub fn to_note_name (n: usize) -> &'static str {
|
|||
MIDI_NOTE_NAMES[n]
|
||||
}
|
||||
|
||||
pub const MIDI_NOTE_NAMES: [&'static str;128] = [
|
||||
pub const MIDI_NOTE_NAMES: [&str; 128] = [
|
||||
"C0", "C#0", "D0", "D#0", "E0", "F0", "F#0", "G0", "G#0", "A0", "A#0", "B0",
|
||||
"C1", "C#1", "D1", "D#1", "E1", "F1", "F#1", "G1", "G#1", "A1", "A#1", "B1",
|
||||
"C2", "C#2", "D2", "D#2", "E2", "F2", "F#2", "G2", "G#2", "A2", "A#2", "B2",
|
||||
|
|
|
|||
|
|
@ -90,11 +90,7 @@ impl<E: Engine, T: Render<E>> Render<E> for Align<E, T> {
|
|||
let inner_area = outer_area.clip(inner_size);
|
||||
if let Some(aligned) = align(&self, outer_area.into(), inner_area.into()) {
|
||||
to.render_in(aligned, self.inner())?
|
||||
} else {
|
||||
()
|
||||
}
|
||||
} else {
|
||||
()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,6 @@ impl<E: Engine, X: Render<E>, Y: Render<E>> Render<E> for Bsp<E, X, Y> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
#[cfg(test)] #[test] fn test_bsp () {
|
||||
// TODO
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,17 +57,9 @@ pub struct Either<E: Engine, A: Render<E>, B: Render<E>>(
|
|||
|
||||
impl<E: Engine, A: Render<E>, B: Render<E>> Render<E> for Either<E, A, B> {
|
||||
fn min_size (&self, to: E::Size) -> Perhaps<E::Size> {
|
||||
if self.1 {
|
||||
return self.2.min_size(to)
|
||||
} else {
|
||||
return self.3.min_size(to)
|
||||
}
|
||||
if self.1 { self.2.min_size(to) } else { self.3.min_size(to) }
|
||||
}
|
||||
fn render (&self, to: &mut E::Output) -> Usually<()> {
|
||||
if self.1 {
|
||||
return self.2.render(to)
|
||||
} else {
|
||||
return self.3.render(to)
|
||||
}
|
||||
if self.1 { self.2.render(to) } else { self.3.render(to) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,12 +48,12 @@ pub trait TimeUnit: InteriorMutable<f64> {}
|
|||
impl_op!($T, Mul, mul, |a, b|{a * b});
|
||||
impl_op!($T, Div, div, |a, b|{a / b});
|
||||
impl_op!($T, Rem, rem, |a, b|{a % b});
|
||||
impl From<f64> for $T { fn from (value: f64) -> Self { Self(value.into()) } }
|
||||
impl From<usize> for $T { fn from (value: usize) -> Self { Self((value as f64).into()) } }
|
||||
impl Into<f64> for $T { fn into (self) -> f64 { self.get() } }
|
||||
impl Into<usize> for $T { fn into (self) -> usize { self.get() as usize } }
|
||||
impl Into<f64> for &$T { fn into (self) -> f64 { self.get() } }
|
||||
impl Into<usize> for &$T { fn into (self) -> usize { self.get() as usize } }
|
||||
impl From<f64> for $T { fn from (value: f64) -> Self { Self(value.into()) } }
|
||||
impl From<usize> for $T { fn from (value: usize) -> Self { Self((value as f64).into()) } }
|
||||
impl From<$T> for f64 { fn from (value: $T) -> Self { value.get() } }
|
||||
impl From<$T> for usize { fn from (value: $T) -> Self { value.get() as usize } }
|
||||
impl From<&$T> for f64 { fn from (value: &$T) -> Self { value.get() } }
|
||||
impl From<&$T> for usize { fn from (value: &$T) -> Self { value.get() as usize } }
|
||||
impl Clone for $T { fn clone (&self) -> Self { Self(self.get().into()) } }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ mod tui_border; pub(crate) use self::tui_border::*;
|
|||
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
mod app_transport; pub(crate) use self::app_transport::*;
|
||||
mod app_sequencer; pub(crate) use self::app_sequencer::*;
|
||||
mod app_sampler; pub(crate) use self::app_sampler::*;
|
||||
mod app_groovebox; pub(crate) use self::app_groovebox::*;
|
||||
mod app_arranger; pub(crate) use self::app_arranger::*;
|
||||
mod app_transport; #[allow(unused)] pub(crate) use self::app_transport::*;
|
||||
mod app_sequencer; #[allow(unused)] pub(crate) use self::app_sequencer::*;
|
||||
mod app_sampler; #[allow(unused)] pub(crate) use self::app_sampler::*;
|
||||
mod app_groovebox; #[allow(unused)] pub(crate) use self::app_groovebox::*;
|
||||
mod app_arranger; #[allow(unused)] pub(crate) use self::app_arranger::*;
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ impl ArrangerSelection {
|
|||
Self::Mix => format!("Everything"),
|
||||
Self::Track(t) => match tracks.get(*t) {
|
||||
Some(track) => format!("T{t}: {}", &track.name.read().unwrap()),
|
||||
None => format!("T??"),
|
||||
None => "T??".into(),
|
||||
},
|
||||
Self::Scene(s) => match scenes.get(*s) {
|
||||
Some(scene) => format!("S{s}: {}", &scene.name.read().unwrap()),
|
||||
None => format!("S??"),
|
||||
None => "S??".into(),
|
||||
},
|
||||
Self::Clip(t, s) => match (tracks.get(*t), scenes.get(*s)) {
|
||||
(Some(_), Some(scene)) => match scene.clip(*t) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use crate::*;
|
||||
use KeyCode::{Char, Delete};
|
||||
|
||||
impl ArrangerTui {
|
||||
pub fn track_next_name (&self) -> String {
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ impl PianoHorizontal {
|
|||
let mut range = MidiRangeModel::from((24, true));
|
||||
range.time_axis = size.x.clone();
|
||||
range.note_axis = size.y.clone();
|
||||
let phrase = phrase.map(|p|p.clone());
|
||||
let color = phrase.as_ref()
|
||||
let color = phrase.as_ref()
|
||||
.map(|p|p.read().unwrap().color)
|
||||
.unwrap_or(ItemPalette::from(ItemColor::from(TuiTheme::g(64))));
|
||||
Self {
|
||||
|
|
@ -40,7 +39,7 @@ impl PianoHorizontal {
|
|||
point: MidiPointModel::default(),
|
||||
size,
|
||||
range,
|
||||
phrase,
|
||||
phrase: phrase.map(|p|p.clone()),
|
||||
color
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::*;
|
|||
use super::*;
|
||||
use PhraseLengthFocus::*;
|
||||
use PhraseLengthCommand::*;
|
||||
use KeyCode::{Up, Down, Left, Right, Enter, Esc};
|
||||
|
||||
/// Displays and edits phrase length.
|
||||
#[derive(Clone)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use crate::*;
|
||||
use super::*;
|
||||
|
||||
/// Status bar for arranger app
|
||||
#[derive(Clone)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use crate::*;
|
||||
use super::*;
|
||||
|
||||
pub struct PhraseEditStatus<'a>(pub &'a PhraseEditorModel);
|
||||
render!(<Tui>|self:PhraseEditStatus<'a>|{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use crate::*;
|
||||
use super::*;
|
||||
|
||||
/// Status bar for sequencer app
|
||||
#[derive(Clone)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue