INNER CODE UNIT · Kotlin
scaledAmplitude
Ayush0Chaudhary/blurr · app/src/main/java/com/blurr/voice/AudioWaveView.kt:110
val scaledAmplitude = amplitude.pow(1.5f).coerceIn(0.0f, 1.0f)
val targetAmplitude = minIdleAmplitude + (scaledAmplitude * maxWaveHeightScale)
amplitudeAnimator?.cancel()
amplitudeAnimator = ValueAnimator.ofFloat(audioAmplitude, targetAmplitude).apply {
duration = realtimeAmplitudeTransitionDuration // Use short duration for responsiveness
interpolator = AccelerateDecelerateInterpolator()
addUpdateListener { animation ->
audioAmplitude = animation.animatedValue as Float
}
start()
}
}
/**
* Smoothly animates the wave's amplitude to a new target level.
* Used for non-realtime effects like a "power up" sequence.
* @param target The target amplitude level (0.0f for idle, 1.0f for full).
*/