Closed carycodes closed 2 years ago
The VST 2.4 API doesn't provide this functionality, but e.g. Reaper's extension API does: https://www.reaper.fm/sdk/vst/vst_ext.php#vst_hostctx
E.g. with the reaper-medium
crate, you can get your track this way:
fn my_track(&self) -> MediaTrack {
if let TypeSpecificPluginContext::Vst(ctx) = self.reaper.plugin_context().type_specific() {
unsafe {
ctx.request_containing_track(NonNull::new(self.host.raw_effect()).expect("NonNull"))
.expect("my_track")
}
} else {
unreachable!()
}
}
If you want to get notified when your track's name changes, impl ControlSurface::set_track_title
.
E.g.:
impl ControlSurface for MyControlSurface {
fn set_track_title(&self, args: SetTrackTitleArgs) {
let my_track = self.my_track();
if args.track == my_track {
let track_name = args.name.to_str();
let _ = self.tx_action.send(SurfaceAction::MyTackNameChanged(track_name.to_string()));
}
}
Similarly you can query your position in this track's FX chain.
But this is host-specific. The VST API doesn't have the concept of "tracks". You could e.g. have a modular host like Jeskola Buzz where tracks don't even exist.
Not sure where the best VST SDK doc is. This one seems offline now.. Maybe the best doc is the SDK source itself.
Btw, on our org page at the top you can find links to our discourse, discord etc.
I'm new to VST development so apologies if this is a silly question, but is there any API for multiple instances of the plugin to determine "where" they are running in terms of track number and FX chain index? My goal is to have instances of the plugin be able to uniquely identify themselves (in a way that's obvious to the user, so something like &self as *const _ as usize is an awkward last resort) to communicate with an external program. Or are things like track numbers too DAW-specific?
Tangential: for a newcomer, it seems particularly difficult to find any documentation on the VST2.4 API. Pointers on how to answer questions like this myself would also be welcome.