当前位置: 首页>>代码示例>>Java>>正文


Java AcousticEchoCanceler类代码示例

本文整理汇总了Java中android.media.audiofx.AcousticEchoCanceler的典型用法代码示例。如果您正苦于以下问题:Java AcousticEchoCanceler类的具体用法?Java AcousticEchoCanceler怎么用?Java AcousticEchoCanceler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AcousticEchoCanceler类属于android.media.audiofx包,在下文中一共展示了AcousticEchoCanceler类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkthingsforrecoder

import android.media.audiofx.AcousticEchoCanceler; //导入依赖的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);
    }
}
 
开发者ID:raj10071997,项目名称:Alexa-Voice-Service,代码行数:16,代码来源:RecordAudioinBytes.java

示例2: shouldUseAcousticEchoCanceler

import android.media.audiofx.AcousticEchoCanceler; //导入依赖的package包/类
@CalledByNative
public static boolean shouldUseAcousticEchoCanceler() {
    // AcousticEchoCanceler was added in API level 16 (Jelly Bean).
    if (!runningOnJellyBeanOrHigher()) {
        return false;
    }

    // Next is a list of device models which have been vetted for good
    // quality platform echo cancellation.
    if (!Build.MODEL.equals("SM-T310R") &&  // Galaxy Tab 3 7.0
        !Build.MODEL.equals("GT-I9300") &&  // Galaxy S3
        !Build.MODEL.equals("GT-I9500") &&  // Galaxy S4
        !Build.MODEL.equals("GT-N7105") &&  // Galaxy Note 2
        !Build.MODEL.equals("SM-N9005") &&  // Galaxy Note 3
        !Build.MODEL.equals("Nexus 4") &&
        !Build.MODEL.equals("Nexus 5") &&
        !Build.MODEL.equals("Nexus 7")) {
        return false;
    }

    // As a final check, verify that the device supports acoustic echo
    // cancellation.
    return AcousticEchoCanceler.isAvailable();
}
 
开发者ID:mogoweb,项目名称:chromium_webview,代码行数:25,代码来源:AudioManagerAndroid.java

示例3: setConfig

import android.media.audiofx.AcousticEchoCanceler; //导入依赖的package包/类
public void setConfig(double recvTimeout, double initTimeout, int dataSavingOption, long callID){
	ensureNativeInstance();
	boolean sysAecAvailable=false, sysNsAvailable=false;
	if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.JELLY_BEAN){
		try{
			sysAecAvailable=AcousticEchoCanceler.isAvailable();
			sysNsAvailable=AcousticEchoCanceler.isAvailable();
		}catch(Throwable x){

		}
	}
	SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
	boolean dump = preferences.getBoolean("dbg_dump_call_stats", false);
	nativeSetConfig(nativeInst, recvTimeout, initTimeout, dataSavingOption,
			Build.VERSION.SDK_INT<Build.VERSION_CODES.JELLY_BEAN || !(sysAecAvailable && VoIPServerConfig.getBoolean("use_system_aec", true)),
			Build.VERSION.SDK_INT<Build.VERSION_CODES.JELLY_BEAN || !(sysNsAvailable && VoIPServerConfig.getBoolean("use_system_ns", true)),
			true, BuildConfig.DEBUG ? getLogFilePath("voip") : getLogFilePath(callID), BuildConfig.DEBUG && dump ? getLogFilePath("voipStats") : null);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:19,代码来源:VoIPController.java

示例4: enableEchoCanceler

import android.media.audiofx.AcousticEchoCanceler; //导入依赖的package包/类
public void enableEchoCanceler() {
  if (AcousticEchoCanceler.isAvailable() && acousticEchoCanceler == null) {
    acousticEchoCanceler = AcousticEchoCanceler.create(microphoneId);
    acousticEchoCanceler.setEnabled(true);
    Log.i(TAG, "EchoCanceler enabled");
  } else {
    Log.e(TAG, "This device don't support EchoCanceler");
  }
}
 
开发者ID:pedroSG94,项目名称:rtmp-rtsp-stream-client-java,代码行数:10,代码来源:AudioPostProcessEffect.java

