本文整理汇总了Java中android.media.audiofx.NoiseSuppressor.isAvailable方法的典型用法代码示例。如果您正苦于以下问题:Java NoiseSuppressor.isAvailable方法的具体用法?Java NoiseSuppressor.isAvailable怎么用?Java NoiseSuppressor.isAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.audiofx.NoiseSuppressor
的用法示例。
在下文中一共展示了NoiseSuppressor.isAvailable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkthingsforrecoder
import android.media.audiofx.NoiseSuppressor; //导入方法依赖的package包/类
private void checkthingsforrecoder() {
int audioSessionId = getAudioSessionId();
if(NoiseSuppressor.isAvailable())
{
// NoiseSuppressor.create(audioSessionId);
}
if(AutomaticGainControl.isAvailable())
{
// AutomaticGainControl.create(audioSessionId);
}
if(AcousticEchoCanceler.isAvailable()){
// AcousticEchoCanceler.create(audioSessionId);
}
}
示例2: enableNoiseSuppressor
import android.media.audiofx.NoiseSuppressor; //导入方法依赖的package包/类
public void enableNoiseSuppressor() {
if (NoiseSuppressor.isAvailable() && noiseSuppressor == null) {
noiseSuppressor = NoiseSuppressor.create(microphoneId);
noiseSuppressor.setEnabled(true);
Log.i(TAG, "NoiseSuppressor enabled");
} else {
Log.e(TAG, "This device don't support NoiseSuppressor");
}
}
示例3: isNoiseSuppressorAvailable
import android.media.audiofx.NoiseSuppressor; //导入方法依赖的package包/类
public static boolean isNoiseSuppressorAvailable() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
return NoiseSuppressor.isAvailable();
}
return false;
}
示例4: initCapturer
import android.media.audiofx.NoiseSuppressor; //导入方法依赖的package包/类
@Override
public boolean initCapturer() {
// initalize audio mode
audioManagerMode.acquireMode(audioManager);
// get the minimum buffer size that can be used
int minRecBufSize = AudioRecord.getMinBufferSize(
captureSettings.getSampleRate(),
NUM_CHANNELS_CAPTURING == 1 ? AudioFormat.CHANNEL_IN_MONO : AudioFormat.CHANNEL_IN_STEREO,
AudioFormat.ENCODING_PCM_16BIT
);
// double size to be more safe
int recBufSize = minRecBufSize * 2;
// release the object
if (noiseSuppressor != null) {
noiseSuppressor.release();
noiseSuppressor = null;
}
if (echoCanceler != null) {
echoCanceler.release();
echoCanceler = null;
}
if (audioRecord != null) {
audioRecord.release();
audioRecord = null;
}
try {
audioRecord = new AudioRecord(AudioSource.VOICE_COMMUNICATION,
captureSettings.getSampleRate(),
NUM_CHANNELS_CAPTURING == 1 ? AudioFormat.CHANNEL_IN_MONO
: AudioFormat.CHANNEL_IN_STEREO,
AudioFormat.ENCODING_PCM_16BIT, recBufSize);
if (NoiseSuppressor.isAvailable()) {
noiseSuppressor = NoiseSuppressor.create(audioRecord.getAudioSessionId());
}
if (AcousticEchoCanceler.isAvailable()) {
echoCanceler = AcousticEchoCanceler.create(audioRecord.getAudioSessionId());
}
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
// check that the audioRecord is ready to be used
if (audioRecord.getState() != AudioRecord.STATE_INITIALIZED) {
throw new RuntimeException("Audio capture is not initialized " + captureSettings.getSampleRate());
}
shutdownCaptureThread = false;
new Thread(captureThread).start();
return true;
}