Skip to content

Commit

Permalink
Fixed live values for poly params with mono sources
Browse files Browse the repository at this point in the history
  • Loading branch information
FigBug committed Sep 10, 2023
1 parent fb19542 commit e5f2f51
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions modules/gin_plugin/plugin/gin_modmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ class ModMatrix

const int paramId = p->getModIndex();
auto& pi = parameters.getReference (paramId);

auto& info = parameters.getReference (paramId);

if (pi.poly)
{
Expand All @@ -164,7 +166,6 @@ class ModMatrix
if (v->isVoiceActive())
{
float base = p->getValue();
auto& info = parameters.getReference (paramId);

for (auto& src : info.sources)
{
Expand All @@ -179,14 +180,35 @@ class ModMatrix
liveValues.add (base);
}
}

if (liveValues.size() == 0)
{
float base = p->getValue();
bool ok = false;

for (auto& src : info.sources)
{
if (! src.poly)
{
base += sources[src.id.id].monoValue * src.depth;
ok = true;
}
}

if (ok)
{
base = juce::jlimit (0.0f, 1.0f, base);
liveValues.add (base);
}
}

}
else
{
bool ok = false;
auto v = activeVoice;

float base = p->getValue();
auto& info = parameters.getReference (paramId);

for (auto& src : info.sources)
{
Expand Down

0 comments on commit e5f2f51

Please sign in to comment.