home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / 06user / sound.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  432 b   |  22 lines

  1. /*
  2.  *    sound -- produce a constant tone for a specified duration
  3.  */
  4.  
  5. #include <local\sound.h>
  6.  
  7. void
  8. sound(f, dur)
  9. unsigned int f;    /* frequency of pitch in hertz */
  10. float dur;    /* in seconds and tenths of seconds */
  11. {
  12.     extern void setfreq(unsigned int);
  13.     extern void delay(float);
  14.     
  15.     /* set frequency in hertz */
  16.     setfreq(f);
  17.     
  18.     /* turn the speaker on for specified duration */
  19.     SPKR_ON;
  20.     delay(dur);
  21.     SPKR_OFF;
  22. }