public void update() {
   if (currentItem == -1) {
     currentItem = 0;
     SequenceItem item = items.get(currentItem);
     changeItem(item);
   }
   if (musicSynced) {
     if (LEDCubeManager.getLEDCube().getSpectrumAnalyzer().isPlaying()) {
       int time = LEDCubeManager.getLEDCube().getSpectrumAnalyzer().getPositionMillis();
       int lastItem = currentItem;
       for (int i = items.size() - 1; i >= 0; i--) {
         SequenceItem item = items.get(i);
         if (time >= item.time) {
           currentItem = i;
           break;
         }
       }
       if (currentItem != lastItem) {
         changeItem(items.get(currentItem));
       }
     }
   } else {
     SequenceItem item = items.get(currentItem);
     if (timer.getMilliseconds() >= item.time) {
       timer.restart();
       if (++currentItem >= items.size()) currentItem = 0;
       changeItem(items.get(currentItem));
     }
   }
 }
 private void changeItem(SequenceItem item) {
   if (item.color != null) LEDCubeManager.setPaintColor(item.color);
   if (item.clear) {
     LEDManager ledManager = LEDCubeManager.getLEDManager();
     Dimension3D dim = ledManager.getDimensions();
     for (int x = 0; x < dim.x; x++) {
       for (int y = 0; y < dim.y; y++) {
         for (int z = 0; z < dim.z; z++) {
           ledManager.setLEDColor(x, y, z, new Color());
         }
       }
     }
   }
   Animation anim =
       LEDCubeManager.getLEDCube().getAnimationByClassName("Animation" + item.animation);
   if (anim != null) {
     LEDCubeManager.getLEDCube().getCommThread().setCurrentAnimation(anim);
     LEDCubeManager.getInstance()
         .getScreenMainControl()
         .animComboBox
         .setSelectedItem(anim.getName());
   }
   if (item.options != null) {
     for (SequenceItem.Option option : item.options) {
       LEDCubeManager.getLEDCube()
           .getCommThread()
           .getCurrentAnimation()
           .setOption(option.name, option.value);
     }
   }
 }
 public void start() {
   timer.restart();
   currentItem = -1;
   if (musicFile != null)
     LEDCubeManager.getLEDCube().getSpectrumAnalyzer().loadFile(musicFile.getAbsolutePath());
 }