Struct gabc_parser::Note [−][src]
pub struct Note<'a> { pub prefix: &'a str, pub position: char, pub suffix: &'a str, pub current_clef: &'a str, }
Struct representing a gabc note.
Fields
prefix: &'a str
Entire prefix of the note (uncommon, only implemented here for "-" which indicates an initio debilis)
position: char
Main character of the note: its position in the gabc staff (a-m)
suffix: &'a str
Entire suffix of the note, including shape indicators and rhythmic signs, e.g. "V."
current_clef: &'a str
Clef governing this note in its original context
Methods
impl<'a> Note<'a>
[src]
impl<'a> Note<'a>
pub fn new<'b>(gabc_input: &'b str, current_clef: &'b str) -> Note<'b>
[src]
pub fn new<'b>(gabc_input: &'b str, current_clef: &'b str) -> Note<'b>
Create a new note from well-formed gabc input.
let n = Note::new("h..", "c1"); assert_eq!(n.prefix, ""); assert_eq!(n.position, 'h'); assert_eq!(n.suffix, ".."); assert_eq!(n.current_clef, "c1");
pub fn absolute_pitch(&self) -> &str
[src]
pub fn absolute_pitch(&self) -> &str
Get the absolute pitch of this note in modern (Lilypond) notation, between a, and a'''. Assumes that the clef indicates middle C or the F above middle C.
let n = Note::new("h..", "c1"); assert_eq!(n.absolute_pitch(), "g'");