preset-identity-read-back-from-value
Installation
SKILL.md
Read the preset back off the value
A preset list plus "which one is selected" looks like two pieces of state. It is one. The value is the truth; the label is a question you can ask about it:
/** The preset [bandsDb] currently sits on, or null once it has been dragged off every one. */
fun presetFor(bandsDb: List<Float>): Preset? =
PRESETS.firstOrNull { preset ->
preset.bandsDb.indices.all { i -> abs(preset.bandsDb[i] - bandsDb.getOrElse(i) { 0f }) < 0.01f }
}
Nothing on disk records which preset is on. Editing the value drops the label to Custom by itself; putting the value back re-selects the preset, with nothing having to notice. The same read-back covers a second, unrelated label over the same value — an imported profile's name — so two pickers can write one value and each stay honest about it.