Implement headphone autodetection, earpiece routing, and linear volume controls
- Fix msm8916-wcd ALSA UCM2 configs (Earpiece.conf, Speaker.conf, Headphones.conf, PrimaryMic.conf, HeadsetMic.conf) so Speaker, Earpiece, and Headphones outputs and Mic1/Headset inputs are always available and mutually exclusive without invalid mixer controls - Add event-driven wired headphone/headset jack detection and automatic audio routing in sxmo_soundmonitor.sh via evtest on the msm8916 Headset Jack input device - Make Earpiece, Speaker, and Headphones first-class routable output devices across sxmo_audio.sh, sxmo_modemaudio.sh, xdrawer, dmenu, and callscreen - Make volume controls strictly linear across all channels by keeping PipeWire software gain at unity (100%) when unmuted and linearly mapping 0-100% to hardware digital volume registers (RX3 for Speaker, RX1 for Earpiece, RX1+RX2 for Headphones, TX1+ADC for Microphone)
This commit is contained in:
1 parent
e42eb573ed
commit
370f8b085c
33 files changed
+1351
-488
No files matched your search
@@ -824,7 +824,7 @@ class PcmAudioOut {
|
||||
if (sysMuted_) {
|
||||
volScale_ = 0;
|
||||
} else {
|
||||
volScale_ = std::max(1, (pct * pct * 20 + 5000) / 10000);
|
||||
volScale_ = std::max(1, (pct * 20 + 50) / 100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -840,16 +840,10 @@ class PcmAudioOut {
|
||||
std::ofstream ofs(cfgDir + "/speaker_vol", std::ios::trunc);
|
||||
if (ofs) ofs << nextPct << "\n";
|
||||
}
|
||||
snd_ctl_t* ctl = nullptr;
|
||||
if (snd_ctl_open(&ctl, "hw:0", 0) == 0 && ctl) {
|
||||
long targetRx3 =
|
||||
(nextPct <= 0) ? 0 : (56 + ((nextPct * 28 + 50) / 100));
|
||||
if (nextPct > 0) {
|
||||
writeCtlBool(ctl, "SPK DAC Switch", true);
|
||||
}
|
||||
writeCtlInt(ctl, "RX3 Digital Volume", targetRx3);
|
||||
snd_ctl_close(ctl);
|
||||
}
|
||||
char cmd[128];
|
||||
std::snprintf(cmd, sizeof(cmd),
|
||||
"sxmo_audio.sh vol set %d >/dev/null 2>&1 &", nextPct);
|
||||
(void)std::system(cmd);
|
||||
refreshVolume(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user