Skip to content

Commit

Permalink
[max] Build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Sep 22, 2024
1 parent ffe61b5 commit e729b46
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
15 changes: 14 additions & 1 deletion include/avnd/binding/max/outputs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <avnd/binding/max/helpers.hpp>
#include <avnd/binding/max/to_atoms.hpp>

#include <commonsyms.h>
namespace max
{
struct do_process_outlet
Expand Down Expand Up @@ -83,6 +83,19 @@ struct do_process_outlet
outlet_list(p, nullptr, l.atoms.size(), l.atoms.data());
*/
}
template <typename... Args>
requires(sizeof...(Args) > 1)
void operator()(Args&&... v) noexcept
{
std::array<t_atom, sizeof...(Args)> atoms;
static constexpr int N = sizeof...(Args);

[&]<std::size_t... I>(std::index_sequence<I...>) {
(set_atom{}(&atoms[I], v), ...);
}(std::make_index_sequence<N>{});

outlet_list(p, nullptr, N, atoms.data());
}
};


Expand Down
21 changes: 21 additions & 0 deletions include/avnd/binding/max/to_atoms.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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{};
Expand Down

0 comments on commit e729b46

Please sign in to comment.