-
Notifications
You must be signed in to change notification settings - Fork 0
/
NoteEvaluator.h
65 lines (56 loc) · 1.39 KB
/
NoteEvaluator.h
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* NoteEvaluator.h
*
* Created on: Dec 2, 2012
* Author: xo
*/
#ifndef NOTEEVALUATOR_H_
#define NOTEEVALUATOR_H_
#include <alsa/asoundlib.h>
#include <alsa/asoundef.h>
#include <alsa/global.h>
#include <alsa/rawmidi.h>
#include <signal.h>
#include <time.h>
#include <math.h>
#include "MidiSong.h"
#include "SongReader.h"
#include "SongWriter.h"
namespace MidiEngine {
#define SIGNAL_HISTORY_SIZE 10
#define INPUT_SOURCE_FD 0
#define INPUT_SOURCE_DEBUG 1
#define INPUT_SOURCE_PLAYER 2
class NoteEvaluator {
public:
NoteEvaluator();
virtual ~NoteEvaluator();
int set_fd(int);
int set_verbose(char);
int process_input_as_loop(char*&);
int set_input(unsigned char);
int set_input(unsigned char, char*);
int set_output(char*,unsigned int);
private:
int fd;
char verbose;
char verb_timestamp[40];
unsigned long long iLastNoteTime;
unsigned long long iCurrentNoteTime;
unsigned char input;
unsigned char signals[7];
unsigned char old_signals[SIGNAL_HISTORY_SIZE][7];
unsigned long long old_notetimes[SIGNAL_HISTORY_SIZE];
char* song_filename;
MidiSong* track;
SongWriter* output;
int new_note();
int print_output(char*);
int add_signal(char);
int signal_to_verb(char*);
int save_to_history();
int get_input(unsigned char&);
int save_note();
};
} /* namespace MidiEngine */
#endif /* NOTEEVALUATOR_H_ */