1 /*
2 * midi_in.h
3 * DIN Is Noise is copyright (c) 2006-2021 Jagannathan Sampath
4 * DIN Is Noise is released under GNU Public License 2.0
5 * For more information, please visit https://dinisnoise.org/
6 */
7 
8 #ifndef __midi_in
9 #define __midi_in
10 
11 #include "RtMidi.h"
12 #include <vector>
13 #include <string>
14 
15 struct midi_in {
16 
17 	RtMidiIn rt;
18 
19 	int num_ports;
20 	int input_port;
21 	int available;
22 
23   unsigned char channel;
24   unsigned char cc;
25   unsigned char val;
26 
27 	std::vector<std::string> names;
28 
29 	midi_in ();
30 	void probe ();
31 	void open ();
32 	void open (int _input_port);
33 	void handle_input ();
get_namemidi_in34 	std::string get_name (int i) {
35 		if (i > -1 && i < num_ports)
36       return names[i];
37 		else
38       return "?";
39 	}
40 
41 };
42 
43 void run_midi_cmd (const std::string& cmd, std::vector<unsigned char>& args);
44 extern midi_in midiin;
45 
46 #endif
47