简体   繁体   English

Android 中支持的 OpenSL ES 功能

[英]Supported OpenSL ES Features in Android

Android is supposed to support 3D audio via the OpenSL es API which is accesible via the NDK. Android 应该通过 OpenSL es API 支持 3D 音频,该 API 可通过 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.但是当我尝试使用 3D 位置接口(SL_IID_3DLOCATION 常量)实现一个监听器时,这是播放 3D 声音所必需的。 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.但是当我尝试将常量设置为 SL_BOOLEAN_TRUE 时,CreateListener 方法的结果是传递给 LogCat 的 12。 12 is the value of the OpenSL es constant SL_RESULT_FEATURE_UNSUPPORTED. 12 是 OpenSL es 常量 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?您可以在下面找到代码的一小部分,谁能确认我是否做错了什么,或者该功能是否真的不受支持,这意味着 OpenSL es 实现不支持 3D 音频?

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

You might want to take a look at this website: https://developer.android.com/ndk/guides/audio/opensl/opensl-for-android .您可能想看看这个网站: https : //developer.android.com/ndk/guides/audio/opensl/opensl-for-android It shows what is and (more importantly), what is not supported by the OpenSL ES API's for Android.它显示了适用于 Android 的 OpenSL ES API 支持的内容以及(更重要的是)不支持的内容。 I haven't worked with with the 3D location feature, but then again, I haven't had the need for it yet.我还没有使用过 3D 定位功能,但话说回来,我还没有需要它。

Anyway, maybe that site will give you more information about it...无论如何,也许那个网站会给你更多关于它的信息......

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 带 3D 音频的 OpenSLES

Maybe someone who needs it can verify if it worked.也许需要它的人可以验证它是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM