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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
#include "jackclient.h"
#include "drumkitparser.h"
int main(int argc, char *argv[])
{
DrumKitParser parser("/tmp/aasimonster/aasimonster.xml");
if(parser.parse()) return 1;
JackClient client(parser.getDrumkit());
client.activate();
while(1) sleep(1);
return 0;
}
#if 0
#include <jack/jack.h>
#include <jack/midiport.h>
static jack_port_t *test_midi_port = NULL;
static size_t timer = 0;
static size_t next = 44100;
int process(jack_nframes_t nframes, void *arg)
{
void* port_buf = jack_port_get_buffer(test_midi_port, nframes);
if(timer > next) {
jack_nframes_t time = (jack_nframes_t)(((float)rand() / (float)RAND_MAX) * nframes);
size_t size = 1;
jack_midi_data_t all_notes_off[] = { rand() % 2 };
jack_midi_event_write(port_buf, time, all_notes_off, size);
timer = 0;
next = (size_t)(((float)rand() / (float)RAND_MAX) * 0.2 * 44100);
}
timer += nframes;
return 0;
}
void sendMidi()
{
jack_status_t status;
jack_client_t *jack_client = jack_client_open("MidiTest", JackNullOption, &status);
test_midi_port = jack_port_register(jack_client,
"midi_out",
JACK_DEFAULT_MIDI_TYPE,
JackPortIsOutput,
0);
jack_set_process_callback(jack_client, process, NULL);
jack_activate(jack_client);
jack_connect(jack_client, "MidiTest:midi_out", "DrumGizmo:midi_in");
jack_connect(jack_client, "DrumGizmo:output_1", "system:playback_1");
jack_connect(jack_client, "DrumGizmo:output_2", "system:playback_2");
}
#endif
|