我尝试使用如下所示的录音机方法录制声音,在某些设备上很好,但在其他设备上它只是第一次工作,当我想再次使用时它会抛出Error code -20 when initializing native AudioRecord object
什么问题?
final int RECORDER_BPP = 16;
int RECORDER_SAMPLERATE = 16000;
int RECORDER_CHANNELS = AudioFormat.CHANNEL_IN_MONO;
int RECORDER_AUDIO_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
int bufferSizeInBytes = AudioRecord
.getMinBufferSize(RECORDER_SAMPLERATE, RECORDER_CHANNELS,
RECORDER_AUDIO_ENCODING);
// Initialize Audio Recorder.
AudioRecord audioRecorder = new AudioRecord(
MediaRecorder.AudioSource.MIC, RECORDER_SAMPLERATE,
RECORDER_CHANNELS, RECORDER_AUDIO_ENCODING, bufferSizeInBytes);
audioRecorder.startRecording();