Merge pull request #13 from fwiesel/normalize_relative_brightness
Normalize volume for brightness
This commit is contained in:
@@ -52,10 +52,11 @@ class VolumeView : View {
|
|||||||
val width = width
|
val width = width
|
||||||
val size = volumeHistory.size() // Size is at most width
|
val size = volumeHistory.size() // Size is at most width
|
||||||
val volumeNorm = volumeHistory.volumeNorm
|
val volumeNorm = volumeHistory.volumeNorm
|
||||||
|
val minBrightness = 0.3
|
||||||
val relativeBrightness: Double = if (size > 0) {
|
val relativeBrightness: Double = if (size > 0) {
|
||||||
volumeHistory[size - 1].coerceAtLeast(0.3)
|
(volumeNorm * volumeHistory[size - 1]).coerceAtLeast(minBrightness)
|
||||||
} else {
|
} else {
|
||||||
0.3
|
minBrightness
|
||||||
}
|
}
|
||||||
val blue: Int
|
val blue: Int
|
||||||
val rest: Int
|
val rest: Int
|
||||||
|
|||||||
Reference in New Issue
Block a user