wip: inc/dec phrase length

This commit is contained in:
🪞👃🪞 2024-10-16 11:32:56 +03:00
parent 26d75340f6
commit ff342963a1
3 changed files with 56 additions and 13 deletions

View file

@ -342,7 +342,7 @@ impl<E: Engine> PhraseLength<E> {
self.pulses / (self.bpb * self.ppq)
}
pub fn beats (&self) -> usize {
self.pulses % (self.bpb * self.ppq)
(self.pulses % (self.bpb * self.ppq)) / self.ppq
}
pub fn ticks (&self) -> usize {
self.pulses % self.ppq
@ -359,3 +359,19 @@ impl<E: Engine> PhraseLength<E> {
}
#[derive(Copy,Clone)]
pub enum PhraseLengthFocus { Bar, Beat, Tick }
impl PhraseLengthFocus {
pub fn next (&mut self) {
*self = match self {
Self::Bar => Self::Beat,
Self::Beat => Self::Tick,
Self::Tick => Self::Bar,
}
}
pub fn prev (&mut self) {
*self = match self {
Self::Bar => Self::Tick,
Self::Beat => Self::Bar,
Self::Tick => Self::Beat,
}
}
}