Skip to content

Commit

Permalink
fixing the conversion between clap and normalized vst3 vaues
Browse files Browse the repository at this point in the history
  • Loading branch information
defiantnerd committed Sep 5, 2024
1 parent aed3477 commit 5516dda
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/detail/vst3/parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ class Vst3Parameter : public Steinberg::Vst::Parameter
bool fromString(const Steinberg::Vst::TChar* string, Steinberg::Vst::ParamValue& valueNormalized) const override;
#endif

// for asClapValue() and asVst3Value()
// regarding conversion and the meaning of stepCount take a look here:
// https://steinbergmedia.github.io/vst3_dev_portal/pages/Technical+Documentation/Parameters+Automation/Index.html#conversion-of-normalized-values

inline double asClapValue(double vst3value) const
{
if (info.stepCount > 0)
Expand All @@ -63,7 +67,7 @@ class Vst3Parameter : public Steinberg::Vst::Parameter
auto& info = this->getInfo();
if (info.stepCount > 0)
{
return (clapvalue - min_value) / float(info.stepCount + 1);
return floor(clapvalue - min_value) / float(info.stepCount);
}
return (clapvalue - min_value) / (max_value - min_value);
}
Expand Down

0 comments on commit 5516dda

Please sign in to comment.