如何配置OpenSL比主音箱或耳机等耳机扬声器工作 [英] How to configure OpenSL to work with ear speaker other than main speaker or headphones

查看:1149
本文介绍了如何配置OpenSL比主音箱或耳机等耳机扬声器工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过在Android的NDK本地音频code样品。当我尝试记录一些演讲,然后回放它工作正常。它使用的语音播放主音箱(外放)。我想,这样的言论的​​听筒,而不是主要的扬声器播放修改code。任何帮助吗?

I've tried the native-audio code sample in android NDK. When i try to record some speech and then play it back it works fine. It uses the main speaker(loud speaker) for the speech playback. I want to modify the code so that the speech is played in the ear speaker instead of the main speaker. Any help?

推荐答案

我解决了这个问题,我已经找到了谷歌组相关的话题。这是真的很有帮助。这里的链接:
https://groups.google.com/forum/#​​!topic / Android的NDK / O-hufEm20cU

I solved the problem and I've found a google group of related topic. It was really helpful. Here's the link: https://groups.google.com/forum/#!topic/android-ndk/O-hufEm20cU

我提供与Android NDK本地音频的例子进行了测试。您对先配置的Andr​​oid界面,然后设置流类型创建音频播放器后STREAM_VOICE。

I tested it in the native-audio example provided with android NDK. You've to take interface of android configuration first and then set stream type to STREAM_VOICE after creating the audio player.

// Code for working with ear speaker by setting stream type to STREAM_VOICE
SLAndroidConfigurationItf playerConfig;
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_ANDROIDCONFIGURATION, &playerConfig);
SLint32 streamType = SL_ANDROID_STREAM_VOICE;
result = (*playerConfig)->SetConfiguration(playerConfig, SL_ANDROID_KEY_STREAM_TYPE, &streamType, sizeof(SLint32));

这篇关于如何配置OpenSL比主音箱或耳机等耳机扬声器工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