OSDN Git Service

Android: add makefile and config.h
[android-x86/external-alsa-lib.git] / test / client_event_filter.c
1 #include <alsa/asoundlib.h>
2
3 void dump_event_filter(snd_seq_client_info_t *client_info) {
4         int i, b;
5
6         for (i = 0; i <= 255;) {
7                 b = snd_seq_client_info_event_filter_check(client_info, i);
8                 i++;
9                 printf("%c%s%s", (b ? 'X' : '.'),
10                         (i % 8 == 0 ? " " : ""),
11                         (i % 32 == 0 ? "\n" : ""));
12         }
13         printf("\n");
14 }
15
16 int main(void) {
17         snd_seq_client_info_t *client_info;
18
19         snd_seq_client_info_alloca(&client_info);
20
21         printf("first client_info_event_filter                   :\n");
22         dump_event_filter(client_info);
23
24         snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);
25         printf("after snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);\n");
26         dump_event_filter(client_info);
27
28         snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_PGMCHANGE);
29         printf("after snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_PGMCHANGE);\n");
30         dump_event_filter(client_info);
31
32         snd_seq_client_info_event_filter_del(client_info, SND_SEQ_EVENT_NOTEON);
33         printf("after snd_seq_client_info_event_filter_del(client_info, SND_SEQ_EVENT_NOTEON);\n");
34         dump_event_filter(client_info);
35
36         snd_seq_client_info_event_filter_clear(client_info);
37         printf("after snd_seq_client_info_event_filter_clear(client_info);\n");
38         dump_event_filter(client_info);
39
40         snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);
41         printf("after snd_seq_client_info_event_filter_add(client_info, SND_SEQ_EVENT_NOTEON);\n");
42         dump_event_filter(client_info);
43
44         return 0;
45 }
46