/// <summary> /// NoteBubble Constructor. /// Creates a new NoteBubble object and its Note with its alteration /// </summary> /// <param name="sharp">sharp (#)</param> /// <param name="flat">flat (b)</param> public NoteBubble(bool sharp, bool flat) { Note = new Note(NoteValue.alteration); Note.Flat = flat; Note.Sharp = sharp; Id = GlobalVariables.idNoteBubble++; }
/// <summary> /// Constructor by copie. /// </summary> /// <param name="note">the Note</param> public Note(Note note) { Octave = note.Octave; Duration = note.Duration; Pitch = note.Pitch; Sharp = note.Sharp; Flat = note.Flat; Position = note.Position; }
/// <summary> /// NoteBubble Constructor. /// Creates a new NoteBubble object and its Note. /// </summary> /// <param name="note">The note</param> public NoteBubble(Note note) { Note = note; Id = GlobalVariables.idNoteBubble++; }
/// <summary> /// NoteBubble Constructor. /// Creates a new NoteBubble object and its Note. /// </summary> /// <param name="noteValue">The NoteValue needed to create a Note</param> public NoteBubble(NoteValue noteValue) { Note = new Note(1, noteValue, "do", -1); Id = GlobalVariables.idNoteBubble++; }
/// <summary> /// Plays the given note with the instrument. /// </summary> /// <param name="n">The note to play</param> public void PlayNote(Note n) { Instrument tmp = new Instrument(Name); Thread t = new Thread(tmp.ActionPlay); t.Start(n); }
/// <summary> /// Return true if two notes are equals /// Don't mind about duration /// </summary> /// <param name="n"></param> /// <returns></returns> public bool equals(Note n) { return ((Octave == n.Octave) && (Position == n.Position) && (Pitch == n.Pitch)); }
/// <summary> /// Remove the note from the list Notes /// </summary> /// <param name="note">The note to remove</param> public void RemoveNote(Note note) { Notes.Remove(note); }
/// <summary> /// Adds a Note on the stave at a defined position. /// </summary> /// <param name="note">The note to be added</param> /// <param name="position">The Note position</param> public void AddNote(Note note, int position) { note.Position = position; if (!Notes.Contains(note)) { int i = 0; for (i=0; (i < Notes.Count && Notes[i].Position < position); i++); Notes.Insert(i, note); MaxPosition = Math.Max(MaxPosition, note.Position); } }