Ejemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="sub">Note to be modified.</param>
        /// <param name="act">How many notes does this tuplet contain?</param>
        /// <param name="norm">How many of those notes is the tuplet equivalent to, time-wise? Automatically filled in for an act of 3, 5, 6, 7, and 9.</param>
        /// <param name="num">Which tuplet is this? only needs to be filled in for multiple concurrent tuplets.</param>
        public Tuplet(IRhythm sub, int act, int norm = 0, int num = 1)
        {
            SubRhythm = sub;
            number    = num;
            Actual    = act;
            if (norm != 0)
            {
                Normal = norm;
            }
            else
            {
                switch (act)
                {
                case 3:
                    Normal = 2;
                    break;

                case 5:
                case 6:
                case 7:
                    Normal = 4;
                    break;

                case 9:
                    Normal = 8;
                    break;

                default:
                    Normal = norm;
                    break;
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Add a note to the sheet music.
 /// </summary>
 /// <param name="note">Note you want added.</param>
 public void Add(IRhythm note)
 {
     if (measures.Count == 0 || !measures.Last().Add(note))
     {
         CreateMeasure().Add(note);//Guaranteed empty--cannot fail.
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Add a note to this measure.
 /// Can fail if it has a number of beats equal to the numberator of the time signature, all of which are full and if Oflow is true.
 /// </summary>
 /// <param name="note"></param>
 /// <returns></returns>
 public bool Add(IRhythm note)
 {
     if (beats.Count > 0 && !beats.Last().IsFull() && beats.Last().Add(note))
     {
         return(true);
     } //a new beat is needed
     if (Oflow && SumBeats() >= beatNum)
     {
         return(false); //fail to add on full--a new measure is needed
     }
     else
     {
         Beat newBeat = new Beat(beatVal);
         beats.Add(newBeat);
         newBeat.Add(note);//Guaranteed empty. Cannot fail.
         Progenitor.InvokeBeatCreated(newBeat, this);
     }
     return(true);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds a note to this beat.
        /// Can fail if note puts beat over full.
        /// Will always take all notes of a tuplet unless the beat is full before it starts.
        /// </summary>
        /// <param name="note">Note to be added.</param>
        /// <returns>Bool successful or not.</returns>
        public bool Add(IRhythm note)
        {
            if (IsFull() && !tupleting)
            {
                return(false);
            }
            if (note.IsTupletStart())
            {
                tupleting = true;
                place    += note.GetLength();
            }
            if (tupleting)
            {
                notes.Add(note);
                if (note.IsTupletEnd())
                {
                    tupleting = false;
                }
                return(true);
            }
            int bak = place;

            place += note.GetVal();
            if (notes.Count == 0)//always accept on empty
            {
                notes.Add(note);
                return(true);
            }
            if (place / len > bak / len && place % len != 0)//accept note causing rollover iff it makes this Beat's length evenly divisible by the length of a beat
            {
                place = bak;
                return(false);
            }
            notes.Add(note);
            return(true);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 /// <param name="whichhand">Which hand is it?</param>
 public Sticking(IRhythm sub, string whichhand)
 {
     SubRhythm = sub;
     hand      = whichhand;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public Rimshot(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public RimClick(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 /// <param name="num">Which tuplet is this?</param>
 public TupletEnd(IRhythm sub, int num = 1)
 {
     SubRhythm = sub;
     number    = num;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public Backstick(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public Decrescendo(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public DoubleStrokeRoll(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public Flam(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public Dot(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 /// <param name="beamState">"begin", "continue", or "end" based on whether this is in the beginning, middle, or end of a beam, respectively.</param>
 /// <param name="beamNumber">Which beam is this? Only needs to be changed for multiple concurrent beams.</param>
 public Beam(IRhythm sub, string beamState, int beamNumber = 1)
 {
     SubRhythm = sub;
     number    = beamNumber;
     state     = beamState;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public StrongAccent(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public BuzzStrokeRoll(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public CrescendoEnd(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public Rest(IRhythm sub)
 {
     SubRhythm = sub;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 /// <param name="t">Which dynamic it is. Possibilities include: p, pp, ppp, f, ff, fff, mp, mf, sfz, and fp. There may be others.</param>
 public Dynamic(IRhythm sub, string t)
 {
     SubRhythm = sub;
     type      = t;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sub">Note to be modified.</param>
 public Accent(IRhythm sub)
 {
     SubRhythm = sub;
 }