pub struct Progression {
pub chords: Vec<(Chord, f32)>,
pub current: usize,
pub beat_clock: f32,
}Expand description
A sequence of chords with durations (in beats).
Fields§
§chords: Vec<(Chord, f32)>§current: usize§beat_clock: f32Implementations§
Source§impl Progression
impl Progression
pub fn new(chords: Vec<(Chord, f32)>) -> Self
Sourcepub fn one_five_six_four(octave: i32) -> Self
pub fn one_five_six_four(octave: i32) -> Self
I–V–vi–IV in major (pop progression).
Sourcepub fn two_five_one(octave: i32) -> Self
pub fn two_five_one(octave: i32) -> Self
ii–V–I (jazz).
Sourcepub fn tick(&mut self, beat_delta: f32) -> Option<&Chord>
pub fn tick(&mut self, beat_delta: f32) -> Option<&Chord>
Advance the progression clock by beat_delta. Returns Some(chord) when a new chord starts.
pub fn current_chord(&self) -> Option<&Chord>
pub fn progress_in_chord(&self) -> f32
Trait Implementations§
Source§impl Clone for Progression
impl Clone for Progression
Source§fn clone(&self) -> Progression
fn clone(&self) -> Progression
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Progression
impl RefUnwindSafe for Progression
impl Send for Progression
impl Sync for Progression
impl Unpin for Progression
impl UnsafeUnpin for Progression
impl UnwindSafe for Progression
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.