home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of Select: Games Special 10
/
SPSP10.ISO
/
dosgames
/
chessclk
/
sound.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-15
|
2KB
|
99 lines
// Sound Module
// M\Cooper, 3425 Chestnut Ridge Rd., Grantsville, MD 21536-9801
#include <dos.h>
#define FREQ 900
#define DELAY 100
void beep1(),
beep2();
/***************************************************************************/
/* BEEPS */
/***************************************************************************/
void beep1()
{
sound( FREQ );
delay( DELAY );
nosound();
return;
}
void beep2()
{
beep1();
delay( DELAY / 2 );
beep1();
return;
}
/**********************************TONE***********************************/
/* Produces tone at frequency, duration (of sound) */
/* Arguments in: freq [in Hz], dur [duration in millisec.] */
/*************************************************************************/
void tone( int freq, int dur )
{
sound( freq );
delay( dur );
nosound();
return;
}
/**************************************************************************/
/* Produces a "two-tone" sound (beep-boop) */
/**************************************************************************/
void two_tone()
{
int frequency,
duration;
frequency = 700;
duration = 165;
tone( frequency, duration );
frequency = 450;
duration = 110;
tone( frequency, duration );
}
/**************************************************************************/
/* BELL */
/* Produces a succession of 'beep' tones */
/* Takes 'times' as argument [# of times to beep] */
/**************************************************************************/
void bell( int times )
{
while( times-- )
{
tone(380,165);
delay (20 );
}
return;
}
/**************************************************************************/
/* BLATT */
/* Produces a "Bronx Cheer" */
/* [use with error routine] */
/**************************************************************************/
void blatt()
{
tone( 42,330 );
tone(34,220);
return;
}