File: client_event_filter.c

package info (click to toggle)
alsa-lib 1.1.3-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,656 kB
  • sloc: ansic: 84,132; sh: 11,192; makefile: 711
file content (46 lines) | stat: -rw-r--r-- 1,496 bytes parent folder | download | duplicates (9)
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
#include <alsa/asoundlib.h>

void dump_event_filter(snd_seq_client_info_t *client_info) {
	int i, b;

	for (i = 0; i <= 255;) {
		b = snd_seq_client_info_event_filter_check(client_info, i);
		i++;
		printf("%c%s%s", (b ? 'X' : '.'),
			(i % 8 == 0 ? " " : ""),
			(i % 32 == 0 ? "\n" : ""));
	}
	printf("\n");
}

int main(void) {
	snd_seq_client_info_t *client_info;

	snd_seq_client_info_alloca(&client_info);

	printf("first client_info_event_filter                   :\n");
	dump_event_filter(client_info);

	snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);
	printf("after snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);\n");
	dump_event_filter(client_info);

	snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_PGMCHANGE);
	printf("after snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_PGMCHANGE);\n");
	dump_event_filter(client_info);

	snd_seq_client_info_event_filter_del(client_info, SND_SEQ_EVENT_NOTEON);
	printf("after snd_seq_client_info_event_filter_del(client_info, SND_SEQ_EVENT_NOTEON);\n");
	dump_event_filter(client_info);

	snd_seq_client_info_event_filter_clear(client_info);
	printf("after snd_seq_client_info_event_filter_clear(client_info);\n");
	dump_event_filter(client_info);

	snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);
	printf("after snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);\n");
	dump_event_filter(client_info);

	return 0;
}