问题描述
我使用OpenSL ES是新来的Android原生音频和我需要你的帮助。
I am new to Android Native audio using OpenSL ES and I need your help.
现在我想编写一个应用程序来进行实时录制和播放。在记录的一部分,我们必须首先配置时,我们正在创造录音机的音频源。像这样的。
Now I wanna write an app to do real-time recording and playing back. In recording part, we have to configure the audio source firstly when we are creating an audio recorder. Like this.
SLDataLocator_IODevice loc_dev = {SL_DATALOCATOR_IODEVICE,SL_IODEVICE_AUDIOINPUT,SL_DEFAULTDEVICEID_AUDIOINPUT, NULL};
SLDataSource audioSrc = {&loc_dev, NULL};
的SL_DEFAULTDEVICEID_AUDIOINPUT是默认麦克风的地址。我想在Android手机(我用的Nexus 6有三种不同的MIC)上使用其他中等收入国家,但我无法找到其他中等收入国家的地址。
The SL_DEFAULTDEVICEID_AUDIOINPUT is the address of Default microphones. I wanna use other MICs on the android phone(I am using Nexus 6 which has three different MICs), but I cannot find other MICs' addresses.
鸭preciate任何责任!
Appreciate any response!
推荐答案
从的我们有一些类型的IODevices的这是。
From OpenSLES.h we've got some types of IODevices which are..
/** 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)
您可以尝试每一项检查,如果这些满足您的需求。
You can try each of these to check if these satisfy your need.
您也可以看看 OpenSLES_AndroidConfiguration.h 一>。当初始化你AudioRecorder你在这里已经有些Android的配置设置输入类型。
You can also have a look at OpenSLES_AndroidConfiguration.h. While initializing your AudioRecorder you've some Android configuration here to set the input type.
/*---------------------------------------------------------------------------*/
/* 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)
这主要是为试验和错误。我没有任何确切的解决方案。
These are mainly for trial and error. I don't have any exact solution.
这篇关于更换使用OpenSL ES(在Android原生音频)默认MIC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!