I'm struggling to get things right using AudioRecord.
Basically what I'm trying to do is seldomly record from the audio on my Android device. I don't have to get a continuous stream of bytes from the audio source, but I have to feed a buffer every 5 minutes or so.
The problem is that the memory used by my program increases everytime I'm recording (I used the DDMS to investigate my memory issue). I reduced my code to the following lines to better understand the issue.
buffersizebytes = AudioRecord.getMinBufferSize(SAMPPERSEC,
channelConfiguration, audioEncoding);
tabbAudioBuffer = new byte[buffersizebytes];
setContentView(R.layout.main);
audioRecord = new AudioRecord(
android.media.MediaRecorder.AudioSource.MIC, SAMPPERSEC,
channelConfiguration, audioEncoding, buffersizebytes);
int i=1000;
while(i-->0) {
audioRecord.startRecording();
audioRecord.stop();
}
audioRecord.release();
audioRecord = null;
Please let me know if you can help me with my problem. Thanks.
Comments
Post a Comment