helgoboss / reaper-rs

Rust bindings for the REAPER C++ API
MIT License
82 stars 8 forks source link

Getting host context? #37

Closed Boscop closed 3 years ago

Boscop commented 3 years ago

In my livecoding VST, whenever the midi composition changes, I want to insert it on the same track that the VST is loaded on (and clear the track before calling InsertMedia), so I need to determine the track that the VST is on. Reaper supports this via a callback that's similar to getting host function pointers (but passing 1 as the request param instead of 0): https://www.reaper.fm/sdk/vst/vst_ext.php#vst_hostctx

Does reaper-rs already support this in some way? :)

helgoboss commented 3 years ago

Yes. reaper_medium::Reaper::plugin_context().type_specific(). And then VstPluginContext::request_containing_track() etc.