e.clear();
e.setValue(0f);
[0] e.addSegment(1f, 100f);
[1] e.addSegment(0.5f, 100f);
[2] e.addSegment(0.5f, 1000f);
[3] e.addSegment(0, 1000f);
Let's say the envelope has started, and we're currently at 150ms duration, in the middle of segment [1], with the value of 0.75f (halfway between 1f and 0.5f).
Now let's say I decide I want the segment [2] to be (0.3f, 800f) instead of (0.5f, 1000f). What is the preferred way to do this?
Should I (e.g.) do some math to figure out which segment I'm currently in, then pop() all subsequent segments and add new ones?
Or should I getCurrentVlaue(), clear all the segments, and do some math to figure out what the remainder of the segment I'm currently in is (in this case, 50ms) and to the empty envelope do:
e.addSegment(getCurrentValue(), 50f)
e.addSegment(0.3f, 800f)
e.addSegment(0, 1000f);
Or is there a way to directly alter segment [2]'s value and duration?
Thanks!
Devin