mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
rename phrase -> clip mostly everywhere
This commit is contained in:
parent
709391ff0a
commit
08f7a62692
24 changed files with 426 additions and 423 deletions
|
|
@ -58,42 +58,3 @@ pub fn update_keys (keys: &mut[bool;128], message: &MidiMessage) {
|
|||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
/// A phrase, rendered as a horizontal piano roll.
|
||||
pub struct PianoHorizontal {
|
||||
phrase: Option<Arc<RwLock<MidiClip>>>,
|
||||
/// Buffer where the whole phrase is rerendered on change
|
||||
buffer: Arc<RwLock<BigBuffer>>,
|
||||
/// Size of actual notes area
|
||||
size: Measure<TuiOut>,
|
||||
/// The display window
|
||||
range: MidiRangeModel,
|
||||
/// The note cursor
|
||||
point: MidiPointModel,
|
||||
/// The highlight color palette
|
||||
color: ItemPalette,
|
||||
/// Width of the keyboard
|
||||
keys_width: u16,
|
||||
}
|
||||
|
||||
impl PianoHorizontal {
|
||||
pub fn new (phrase: Option<&Arc<RwLock<MidiClip>>>) -> Self {
|
||||
let size = Measure::new();
|
||||
let mut range = MidiRangeModel::from((24, true));
|
||||
range.time_axis = size.x.clone();
|
||||
range.note_axis = size.y.clone();
|
||||
let mut piano = Self {
|
||||
keys_width: 5,
|
||||
size,
|
||||
range,
|
||||
buffer: RwLock::new(Default::default()).into(),
|
||||
point: MidiPointModel::default(),
|
||||
phrase: phrase.cloned(),
|
||||
color: phrase.as_ref()
|
||||
.map(|p|p.read().unwrap().color)
|
||||
.unwrap_or(ItemPalette::from(ItemColor::from(TuiTheme::g(64)))),
|
||||
};
|
||||
piano.redraw();
|
||||
piano
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue