blob: 46d7482e81484a9b52d4645f59d02739e4e268e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#pragma once
#include "config.h"
#include "debug.h"
#include "log.h"
#include <boost/signals2.hpp>
#include <alsa/asoundlib.h>
#include <fmt/format.h>
#include <iostream>
class MIDI
{
public:
MIDI();
~MIDI();
boost::signals2::signal<void(int, int, uint64_t)> signal_note;
boost::signals2::signal<void()> signal_active_sensing;
boost::signals2::signal<void()> signal_clock;
boost::signals2::signal<void(size_t)> signal_count_events;
int fd();
bool event_ready();
snd_seq_event_t *read(void);
// returns if click starts
void process(snd_seq_event_t *ev);
void flush();
void wait_for_event();
private:
void detect_port(void);
int m_client;
snd_seq_t *seq_handle;
int in_port;
int npfd;
struct pollfd* pfd;
snd_midi_event_t* midi_event_parser;
};
|