home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.lbl.gov
/
2014.05.ftp.ee.lbl.gov.tar
/
ftp.ee.lbl.gov
/
bmd-1.0beta.tar.Z
/
bmd-1.0beta.tar
/
bmd-1.0beta
/
app
/
mtools
/
mute.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-08-21
|
2KB
|
75 lines
/*
* Copyright (c) 1991 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Lawrence Berkeley Laboratory,
* Berkeley, CA. The name of the University may not be used to
* endorse or promote products derived from this software without
* specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
#ifndef lint
static char rcsid[] =
"@(#) $Header: mute.c,v 1.1 91/08/20 21:05:25 mccanne Exp $ (LBL)";
#endif
#include <stdio.h>
#include <sys/types.h>
#include <sys/file.h>
#include <sundev/midi.h>
usage()
{
printf("usage: mute [-p port]\n");
exit(1);
}
void
mute(fd)
{
int i;
struct midi_msg m = { 0, { 0xb0, 123, 0 } };
for (i = 0; i < 16; ++i) {
m.mm_data[0] = 0xb0 | i;
if (write(fd, (char *)&m, sizeof(m)) < 0) {
perror("write");
exit(1);
}
}
}
extern char *optarg;
main(argc, argv)
int argc;
char **argv;
{
int fd, c;
int port = 1;
while ((c = getopt(argc, argv, "p:")) != -1) {
switch(c) {
case 'p':
port = atoi(optarg);
break;
default:
usage();
}
}
fd = midi_open(O_WRONLY, port);
mute(fd);
close(fd);
return 0;
}