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 / scale.c < prev   
C/C++ Source or Header  |  1991-08-21  |  2KB  |  80 lines

  1. /*
  2.  * Copyright (c) 1990-1991 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Lawrence Berkeley Laboratory,
  11.  * Berkeley, CA.  The name of the University may not be used to
  12.  * endorse or promote products derived from this software without
  13.  * specific prior written permission.
  14.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  15.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  16.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  17.  */
  18.  
  19. #include <stdio.h>
  20. #include <sys/file.h>
  21. #include <sys/types.h>
  22. #include <sys/ioctl.h>
  23. #include <sundev/midi.h>
  24.  
  25. struct midi_msg scale[] = {
  26.     { 0, { 0x90, 0x40, 0x40 } },
  27.     { 250, { 0x90, 0x40, 0x0 } },
  28.     { 250, { 0x90, 0x42, 0x40 } },
  29.     { 500, { 0x90, 0x42, 0x0 } },
  30.     { 500, { 0x90, 0x44, 0x40 } },
  31.     { 750, { 0x90, 0x44, 0x0 } },
  32.     { 750, { 0x90, 0x45, 0x40 } },
  33.     { 1000, { 0x90, 0x45, 0x0 } },
  34.     { 1000, { 0x90, 0x47, 0x40 } },
  35.     { 1250, { 0x90, 0x47, 0x0 } },
  36.     { 1250, { 0x90, 0x49, 0x40 } },
  37.     { 1500, { 0x90, 0x49, 0x0 } },
  38.     { 1500, { 0x90, 0x4b, 0x40 } },
  39.     { 1750, { 0x90, 0x4b, 0x0 } },
  40.     { 1750, { 0x90, 0x4c, 0x40 } },
  41.     { 2000, { 0x90, 0x4c, 0x0 } },
  42. };
  43.  
  44. usage()
  45. {
  46.     fprintf(stderr, "usage: scale [-p port]\n");
  47.     exit(1);
  48. }
  49.  
  50. main(argc, argv)
  51.     int argc;
  52.     char **argv;
  53. {
  54.     int fd, i, cc, c;
  55.     u_long mtime;
  56.     int port = 1;
  57.  
  58.     extern char *optarg;
  59.  
  60.     while ((c = getopt(argc, argv, "p:")) != -1) {
  61.         switch(c) {
  62.  
  63.         case 'p':
  64.             port = atoi(optarg);
  65.             break;
  66.  
  67.         default:
  68.             usage();
  69.         }
  70.     }
  71.     fd = midi_open(O_WRONLY, port);
  72.     cc = write(fd, (caddr_t)&scale, sizeof scale);
  73.     if (cc < 0) {
  74.         perror("write");
  75.         exit(1);
  76.     }
  77.     close(fd);
  78.     return 0;
  79. }
  80.