Add a wrapper struct around IPlugView for casts

This commit is contained in:
Robbert van der Helm
2021-01-03 23:43:51 +01:00
parent ace0d789d3
commit 52d4fe2f08
2 changed files with 54 additions and 21 deletions
+20 -1
View File
@@ -26,6 +26,25 @@
#include "../editor.h"
#include "common.h"
/**
* A holder for an object instance's `IPlugView` object and all smart pointers
* casted from it.
*
* @relates InstanceInterfaces
*/
struct InstancePlugView {
InstancePlugView();
InstancePlugView(Steinberg::IPtr<Steinberg::IPlugView> plug_View);
Steinberg::IPtr<Steinberg::IPlugView> plug_view;
// All smart pointers below are created from `plug_view`. They will be null
// pointers if `plug_view` did not implement the interface.
Steinberg::FUnknownPtr<Steinberg::Vst::IParameterFinder> parameter_finder;
};
/**
* A holder for plugin object instance created from the factory. This stores all
* relevant interface smart pointers to that object so we can handle control
@@ -98,7 +117,7 @@ struct InstanceInterfaces {
* multiple different view for a single plugin. This is not used within
* the SDK, so a single pointer should be fine for now.
*/
Steinberg::IPtr<Steinberg::IPlugView> plug_view;
std::optional<InstancePlugView> plug_view_instance;
/**
* This instance's editor, if it has an open editor. Embedding here works