added documentation

This commit is contained in:
DaniTheSkunk 2022-11-25 00:52:43 +00:00
parent 3857c64e41
commit 978614be36
1 changed files with 40 additions and 0 deletions

View File

@ -1,16 +1,56 @@
package com.danitheskunk.skunkworks.audio; package com.danitheskunk.skunkworks.audio;
/**
* An audio sample
* <p>
* Either mono or stereo. Samplerate unaware.
*/
//todo: samplerate stuffs? //todo: samplerate stuffs?
public interface ISample { public interface ISample {
/**
* Returns the length
*
* @return the length in samples
*/
int getLength(); 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); 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); double getSampleRight(int pos);
/**
* Returns if the sample is in stereo
*
* @return true if the sample is stereo, false if mono
*/
boolean isStereo(); 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); 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); void setSamplei(int pos, short left);
} }