private void doRepeat()
   {
      // Repeat the previous 1, 4, 8, 16 beats
      switch (REPEAT_STATE)
      {
         case BEAT:
            if (OUTPUT_BEATS.size() >= 1)
            {
               LAST_BEAT = OUTPUT_BEATS.get(OUTPUT_BEATS.size() - 1);
               OUTPUT_BEATS.add(LAST_BEAT);
               DURATION -= LAST_BEAT.getBeat()[0].length;
            }
            break;
         case MEASURE:
            if (OUTPUT_BEATS.size() >= 4) for (int i = 4; i > 0; i--)
            {
               LAST_BEAT = OUTPUT_BEATS.get(OUTPUT_BEATS.size() - i);
               OUTPUT_BEATS.add(LAST_BEAT);
               DURATION -= LAST_BEAT.getBeat()[0].length;
            }
            break;
         case DOUBLE_MEASURE:
            if (OUTPUT_BEATS.size() >= 8) for (int i = 8; i > 0; i--)
            {
               LAST_BEAT = OUTPUT_BEATS.get(OUTPUT_BEATS.size() - i);
               OUTPUT_BEATS.add(LAST_BEAT);
               DURATION -= LAST_BEAT.getBeat()[0].length;
            }
            break;
      // case QUAD_MEASURE:
      // for (int i = 16; i > 0; i--)
      // {
      // LAST_BEAT = OUTPUT_BEATS.get(OUTPUT_BEATS.size() - i);
      // OUTPUT_BEATS.add(LAST_BEAT);
      // DURATION -= LAST_BEAT.getBeat()[0].length;
      // }
      // break;
      }
      BEATS_SINCE_REPEAT = 0;
   }