Created
November 7, 2014 20:37
-
-
Save jjmilburn/bfdb7d0ee1bcdd6d9570 to your computer and use it in GitHub Desktop.
stereo maybe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public short[] toMonoSampleArray() { | |
int written = 0; | |
final short[] samples = new short[this.buffersTotalLength]; | |
for(short[] buffer : buffers) { | |
System.arraycopy(buffer, 0, samples, written, buffer.length); | |
written += buffer.length; | |
} | |
return samples; | |
} | |
public short[] toStereoSampleArray() { | |
final short[] stereoSamples = new short[this.buffersTotalLength*2]; | |
final short[] monoSamples = this.toMonoSampleArray(); | |
int k = 0; | |
for (int j = 0; j < this.buffersTotalLength; j++) //Assuming you only have half a buffer since mono??? | |
{ | |
stereoSamples[k] = monoSamples[j]; | |
stereoSamples[k+1] = monoSamples[j]; | |
k += 2; | |
} | |
return stereoSamples; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment