package net.mkonrad.synes.ctrl.anim;

import java.util.Enumeration;

import javax.media.j3d.Behavior;
import javax.media.j3d.WakeupCondition;
import javax.media.j3d.WakeupOnElapsedTime;

import net.mkonrad.synes.gui.elements.instruments.AbstractInstrumentShape;
import net.mkonrad.synes.gui.elements.instruments.InstrumentShape;
import net.mkonrad.synes.util.DbgTools;

public class BeatAnimBehavior extends Behavior
{
  public static final int UPDATE_TIME = 25;
  private WakeupCondition _timeOut;
  private InstrumentShape _shape;
  
  public BeatAnimBehavior(InstrumentShape abstractInstrumentShape)
  {
    _shape = abstractInstrumentShape;
    _timeOut = new WakeupOnElapsedTime(UPDATE_TIME);
  }
  
  public void initialize()
  {
    wakeupOn(_timeOut);
  }

  public void processStimulus(Enumeration criteria)
  {
    _shape.beatUpdate();
    wakeupOn(_timeOut);
  }

}
