added audio sample class
This commit is contained in:
parent
abc460e59b
commit
a05892e677
|
@ -0,0 +1,16 @@
|
|||
package com.danitheskunk.skunkworks.audio;
|
||||
|
||||
//todo: samplerate stuffs?
|
||||
public interface ISample {
|
||||
int getLength();
|
||||
|
||||
double getSampleLeft(int pos);
|
||||
|
||||
double getSampleRight(int pos);
|
||||
|
||||
void setSample(int pos, int left);
|
||||
|
||||
void setSample(int pos, int left, int right);
|
||||
|
||||
void isStereo();
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.danitheskunk.skunkworks.audio;
|
||||
|
||||
public class Samplei implements ISample {
|
||||
private double[] left;
|
||||
private double[] right;
|
||||
|
||||
public Samplei(int length, boolean stereo) {
|
||||
left = new double[length];
|
||||
right = stereo ? new double[length] : left;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLength() {
|
||||
return left.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSampleLeft(int pos) {
|
||||
return left[pos];
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getSampleRight(int pos) {
|
||||
return right[pos];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSample(int pos, int left) {
|
||||
this.left[pos] = left;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSample(int pos, int left, int right) {
|
||||
this.left[pos] = left;
|
||||
this.right[pos] = right;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isStereo() {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue