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;

}

create用法java_Java AcousticEchoCanceler.create方法代碼示例相关推荐

  1. newinsets用法java_Java XYPlot.setInsets方法代碼示例

    import org.jfree.chart.plot.XYPlot; //導入方法依賴的package包/類 public static void setTimeSeriesRender(Plot ...

  2. rowdata java_Java RowDataUtil.addRowData方法代碼示例

    本文整理匯總了Java中org.pentaho.di.core.row.RowDataUtil.addRowData方法的典型用法代碼示例.如果您正苦於以下問題:Java RowDataUtil.ad ...

  3. drawlinetest.java_Java Graphics2D.setRenderingHint方法代碼示例

    本文整理匯總了Java中java.awt.Graphics2D.setRenderingHint方法的典型用法代碼示例.如果您正苦於以下問題:Java Graphics2D.setRenderingH ...

  4. bls java_Java PairingFactory.getPairing方法代碼示例

    本文整理匯總了Java中it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory.getPairing方法的典型用法代碼示例.如果您正苦於以下問題:Java ...

  5. isdisposed java_Java Shell.isDisposed方法代碼示例

    本文整理匯總了Java中org.eclipse.swt.widgets.Shell.isDisposed方法的典型用法代碼示例.如果您正苦於以下問題:Java Shell.isDisposed方法的具 ...

  6. .net ref java_Java URL.getRef方法代碼示例

    本文整理匯總了Java中java.net.URL.getRef方法的典型用法代碼示例.如果您正苦於以下問題:Java URL.getRef方法的具體用法?Java URL.getRef怎麽用?Java ...

  7. java中move用法_Java IFile.move方法代碼示例

    import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類 /** * * 01. Class0 uses Class1 in requi ...

  8. remote_port java_Java HttpServletRequest.getRemotePort方法代碼示例

    import javax.servlet.http.HttpServletRequest; //導入方法依賴的package包/類 public ServletRequestCopy(HttpServ ...

  9. exhaustion java_Java Player.setExhaustion方法代碼示例

    import org.bukkit.entity.Player; //導入方法依賴的package包/類 /** * Set SamaGamesAPI */ @Override public void ...

最新文章

  1. Openoffice 安装与配置
  2. 【视频课】8大Pytorch CV实践案例,超30小时视频助你攻略CV三大基础任务(分类分割检测)
  3. QDD pricing determination does not trigger - set breakpoint to resolve it
  4. 在html中 标题字体标记的最大取值,西南大学网络教育2020年春0834]《网页设计》作业标准答案...
  5. 万用表检测常用元器件的方法
  6. 今天一看,自己发的文章原来这么多了。openeim
  7. IS-IS详解(五)——IS-IS 三次握手与两次握手
  8. tcpdump抓包工具详解
  9. VMWareStation10 密钥
  10. fileupload控件的属性_FileUpload上传控件用法详解
  11. python操作mysql批量插入
  12. 微型计算机原理与接口技术第五版pdf,微型计算机原理与接口技术(第5版)
  13. 通过阿里云容器镜像服务下载谷歌gcr.io镜像
  14. PE系统纯净(可以识别nvme固态)
  15. CityBuilder+DataV制作次世代3D城市大屏,一秒俘获甲方的心!
  16. Rich Dad Poor Dad
  17. 半导体通讯标准EAP、SECS/GEM视频介绍
  18. 生死单元技术!如何在abaqus焊接仿真中的应用
  19. dockerfile拉取私库镜像_Dockerfile From 私有库认证问题
  20. 让自己的博客可以在百度上搜索到

热门文章

  1. 美柚上云 致力成为最懂女人的互联网企业
  2. 前端内存优化的探索与实践
  3. JSON数据从OSS迁移到MaxCompute最佳实践 1
  4. Michael Jordan:当下的AI其实都是伪“AI” 1
  5. 云原生,智慧营销破圈新利器
  6. 漫画:什么是 “图灵测试” ?
  7. AWS拓展中国合作伙伴生态 加速企业数字化转型进程
  8. 为你整理了一份 Mysql 的学习笔记,建议收藏学习!
  9. 云有约 | 精华汇总
  10. 有问有答 | 算法和数据结构精华问答