How to mute Microphone when recording from headset

北战南征 提交于 2020-01-23 17:06:07

问题


I am making a application to record audio from bluetooth headset. After that, the signal sound from headset will be played in to speaker of android phone. However, my problem is that some signal from microphone of android phone is also played. I want to mute microphone of android during playing. Is it possible. I am refering some link but it does not useful. Please give me one solution to turn of my microphone. This is my setting

_audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
    int maxJitter = AudioTrack.getMinBufferSize(SAMPLE_RATE, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT);

    track = new AudioTrack(AudioManager.MODE_IN_COMMUNICATION, SAMPLE_RATE, AudioFormat.CHANNEL`enter code here`_OUT_MONO,
            AudioFormat.ENCODING_PCM_16BIT, maxJitter, AudioTrack.MODE_STREAM);
    _audioManager.startBluetoothSco();
    _audioManager.setMode(AudioManager.STREAM_SYSTEM); 

    _audioManager.setMicrophoneMute( false);
    _audioManager.setSpeakerphoneOn(true);
    setVolumeControlStream(AudioManager.MODE_IN_COMMUNICATION);

This is my expected work

You can download the source code at Audio record and speak via headset bluetooth

来源:https://stackoverflow.com/questions/27777305/how-to-mute-microphone-when-recording-from-headset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!