Android NDK 및 OpenSL ES를 사용하여 기본 레코더 앱을 작성했습니다. 그것은 컴파일과 잘 연결하지만, 나는 다음과 같은 오류를 얻을 갤럭시 넥서스 장치에서 실행하려고하면OpenSL ES 레코더 개체의 인터페이스 SL_IID_ANDROIDSIMPLEBUFFERQUEUE 요청시 SL_RESULT_FEATURE_UNSUPPORTED가 반환됩니다.
res = (*recorderObj)->GetInterface(recorderObj, SL_IID_ANDROIDSIMPLEBUFFERQUEUE, &recorderBufferQueueItf);
는이 작업을 수행 :이 라인에서 발생
W/libOpenSLES(10708): Leaving Object::GetInterface (SL_RESULT_FEATURE_UNSUPPORTED)
Galaxy Nexus 기기에서 OpenSL ES를 사용하여 녹음하는 것이 지원되지 않거나 단순히 실수 한 것입니까? 다음은 관련 코드입니다 :
static SLObjectItf recorderObj;
static SLEngineItf EngineItf;
static SLRecordItf recordItf;
static SLAndroidSimpleBufferQueueItf recorderBufferQueueItf;
static SLDataSink recDest;
static SLDataLocator_AndroidSimpleBufferQueue recBuffQueue;
static SLDataFormat_PCM pcm;
/* Setup the data source structure */
locator_mic.locatorType = SL_DATALOCATOR_IODEVICE;
locator_mic.deviceType = SL_IODEVICE_AUDIOINPUT;
locator_mic.deviceID = SL_DEFAULTDEVICEID_AUDIOINPUT;
locator_mic.device = NULL;
audioSource.pLocator = (void *) &locator_mic;
audioSource.pFormat = NULL;
/* Setup the data sink structure */
recBuffQueue.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE;
recBuffQueue.numBuffers = NB_BUFFERS_IN_QUEUE;
/* set up the format of the data in the buffer queue */
pcm.formatType = SL_DATAFORMAT_PCM;
pcm.numChannels = 1;
pcm.samplesPerSec = SL_SAMPLINGRATE_44_1;
pcm.bitsPerSample = SL_PCMSAMPLEFORMAT_FIXED_16;
pcm.containerSize = SL_PCMSAMPLEFORMAT_FIXED_16;
pcm.channelMask = SL_SPEAKER_FRONT_CENTER;
pcm.endianness = SL_BYTEORDER_LITTLEENDIAN;
recDest.pLocator = (void *) &recBuffQueue;
recDest.pFormat = (void *) &pcm;
/* Create audio recorder */
res = (*EngineItf)->CreateAudioRecorder(EngineItf, &recorderObj, &audioSource, &recDest, 0, iidArray, required);
CheckErr(res);
/* Realizing the recorder in synchronous mode. */
res = (*recorderObj)->Realize(recorderObj, SL_BOOLEAN_FALSE);
CheckErr(res);
/* Get the RECORD interface - it is an implicit interface */
LOGI("GetInterface: Recorder");
res = (*recorderObj)->GetInterface(recorderObj, SL_IID_RECORD, &recordItf);
CheckErr(res);
/* Get the buffer queue interface which was explicitly requested */
LOGI("GetInterface: Buffer Queue");
res = (*recorderObj)->GetInterface(recorderObj, SL_IID_ANDROIDSIMPLEBUFFERQUEUE, &recorderBufferQueueItf);
CheckErr(res);
대부분은 당신이 오디오 레코더를 만들 때
에
을 변경. plzz –