[Solved] Host set preset name

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

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);

Hi Guys,

Sorry to resurrect this thread but I don’t seem to be able to find much about this on the net.

@Yvan Should the attribute be on the iComponent or the iEditController?

@Urs1 We are currently using this on both the iComponent and the iEditController, Diva will occasionally crash on the iComponent with the iEditController always being fine. We have seen one crash with Repro, also with Repro there is a bit of debug output:

Preset path: ‘myStrings’
Preset name: ‘myStrings’
AM_VST3_ViewInterface::presentPresetChanged myStrings
AM_Message_PresetChanged did not find preset. name: myStrings (/Users/Urs/Jenkins/jobs/All PlugIns Mac/workspace/plugins/AM_View/AM_View_PresetSelector.cpp:186)
AM_Message_PresetChanged did not find preset. name: myStrings (/Users/Urs/Jenkins/jobs/All PlugIns Mac/workspace/plugins/AM_View/AM_View_PresetSelector.cpp:186)

this should be implemented in the iComponent, but the iEditController gets this too with Controller::setComponentState (IBStream* state)

Thanks @Yvan this is how we have it now, not many plugins seem to support it though :frowning:

Hi @Yvan

Sorry to resurrect the thread again!

From the hosts point of view how can it get the name of the current preset/program?

Is the only way of doing this via unitInfo->getProgramListInfo() and unitInfo->getProgramName()

Thanks

Andy