从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)
这些主要用于反复试验。 我没有确切的解决方案。