home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / microcrn / issue_51.arc / VOICE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-15  |  1.4 KB  |  43 lines

  1. /*  This code supports an article in issue #51 of:
  2.  
  3.     Micro Cornucopia Magazine
  4.     P.O. Box 223
  5.     Bend, OR 97709
  6. */
  7.  
  8. /* VOICE.C : displaying a voice pattern on the screen using the Borland
  9.    BGI graphics functions.
  10.    Bruce Eckel, Revolution2 Real-Time Consulting.
  11. */
  12.  
  13. #include <conio.h>  /* kbhit() */
  14. #include <stdlib.h> /* calloc() */
  15. #include "capture.h"
  16. #include "display.h" /* includes graphics.h */
  17.  
  18. main() {
  19.   int graphdriver = DETECT;  /* will request autodetection */
  20.   struct viewporttype view;
  21.   int i, graphmode, color;
  22.   unsigned int * points;
  23.   /* Initialize graphics.  The string in the third argument tells
  24.      the function where to look for the graphics drivers (you may
  25.      need to change it for your own environment): */
  26.   initgraph(&graphdriver, &graphmode, "c:\\turboc");
  27.   color = getmaxcolor();  /* works with all machines */
  28.   getviewsettings(&view);
  29. /*  display_viewsettings(view);  /* for debugging */
  30.   /* create an array according to the size in pixels of the monitor: */
  31.   points = (unsigned int *)calloc(view.right, sizeof(int));
  32.   MUX(0);  /* select the channel to read */
  33.   while(!kbhit()) {
  34.     capture(points, view.right, 1000, 0);
  35.     for(i = 0; i < view.right; i++)
  36.       points[i] >>= 3; /* do some rough scaling */
  37.     display_series(points, view.right, 20, half, full, color);
  38.     clearviewport();
  39.   }
  40.   closegraph();
  41. }
  42.  
  43.