Skip to content

Device-independent volume fix - #379

Merged
chrisuthe merged 2 commits into
chrisuthe:mainfrom
xBelladonna:volume-fix
Nov 28, 2026
Merged

chrisuthe merged 2 commits into
chrisuthe:mainfrom
xBelladonna:volume-fix

Conversation

@xBelladonna

Copy link
Copy Markdown
Contributor

Fixes a regression introduced with #342

A vendor's getStreamVolumeDb() table is not necessarily a usable gain curve. The protocol assumes dB attenuation (negative below full scale), but some devices (e.g. Samsung One UI) return values at or above zero for non-maximal steps. Using those values would select a near-mute volume at high requested volumes. Reject such tables on any device/output and use native volume steps as a fallback.

Compiled and tested on:

  • Samsung Galaxy S21+ (SM-G996B)
  • Samsung Galaxy S24+ (SM-S926B)
  • Samsung Galaxy Tab A9+ 5G (SM-X216B)

A vendor's `getStreamVolumeDb()` table is not necessarily a usable gain curve. The protocol assumes dB attenuation (negative below full scale), but some devices (e.g. Samsung One UI) return values at or above zero for non-maximal steps. Using those values would select a near-mute volume at high requested volumes. Reject such tables on any device/output and use native volume steps as a fallback.
@xBelladonna

Copy link
Copy Markdown
Contributor Author

I have since installed LineageOS 23.2 GSI on the SM-X216B and can confirm that the regular volume curve logic works fine, isolating the issue to OneUI itself and clearing the hardware of any suspicion.

isUsableCurve read index 1, which is minus infinity where the stream's
minimum is 2 or more, so a valid curve was refused. Start from the lowest
audible index instead.

The curve is read on every volume change, so warn about an unusable one
only when the output changes.

Drop the 100% shortcuts in indexFor and trackGainFor: a table that is not
in dB no longer reaches them.

Test the service with a table of linear amplitudes, as reported in chrisuthe#380:
nothing failed with the check disconnected. Test a table that dips too.
@chrisuthe
chrisuthe merged commit 55d3e77 into chrisuthe:main Nov 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants