added Samplei.fromMonoDoubleArray
This commit is contained in:
parent
59c918299d
commit
7063bbee37
|
@ -14,6 +14,14 @@ public class Samplei implements ISample {
|
||||||
this.right = right == null ? left : right;
|
this.right = right == null ? left : right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Samplei fromMonoDoubleArray(double[] d) {
|
||||||
|
var sample = new Samplei(d.length, false);
|
||||||
|
for(int i = 0; i < d.length; ++i) {
|
||||||
|
sample.setSamplei(i, (short)(d[i] * 32768));
|
||||||
|
}
|
||||||
|
return sample;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLength() {
|
public int getLength() {
|
||||||
return left.length;
|
return left.length;
|
||||||
|
|
Loading…
Reference in New Issue