package com.danitheskunk.skunkworks.audio;

/**
 * An audio sample
 * <p>
 * Either mono or stereo. Samplerate unaware.
 */
//todo: samplerate stuffs?
public interface ISample {
	/**
	 * Returns the length
	 *
	 * @return the length in samples
	 */
	int getLength();

	/**
	 * Returns the sample of left channel at position
	 *
	 * @param pos position in samples
	 * @return the sample value from -1.0 to 1.0 (+ headroom if clipping)
	 */
	double getSampleLeft(int pos);

	/**
	 * Returns the sample of right channel at position
	 *
	 * @param pos position in samples
	 * @return the sample value from -1.0 to 1.0 (+ headroom if clipping)
	 */
	double getSampleRight(int pos);

	/**
	 * Returns if the sample is in stereo
	 *
	 * @return true if the sample is stereo, false if mono
	 */
	boolean isStereo();

	/**
	 * Set a sample value for left and right channel
	 *
	 * @param pos position in samples
	 * @param left sample value of left channel -32768 to 32768
	 * @param right sample value of right channel -32768 to 32768
	 */
	void setSamplei(int pos, short left, short right);

	/**
	 * Set a sample value for left or mono channel
	 *
	 * @param pos position in samples
	 * @param left sample value of left(or mono) channel -32768 to 32768
	 */
	void setSamplei(int pos, short left);
}
