This commit is contained in:
Gerolf Ziegenhain 2016-10-04 17:11:18 +02:00
parent eee931feb1
commit 4f08a0c6c7

View File

@ -220,14 +220,18 @@ int beep(double freq_hz, double duration_sec)
p1 = p2 = f1 = f2 = 0.02; p1 = p2 = f1 = f2 = 0.02;
for (i = 0; i < 3; i++) { for (i = 0; i < up_count; ) {
for (j = 0; j < FRAMES*2; j+=2) for (j = 0; j < FRAMES*2 ; j+=2)
//for (j = 0; j < up_count*2; j+=2) //for (j = 0; j < up_count*2; j+=2)
{ {
i += 2;
if (i<up_count)
{
buffer[j] = freq_hz*100.0 * sin(p1); buffer[j] = freq_hz*100.0 * sin(p1);
buffer[j+1] = freq_hz*100.0 * sin(p2); buffer[j+1] = freq_hz*100.0 * sin(p2);
p1 += f1; p1 += f1;
p2 += f2; p2 += f2;
}
} }
frames = snd_pcm_writei(handle, buffer, FRAMES); frames = snd_pcm_writei(handle, buffer, FRAMES);