package client.audio;

public class Operator {
	public final int mult;
	public final int level;
	public final int waveform;
	public final int attack;
	public final int decay;
	public final int sustain;
	public final int release;
	
	public boolean tremolo;
	public boolean vibrato;
	public boolean sustaining;
	public boolean ksr;
	public int ksl;
	public int offset;
	public int detune;
	
	public Operator(int mult, int level, int waveform, int a, int d, int s, int r) {
		this.mult = mult;
		this.level = 63 - level;
		this.waveform = waveform;
		this.attack = a;
		this.decay = d;
		this.sustain = 15 - s;
		this.release = r;
	}
	
	public Operator tremolo() {
		this.tremolo = true;
		return this;
	}
	
	public Operator vibrato() {
		this.vibrato = true;
		return this;
	}
	
	public Operator sustaining() {
		this.sustaining = true;
		return this;
	}
	
	public Operator ksr() {
		this.ksr = true;
		return this;
	}
	
	public Operator ksl(int ksl) {
		this.ksl = ksl;
		return this;
	}
	
	public Operator offset(int offset) {
		this.offset = offset;
		return this;
	}
	
	public Operator detune(int detune) {
		this.detune = detune;
		return this;
	}
}
