Hey, sorry I may be barding this community with questions, but here’s another.
I’m currently working on adding in an LFO editor that is in the form of a custom IControl. I have it set up in a way that the user can click to add points as well as drag them around. The thing I’m struggling on is how to return a value from the LFO when I pass in a value (0-1) for the time. I’m pretty sure the ISender class(s) are meant for sending data to the control, so as far as I see, that isn’t an option. My other idea was to pass in a series of parameters in an array, but I feel like there is a better solution out there.
Thanks for any help!
This is essentially the same functionality as a sequencer control has, right? (Perhaps just finer-grained, i.e. far more than the usual 8-16 steps a sequencer would have.) If so, I think you’ll find the IPlugChunks example useful - that’s what I used as a basis to implement a sequencer (which I derived from the LFO class) in the plugin I’m working on. Essentially, an update to the LFO/sequencer editor control triggers an action function that uses SendArbitraryMessageFromUI, which sends an untyped pointer (void*) to the OnMessage function of your plugin class. There, as far as I know, you’re safe to edit DSP members.
One caveat about the IPlugChunks example, though: The example illustrates both how to make a sequencer with a MultiSlider control, as well as (and more importantly) how to save data other than VST-standard parameters. In the example, the sequencer values are stored in a DSP member variable within the action function, based on the new values produced by interaction between the mouse and the control. However, the IVMultiSliderControl object will interpolate and set multiple values if the mouse skips a slider between triggers of OnMouseDrag. These slider updates don’t trigger the action function and thus don’t get stored in mDSP.mSteps, and therefore if you quickly sweep the mouse across the control, you’ll find when you reload the plugin that only about half of the steps actually got serialized and saved. To get around this, I simply looped through all slider values and stored them every time the action function was triggered (since my sequencer only has 16 steps, this has a negligible impact on performance).