Retrieving sound volume on Android

I finally got to use LE Extended Standard Library plugin to get sound volume on Android, but I am not sure if it works correctly.

On Android Volume Up/Down (Pressed) input event in BP I execute Get Current System Volume (Percentages) and feed the Percentage float into Print String. What I get is range from 0 (no sound) to 0.15 (max volume) and when I adjust volume on the device, the value doesn’t change gradually. It goes from 0.0 to 0.000something for a while, then jumps to 0.1 and so on. Somehow it doesn’t increment linearly.

Even if I feed float into Normalize to Range node to map it to 0 - 1 range (so that my volume bar in the HUD fills properly) that non-linear volume change makes volume bar grow slowly at first (if I keep volume button on the device pressed), then jumps with large increments.

I e-mailed the author of the plugin and he said the following:

The “Get Current System Volume (Percentages)” blueprint doesn’t have any logic in it, it just uses the “FAndroidMisc::GetVolumeState(NULL)” function that is programmed inside of the Unreal Engine.
If it returns an incorrect result, the bug is in the “FAndroidMisc::GetVolumeState(NULL)” function.

Please advise and if it’s a bug indeed, please fix it.

The volume is not a float. It is an int from 0 (off) to 15 (max).

Well, I hate to be back and forth messenger on issues like this, but: Low Entry Plugins - Marketplace - Unreal Engine Forums

Excerpt from the thread (developer is saying):

It divides the integer by 100.0, which
causes it to have a value from 0.0 to
1.0. It is expected to return a float.

Although it might be better if it
returned an integer, it won’t make a
difference in the workings of the
blueprint. If it currently returns
0.15 instead of 1.0, it will also return 15 instead of 100 if I would
change it to return an integer.

The fact that the result is divided by
100.0 doesn’t mean the weird bug is caused by the blueprint.

Edit: Ow, I missed the part that the
max is supposedly 15. That is weird,
because in the code it says the max is
100. I’ll fix it asap haha :stuck_out_tongue:

This does mean there is a mistake in
the internal code commenting, which
can also cause bugs to other

In the AndroidMisc.h it says this:

// Returns current volume, 0-100 (%)
static int GetVolumeState(double* OutTimeOfChangeInSec = nullptr);

As you can see, it says it returns 0
to 100, not 0 to 15.

Maybe it’s useful if Epic also knows
about this so they can fix it.

The comment in the header is bad; it always returned an integer in 0-15 range (this is passed straight from Java). If you want 0.0 to 1.0, you should divide by 15.0, not 100.0.

Can I use Normalize to Range with 0 - 15 range specified ?