示例5: SpeechRecord

import android.media.audiofx.AcousticEchoCanceler; //导入依赖的package包/类
public SpeechRecord(int audioSource, int sampleRateInHz, int channelConfig, int audioFormat, int bufferSizeInBytes,
                    boolean noise, boolean gain, boolean echo)
        throws IllegalArgumentException {

    super(audioSource, sampleRateInHz, channelConfig, audioFormat, bufferSizeInBytes);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        Log.i("Trying to enhance audio because running on SDK " + Build.VERSION.SDK_INT);

        int audioSessionId = getAudioSessionId();

        if (noise) {
            if (NoiseSuppressor.create(audioSessionId) == null) {
                Log.i("NoiseSuppressor: failed");
            } else {
                Log.i("NoiseSuppressor: ON");
            }
        } else {
            Log.i("NoiseSuppressor: OFF");
        }

        if (gain) {
            if (AutomaticGainControl.create(audioSessionId) == null) {
                Log.i("AutomaticGainControl: failed");
            } else {
                Log.i("AutomaticGainControl: ON");
            }
        } else {
            Log.i("AutomaticGainControl: OFF");
        }

        if (echo) {
            if (AcousticEchoCanceler.create(audioSessionId) == null) {
                Log.i("AcousticEchoCanceler: failed");
            } else {
                Log.i("AcousticEchoCanceler: ON");
            }
        } else {
            Log.i("AcousticEchoCanceler: OFF");
        }
    }
}
 
开发者ID:Kaljurand,项目名称:speechutils,代码行数:43,代码来源:SpeechRecord.java

示例6: shouldUseAcousticEchoCanceler

import android.media.audiofx.AcousticEchoCanceler; //导入依赖的package包/类
@CalledByNative
private static boolean shouldUseAcousticEchoCanceler() {
    // Verify that this device is among the supported/tested models.
    List<String> supportedModels = Arrays.asList(SUPPORTED_AEC_MODELS);
    if (!supportedModels.contains(Build.MODEL)) {
        return false;
    }
    if (DEBUG && AcousticEchoCanceler.isAvailable()) {
        logd("Approved for use of hardware acoustic echo canceler.");
    }

    // As a final check, verify that the device supports acoustic echo
    // cancellation.
    return AcousticEchoCanceler.isAvailable();
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:16,代码来源:AudioManagerAndroid.java

示例7: setEnhancers

import android.media.audiofx.AcousticEchoCanceler; //导入依赖的package包/类
/**
 * Attempt to set enhancers available on modern devices.
 * <p/>
 * These are hardware dependent, not build version. Although the APIs weren't available to
 * devices until API Level 16
 */
@SuppressWarnings("NewApi")
private void setEnhancers(final int sessionId) {

    if (!DEBUG) {
        NoiseSuppressor.create(sessionId);
        AcousticEchoCanceler.create(sessionId);
        AutomaticGainControl.create(sessionId);
    } else {
        if (NoiseSuppressor.create(sessionId) == null) {
            MyLog.i(CLS_NAME, "NoiseSuppressor null");
        } else {
            MyLog.i(CLS_NAME, "NoiseSuppressor success");
        }

        if (AcousticEchoCanceler.create(sessionId) == null) {
            MyLog.i(CLS_NAME, "AcousticEchoCanceler null");
        } else {
            MyLog.i(CLS_NAME, "AcousticEchoCanceler success");
        }

        if (AutomaticGainControl.create(sessionId) == null) {
            MyLog.i(CLS_NAME, "AutomaticGainControl null");
        } else {
            MyLog.i(CLS_NAME, "AutomaticGainControl success");
        }
    }
}
 
开发者ID:brandall76,项目名称:Saiy-PS,代码行数:34,代码来源:SaiyAudio.java

示例8: initCapturer

import android.media.audiofx.AcousticEchoCanceler; //导入依赖的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;
}
 
开发者ID:opentok,项目名称:opentok-android-sdk-samples,代码行数:56,代码来源:CustomAudioDevice.java


注:本文中的android.media.audiofx.AcousticEchoCanceler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。