Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getGainValue() returns wrong value. #30

Open
HelgeStenstrom opened this issue Sep 5, 2019 · 2 comments · Fixed by sunny-chung/java-stream-player#2
Open

getGainValue() returns wrong value. #30

HelgeStenstrom opened this issue Sep 5, 2019 · 2 comments · Fixed by sunny-chung/java-stream-player#2
Labels

Comments

@HelgeStenstrom
Copy link
Collaborator

public float getGainValue() {
return !hasControl(FloatControl.Type.MASTER_GAIN, gainControl) ? 0.0F : gainControl.getValue();
}

At least it doesn't return the value set by setGain(), which is confusing.
After reading the code, I realize that the internal gainControl probably has a setting on a dB scale, whereas setGain is linear.

getGainValue() doesn't translate from the gainControl setting, but setGain() does, which leads to the confusion.

@goxr3plus
Copy link
Owner

I think you have to multiply with 100 or divide by 100 ? It's been time i wrote it . Maybe it's a bug too , in XR3Player it works quite well .

@HelgeStenstrom
Copy link
Collaborator Author

No, you have to do a conversion between linear scale and logarithmic (dB) scale.
Since the setter method name and the getter method name don't match, there is an opportunity to simply add another method, with matching name and matching gain scale.

sunny-chung added a commit to sunny-chung/java-stream-player that referenced this issue Oct 2, 2023
sunny-chung added a commit to sunny-chung/java-stream-player that referenced this issue Oct 2, 2023
…aligned

fix value returned by getGain and parameter in setGain do not align (goxr3plus#30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants