package net.mkonrad.synes.data;

import javax.vecmath.Vector3f;

import net.mkonrad.synes.gui.elements.instruments.InstrumentShape;
import net.mkonrad.synes.synth.SynthExt;

public class SynthObj
{
  /** ID of the SynthObj */
  protected int _id;
  
  /** graph, to which this SynthObj belongs */ 
  protected AbstractGraph _graph;
  
  /** Instrument that is used by this SynthObj */
  protected Instrument _instrument;
  
  /** 3D model connected to this SynthObj */
  protected InstrumentShape _instrumentShape;
  
  /** Amplitude (volume) */
  protected float _amp;
  
  /** Distance to the next object (or @see Modulator) */
  protected float _distance;
  
  
  /** SC Synthesizer-Representation */
  protected SynthExt _synth;
  
  /**
   * Make a new SynthObj that plays an Instrument with a certain amplitude
   * @param instrument
   * @param amp
   */
  public SynthObj(Instrument instrument, float amp)
  {
    _id = ++IdCounter.BEAT_IDS;
    _instrument = instrument;
    _amp = amp;
  }
  
  public int getId()
  {
    return _id;
  }
  
  /**
   * Relative position of this object.
   * Shortcut for InstrumentShape.getPos()
   * @see InstrumentShape.getPos()
   * @return Vector3f Relative position of this object
   */
  public Vector3f getPos()
  {
    return _instrumentShape.getPos();
  }
  
  /**
   * Absolute position of this object.
   * Shortcut for InstrumentShape.getAbsPos()
   * @see InstrumentShape.getAbsPos()
   * @return Vector3f Absolute position of this object
   */
  public Vector3f getAbsPos()
  {
    return _instrumentShape.getAbsPos();
  }
  
  public SynthExt getSynth()
  {
    return _synth;
  }

  public void setSynth(SynthExt synth)
  {
    _synth = synth;
  }

  public String getInstrumentSymbol()
  {
    return _instrument.getName();
  }
  
  public Instrument getInstrument()
  {
    return _instrument;
  }

  public void setInstrument(Instrument instrument)
  {
    _instrument = instrument;
  }

  public float getAmp()
  {
    return _amp;
  }

  public void setAmp(float amp)
  {
    _amp = amp;
  }
  
  public void setDistance(float distance)
  {
    _distance = distance;
  }
  
  public float getDistance()
  {
    return _distance;
  }
  
  public InstrumentShape getInstrumentShape()
  {
    return _instrumentShape;
  }

  public void setInstrumentShape(InstrumentShape instrumentShape)
  {
    _instrumentShape = instrumentShape;
  }
  
  public AbstractGraph getGraph()
  {
    return _graph;
  }
  
  public void setGraph(AbstractGraph bg)
  {
    _graph = bg;
  }
}
