File: seq2.c

package info (click to toggle)
alsa-driver 1.0.13-5etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 20,108 kB
  • ctags: 50,477
  • sloc: ansic: 319,881; sh: 32,930; makefile: 2,015; python: 1,527; perl: 1,316; xml: 896; awk: 66
file content (26 lines) | stat: -rw-r--r-- 573 bytes parent folder | download | duplicates (5)
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
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <linux/soundcard.h>

#define DEVICE "/dev/sequencer"

int main(int argc, char *argv[])
{
	int fd;
	ssize_t res;
	unsigned char ev[4];

	fd = open(DEVICE, O_RDWR);
	if (fd < 0) { perror( "open (" DEVICE ")" ); return EXIT_FAILURE; }
	ev[0] = SEQ_MIDIPUTC;
	ev[1] = 0xfe;		/* active sensing */
	ev[2] = argc > 1 ? atoi(argv[1]) : 0;
	res = write(fd, &ev, sizeof(ev));
	printf("end res = %li\n", (long)res);
	close(fd);
	return EXIT_SUCCESS;
}