Fix A2DP Bluetooth audio routing, stream migration, hotplug monitoring, and q6voice teardown

This commit is contained in:
Luxferre committed 2026-11-04 15:42:58 +02:00
1 parent b2ade2dc42
commit b8dea31b59
34 files changed
+533 -155

No files matched your search

+16 -7
View File
@@ -266,7 +266,12 @@ int readSavedSpeakerVol() {
}
std::string vfile = "/speaker_vol";
int defv = 85;
if (outDev.find("Headphone") != std::string::npos || outDev.find("Headset") != std::string::npos) {
if (outDev.find("Bluetooth") != std::string::npos ||
outDev.find("bluetooth") != std::string::npos) {
vfile = "/bluetooth_vol";
defv = 80;
} else if (outDev.find("Headphone") != std::string::npos ||
outDev.find("Headset") != std::string::npos) {
vfile = "/headphones_vol";
defv = 80;
} else if (outDev.find("Earpiece") != std::string::npos) {
@@ -502,10 +507,14 @@ int runMusicApp(int argc, char** argv) {
isPaused = false;
ignoreEofUntilMs = nowMs() + 450;
runAsyncCmd("amixer -c 0 cset \"name='EAR_S'\" 0 >/dev/null 2>&1; "
"amixer -c 0 cset \"name='SPK DAC Switch'\" 1 >/dev/null 2>&1; "
"amixer -c 0 cset \"name='RX3 MIX1 INP1'\" 3 >/dev/null 2>&1; "
"wpctl set-mute @DEFAULT_AUDIO_SINK@ 0 >/dev/null 2>&1");
runAsyncCmd("sxmo_audio.sh device apply >/dev/null 2>&1; "
"(sleep 0.25; "
"sink=$(pactl get-default-sink 2>/dev/null); "
"if [ -n \"$sink\" ]; then "
" for sid in $(pactl list short sink-inputs 2>/dev/null | awk '{print $1}'); do "
" pactl move-sink-input \"$sid\" \"$sink\" >/dev/null 2>&1 || true; "
" done; "
"fi) >/dev/null 2>&1 &");
std::string loadTarget = tr.path;
if (isMonotoneFile(tr.path)) {
@@ -1333,11 +1342,11 @@ int runMusicApp(int argc, char** argv) {
} else if (sym == XK_Right || sym == XK_KP_Right) {
seekRelative(5);
} else if (sym == XK_Up || sym == XK_KP_Up) {
volumePct = std::clamp(volumePct + 5, 0, 100);
volumePct = std::clamp(readSavedSpeakerVol() + 5, 0, 100);
applySystemSpeakerVol(volumePct);
setBanner("Volume: " + std::to_string(volumePct) + "%", 1200);
} else if (sym == XK_Down || sym == XK_KP_Down) {
volumePct = std::clamp(volumePct - 5, 0, 100);
volumePct = std::clamp(readSavedSpeakerVol() - 5, 0, 100);
applySystemSpeakerVol(volumePct);
setBanner("Volume: " + std::to_string(volumePct) + "%", 1200);
} else if (dch == '4') {