Skip to content

Commit

Permalink
fix: #258
Browse files Browse the repository at this point in the history
  • Loading branch information
defiantnerd committed Jun 11, 2024
1 parent 6fa9e1c commit 78e46ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/detail/vst3/parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Vst3Parameter* Vst3Parameter::create(
v.defaultNormalizedValue = (info->default_value - info->min_value) / param_range;
if ((info->flags & CLAP_PARAM_IS_STEPPED) || (info->flags & CLAP_PARAM_IS_ENUM))
{
auto steps = param_range + 1;
auto steps = param_range;
v.stepCount = steps;
}
else
Expand Down Expand Up @@ -166,15 +166,15 @@ Vst3Parameter* Vst3Parameter::create(uint8_t bus, uint8_t channel, uint8_t cc, V
if (cc == Vst::ControllerNumbers::kCtrlProgramChange)
{
v.flags |= Vst::ParameterInfo::kIsProgramChange | Vst::ParameterInfo::kCanAutomate;
v.stepCount = 128;
v.stepCount = 127;
}

v.defaultNormalizedValue = 0;
v.stepCount = 128;
v.stepCount = 127;

if (cc == Vst::ControllerNumbers::kPitchBend)
{
v.stepCount = 16384;
v.stepCount = 16383;
}

auto result = new Vst3Parameter(v, bus, channel, cc);
Expand Down
4 changes: 2 additions & 2 deletions src/detail/vst3/parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Vst3Parameter : public Steinberg::Vst::Parameter
{
if (info.stepCount > 0)
{
return (vst3value * info.stepCount) + min_value;
return (vst3value * info.stepCount + 1) + min_value;
}
return (vst3value * (max_value - min_value)) + min_value;
}
Expand All @@ -63,7 +63,7 @@ class Vst3Parameter : public Steinberg::Vst::Parameter
auto& info = this->getInfo();
if (info.stepCount > 0)
{
return (clapvalue - min_value) / float(info.stepCount);
return (clapvalue - min_value) / float(info.stepCount + 1);
}
return (clapvalue - min_value) / (max_value - min_value);
}
Expand Down

0 comments on commit 78e46ed

Please sign in to comment.