I’m starting my journey on JUCE development and sometimes I wonder whether what I am doing makes sense or not and, as a beginner, I could use some advice here.
My target is to create a component that displays an editable MIDI velocity scale curve. I want user to be able to add points and change the shape of each segment by mouse interaction, so I am using Path::cubicTo and some mouse events handling.
The display and the user interactivity parts are working fine.
Now I need to mathematically invert the curve, I’d ideally need y = getYatX(myPath, x) so I can actually scale out incoming MIDI notes
I see PathFlatteningIterator might be one solution here, so I can approximate the path in a piecewise linear fashion and calculate the Y with some little error around the corners I guess.
I wonder, when doing stuff like this (I am thinking to Envelopes, ADSR, user defined waveforms etc) is this the “usual / recommended” approach?
Any better way of doing this?