From bc15f66ba3911d91a576971bcea65efb3cdb3ffc Mon Sep 17 00:00:00 2001 From: deuce <> Date: Mon, 7 Mar 2005 23:35:14 +0000 Subject: [PATCH] If a frequency of less than 17 (The lowest audible frequency for elephants... Humans generally gan't hear anything below 20Hz) force to 17. Fixes a one- in-800 chance of segfault from sbbs_t::inkey() when it beeps. --- src/xpdev/xpbeep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/xpdev/xpbeep.c b/src/xpdev/xpbeep.c index 70393def94..7e1d2483c0 100644 --- a/src/xpdev/xpbeep.c +++ b/src/xpdev/xpbeep.c @@ -195,6 +195,8 @@ BOOL DLLCALL xptone(double freq, DWORD duration, enum WAVE_SHAPE shape) int i; unsigned char wave[S_RATE*15/2+1]; + if(freq<17) + freq=17; samples=S_RATE*duration/1000; if(samples<=S_RATE/freq*2) samples=S_RATE/freq*2; -- GitLab