Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

sirens.c

Go to the documentation of this file.
00001 /****************************** Module Header ******************************\ 00002 * Module Name: sirens.c 00003 * 00004 * Copyright (c) 1985 - 1999, Microsoft Corporation 00005 * 00006 * This module contains the functions used by the Access Pack features to 00007 * provide audible feedback. 00008 * 00009 * History: 00010 * 4 Feb 93 Gregoryw Created. 00011 \***************************************************************************/ 00012 00013 #include "precomp.h" 00014 #pragma hdrstop 00015 00016 #define TONE_HIGH_FREQ 2000 // High tone frequency (Hz) 00017 #define TONE_HIGH_LEN 75 // High tone duration (ms) 00018 #define TONE_LOW_FREQ 500 // Low tone frequency (Hz) 00019 #define TONE_LOW_LEN 75 // Low tone duration (ms) 00020 #define TONE_CLICK_FREQ 400 // Key click tone frequency (Hz) 00021 #define TONE_CLICK_LEN 4 // Key click tone duration (ms) 00022 #define TONE_SILENT 10 00023 #define SIREN_LOW_FREQ 1200 // Lowest freq for siren (Hz) 00024 #define SIREN_HIGH_FREQ 2000 // Highest freq for siren (Hz) 00025 #define SIREN_INTERVAL 100 // +/- interval SIREN_LOW_FREQ <-> SIREN_HIGH_FREQ 00026 00027 /***************************************************************************\ 00028 * HighBeep 00029 * 00030 * Send a high beep to the beep device 00031 * 00032 * History: 00033 \***************************************************************************/ 00034 00035 BOOL HighBeep(void) 00036 { 00037 BOOL Status; 00038 00039 LeaveCrit(); 00040 Status = UserBeep(TONE_HIGH_FREQ, TONE_HIGH_LEN); 00041 EnterCrit(); 00042 return Status; 00043 } 00044 00045 /***************************************************************************\ 00046 * LowBeep 00047 * 00048 * Send a low beep to the beep device 00049 * 00050 * History: 00051 \***************************************************************************/ 00052 00053 BOOL LowBeep(void) 00054 { 00055 BOOL Status; 00056 00057 LeaveCrit(); 00058 Status = UserBeep(TONE_LOW_FREQ, TONE_LOW_LEN); 00059 EnterCrit(); 00060 return Status; 00061 } 00062 00063 /***************************************************************************\ 00064 * KeyClick 00065 * 00066 * Send a key click to the beep device 00067 * 00068 * History: 00069 \***************************************************************************/ 00070 00071 BOOL KeyClick(void) 00072 { 00073 BOOL Status; 00074 00075 LeaveCrit(); 00076 Status = UserBeep(TONE_CLICK_FREQ, TONE_CLICK_LEN); 00077 EnterCrit(); 00078 return Status; 00079 } 00080 00081 /***************************************************************************\ 00082 * UpSiren 00083 * 00084 * Generate an up-siren tone. 00085 * 00086 * History: 00087 \***************************************************************************/ 00088 00089 BOOL UpSiren(void) 00090 { 00091 DWORD freq; 00092 BOOL BeepStatus = TRUE; 00093 00094 LeaveCrit(); 00095 for (freq = SIREN_LOW_FREQ; 00096 BeepStatus && freq <= SIREN_HIGH_FREQ; 00097 freq += SIREN_INTERVAL) { 00098 BeepStatus = UserBeep(freq, (DWORD)1); 00099 } 00100 EnterCrit(); 00101 return BeepStatus; 00102 } 00103 00104 /***************************************************************************\ 00105 * DownSiren 00106 * 00107 * Generate a down-siren tone. 00108 * 00109 * History: 00110 \***************************************************************************/ 00111 00112 BOOL DownSiren(void) 00113 { 00114 DWORD freq; 00115 BOOL BeepStatus = TRUE; 00116 00117 LeaveCrit(); 00118 00119 for (freq = SIREN_HIGH_FREQ; 00120 BeepStatus && freq >= SIREN_LOW_FREQ; 00121 freq -= SIREN_INTERVAL) { 00122 BeepStatus = UserBeep(freq, (DWORD)1); 00123 } 00124 EnterCrit(); 00125 return BeepStatus; 00126 } 00127 00128 BOOL DoBeep(BEEPPROC BeepProc, UINT Count) 00129 { 00130 while (Count--) { 00131 (*BeepProc)(); 00132 UserSleep(100); 00133 } 00134 return TRUE; 00135 }

Generated on Sat May 15 19:41:49 2004 for test by doxygen 1.3.7