home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / veridata.zip / sound.h < prev    next >
Text File  |  1995-02-19  |  766b  |  20 lines

  1. /*
  2.  * sound.h: sound utilities + definitions
  3.  */
  4.  
  5. #define FREQ_PROG_PORT 0x42 /* port to program the frequentie */
  6. #define FREQ_INIT_PORT 0x43 /* port to initialise the freq. programming */
  7. #define SOUND_PORT     0x61 /* port used to put the sound on/off */
  8.  
  9. #define FREQ_INIT 0xb6 /* send to the FREQ_INIT_PORT */
  10. #define SOUND_ON  0x03 /* send to SOUND_PORT to enable sound */
  11. #define SOUND_OFF 0xfc /* send to SOUND_PORT to disable sound */
  12.  
  13. #define beep(freq1,freq2,duration)\
  14.         _outp8(FREQ_INIT_PORT,FREQ_INIT);\
  15.         _outp8(FREQ_PROG_PORT,freq1);\
  16.         _outp8(FREQ_PROG_PORT,freq2);\
  17.         _outp8(SOUND_PORT,_inp8(SOUND_PORT) | SOUND_ON);\
  18.         _sleep2(duration);\
  19.         _outp8(SOUND_PORT,_inp8(SOUND_PORT) & SOUND_OFF);
  20.