Beispiel #1
0
        //////////// Constructors ////////////
        /// <summary>
        /// Creates an LMeasure object that contains the supplied list of elements.
        /// </summary>
        /// <param name="elems">A LinkedList of MusicalSymbol objects to add to the LMeasure.</param>
        /// <param name="staff">The LStaff object that contains or will contain the LMeasure.</param>
        /// <param name="capacity">The number of whole notes that can fit into the measure. This number is overridden
        /// if the LMeasure contains a TimeSignature object. Default = 1.</param>
        internal LMeasure(List <MusicalSymbol> elems, LStaff staff, double capacity = 1)
        {
            foreach (MusicalSymbol item in elems)
            {
                AddLast(item);
            }

            if (capacity != 0)
            {
                this.capacity = capacity;
            }
            TimeSignature sig = (TimeSignature)elems.FirstOrDefault(e => e.GetType() == typeof(TimeSignature));

            if (sig != null)
            {
                capacity = sig.WholeNoteCapacity;
            }
            this.staff = staff;
            if (Beats > capacity)
            {
                trimExtras();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Creates an empty LMeasure object.
 /// </summary>
 /// <param name="staff">The LStaff object that contains or will contain the LMeasure.</param>
 /// <param name="capacity">The number of whole notes that can fit into the measure. Default = 1.</param>
 internal LMeasure(LStaff staff, double capacity = 1) : this(new List <MusicalSymbol>(), staff, capacity)
 {
 }