Page 1 of 1

Set system setting - Bluetooth music volume

Posted: 20 Mar 2014 11:06
by guuzendesu
Help, anyone!

I'm using a flow to set the Bluetooth music volume using voice input.
Since the physical volume button is the easiest thing for me to use, I set the "System setting changed: volume_music_bt_a2dp" as the trigger. This records the present volume and then gets my voice input. If the first word is "volume," the last two characters are stored in a global_btmzk variable, and then another flow is activated. That flow disables the first one (since it's going to activate the trigger otherwise), performs "Set system setting: volume_music_bt_a2dp" with the value of {global_btmzk}, then enables the first flow.
When I check the value of the Bluetooth music volume in the flow function, it registers as being set to what I said, but I can hear that the actual volume hasn't changed. Then, if I change it by the physical button by just one click and check the value, it shows me the actual (very different) volume level.
What's going on? Is there a way to accomplish this?

Re: Set system setting - Bluetooth music volume

Posted: 20 Mar 2014 17:31
by Martin
Hi,

Android does not apply some of the settings you can access in action Set System Setting. Settings like audio volumes belong to this category and have to be changed by special APIs (the AudioManager in this case).
Android usually routes media volume changes automatically to the BT device when a BT device with media profile is connected so you can use a regular action Set Audio Volume with type Music. You can also enable Show Volume Level Popup which should show a BT icon when Android changes the volume of the BT device.

Regards,
Martin

Re: Set system setting - Bluetooth music volume

Posted: 20 Mar 2014 20:50
by guuzendesu
Thanks Martin!
But then, is there a way to change the volume to a level that I specify by voice?

Re: Set system setting - Bluetooth music volume

Posted: 21 Mar 2014 09:04
by Martin
If you only have a few values like 'high', 'medium' and 'low', you could test the voice input in conditions like Expression: value=='medium' and execute a suitable action Set Audio Volume: Music to level XYZ.
Alternatively you could store the spoken value in a variable and use action Restore Audio Volumes to set the music volume to the value stored in the variable.

Re: Set system setting - Bluetooth music volume

Posted: 22 Mar 2014 00:03
by guuzendesu
Awesome workaround! I didn't get it last night, since I was plastered and jamming to great music, but today I see the coolness of the 'restore' method! THANK YOU!

Re: Set system setting - Bluetooth music volume

Posted: 24 Mar 2014 04:03
by guuzendesu
One note: You might remember to ask noobs such as me whether we are using any numbers taken from a text string, such as from Input Speech. That was holding me up for a day and a half. Not complaining at you, just letting you know you might want to ask if people are using "toNumber()" to get a real number when they're using numbers. I had completely forgotten that numbers can be text too.

Re: Set system setting - Bluetooth music volume

Posted: 24 Mar 2014 18:39
by Martin
I was not aware that you were having troubles. In what situation did you use toNumber? I use this function very rarely and even forgot that it exists.

Re: Set system setting - Bluetooth music volume

Posted: 25 Mar 2014 17:41
by Martin
I probably found the culprit, action Restore Audio Volumes does not convert the variable on its own.
I will change it in the next update so that the action also accepts strings and properly converts the strings automatically to a number.