blob: 85f6175e9b728afdc6643e580af7db761502cfc2 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#ifndef __MIDILLO_EVENT_H
#define __MIDILLO_EVENT_H
#include <istream>
#include <ostream>
#include <list>
#include <midillo/message.h>
/**
* @file
* @brief midi event container
*/
namespace midillo {
using std::istream;
using std::ostream;
using std::list;
/**
* MIDI event container class
*/
class event_t {
public:
/**
* delta time since the last event
*/
long deltat;
/**
* MIDI message itself
*/
message_t message;
/**
* Load MIDI event from the stream
* @param rs reference to the running status
* @param s input stream
*/
void load(int& rs,istream& s);
/**
* Save MIDI event to the stream
* @param rs reference to the running status
* @param s output stream
*/
void save(int& rs,ostream& s) const;
/**
* Calculate the amount of data that would be written to stream in
* case of save
* @param rs reference to the running status
* @return the number of bytes
*/
unsigned long calculate_save_size(int& rs) const;
/**
* Dump textual representation of event to stream
* @param s output stream
*/
void dump(ostream& s) const;
};
inline ostream& operator<<(ostream& s,const event_t& e) {
e.dump(s); return s;
}
/**
* MIDI events list container
*/
class events_t : public list<event_t> {
public:
/**
* Append empty event to the end of the list
* @return iterator, pointing to the appended event
*/
iterator append_event();
/**
* Load MIDI events (track data) from the stream
* @param s input stream
*/
void load(istream& s);
/**
* Save MIDI events (track data) to the stream
* @param s output stream
*/
void save(ostream& s) const;
/**
* Calculate the size of the track data that would be written to
* the stream by save()
* @return the number of bytes
*/
unsigned long calculate_save_size() const;
};
}
#endif /* __MIDILLO_EVENT_H */
|