TestNode.hpp
1 #pragma once
2 #include <halp/controls.hpp>
3 #include <halp/meta.hpp>
4 #include <halp/midi.hpp>
5 
6 /*
7 namespace Control
8 {
9 static inline constexpr void test_nodes()
10 {
11  constexpr NodeBuilder<> n{};
12  constexpr auto res =
13  n.audio_ins({{"foo"}, {"bar"}})
14  .audio_outs({{"mimi"}});
15 
16  constexpr NodeInfo<std::array<AudioOutInfo, 1>, std::array<AudioInInfo, 2>>&
17 bld = res.build();
18 {
19  constexpr std::tuple<std::array<AudioOutInfo, 1>, std::array<AudioInInfo, 2>>
20 t{bld};
21 
22  constexpr auto res2 = std::get<std::array<AudioInInfo, 2>>(t);
23  static_assert(res2[0].name[0] == 'f');
24 
25  constexpr auto res1 = std::get<std::array<AudioOutInfo, 1>>(t);
26  static_assert(res1[0].name[0] == 'm');
27 }
28  constexpr auto res2 = std::get<std::array<AudioInInfo, 2>>(bld.v);
29  static_assert(res2[0].name[0] == 'f');
30 
31  constexpr auto res1 = std::get<std::array<AudioOutInfo, 1>>(bld.v);
32  static_assert(res1[0].name[0] == 'm');
33 
34  static_assert(get_ports<AudioInInfo>(bld.v).size() == 2);
35  static_assert(get_ports<AudioOutInfo>(bld.v).size() == 1);
36  static_assert(get_ports<AudioInInfo>(bld.v)[0].name[0] == 'f');
37  static_assert(get_ports<AudioInInfo>(bld.v)[1].name[0] == 'b');
38  constexpr auto ports = get_ports<AudioOutInfo>(bld.v);
39  constexpr auto port = ports[0];
40  constexpr auto name = port.name;
41  static_assert(name[0] == 'm');
42 }
43 }
44 
45 namespace Nodes
46 {
47 
48 struct SomeInfo
49 {
50  halp_meta(name, "My Funny Process")
51  halp_meta(c_name, "FunnyProcess")
52  halp_meta(category, "Test")
53  static const constexpr auto uuid =
54 make_uuid("f6b88ec9-cd56-43e8-a568-33208d5a8fb7");
55 
56  struct {
57 
58  } inputs;
59  struct {
60 
61  } outputs;
62  static const constexpr auto info =
63  Control::create_node()
64  .audio_ins({{"audio1"}, {"audio2"}})
65  .midi_ins()
66  .midi_outs({{"midi1"}})
67  .value_ins()
68  .value_outs()
69  .controls(Control::FloatSlider{"foo", .0, 10., 5.})
70  .build();
71  using control_policy = Control::DefaultTick;
72  static void run(
73  const ossia::audio_port& p1,
74  const ossia::audio_port& p2,
75  const ossia::timed_vec<float>& o1,
76  ossia::midi_port& p,
77  ossia::time_value tk.prev_date,
78  ossia::token_request tk,
79  ossia::exec_state_facade ,
80  State& st)
81  {
82  }
83 };
84 }*/