package zero1hd.polyjet.audio;

import javax.sound.sampled.AudioFormat;

import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.utils.Disposable;

public interface AudioData extends Disposable {
	/**
	 * sets a integer variable to the current window of audio data the playback is at.
	 * Useful for efficiency because we compute once for that frame then get the values everytime it is required instead of calculating every time we get the index.
	 */
	public void readIndexUpdate();
	
	/**
	 * Gets the current position in seconds 
	 * @return the current frame of audio.
	 */
	public int getReadIndex();
	
	/**
	 * Completely resets the current audio data. Think of pooling, except, only one instance which is reused instead of multiple.
	 */
	public void reset();
	
	/**
	 * returns the read window size.
	 * @return
	 */
	public int getReadWindowSize();
	
	/**
	 * Gets the object to play the music. Contains playback data.
	 * @return
	 */
	public Music getPlaybackMusic();
	
	/**
	 * read in samples and fills the array.
	 * @param samples the array that should contain said samples
	 * @return amount read. Will return 0 if end of stream.
	 */
	public int readSamples(float[] samples);
	
	/**
	 * Returns properly setup AudioFormat object.
	 * @return
	 */
	public AudioFormat getFormat();
	
	/**
	 * returns sample count
	 * @return
	 */
	public int getSampleCount();
	
	/**
	 * returns duration of song in seconds
	 * @return
	 */
	public float getDuration();
}
