2

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);
4

2 回答 2

2

您可能想看看这个网站:https ://developer.android.com/ndk/guides/audio/opensl/opensl-for-android 。它显示了适用于 Android 的 OpenSL ES API 支持什么以及(更重要的是)不支持什么。我还没有使用 3D 定位功能,但话又说回来,我还没有需要它。

无论如何,也许那个网站会给你更多关于它的信息......

于 2011-05-17T13:06:10.550 回答
0

当我上周再次查看这个问题时,我可能已经找到了解决方案。我在这里发布了一个可能的第三方库解决方案:

带有 3D 音频的 OpenSLES

也许需要它的人可以验证它是否有效。

于 2013-09-17T22:29:22.380 回答