Open mdaymard opened 8 years ago
hello, I using this project in android platform . Lame.decodeFrame(headIn, pcmLeft, pcmRight),this method returns a value bigger than pcmLeft or pcmRight array length. if it is bigger , how can i dill with the data decoded.
My code is below:
protected void decode(String file) throws Exception{
InputStream headIn = getAssets().open(file);
Lame.initializeDecoder();
int config = Lame.configureDecoder(headIn);
if(config != -1){
Log.i(this.getClass().getName(), Lame.getDecoderBitrate() + "");
Log.i(this.getClass().getName(), Lame.getDecoderChannels() + "");
Log.i(this.getClass().getName(), Lame.getDecoderSampleRate() + "");
Log.i(this.getClass().getName(), Lame.getDecoderDelay() + "");
Log.i(this.getClass().getName(), Lame.getDecoderFrameSize() + "");
int frameSize = Lame.getDecoderFrameSize();
int decodedSize = 0;
short[] pcmLeft = new short[1024];
short[] pcmRight = new short[1024];
File left = new File(Environment.getExternalStorageDirectory() + "/" + file + "_left.pcm");
File right = new File(Environment.getExternalStorageDirectory() + "/" + file + "_right.pcm");
OutputStream leftOut = new FileOutputStream(left);
OutputStream rightOut = new FileOutputStream(right);
while(decodedSize < frameSize){
int currentSize = Lame.decodeFrame(headIn, pcmLeft, pcmRight);
decodedSize = decodedSize + currentSize;
for(int index = 0; index < currentSize; index++){
leftOut.write(pcmLeft[index]);
rightOut.write(pcmRight[index]);
}
}
leftOut.flush();
rightOut.flush();
leftOut.close();
rightOut.close();
}
Lame.closeDecoder();
}
Hello,
I would like to use liblame in another android project. I've already generated the .so file with the NDK. Right now I've just copied the .so in my/armeabi-, and I load the library with :
static { System.loadLibrary("lame"); System.loadLibrary("another_library"); }
But I'm not sure if I need to add other files in the project to make lame work. Any help would be very nice, thanks in advance.