Skip to content
Snippets Groups Projects
Commit 297436fa authored by deuce's avatar deuce
Browse files

Fix segfault on tones over 7.5 seconds... there is now an audible

discontinuity every 7.5 seconds, but at least no crash.
parent bb763afc
No related branches found
No related tags found
No related merge requests found
......@@ -847,6 +847,19 @@ BOOL DLLCALL xptone(double freq, DWORD duration, enum WAVE_SHAPE shape)
samples=S_RATE*duration/1000;
if(samples<=S_RATE/freq*2)
samples=S_RATE/freq*2;
if(samples > S_RATE/freq*2) {
int sample_len;
makewave(freq,wave,S_RATE*15/2,shape);
for(sample_len=S_RATE*15/2-1; sample_len && wave[sample_len]==128; sample_len--)
;
sample_len++;
while(samples > S_RATE*15/2) {
if(!xp_play_sample(wave, sample_len, TRUE))
return FALSE;
samples -= sample_len;
}
}
makewave(freq,wave,samples,shape);
return(xp_play_sample(wave, samples, FALSE));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment