2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
|
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
}
/*
* Beep.
*/
void beep(int mode) {
if (mode == BELL_DEFAULT) {
/*
* For MessageBeep style bells, we want to be careful of
* timing, because they don't have the nice property of
* PlaySound bells that each one cancels the previous
* active one. So we limit the rate to one per 50ms or so.
*/
static long lastbeep = 0;
long now, beepdiff;
now = GetTickCount();
beepdiff = now - lastbeep;
if (beepdiff >= 0 && beepdiff < 50)
return;
MessageBeep(MB_OK);
lastbeep = now;
} else if (mode == BELL_WAVEFILE) {
if (!PlaySound(cfg.bell_wavefile, NULL, SND_ASYNC | SND_FILENAME)) {
char buf[sizeof(cfg.bell_wavefile)+80];
sprintf(buf, "Unable to play sound file\n%s\n"
"Using default sound instead", cfg.bell_wavefile);
MessageBox(hwnd, buf, "PuTTY Sound Error", MB_OK | MB_ICONEXCLAMATION);
cfg.beep = BELL_DEFAULT;
|