format phrase length as B.B.TT

This commit is contained in:
🪞👃🪞 2024-10-14 22:43:20 +03:00
parent 7a6bdf2764
commit 05e0299f5f

View file

@ -17,9 +17,12 @@ impl Content for PhrasePool<Tui> {
let content = col!(
(i, phrase) in self.phrases.iter().enumerate() => Layers::new(|add|{
let Phrase { ref name, color, length, .. } = *phrase.read().unwrap();
let ticks = length % PPQ;
let beats = length % (4 * PPQ);
let bars = length / (4 * PPQ);
let row1 = lay!(
format!(" {i}").align_w().fill_x(),
format!("{length} ").align_e().fill_x(),
format!("{bars}.{beats}.{ticks:>02} ").align_e().fill_x(),
).fill_x();
let row2 = if let Some(PhrasePoolMode::Rename(phrase, _)) = self.mode {
if self.focused && i == phrase {