Beispiel #1
0
        public bool IsFull(List <Bar> bars)
        {
            double length = 0;

            foreach (NoteRest note in notes)
            {
                length += note.GetLength();
            }
            if (length == (double)amount / type)
            {
                Bar bar = new Bar();
                bar.SetAmount(amount);
                bar.SetType(type);
                bars.Add(bar);
                return(true);
            }
            if (length > (double)amount / type)
            {
                NoteRest lastNote = notes[notes.Count - 1];
                notes.Remove(lastNote);
                Bar bar = new Bar();
                bar.SetAmount(amount);
                bar.SetType(type);
                bar.AddNote(lastNote);
                bars.Add(bar);
                Fill();
                return(true);
            }
            return(false);
        }
Beispiel #2
0
        public void AddNote(NoteRest note)
        {
            Bar bar = bars[bars.Count - 1];

            if (bar.IsFull(bars))
            {
                bar = bars[bars.Count - 1];
            }
            bar.AddNote(note);
        }
Beispiel #3
0
 public void AddNote(NoteRest note)
 {
     notes.Add(note);
 }