diff --git a/modules/dsp/chowdsp_eq/EQ/chowdsp_StandardEQParameters.cpp b/modules/dsp/chowdsp_eq/EQ/chowdsp_StandardEQParameters.cpp index 9fd46ce6..7376e2dd 100644 --- a/modules/dsp/chowdsp_eq/EQ/chowdsp_StandardEQParameters.cpp +++ b/modules/dsp/chowdsp_eq/EQ/chowdsp_StandardEQParameters.cpp @@ -12,8 +12,10 @@ StandardEQParameters::StandardEQParameters (ParamHolder* parent, { for (auto& bandParams : eqParams) { - bandParams.paramHolder.emplace (this, - format (*arena, "{} {}", bandParams.bandNamePrefix, bandParams.bandIndex + 1)); + bandParams.paramHolder = new (arena->allocate (1)) ParamHolder { + this, + format (*arena, "{} {}", bandParams.bandNamePrefix, bandParams.bandIndex + 1), + }; bandParams.paramHolder->add (bandParams.onOffParam, bandParams.typeParam, bandParams.freqParam, @@ -23,6 +25,13 @@ StandardEQParameters::StandardEQParameters (ParamHolder* parent, } } +template +StandardEQParameters::~StandardEQParameters() +{ + for (auto& bandParams : eqParams) + bandParams.paramHolder->~ParamHolder(); +} + template typename StandardEQParameters::Params StandardEQParameters::getEQParameters (const EQParameterHandles& paramHandles) { diff --git a/modules/dsp/chowdsp_eq/EQ/chowdsp_StandardEQParameters.h b/modules/dsp/chowdsp_eq/EQ/chowdsp_StandardEQParameters.h index bc29bdf3..7d3124ae 100644 --- a/modules/dsp/chowdsp_eq/EQ/chowdsp_StandardEQParameters.h +++ b/modules/dsp/chowdsp_eq/EQ/chowdsp_StandardEQParameters.h @@ -94,7 +94,7 @@ struct StandardEQParameters : ParamHolder }; /** Internal use only! */ - std::optional paramHolder { std::nullopt }; // @TODO: use pointer instead of optional? + ParamHolder* paramHolder {}; }; /** Set of parameter handles for the entire EQ. */ @@ -102,6 +102,7 @@ struct StandardEQParameters : ParamHolder /** Constructor */ explicit StandardEQParameters (ParamHolder* parent, EQParameterHandles&& paramHandles, std::string_view name = {}); + ~StandardEQParameters(); /** Parameter handles */ EQParameterHandles eqParams; diff --git a/modules/gui/chowdsp_gui/PluginComponents/chowdsp_ParametersView.cpp b/modules/gui/chowdsp_gui/PluginComponents/chowdsp_ParametersView.cpp index cb83f920..98df51cb 100644 --- a/modules/gui/chowdsp_gui/PluginComponents/chowdsp_ParametersView.cpp +++ b/modules/gui/chowdsp_gui/PluginComponents/chowdsp_ParametersView.cpp @@ -180,7 +180,7 @@ struct ParametersView::Pimpl Pimpl (ParamHolder& params, ParameterListeners& listeners) : groupItem (params, listeners) { - view.setIndentSize (5); + view.setIndentSize (12); const auto numIndents = getNumIndents (groupItem); const auto width = 400 + view.getIndentSize() * numIndents; diff --git a/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp b/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp index ce46dc6e..ab9618f3 100644 --- a/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp +++ b/modules/plugin/chowdsp_plugin_state/Backend/chowdsp_ParamHolder.cpp @@ -127,7 +127,7 @@ std::enable_if_t, void> [[nodiscard]] inline int ParamHolder::count() const noexcept { - int count = static_cast (things.count()); + auto count = static_cast (things.count()); for (auto& thing : things) { if (thing.get_flags() == Holder)