I have multiple constructors depending on the PluginHostType - for this issue we have to consider that our VI in Logic has 16 stereo outputs and the VI in GarageBand is limited to 1 stereo out only.
Start Logic
Load the stereo version of our VI
PluginHostType detects that we’re running under AUHostingService and detects that it’s AppleLogic so isLogic() returns true. The plugin opens with the 16 outputs.
In the insert menu switch the VI from stereo to Multi-Output (16xstereo)
The current instance is destroyed and a new instance is created, but this time PluginHostType detects that we’re running under AUHostingService but the host type is AppleGarageBand so our recall crashes.
AppleGarageBand, /**< Represents Apple GarageBand. */
MaybeAppleGarageBand,
and add:
bool isGarageBand() const noexcept { return type == AppleGarageBand; }
bool isMaybeGarageBand() const noexcept { return type == MaybeAppleGarageBand; }
Then
PluginHostType::getHostType()
change the return type for “com.apple.garageband”
if (hostIdReportedByWrapper == "com.apple.garageband") return MaybeAppleGarageBand;
And when the VI starts up in GarageBand the HostType is AppleGarageBand, when the VI starts up as stereo or Multi-Out in Logic Pro the HostType is AppleLogic and if you then change the plugin configuration in Logic and the VI restarts the HostType is MaybeAppleGarageBand