Hello everyone,
I am trying to find a convenient way to parse osc value from almost identical addresses (like « /test1, /test2, /test3 etc…) into a MutableList so I can then reuse this values into chosen parameters, let’s say circles radiuses.
I came up with this idea :
program {
var radius = 0.0f
val radiusList = mutableListOf(radius)
val osc = OSC(InetAddress.getByName(127.0.0.1), portIn = 12345, portOut = 1000)
for (i in 0 until 3){
osc.listen(String.format(« /test%01d », i)) { addr, it →
radius = it[0] as Float
radiusList[i] = radius
}
}
}
extend {
println(radiusList)
}
I send OSC from Ableton Live, using the OSC Send Max4Live module mapped to some knobs on an audio effect rack. Everything is fine when I move the first knob, mapped to /test0 here. But if I move the second knob, mapped to /test1 the console return
Index 1 out of bounds for length 1 (IndexOutOfBoundsException)
I am not a programming expert and I might have overlooked something obvious. Any advice would be helpful, I will take another look at the Kotlin documentation in the meantime. Thanks in advance and have a good day/night !