package client.gui.options;

import client.audio.Volume;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.PressType;

public class GuiSound extends GuiOptions {
	protected GuiSound() {
	}
	
	public void init(int width, int height) {
		int x = 0;
		int y = 0;
		for(Volume volume : Volume.values()) {
			this.addSelector(volume.getCVarName(), x, y, 240, 0);
			x = (x == 0) ? 242 : 0;
			if(x == 0)
				y += 20;
		}

		this.addSelector("snd_enabled", 0, 50, 240, 0);

		this.addSelector("snd_buffer_size", 0, 70, 240, 0);
		this.addSelector("snd_frame_size", 242, 70, 240, 0);
		
		this.add(new ActButton(0, 100, 482, 0, new ButtonCallback() {
			public void use(ActButton elem, PressType action) {
				GuiSound.this.gm.restartSound(false);
			}
		}, "Übernehmen und Audio neu starten"));


		this.addSelector("mid_opl_voices", 0, 130, 240, 0);
		this.addSelector("mid_opl_bank", 242, 130, 240, 0);

		this.addSelector("mid_velocity_func", 0, 150, 240, 0);
		this.addSelector("mid_keep_notes", 242, 150, 240, 0);

		this.addSelector("mid_dont_fade", 0, 170, 240, 0);
		this.addSelector("mid_play_unknown", 242, 170, 240, 0);

		this.addSelector("mid_visualizer", 0, 190, 240, 0);
		this.addSelector("mid_debug_events", 242, 190, 240, 0);

		super.init(width, height);
	}
	
	public String getTitle() {
		return "Audio und Ton";
	}	
}
