From fc003f8a1406811ced259fee0aa628ca89f59b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Sun, 30 Oct 2022 19:02:05 -0400 Subject: [PATCH] [max/pd] Further data type conversion fixes for audio parameter --- include/avnd/binding/max/audio_processor.hpp | 4 ++-- include/avnd/binding/pd/audio_processor.hpp | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/avnd/binding/max/audio_processor.hpp b/include/avnd/binding/max/audio_processor.hpp index ee26424a..5ddc2563 100644 --- a/include/avnd/binding/max/audio_processor.hpp +++ b/include/avnd/binding/max/audio_processor.hpp @@ -143,7 +143,7 @@ struct audio_processor // but most pd externals seem to just do a chain of if() so this is equivalent float res = argv[0].a_w.w_float; avnd::pfr::for_each_field(state.inputs, [s, res, &state](C& ctl) { - if constexpr(requires { ctl.value = float{}; }) + if constexpr(avnd::float_parameter || avnd::int_parameter || avnd::bool_parameter) { constexpr std::string_view control_name = avnd::get_name(); if(control_name == s->s_name) @@ -161,7 +161,7 @@ struct audio_processor // but most pd externals seem to just do a chain of if() so this is equivalent int res = argv[0].a_w.w_long; avnd::pfr::for_each_field(state.inputs, [s, res, &state](C& ctl) { - if constexpr(avnd::int_parameter || avnd::float_parameter || avnd::enum_parameter) + if constexpr(avnd::int_parameter || avnd::float_parameter || avnd::enum_parameter || avnd::bool_parameter) { constexpr std::string_view control_name = avnd::get_name(); if(control_name == s->s_name) diff --git a/include/avnd/binding/pd/audio_processor.hpp b/include/avnd/binding/pd/audio_processor.hpp index 0cee002c..2c7ed1ff 100644 --- a/include/avnd/binding/pd/audio_processor.hpp +++ b/include/avnd/binding/pd/audio_processor.hpp @@ -171,7 +171,9 @@ struct audio_processor // but most pd externals seem to just do a chain of if() so this is equivalent float res = argv[0].a_w.w_float; avnd::for_each_field_ref(state.inputs, [s, res, &state](C& ctl) { - if constexpr(requires { ctl.value = float{}; }) + if constexpr( + avnd::float_parameter< + C> || avnd::int_parameter || avnd::bool_parameter) { constexpr std::string_view control_name = avnd::get_name(); if(control_name == s->s_name)