Hi all,
I must be missing something very simple… how does the VST3 plug-in get notified of the preset name when the preset is saved through the host interface?
Thanks,
- Urs
Hi all,
I must be missing something very simple… how does the VST3 plug-in get notified of the preset name when the preset is saved through the host interface?
Thanks,
you can check the example in again.cpp:
//------------------------------------------------------------------------
tresult PLUGIN_API AGain::setState (IBStream* state)
{
....
// Example of using the IStreamAttributes interface
FUnknownPtr<IStreamAttributes> stream (state);
if (stream)
{
IAttributeList* list = stream->getAttributes ();
if (list)
{
// get the current type (project/Default..) of this state
String128 string = {0};
if (list->getString (PresetAttributes::kStateType, string, 128 * sizeof (TChar)) == kResultTrue)
{
UString128 tmp (string);
char ascii[128];
tmp.toAscii (ascii, 128);
if (!strncmp (ascii, StateType::kProject, strlen (StateType::kProject)))
{
// we are in project loading context...
}
}
// get the full file path of this state
TChar fullPath[1024];
memset (fullPath, 0, 1024 * sizeof (TChar));
if (list->getString (PresetAttributes::kFilePathStringType, fullPath, 1024 * sizeof (TChar)) == kResultTrue)
{
// here we have the full path ...
}
}
Cheers
Cool, thanks - I’ll check this out!
If you just want to get the preset name (for getState and setState): works under Cubase/Nuendo/Dorico
FUnknownPtr stream (state);
String128 name;
if (stream)
stream->getFileName (name);