package net.mkonrad.synes.data.instruments;

import javax.vecmath.Point3f;
import javax.vecmath.Vector3f;


import net.mkonrad.synes.data.Beat;
import net.mkonrad.synes.data.MelodyInstrument;
import net.mkonrad.synes.data.SynthObj;
import net.mkonrad.synes.gui.elements.instruments.CylinderShape;
import net.mkonrad.synes.gui.elements.instruments.InstrumentShape;
import net.mkonrad.synes.gui.style.Colors;
import net.mkonrad.synes.util.MusicTools;

public class Piano extends MelodyInstrument
{  
  public Piano()
  {
    super();                  //set default values
    _name = "synes_piano";    //set name of the SynthDef to play
    _iconName = "piano.png";  //set the name of the icon-image
    _texture = "circle.png";  //set the texture to use
    _color = Colors.white;    //set the color for the instrument shape
  }

  public InstrumentShape createInstrumentShape(SynthObj synthData, Point3f pos)
  {
    //the instruments shape will be a cylinder
    return new CylinderShape(synthData, pos);
  }
  
  protected float getPitchArg(Vector3f pos)
  {
    //Take the Y-Coordinate (pos.y), calculate the MIDI-Note for it,
    //shift it up 3 octaves (second parameter)
    //and round it down to a integer (third parameter)
    return MusicTools.getMidiFromYCoord(pos.y, 3, true);
  }
}
