Max numerical value of any audio stream?
Moderator: Martin
-
- Posts: 109
- Joined: 16 Apr 2014 04:57
Max numerical value of any audio stream?
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
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?
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.
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.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Max numerical value of any audio stream?
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
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
-
- Posts: 109
- Joined: 16 Apr 2014 04:57
Re: Max numerical value of any audio stream?
Thanks a lot. That did the job flawlessly.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.
-
- Posts: 109
- Joined: 16 Apr 2014 04:57
Re: Max numerical value of any audio stream?
I always mind. That's why the query.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.
-
- Posts: 109
- Joined: 16 Apr 2014 04:57
Re: Max numerical value of any audio stream?
Brother Peter, really sorry, I didn't quite get your point. Could you please clarify?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
Thanks.
Re: Max numerical value of any audio stream?
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
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
- Attachments
-
- flow_highest_value_audio.xml
- (4.92 KiB) Downloaded 887 times
Re: Max numerical value of any audio stream?
@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.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Re: Max numerical value of any audio stream?
Hello Desmanto!
Your idea with the curly braces is good!
Learned something again!
Regards
Peter
Your idea with the curly braces is good!
Learned something again!
Regards
Peter
-
- Posts: 109
- Joined: 16 Apr 2014 04:57
Re: Max numerical value of any audio stream?
Hi brother!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.
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