3D Sound in OpenSL ES

578 views
Skip to first unread message

Ratamovic

unread,
Apr 24, 2011, 1:13:18 PM4/24/11
to android-ndk
Hi there, I tried to use OpenGL ES 3D sound features but don't manage
to use them. It keeps saying the feature is unsupported (error 12)
when I request SL_IID_3DLOCATION, for example:

// Creates OpenSL ES engine.
lResult = slCreateEngine(&mEngineObj, 0, NULL, 0, NULL, NULL);
assert(lResult == SL_RESULT_SUCCESS);
lResult = (*mEngineObj)->Realize(mEngineObj,
SL_BOOLEAN_FALSE);
assert(lResult == SL_RESULT_SUCCESS);
lResult = (*mEngineObj)->GetInterface(mEngineObj,
SL_IID_ENGINE, &mEngine);
assert(lResult == SL_RESULT_SUCCESS);

const SLInterfaceID ids[5] = {SL_IID_NULL, SL_IID_NULL,
SL_IID_NULL, SL_IID_NULL, SL_IID_NULL};
const SLboolean req[5] = {SL_BOOLEAN_FALSE, SL_BOOLEAN_FALSE,
SL_BOOLEAN_FALSE, SL_BOOLEAN_FALSE, SL_BOOLEAN_FALSE};
lResult = (*mEngine)->CreateOutputMix(mEngine,
&mOutputMixObject, 1, ids, req);
assert(lResult == SL_RESULT_SUCCESS);
lResult = (*mOutputMixObject)->Realize(mOutputMixObject,
SL_BOOLEAN_FALSE);
assert(lResult == SL_RESULT_SUCCESS);

SLObjectItf listenerObject;
const SLInterfaceID listener_ids[] = {SL_IID_3DLOCATION,
SL_IID_3DSOURCE};
const SLboolean listener_req[] = {SL_BOOLEAN_TRUE,
SL_BOOLEAN_TRUE};
lResult = (*mEngine)->CreateListener(mEngine, &listenerObject,
1, listener_ids, listener_req);

result of last operation is 12 (i.e. unsupported. No matter what I
try, I can't get. I am on a HTC Desire. So is 3D sound supported on
OpenSL ES for Android NDK ?


I also tried to get device capabilities but that doesn't work
(unsupported to):
lResult = (*mEngineObj)->GetInterface(mEngineObj,
SL_IID_AUDIOIODEVICECAPABILITIES, (void *)
&AudioIODeviceCapabilitiesItf);


Could anyone give me some hints about what is supported or not? I know
SLES support is not complete but it's not clear what is available and
what is not.
Thanks in advance.

mic _

unread,
Apr 24, 2011, 4:12:17 PM4/24/11
to andro...@googlegroups.com
It depends on which profile flags the OpenSL ES library was compiled with. So that fact that you get an UNSUPPORTED error probably means that HTC didn't include the 3D audio effect on the Desire.

/Michael


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.


Message has been deleted

Ratamovic

unread,
Apr 24, 2011, 6:27:22 PM4/24/11
to android-ndk
I see. Thanks for your answer. While trying to find more about
supported interfaces, I found this on my own phone:
Engine:
SL_IID_OBJECT
SL_IID_DYNAMICINTERFACEMANAGEMENT
SL_IID_ENGINE

OutputMix:
SL_IID_OBJECT
SL_IID_OUTPUTMIX
SL_IID_DYNAMICINTERFACEMANAGEMENT

SLPlay with SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE
SL_IID_OBJECT
SL_IID_PLAY
SL_IID_BUFFERQUEUE
SL_IID_EFFECTSEND
SL_IID_DYNAMICINTERFACEMANAGEMENT

SLPlay with SL_DATALOCATOR_ANDROIDFD
SL_IID_OBJECT
SL_IID_PLAY
SL_IID_SEEK
SL_IID_DYNAMICINTERFACEMANAGEMENT


So I guess that confirm that it is unsupported. I found a piece of
code in sles.c that confirms what you tell about Profiles. Here is an
extract from NDK doc:
"Note: though based on OpenSL ES, Android native audio at API level 9
is not a conforming implementation of any OpenSL ES 1.0.1 profile
(game, music, or phone). This is because Android does not implement
all of the features required by any one of the profiles. Any known
cases where Android behaves differently than the specification are
described in section "Android extensions" below. "

I am absolutely not an expert in 3D audio. Is it highly dependent on
hardware features that can't be emulated in software on (old) phones?
Many thanks

On 24 avr, 22:12, mic _ <micol...@gmail.com> wrote:
> It depends on which profile flags the OpenSL ES library was compiled with.
> So that fact that you get an UNSUPPORTED error probably means that HTC
> didn't include the 3D audio effect on the Desire.
>
> /Michael
>
Reply all
Reply to author
Forward
0 new messages