packages/apps/SoundRecorder/src/com/android/soundrecorder/SoundRecorder.java
if (AUDIO_AMR.equals(mRequestedType)) {
mRemainingTimeCalculator.setBitRate(BITRATE_AMR);
mRecorder.setChannels(1);
mRecorder.setSamplingRate(SAMPLERATE_8000);
mRecorder.startRecording(MediaRecorder.OutputFormat.RAW_AMR, ".amr", this, audioSourceType, MediaRecorder.AudioEncoder.AMR_NB);
};
从上述代码段API中找到以下几个区分点
1. 采样率
2.码率
3. 声道数量
4. AudioSourceType
实测下来,只有通过AudioSourceType具有实操性。
以下是完整的验证代码diff文件,自测实现内部外部Codec上麦克风切换设计。
不过mixer_path.xml文件,只是调试时使用的开发板,是不带外部Codec的,这个并不影响该功能开发。
重点关注usecase的切换即可。
From 7ca1f038a41ac01746553504a433f03d9543a00f Mon Sep 17 00:00:00 2001
From: wumanyuan <wumanyuan@me