Skip to content

Commit

Permalink
- fix filter node enable parameter switching at 0.0 instead of 0.5
Browse files Browse the repository at this point in the history
- fix harcoded FX corrupting XML when using Faust effects with invalid parameter IDs
  • Loading branch information
christoph-hart committed Nov 18, 2024
1 parent 558501f commit 085d1a3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions hi_core/hi_modules/effects/fx/SlotFX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,8 @@ void HardcodedSwappableEffect::restoreHardcodedData(const ValueTree& v)

for (const auto& p : OpaqueNode::ParameterIterator(*opaqueNode))
{
auto value = v.getProperty(p.info.getId(), p.info.defaultValue);
auto id = getSanitizedParameterId(p.info.getId());
auto value = v.getProperty(id, p.info.defaultValue);
setHardcodedAttribute(p.info.index, value);
}
}
Expand All @@ -835,7 +836,7 @@ ValueTree HardcodedSwappableEffect::writeHardcodedData(ValueTree& v) const
{
for (const auto& p : OpaqueNode::ParameterIterator(*opaqueNode))
{
auto id = p.info.getId();
auto id = getSanitizedParameterId(p.info.getId());

if(auto ptr = getParameterPtr(p.info.index))
v.setProperty(id, *ptr, nullptr);
Expand Down
6 changes: 6 additions & 0 deletions hi_core/hi_modules/effects/fx/SlotFX.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class HardcodedSwappableEffect : public HotswappableProcessor,
{
public:

static Identifier getSanitizedParameterId(const String& id)
{
auto sanitized = id.removeCharacters(" \t\n/-+.,");
return Identifier(sanitized);
}

virtual ~HardcodedSwappableEffect();

// ===================================================================================== Complex Data API calls
Expand Down
3 changes: 1 addition & 2 deletions hi_dsp_library/dsp_nodes/FilterNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ void FilterNodeBase<FilterType, NV>::setFrequency(double newFrequency)
template <class FilterType, int NV>
void FilterNodeBase<FilterType, NV>::setEnabled(double isEnabled)
{
enabled = isEnabled;

enabled = isEnabled > 0.5;
this->sendCoefficientUpdateMessage();
}

Expand Down

0 comments on commit 085d1a3

Please sign in to comment.