From eaebd0a90bb1e10546a3f115150d2fb957cf6326 Mon Sep 17 00:00:00 2001 From: dreamer <1185977+dromer@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:08:46 +0200 Subject: [PATCH] try disabling denormal numbers for plugins with input (#158) * try disabling denormal numbers for plugins with input * flag to disable scoped denormals --- CHANGELOG.md | 1 + hvcc/generators/c2dpf/templates/HeavyDPF.cpp | 6 ++++++ hvcc/generators/types/meta.py | 1 + 3 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0449a36..4c33e08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Features: * Only disable DSP with new `--nodsp` flag * Use pydantic types to define metadata objects * DPF: CV flag in portgroups +* DPF: flag to disable scoped denormals Bugfixes diff --git a/hvcc/generators/c2dpf/templates/HeavyDPF.cpp b/hvcc/generators/c2dpf/templates/HeavyDPF.cpp index a8130ec..0d73340 100644 --- a/hvcc/generators/c2dpf/templates/HeavyDPF.cpp +++ b/hvcc/generators/c2dpf/templates/HeavyDPF.cpp @@ -3,6 +3,9 @@ #include "Heavy_{{name}}.h" #include "{{class_name}}.hpp" #include +{% if meta.denormals is sameas false %} +#include "extra/ScopedDenormalDisable.hpp" +{% endif %} #define HV_DPF_NUM_PARAMETER {{receivers|length + senders|length}} @@ -203,6 +206,9 @@ void {{class_name}}::run(const float** inputs, float** outputs, uint32_t frames, void {{class_name}}::run(const float** inputs, float** outputs, uint32_t frames) { #endif +{% if meta.denormals is sameas false %} + const ScopedDenormalDisable sdd; +{% endif %} const TimePosition& timePos(getTimePosition()); if (timePos.playing && timePos.bbt.valid) _context->sendMessageToReceiverV(HV_HASH_DPF_BPM, 0, "f", timePos.bbt.beatsPerMinute); diff --git a/hvcc/generators/types/meta.py b/hvcc/generators/types/meta.py index 38adbc6..f55e474 100644 --- a/hvcc/generators/types/meta.py +++ b/hvcc/generators/types/meta.py @@ -40,6 +40,7 @@ class DPF(BaseModel): midi_output: bool = False port_groups: Optional[DPFPortGroups] = None enumerators: Optional[Dict[str, List[str]]] = None + denormals: bool = True version: Optional[str] = None license: Optional[str] = None maker: Optional[str] = None