android音频默认音频源,android - 使用OpenSL ES替换默认MIC(Android中为本地音频) - 堆栈内存溢出...

本文介绍了OpenSLES库中不同类型的IO设备,并详细讲解了在Android AudioRecorder初始化时如何配置输入类型,包括各种录音预设选项如通用录音、摄像头麦克风等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

从OpenSLES.h,我们有一些类型的IODevice。

/** IODevice-types */

#define SL_IODEVICE_AUDIOINPUT ((SLuint32) 0x00000001)

#define SL_IODEVICE_LEDARRAY ((SLuint32) 0x00000002)

#define SL_IODEVICE_VIBRA ((SLuint32) 0x00000003)

#define SL_IODEVICE_RESERVED4 ((SLuint32) 0x00000004)

#define SL_IODEVICE_RESERVED5 ((SLuint32) 0x00000005)

您可以尝试其中的每一种,以检查它们是否满足您的需求。

初始化AudioRecorder时,您需要在此处进行一些Android配置来设置输入类型。

/*---------------------------------------------------------------------------*/

/* Android AudioRecorder configuration */

/*---------------------------------------------------------------------------*/

/** Audio recording preset */

/** Audio recording preset key */

#define SL_ANDROID_KEY_RECORDING_PRESET ((const SLchar*) "androidRecordingPreset")

/** Audio recording preset values */

/** preset "none" cannot be set, it is used to indicate the current settings

* do not match any of the presets. */

#define SL_ANDROID_RECORDING_PRESET_NONE ((SLuint32) 0x00000000)

/** generic recording configuration on the platform */

#define SL_ANDROID_RECORDING_PRESET_GENERIC ((SLuint32) 0x00000001)

/** uses the microphone audio source with the same orientation as the camera

* if available, the main device microphone otherwise */

#define SL_ANDROID_RECORDING_PRESET_CAMCORDER ((SLuint32) 0x00000002)

/** uses the main microphone tuned for voice recognition */

#define SL_ANDROID_RECORDING_PRESET_VOICE_RECOGNITION ((SLuint32) 0x00000003)

/** uses the main microphone tuned for audio communications */

#define SL_ANDROID_RECORDING_PRESET_VOICE_COMMUNICATION ((SLuint32) 0x00000004)

这些主要用于反复试验。 我没有确切的解决方案。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值