package zero1hd.polyjet.ui.windows;

import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Window;
import com.badlogic.gdx.utils.FloatArray;

import zero1hd.polyjet.audio.AudioData;
import zero1hd.polyjet.ui.builders.AudioGraph;

public class GraphWindow extends Window {
	AudioGraph graph;
	AudioData audioData;
	
	public GraphWindow(String title, Skin skin) {
		super(title, skin, "tinted");
		graph = new AudioGraph(300, 150);
		add(graph);
		setSize(305, 155);
	}
	
	@Override
	public void act(float delta) {
		if (audioData != null) {
			graph.setAudioDataIndex(audioData.getReadIndex());
		}
		super.act(delta);
	}
	
	public AudioGraph getGraph() {
		return graph;
	}
	
	public void setData(FloatArray dataSet1, FloatArray dataSet2, AudioData audioData) {
		this.audioData = audioData;
		graph.setGraphingData(dataSet1, dataSet2);
	}
	
}
