Loading...
Searching...
No Matches
PitchToValue.hpp
1#pragma once
2#include <halp/callback.hpp>
3#include <halp/meta.hpp>
4#include <halp/midi.hpp>
5#include <libremidi/message.hpp>
6
7namespace Nodes::PitchToValue
8{
9struct Node
10{
11 halp_meta(name, "Midi Pitch")
12 halp_meta(c_name, "PitchToValue")
13 halp_meta(category, "Midi")
14 halp_meta(author, "ossia score")
15 halp_flag(deprecated);
16 halp_meta(manual_url, "https://ossia.io/score-docs/processes/midi-utilities.html#midi-pitch")
17 halp_meta(description, "Extract a MIDI pitch")
18 halp_meta(uuid, "29ce484f-cb56-4501-af79-88768fa261c3")
19
20 struct
21 {
22 halp::midi_bus<"in", libremidi::message> midi;
23 } inputs;
24 struct
25 {
26 struct : halp::timed_callback<"out", int>
27 {
28 halp_meta(unit, "midipitch");
29 } out;
30 } outputs;
31
32 void operator()()
33 {
34 for(const auto& note : inputs.midi)
35 {
36 if(note.get_message_type() == libremidi::message_type::NOTE_ON)
37 outputs.out(note.timestamp, (int)note.bytes[1]);
38 }
39 }
40};
41}
Definition PitchToValue.hpp:10