mt6735 SoundRecorder如何使用BT mic收音
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
即使连接BT耳机后,进入SoundRecorder录音时,声音也是从手机MIC录入的,而不是从BT mic录入
[SOLUTION]
SoundRecorder.java中
1.import android.media.AudioManager;
2.private AudioManager mAudioManager = null;
3.onCreate()中mAudioManager = (AudioManager)
getSystEMService(Context.AUDIO_SERVICE);
4.添加如下红色code
void onCLIckRecordButton() {
if (null != mService) {
if (mService.getCurrentState() == SoundRecorderService.STATE_RECORDING) {
LogUtils.d(TAG, "already in recording state, not disable button");
return;
}
disableButton();
mAudioManager.startbluetoothSco();
5.添加如下红色code
void onClickStopButton() {
......
} else if ((SoundRecorderService.STATE_RECORDING == state)
|| (SoundRecorderService.STATE_PAUSE_RECORDING == state)) {
LogUtils.d(TAG, "<onClickStopButton> mService.stopRecord()");
disableButton();
mAudioManager.stopBluetoothSco();
mService.stopRecordingAsync();
}
6.在alps/packages/apps/SoundRecorder/AndroiDMAnifest.xml中加入bluetooth的权限,即
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
即使连接BT耳机后,进入SoundRecorder录音时,声音也是从手机MIC录入的,而不是从BT mic录入
[SOLUTION]
SoundRecorder.java中
1.import android.media.AudioManager;
2.private AudioManager mAudioManager = null;
3.onCreate()中mAudioManager = (AudioManager)
getSystEMService(Context.AUDIO_SERVICE);
4.添加如下红色code
void onCLIckRecordButton() {
if (null != mService) {
if (mService.getCurrentState() == SoundRecorderService.STATE_RECORDING) {
LogUtils.d(TAG, "already in recording state, not disable button");
return;
}
disableButton();
mAudioManager.startbluetoothSco();
5.添加如下红色code
void onClickStopButton() {
......
} else if ((SoundRecorderService.STATE_RECORDING == state)
|| (SoundRecorderService.STATE_PAUSE_RECORDING == state)) {
LogUtils.d(TAG, "<onClickStopButton> mService.stopRecord()");
disableButton();
mAudioManager.stopBluetoothSco();
mService.stopRecordingAsync();
}
6.在alps/packages/apps/SoundRecorder/AndroiDMAnifest.xml中加入bluetooth的权限,即
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>