
package zero1hd.rhythmbullet.audio;

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

public interface MusicDataPack 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 playbackIndexUpdate();
	
	/**
	 * Gets the current position in seconds s
	 * @return the current frame of audio.
	 */
	public int getPlaybackIndexPosition();
	
	/**
	 * 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 sample count.
	 * Can be inaccurate.
	 * @return
	 */
	public long getSampleCount();
	
	/**
	 * returns duration of song in seconds
	 * @return
	 */
	public float getDuration();
	
	/**
	 * returns sample rate
	 * @return sample rate as float
	 */
	public float getSampleRate();
	
	/**
	 * The current numerical value of the last window read
	 * @return
	 */
	public int getCurrentReadWindowIndex();
}
