From c0b3478fd0a6e0ff3063ae59065e34a944d756e0 Mon Sep 17 00:00:00 2001 From: deuce <> Date: Thu, 27 Jan 2005 20:31:22 +0000 Subject: [PATCH] Force the duration to be long enough for two complete waveforms. --- src/xpdev/xpbeep.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xpdev/xpbeep.c b/src/xpdev/xpbeep.c index 3cabc6c9c2..22c0869ac5 100644 --- a/src/xpdev/xpbeep.c +++ b/src/xpdev/xpbeep.c @@ -162,6 +162,9 @@ BOOL xptone(double freq, DWORD duration, enum WAVE_SHAPE shape) memset(&wh, 0, sizeof(wh)); wh.lpData=wave; wh.dwBufferLength=S_RATE*duration/1000; + if(wh.dwBufferLength<=S_RATE/freq*2) + wh.dwBufferLength=S_RATE/freq*2; + makewave(freq,wave,wh.dwBufferLength,shape); if(waveOutPrepareHeader(waveOut, &wh, sizeof(wh))!=MMSYSERR_NOERROR) goto abrt; @@ -191,6 +194,8 @@ BOOL DLLCALL xptone(double freq, DWORD duration, enum WAVE_SHAPE shape) unsigned char wave[S_RATE*15/2+1]; samples=S_RATE*duration/1000; + if(samples<=S_RATE/freq*2) + samples=S_RATE/freq*2; makewave(freq,wave,samples,shape); if(!sound_device_open_failed) { if((dsp=open("/dev/dsp",O_WRONLY,0))<0) { -- GitLab