Exemplo n.º 1
0
 public SongComponent(ComponentLength length, int x, int y, int absoluteX, int octave)
 {
     this.Length    = length;
     this.X         = x;
     this.Y         = y;
     this.AbsoluteX = absoluteX;
     this.Octave    = octave;
 }
Exemplo n.º 2
0
        public void AutoGenerate()
        {
            ComponentLength compLen = ComponentLength.FULL; // 8 out of 16

            int octaveX         = 7 * (int)compLen;
            int totalX          = Piano.OCTAVEN * octaveX;
            int measures        = (int)Math.Ceiling(((double)totalX) / (double)ComponentLength.FULL);
            int notesPerMeasure = ((int)ComponentLength.FULL) / (int)compLen;

            int oct  = 0;
            int note = 0;

            for (int m = 0; m < measures; m++)
            {
                Measure measure = new Measure();
                for (int n = 0; n < notesPerMeasure; n++)
                {
                    measure.Components.Add(new Note(
                                               (NoteLetter)note++,
                                               Piano.BASE_OCTAAF + Piano.OCTAVEN - (oct + 1),
                                               true,
                                               compLen,
                                               n * (int)compLen
                                               ));
                    //measure.Components.Add(new Rest(compLen, n * (int)compLen));
                    if (note == 7)
                    {
                        note = 0;
                        oct++;

                        if (oct >= Piano.OCTAVEN)
                        {
                            break;
                        }
                    }
                }
                Measures.Add(measure);
            }
        }
Exemplo n.º 3
0
 public Note(NoteLetter letter, int octave, bool black, ComponentLength length, int x, int absoluteX) : base(length, x, (int)letter, absoluteX, octave)
 {
     this.Black = black;
 }
Exemplo n.º 4
0
 public Rest(ComponentLength length, int x) : base(length, x, 0, 0, Piano.BASE_OCTAAF)
 {
 }