Change Device Volume

76 views
Skip to first unread message

shah...@essential.com

unread,
Sep 8, 2017, 11:16:49 PM9/8/17
to android-ndk
Hi,

I have  a native ndk audio library that needs to change device volume (as if pressing hardware buttons). The below code returns SL_RESULT_FEATURE_UNSUPPORTED.
I can't get the device volume interface (SLDeviceVolumeItf).

  SLDeviceVolumeItf bqPlayerDeviceVolume = NULL;

    SLInterfaceID ids[4] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME, SL_IID_DEVICEVOLUME};

    SLboolean req[4] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE };

    ....

    SLresult result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_DEVICEVOLUME, &bqPlayerDeviceVolume);


SL_IID_VOLUME interface can change the volume, but can't raise the volume more than what the hardware button has set that to.


Any idea how to do this?


Regards, Shahriar

Glenn Kasten

unread,
Sep 11, 2017, 12:04:45 PM9/11/17
to android-ndk
See section "Objects and interfaces" of OpenSL ES for Android.
Summary is that SL_IID_DEVICEVOLUME is not supported on Android.
Reply all
Reply to author
Forward
0 new messages