modify pool width; wip: status bars

This commit is contained in:
🪞👃🪞 2024-10-18 23:25:01 +03:00
parent 4994e218f7
commit 0699b9d105
5 changed files with 104 additions and 40 deletions

View file

@ -18,7 +18,20 @@ pub struct Sequencer<E: Engine> {
}
/// Sections in the sequencer app that may be focused
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum SequencerFocus { Transport, PhrasePool, PhraseEditor }
pub enum SequencerFocus {
/// The transport (toolbar) is focused
Transport,
/// The phrase list (pool) is focused
PhrasePool,
/// The phrase editor (sequencer) is focused
PhraseEditor,
}
/// Status bar for sequencer app
pub enum SequencerStatusBar {
Transport,
PhrasePool,
PhraseEditor,
}
/// Contains all phrases in a project
pub struct PhrasePool<E: Engine> {
_engine: PhantomData<E>,
@ -35,7 +48,9 @@ pub struct PhrasePool<E: Engine> {
}
/// Modes for phrase pool
pub enum PhrasePoolMode {
/// Renaming a pattern
Rename(usize, String),
/// Editing the length of a pattern
Length(usize, usize, PhraseLengthFocus),
}
/// A MIDI sequence.
@ -328,12 +343,17 @@ impl<E: Engine> PhrasePlayer<E> {
self.overdub = !self.overdub;
}
}
/// Displays and edits phrase length
pub struct PhraseLength<E: Engine> {
_engine: PhantomData<E>,
pub ppq: usize,
pub bpb: usize,
/// Pulses per beat (quaver)
pub ppq: usize,
/// Beats per bar
pub bpb: usize,
/// Length of phrase in pulses
pub pulses: usize,
pub focus: Option<PhraseLengthFocus>,
/// Selected subdivision
pub focus: Option<PhraseLengthFocus>,
}
impl<E: Engine> PhraseLength<E> {
pub fn new (pulses: usize, focus: Option<PhraseLengthFocus>) -> Self {
@ -365,7 +385,14 @@ impl<E: Engine> PhraseLength<E> {
}
}
#[derive(Copy,Clone)]
pub enum PhraseLengthFocus { Bar, Beat, Tick }
pub enum PhraseLengthFocus {
/// Editing the number of bars
Bar,
/// Editing the number of beats
Beat,
/// Editing the number of ticks
Tick,
}
impl PhraseLengthFocus {
pub fn next (&mut self) {
*self = match self {