Skip to content

Commit

Permalink
- fix delay node in hardcoded network not being initialised correctly…
Browse files Browse the repository at this point in the history
… when not modulated / automated
  • Loading branch information
Christoph Hart committed Aug 10, 2023
1 parent 464254d commit f9b4ae0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion hi_core/hi_dsp/modules/EffectProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Path MasterEffectProcessor::getSpecialSymbol() const
{
Path path;

path.loadPathFromData (HiBinaryData::SpecialSymbols::masterEffect, sizeof (HiBinaryData::SpecialSymbols::masterEffect));
path.loadPathFromData (HiBinaryData::SpecialSymbols::masterEffect, SIZE_OF_PATH (HiBinaryData::SpecialSymbols::masterEffect));

return path;
}
Expand Down
38 changes: 26 additions & 12 deletions hi_dsp_library/dsp_nodes/JuceNodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,38 +331,52 @@ struct jdelay : public base::jwrapper<juce::dsp::DelayLine<float, juce::dsp::Del
JuceBaseType::prepare(ps);
sr = ps.sampleRate;

if (sr != 0.0 && maxSize != 0.0)
if (sr > 0.0)
{
setParameter<0>(maxSize);
maxSize = 0.0;
if(maxSize != -1.0)
{
setParameter<0>(maxSize);
maxSize = -1.0;
}

if(currentSize != -1.0)
{
setParameter<1>(currentSize);
currentSize = -1.0;
}
}
}

template <int P> void setParameter(double v)
{
if(sr <= 0.0)
{
if constexpr (P == 0)
maxSize = v;
if constexpr (P == 1)
currentSize = v;

return;
}

auto sampleValue = jmax(0.0f, (float)(v * 0.001 * sr));

FloatSanitizers::sanitizeFloatNumber(sampleValue);

for (auto& obj : objects)
{
if constexpr (P == 0)
{
if (sr != 0.0)
obj.setMaxDelaySamples(roundToInt(sampleValue));
else
maxSize = v;
}
obj.setMaxDelaySamples(roundToInt(sampleValue));
if constexpr (P == 1)
obj.setDelay(sampleValue);
obj.setDelay(sampleValue);
}
}

void createParameters(ParameterDataList& d) override;

double sr = 0.0;
double maxSize = 0.0;

double maxSize = -1.0;
double currentSize = -1.0;
};

struct jchorus: public base::jwrapper<juce::dsp::Chorus<float>, 1>
Expand Down

0 comments on commit f9b4ae0

Please sign in to comment.