goxr3plus / java-stream-player

🌌Java Advanced Audio Controller Library (WAV, AU, AIFF, MP3, OGG VORBIS, FLAC, MONKEY's AUDIO and SPEEX audio formats )
GNU General Public License v3.0
147 stars 33 forks source link

getGainValue() returns wrong value. #30

Open HelgeStenstrom opened 5 years ago

HelgeStenstrom commented 5 years ago

https://github.com/goxr3plus/java-stream-player/blob/ea4b7d9fda27f81902a0774a2535842ead6c622a/src/main/java/com/goxr3plus/streamplayer/stream/StreamPlayer.java#L1096-L1099

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 commented 5 years ago

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 commented 5 years ago

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.