Supported OpenSL ES Features in Android

孤街醉人 提交于 2019-12-13 12:15:42

问题


Android is supposed to support 3D audio via the OpenSL es API which is accesible via the NDK. That more or less works, I managed it to play sound via a created player and an output mix. But when I try to realise a listener with a 3D location interface (SL_IID_3DLOCATION constant) which is mandatory for playing 3D sound. But when I try to set the constant to SL_BOOLEAN_TRUE the result of the CreateListener method is 12 as passed to the LogCat. 12 is the value of the OpenSL es constant SL_RESULT_FEATURE_UNSUPPORTED. Below you can find a short part of the code, can anyone confirm if I do anything wrong or if the feature really is unsopported, meaning that the OpenSL es implementation does not support 3D audio?

#define SL_RESULT_FEATURE_UNSUPPORTED       ((SLuint32) 0x0000000C)

const SLInterfaceID listener_ids[] = {SL_IID_3DLOCATION};
const SLboolean listener_req[] = {SL_BOOLEAN_TRUE};

result = (*engine)->CreateListener(engine, &listenerObject, 1, listener_ids, listener_req);
__android_log_print(ANDROID_LOG_VERBOSE, DEBUG_TAG, "CREATE: [%i]", result);

assert(SL_RESULT_SUCCESS == result);




result = (*listenerObject)->Realize(listenerObject, SL_BOOLEAN_FALSE);
__android_log_print(ANDROID_LOG_VERBOSE, DEBUG_TAG, "REALIZE: [%i]", result);

assert(SL_RESULT_SUCCESS == result);

回答1:


You might want to take a look at this website: http://mobilepearls.com/labs/native-android-api/ndk/docs/opensles/. It shows what is and (more importantly), what is not supported by the OpenSL ES API's for Android. I haven't worked with with the 3D location feature, but then again, I haven't had the need for it yet.

Anyway, maybe that site will give you more information about it...




回答2:


I may have found a solution to this when I had another look at the problem last week. I posted a possible solution with a third party lib here:

OpenSLES with 3D audio

Maybe someone who needs it can verify if it worked.



来源:https://stackoverflow.com/questions/5519357/supported-opensl-es-features-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!