ClassicalBeat.hpp
1 #pragma once
2 #include <halp/audio.hpp>
3 #include <halp/callback.hpp>
4 #include <halp/controls.hpp>
5 #include <halp/meta.hpp>
6 
7 namespace Nodes
8 {
9 namespace ClassicalBeat
10 {
11 struct Node
12 {
13  halp_meta(name, "Beat Metronome")
14  halp_meta(c_name, "ImpulseMetronome")
15  halp_meta(category, "Control/Generators")
16  halp_meta(author, "ossia score")
17  halp_meta(manual_url, "https://ossia.io/score-docs/processes/control-utilities.html#impulse-metronome")
18  halp_meta(description, "A simple metronome - outputs a bang on the current tick")
19  halp_meta(uuid, "1c185139-04f9-492f-8b4a-000dd4428990")
20 
21  struct
22  {
23  halp::timed_callback<"out"> out;
24  } outputs;
25 
26  using tick = halp::tick_musical;
27  void operator()(const halp::tick_musical& tk)
28  {
29  using namespace ossia;
30  if(tk.start_position_in_quarters < tk.end_position_in_quarters)
31  {
32  const auto f = [&](int64_t start_sample) { outputs.out(start_sample); };
33  tk.metronome(f, f);
34  }
35  }
36 };
37 }
38 }
Definition: ClassicalBeat.hpp:12