-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmidi_proc.hxx
81 lines (59 loc) · 1.71 KB
/
midi_proc.hxx
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
#ifndef QMC_H_MIDIPROC
# define QMC_H_MIDIPROC
# include "base.hxx"
namespace qmc
{
class midi_proc
{
protected:
friend class qmcount;
tempo_t* _tempo_arr; // from caller
nps_t* _nps_arr;
pps_t* _pps_arr;
longsize_t _buf_len;
notecount_t _note_count;
alloc_func_t _allocator;
dealloc_func_t _deallocator;
public:
midi_proc();
~midi_proc();
errno_t scan_track(byte_t* track_buf , longsize_t track_size);
};
midi_proc::midi_proc
(
tempo_t* tempo_arr,
alloc_func_t allocator,
dealloc_func_t deallocator,
longsize_t buf_len
){
__QMC_ASSERT_NULLPTR__(tempo_arr);
__QMC_ASSERT_NULLPTR__(allocator);
__QMC_ASSERT_NULLPTR__(deallocator);
this->_allocator = allocator;
this->_deallocator = deallocator;
this->_buf_len = buf_len;
this->_note_count = 0;
this->_nps_arr = nullptr;
this->_tempo_arr = nullptr;
this->_pps_arr = nullptr;
}
midi_proc::~midi_proc()
{
if(_nps_arr)
{
(*(this->_deallocator))(this->_nps_arr);
this->_nps_arr = nullptr;
}
if(_pps_arr)
{
(*(this->_deallocator))(this->_pps_arr);
this->_pps_arr = nullptr;
}
if(_tempo_arr)
{
(*(this->_deallocator))(this->_tempo_arr);
this->_tempo_arr = nullptr;
}
}
} // namespace qmc
#endif // QMC_H_MIDIPROC