From e729b4677df3cb1af5cfc8e532342bc7ba8f4d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Sun, 22 Sep 2024 16:54:46 -0400 Subject: [PATCH] [max] Build fix --- include/avnd/binding/max/outputs.hpp | 15 ++++++++++++++- include/avnd/binding/max/to_atoms.hpp | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/include/avnd/binding/max/outputs.hpp b/include/avnd/binding/max/outputs.hpp index dbc0edd5..00f060d2 100644 --- a/include/avnd/binding/max/outputs.hpp +++ b/include/avnd/binding/max/outputs.hpp @@ -4,7 +4,7 @@ #include #include - +#include namespace max { struct do_process_outlet @@ -83,6 +83,19 @@ struct do_process_outlet outlet_list(p, nullptr, l.atoms.size(), l.atoms.data()); */ } + template + requires(sizeof...(Args) > 1) + void operator()(Args&&... v) noexcept + { + std::array atoms; + static constexpr int N = sizeof...(Args); + + [&](std::index_sequence) { + (set_atom{}(&atoms[I], v), ...); + }(std::make_index_sequence{}); + + outlet_list(p, nullptr, N, atoms.data()); + } }; diff --git a/include/avnd/binding/max/to_atoms.hpp b/include/avnd/binding/max/to_atoms.hpp index 9ca6d38c..5fc8c194 100644 --- a/include/avnd/binding/max/to_atoms.hpp +++ b/include/avnd/binding/max/to_atoms.hpp @@ -173,6 +173,27 @@ struct to_atoms_large }; +struct set_atom +{ + t_max_err operator()(t_atom* at, std::integral auto v) const noexcept + { + atom_setlong(at, v); + return MAX_ERR_NONE; + } + + t_max_err operator()(t_atom* at, std::floating_point auto v) const noexcept + { + atom_setfloat(at, v); + return MAX_ERR_NONE; + } + + t_max_err operator()(t_atom* at, std::string_view v) const noexcept + { + atom_setsym(at, gensym(v.data())); + return MAX_ERR_NONE; + } +}; + struct to_atoms { long* ac{};