38 lines
672 B
Kotlin
38 lines
672 B
Kotlin
package nl.astraeus.vst.ui.components
|
|
|
|
import nl.astraeus.vst.util.formatDouble
|
|
import kotlin.math.log10
|
|
import kotlin.math.pow
|
|
|
|
/**
|
|
* User: rnentjes
|
|
* Date: 26-11-17
|
|
* Time: 16:52
|
|
*/
|
|
|
|
class ExpKnobComponent(
|
|
value: Double = 1.0,
|
|
label: String = "",
|
|
minValue: Double = 0.0,
|
|
maxValue: Double = 5.0,
|
|
step: Double = 0.1,
|
|
width: Int = 50,
|
|
height: Int = 60,
|
|
renderer: (Double) -> String = { nv -> formatDouble(nv, 3) },
|
|
callback: (Double) -> Unit = {}
|
|
) : BaseKnobComponent(
|
|
value,
|
|
label,
|
|
minValue,
|
|
maxValue,
|
|
log10(maxValue / (maxValue - step)),
|
|
false,
|
|
width,
|
|
height,
|
|
0.005,
|
|
{ log10(it) },
|
|
{ 10.0.pow(it) },
|
|
renderer,
|
|
callback
|
|
)
|