diff options
author | ByteHamster <info@bytehamster.com> | 2024-02-18 19:05:13 +0100 |
---|---|---|
committer | ByteHamster <info@bytehamster.com> | 2024-02-18 19:05:13 +0100 |
commit | 0d29e44de5ac97f2285aca241e4f4290c26ea0f9 (patch) | |
tree | be56da0e2381b7a2abc43b2401fb7bfca1d03503 /model/src/main/java/de | |
parent | 556597a17315a6966a940e24e53088f8a31ef018 (diff) | |
parent | bf6721842220d7e89a0c3a451f5965e57feb9ca0 (diff) | |
download | AntennaPod-0d29e44de5ac97f2285aca241e4f4290c26ea0f9.zip |
Merge branch 'master' into develop
Diffstat (limited to 'model/src/main/java/de')
-rw-r--r-- | model/src/main/java/de/danoeh/antennapod/model/feed/VolumeAdaptionSetting.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/model/src/main/java/de/danoeh/antennapod/model/feed/VolumeAdaptionSetting.java b/model/src/main/java/de/danoeh/antennapod/model/feed/VolumeAdaptionSetting.java index e71c5ad36..a9b1089f2 100644 --- a/model/src/main/java/de/danoeh/antennapod/model/feed/VolumeAdaptionSetting.java +++ b/model/src/main/java/de/danoeh/antennapod/model/feed/VolumeAdaptionSetting.java @@ -1,5 +1,10 @@ package de.danoeh.antennapod.model.feed; +import android.media.audiofx.AudioEffect; + +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; + public enum VolumeAdaptionSetting { OFF(0, 1.0f), LIGHT_REDUCTION(1, 0.5f), @@ -32,4 +37,29 @@ public enum VolumeAdaptionSetting { public float getAdaptionFactor() { return adaptionFactor; } + + @Nullable + private static Boolean boostSupported = null; + + public static boolean isBoostSupported() { + if (boostSupported != null) { + return boostSupported; + } + final AudioEffect.Descriptor[] audioEffects = AudioEffect.queryEffects(); + if (audioEffects != null) { + for (AudioEffect.Descriptor effect : audioEffects) { + if (effect.type.equals(AudioEffect.EFFECT_TYPE_LOUDNESS_ENHANCER)) { + boostSupported = true; + return boostSupported; + } + } + } + boostSupported = false; + return boostSupported; + } + + @VisibleForTesting + public static void setBoostSupported(@Nullable Boolean boostSupported) { + VolumeAdaptionSetting.boostSupported = boostSupported; + } } |