[Solved] Host set preset name

Allows to develop VST 3 Audio Plug-ins and VST 3 host.
Urs
Posts: 9
Joined: Thu Jun 23, 2016 11:11 am

[Solved] Host set preset name

Postby Urs » Mon Jul 10, 2017 2:21 pm

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

ygrabit
Posts: 73
Joined: Fri Jun 17, 2016 7:52 am
Location: Hamburg

Re: Host set preset name

Postby ygrabit » Tue Jul 11, 2017 8:51 am

you can check the example in again.cpp:

Code: Select all

//------------------------------------------------------------------------
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
YVan Grabit

Urs
Posts: 9
Joined: Thu Jun 23, 2016 11:11 am

Re: Host set preset name

Postby Urs » Tue Jul 11, 2017 10:41 am

Cool, thanks - I'll check this out!

ygrabit
Posts: 73
Joined: Fri Jun 17, 2016 7:52 am
Location: Hamburg

Re: Host set preset name

Postby ygrabit » Fri Jul 14, 2017 11:41 am

If you just want to get the preset name (for getState and setState): works under Cubase/Nuendo/Dorico

FUnknownPtr<IStreamAttributes> stream (state);
String128 name;
if (stream)
stream->getFileName (name);
YVan Grabit


Return to “VST 3 SDK”

Who is online

Users browsing this forum: No registered users and 7 guests