Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DirtyState()/Rework DirtyParametersFromUI() #1096

Open
olilarkin opened this issue May 15, 2024 · 0 comments
Open

Add DirtyState()/Rework DirtyParametersFromUI() #1096

olilarkin opened this issue May 15, 2024 · 0 comments
Labels
VST3 Issue relates to VST3 plug-ins

Comments

@olilarkin
Copy link
Member

Dumping parameters to sync the dsp side in e.g. VST as is currently done in IPlugVST3::DirtyParametersFromUI() is problematic in some hosts 馃憖 Live! Causing for example very slow preset changing when clicking through presets in the plugin UI.

something like this is recommend by the VST3 docs, but needs more thought.

Also maybe we need a more generic DirtyState() method

void IPlugController::UpdateProcessorOnPresetRecall()
{
  OPtr<IMessage> message = allocateMessage();
  // check message
  message->setMessageID ("StateDump");
  // dummy code to serialize the state as it exists in the controller
  ByteChunk state;
  SerializeState(&state);
  message->getAttributes ()->setBinary("state", state.GetBytes(), state.Size());
  sendMessage(message);
}
tresult PLUGIN_API IPlugProcessor::notify(IMessage* message)
{  
  if (!message)
    return kInvalidArgument;
  
  if (!strcmp (message->getMessageID(), "StateDump"))
  {
    const void* data;
    Steinberg::uint32 size;
    
    if (message->getAttributes()->getBinary("state", data, size) == kResultOk)
    {
      // dummy code to unserialize the binary state and update the component/processor's parameter values
      ByteChunk chunk;
      chunk.PutBytes(data, size);
      
      int readPos = 0;
      UnserializeState(&chunk, readPos);
    }
  }
  
  return ComponentBase::notify(message);
}
@olilarkin olilarkin added the VST3 Issue relates to VST3 plug-ins label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VST3 Issue relates to VST3 plug-ins
Projects
None yet
Development

No branches or pull requests

1 participant