package nxm.dsp.prim;

import nxm.sys.lib.Data;
import nxm.sys.lib.DataFile;
import nxm.sys.lib.DataOp;
import nxm.sys.lib.Primitive;

/**
  Creates FFT windows of various shapes.

  @author Jeff Schoen

*/
public class window extends Primitive {

  /** default constructor */
  public window () {}

  public int open() {

    // Get parameters
    String name = MA.getS("NAME");
    int    size = MA.getL("SIZE");
    boolean sym = MA.getState("/SYM");
    double scale = MA.getD("/SCALE",1.0);

    // Create window
    Data data = DataOp.getWindow(name,sym?-size:size,scale,M);

    // Open output file
    DataFile hcb = MA.getDataFile("OUT","1000","SF",0);
    hcb.setSize (size);
    hcb.open();
    hcb.write (data);
    hcb.close();

    return (FINISH);
  }

}
