INNER CODE UNIT · Kotlin
AudioWaveView
Ayush0Chaudhary/blurr · app/src/main/java/com/blurr/voice/AudioWaveView.kt:15
class AudioWaveView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : View(context, attrs) {
// --- Configuration Constants ---
companion object {
// Added for converting raw audio dB to a normalized value
private const val MIN_DB_VALUE = -60f
private const val MAX_DB_VALUE = -5f
}
private val waveCount = 7
private val minIdleAmplitude = 0.15f
private val maxWaveHeightScale = 0.25f
// Corrected and swapped durations for more logical behavior
private val targetAmplitudeTransitionDuration = 500L
private val realtimeAmplitudeTransitionDuration = 100L
private val maxSpeedIncrease = 4.0f