#[derive(PartialEq, Debug)]
pub enum Length {
Whole,
Half,
Quarter,
Eighth,
Sixteenth,
ThirtySecond,
SixtyFourth,
OneTwentyEighth,
}
impl Default for Length {
fn default() -> Self {
Length::Quarter
}
}
#[derive(PartialEq, Debug)]
pub enum NoteDurationType {
Note,
Rest,
}
impl Default for NoteDurationType {
fn default() -> Self {
NoteDurationType::Note
}
}
#[derive(PartialEq, Debug)]
pub struct NoteDuration {
pub length: Length,
pub dotted: bool,
pub duration_type: NoteDurationType,
}
impl NoteDuration {
pub fn new() -> NoteDuration {
NoteDuration {
length: Default::default(),
dotted: false,
duration_type: Default::default(),
}
}
pub fn length(&mut self, length: Length) {
self.length = length;
}
pub fn dotted(&mut self, is_dotted: bool) {
self.dotted = is_dotted;
}
pub fn duration_type(&mut self, duration_type: NoteDurationType) {
self.duration_type = duration_type;
}
}