Skip to content

Commit

Permalink
[max/pd] Further data type conversion fixes for audio parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Oct 30, 2022
1 parent f4a1417 commit fc003f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/avnd/binding/max/audio_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]<typename C>(C& ctl) {
if constexpr(requires { ctl.value = float{}; })
if constexpr(avnd::float_parameter<C> || avnd::int_parameter<C> || avnd::bool_parameter<C>)
{
constexpr std::string_view control_name = avnd::get_name<C>();
if(control_name == s->s_name)
Expand All @@ -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]<typename C>(C& ctl) {
if constexpr(avnd::int_parameter<C> || avnd::float_parameter<C> || avnd::enum_parameter<C>)
if constexpr(avnd::int_parameter<C> || avnd::float_parameter<C> || avnd::enum_parameter<C> || avnd::bool_parameter<C>)
{
constexpr std::string_view control_name = avnd::get_name<C>();
if(control_name == s->s_name)
Expand Down
4 changes: 3 additions & 1 deletion include/avnd/binding/pd/audio_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]<typename C>(C& ctl) {
if constexpr(requires { ctl.value = float{}; })
if constexpr(
avnd::float_parameter<
C> || avnd::int_parameter<C> || avnd::bool_parameter<C>)
{
constexpr std::string_view control_name = avnd::get_name<C>();
if(control_name == s->s_name)
Expand Down

0 comments on commit fc003f8

Please sign in to comment.