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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VST3 rescans param names on params::request_rescan #289

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/detail/vst3/parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ class Vst3Parameter : public Steinberg::Vst::Parameter
std::function<Steinberg::Vst::UnitID(const char* modulepath)> getUnitId);
static Vst3Parameter* create(uint8_t bus, uint8_t channel, uint8_t cc, Steinberg::Vst::ParamID id);
// copies from the clap_param_info_t
uint32_t param_index_for_clap_get_info = 0;
clap_id id = 0;

void* cookie = nullptr;
double min_value; // minimum plain value
double max_value; // maximum plain value
Expand Down
12 changes: 12 additions & 0 deletions src/wrapasvst3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ void ClapAsVst3::setupParameters(const clap_plugin_t* plugin, const clap_plugin_
auto p = Vst3Parameter::create(
&info, [&](const char* modstring) { return this->getOrCreateUnitInfo(modstring); });
// auto p = Vst3Parameter::create(&info,nullptr);
p->param_index_for_clap_get_info = i;
parameters.addParameter(p);
}
}
Expand Down Expand Up @@ -924,6 +925,17 @@ void ClapAsVst3::param_rescan(clap_param_rescan_flags flags)
p->setNormalized(newval);
}
}
if (flags & CLAP_PARAM_RESCAN_INFO)
{
// In this case, the name and module can also change.
// For now, don't rebuild the unit tree with modules but
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about checking for a change in the module name and rebuild in that case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that but do we have the old module name around? Also can you rebuild unit trees in VST3?

Happy to look into both though!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet, we could add it, though. but you can not request that, only a full reload of the component.

You can also remap parameters but only during project loading (kParamIDMappingChanged).. I remember that I decided back then that CLAPs shouldn't do so much weird things 😺

this does not really match the vst3 semantics. It is something that should probably avoided when you write a CLAP to be used with the wrapper.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah my view was 'modules changing is wierd names is common' hence the fix here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So @defiantnerd we already send those param change flags at line 906. This diff is really just rebuilding the internal cache of the params we have when they change.

I propose the following

  1. lets merge this. The common case of param names change is then taken care of and also we can easily test the unicode thing
  2. lets open an issue for module changes. That issue would contains
    • param has to cache the module name
    • param diffs the module name here
    • if that module name has diffed we issue a full reload, which is a bummer, and add that to the documentation

wdyt?

// do rescan the name
clap_param_info_t info;
if (_plugin->_ext._params->get_info(_plugin->_plugin, p->param_index_for_clap_get_info, &info))
{
str8ToStr16(p->getInfo().title, info.name, str16BufferSize(p->getInfo().title));
}
}
}
}

Expand Down
Loading