Page 1 of 2
Max numerical value of any audio stream?
Posted: 13 Dec 2017 05:05
by akhileshg1988
How can I know the maximum numerical value of any audio stream?
In some custom roms that I used earlier, there was an option in the settings called 'Volume Steps'.
In such roms, I could easily get the maximum value of any audio stream by using the action 'Init Variable System Setting' --> Category 'System' --> Name 'volume_steps_alarm' --> Variable 'alm_vol'.
This way, the variable 'alm_vol' returned the max numerical value of the alarm audio stream on my device.
However, now I'm using a custom rom that doesn't have the option 'Volume Steps' in the settings menu.
Please help.
Akhilesh Chandra Gairola
Re: Max numerical value of any audio stream?
Posted: 13 Dec 2017 15:50
by Desmanto
You can try to loop the value and check it.
1. First set the alarm value to 0. Initiate value prev_vol = 0.
2. Use action set audio volume - raise
3. Use action store audio volume, only alarm, save to next_vol.
4. Compare if next_vol (1) bigger that prev_vol (0). If yes, set prev_vol to next_vol (prev_vol becomes 1), and loop back to volume raise.
5. Until the last result where raise volume won't increase the value of next_vol anymore (false branch), then it is max vol already. Max_vol = next_vol.
I think it is better you check the value manually everytime you flash new cusrom. If you are willing to go through the hassle of changing the rom, you shouldn't mind to check it manually after every flash, in the action set audio volume. Simply slide it to the max and see what is the max value.
Re: Max numerical value of any audio stream?
Posted: 13 Dec 2017 16:44
by Bingwu
Hello!
I chose this option for me:
1. Action: Store Audio Volumes (to restore the current volume - a variable other than point 3.)
2. Action: Set Audio Stream Volume -> Volume = 999 (or another unlikely high value)
3. Action: Store Audio Volumes (That's the highest possible value ... and not 999 - a variable other than point 1.)
4. Action: Set Audio Stream Volume -> Volume (Variable from point 1. to restore the original volume)
This works on all my devices without any problems.
I hope that I did not make a mistake in the translation.
I wish you success!
Peter
Re: Max numerical value of any audio stream?
Posted: 14 Dec 2017 09:15
by akhileshg1988
Desmanto wrote:You can try to loop the value and check it.
1. First set the alarm value to 0. Initiate value prev_vol = 0.
2. Use action set audio volume - raise
3. Use action store audio volume, only alarm, save to next_vol.
4. Compare if next_vol (1) bigger that prev_vol (0). If yes, set prev_vol to next_vol (prev_vol becomes 1), and loop back to volume raise.
5. Until the last result where raise volume won't increase the value of next_vol anymore (false branch), then it is max vol already. Max_vol = next_vol.
Thanks a lot. That did the job flawlessly.
Re: Max numerical value of any audio stream?
Posted: 14 Dec 2017 09:17
by akhileshg1988
Desmanto wrote:I think it is better you check the value manually everytime you flash new cusrom. If you are willing to go through the hassle of changing the rom, you shouldn't mind to check it manually after every flash, in the action set audio volume. Simply slide it to the max and see what is the max value.
I always mind. That's why the query.
Re: Max numerical value of any audio stream?
Posted: 14 Dec 2017 09:19
by akhileshg1988
Bingwu wrote:Hello!
I chose this option for me:
1. Action: Store Audio Volumes (to restore the current volume - a variable other than point 3.)
2. Action: Set Audio Stream Volume -> Volume = 999 (or another unlikely high value)
3. Action: Store Audio Volumes (That's the highest possible value ... and not 999 - a variable other than point 1.)
4. Action: Set Audio Stream Volume -> Volume (Variable from point 1. to restore the original volume)
This works on all my devices without any problems.
I hope that I did not make a mistake in the translation.
I wish you success!
Peter
Brother Peter, really sorry, I didn't quite get your point. Could you please clarify?
Thanks.
Re: Max numerical value of any audio stream?
Posted: 14 Dec 2017 10:09
by Bingwu
Hello akhileshg1988!
I am sorry, but it is a small mistake in my example!

In the action "Set Audio Stream Volume" it is not (no longer?) possible to enter a too high value as a number.
But that's no problem if you set the value with a variable.
I have attached a flow as an example. (The elements are in German, but after saving again in English.)
Regards
Peter
Re: Max numerical value of any audio stream?
Posted: 14 Dec 2017 15:26
by Desmanto
@Bingwu : Nice idea there. I was lost in the loop, your method is much better. I can comment only one thing. The script to set alarm_value_too_high is not needed actually. We can just put {999} directly at the Set Audio Volume. {999} will evaluated to 999 for the volume. So, total only 2 elements needed to check the maximum volume.
Re: Max numerical value of any audio stream?
Posted: 14 Dec 2017 15:36
by Bingwu
Hello Desmanto!
Your idea with the curly braces is good!
Learned something again!
Regards
Peter
Re: Max numerical value of any audio stream?
Posted: 15 Dec 2017 04:46
by akhileshg1988
Desmanto wrote:@Bingwu : Nice idea there. I was lost in the loop, your method is much better. I can comment only one thing. The script to set alarm_value_too_high is not needed actually. We can just put {999} directly at the Set Audio Volume. {999} will evaluated to 999 for the volume. So, total only 2 elements needed to check the maximum volume.
Hi brother!
Don't know how or why did you get lost in the loop. I successfully used the loop method to set all the audio stream volumes to max.
Thanks
Akhilesh