vst-rs icon indicating copy to clipboard operation
vst-rs copied to clipboard

Proposal for even simpler midi sending API

Open Boscop opened this issue 6 years ago • 0 comments

Right now, sending midi events is already quite simple: https://github.com/rust-dsp/rust-vst/blob/6dab92fbbf327837f468de9910414f9ea3e5fffc/examples/fwd_midi.rs#L20

But we are still requiring plugins to own a SendEventBuffer to be able to send midi events. This requires plugin authors to know about the SendEventBuffer and introduces more friction than what could be possible: The SendEventBuffer for each plugin could be an implementation detail, hidden from the plugin author, by storing it in the plugin cache, just like we do with the plugin's Info struct: https://github.com/rust-dsp/rust-vst/blob/6dab92fbbf327837f468de9910414f9ea3e5fffc/src/cache.rs#L3-L4

And then sending midi events would be as simple as:

self.host.send_events(events);

with a method send_events() on HostCallback that uses AEffect::get_cache(): https://github.com/rust-dsp/rust-vst/blob/04258d15fa49e0aec5d38bcbe1839a635aeed7f4/src/api.rs#L163 It already has the AEffect pointer: https://github.com/rust-dsp/rust-vst/blob/4b19b1772a7c8a375498dbbe7f58ebf42cf9da68/src/plugin.rs#L751-L754

What do you think?

Boscop avatar Apr 28 '18 18:04 Boscop