Retrieve volume from the connected bluetooth device #671
Replies: 5 comments 32 replies
-
I can possibly help with the BlueALSA setup, but I have no knowledge of camilladsp. To give specific help I would need to know which version of BlueALSA you are using. Also, please could you clarify what you want to happen when the volume buttons on the iphone are pressed. Should the pico ignore these volume requests, or should they be somehow sent to camilladsp?
|
Beta Was this translation helpful? Give feedback.
-
Sorry I sent my question after one more evening on the subject and I realize now that I wasn't clear at all. So, currently i'm running a gadget audio on a rasp pico 2W. So basically my rasp act as an USB audio sound card for my laptop. I would like to do something similar with a bluetooth audio input. I compiled the latest bluez-alsa commit in the master branch as I saw that aplay now offers volume option. I also tried to link bluealsa-aplay to a mixer using the option "--mixer-device=hw:CARD=2 --mixer-name=PCM" (also tried the version 4.1.1 in this case ). At the end, my question doesn't concern camiladsp, but to answer your question, I use the alsa loopback as sink for bluealsa-play, then as source for camiladsp. |
Beta Was this translation helpful? Give feedback.
-
OK, so first you need to read the manual pages for bluealsa and bluealsa-aplay. I am assuming that camilladsp does not implement its own ALSA mixer device, so you need to use a script similar to your usb one to read the Bluetooth volume setting from its ALSA mixer or from D-Bus and then "send it to camilladsp". When using the latest bluez-alsa sources, the simplest way to tell bluealsa-aplay to disable BlueALSA's internal volume management is with the option Now comes the hard part. I recommend you should read the bluealsa-plugins manual page to understand the options available to you when using the BlueALSA mixer. If you intend to use only one phone connected at a time, then you may find it easiest to use the mixer in single-device mode (this is explained in the manual). The main point to note is that when the phone disconnects, then its volume control disappears from the mixer, so your script needs to be able to cope with that event. An alternative to using the ALSA mixer is to use BlueALSA's D-Bus interface. python has a D-Bus module. See the org.bluealsa.PCM1 manual page for details of the D-Bus API. |
Beta Was this translation helpful? Give feedback.
-
If I understand correctly when using the command : I should not be able to change the volume from my phone ? But I can. I can open the mixer with I tried to add this in my ~/.asoundrc file Did I completly misunderstood the behaviour of the --volume=none option ? |
Beta Was this translation helpful? Give feedback.
-
I've had a look at the Android bluetooth source code, and found this commit: commit 397eabe64261b3bad5164b7deb472e33b79d283a
Author: Antoine SOULIER <[email protected]>
Date: Fri Apr 7 21:22:27 2023 +0000
[avrcp] Fix version of controller
The AVRCP controller version should be set to 1.4 when
absolute volume is supported. Android Car target reads
this attributes and match the version. Leads to unexpected
behaviour of disabling absolute volume control.
Bug: 258826589
Tag: #feature
Test: On device
Change-Id: Id54106d90027d81c19c131d1013920a0b8a74e4e
diff --git a/system/stack/avrc/avrc_api.cc b/system/stack/avrc/avrc_api.cc
index 8bf95942c9..762d6f9ac0 100644
--- a/system/stack/avrc/avrc_api.cc
+++ b/system/stack/avrc/avrc_api.cc
@@ -981,10 +981,14 @@ static BT_HDR* avrc_pass_msg(tAVRC_MSG_PASS* p_msg) {
*
*****************************************************************************/
uint16_t AVRC_GetControlProfileVersion() {
+ char volume_disabled[PROPERTY_VALUE_MAX] = {0};
+ osi_property_get("persist.bluetooth.disableabsvol", volume_disabled, "false");
+
uint16_t profile_version = AVRC_REV_1_3;
char avrcp_version[PROPERTY_VALUE_MAX] = {0};
osi_property_get(AVRC_CONTROL_VERSION_PROPERTY, avrcp_version,
- AVRC_1_3_STRING);
+ strncmp(volume_disabled, "true", 4) == 0 ? AVRC_1_3_STRING
+ : AVRC_1_4_STRING);
if (!strncmp(AVRC_1_6_STRING, avrcp_version, sizeof(AVRC_1_6_STRING))) {
profile_version = AVRC_REV_1_6; So basically any Android build before April 2023 will always report version 1.3 for its AVRCP controller. Any build which includes that commit (I don't know which releases or updates, if any, have been made since that date) will report version 1.4 if absolute volume is enabled, or 1.3 if it is disabled. So, for BlueALSA A2DP remote volume control to work with Android, the Android build must include that commit. That commit first appears in Android 14 |
Beta Was this translation helpful? Give feedback.
-
Hello.
I'm trying to setup a rasp pico 2W as an bluetooth receiver then use camilladsp to do some room equalization and finaly output the result through a DAC.
I setup almost everything correctly, but the volume need to be controlled by camilladsp ( for the loudness filter) and not from the bluetooth transmitter ( ie my phone ).
I tried a lot of options in bluealsa-aplay, like specify the mixer of an another device, but I didn't succed. The volume always seems to be like softwarely controlled in the bluetooth stream.
So is it possible to retrieve the volume from bluetooth device in any way ? :)
Regards
Beta Was this translation helpful? Give feedback.
All reactions