This commit is contained in:
Gerolf Ziegenhain 2016-10-04 17:08:16 +02:00
parent 6e24a9e0ba
commit 96264ece63
2 changed files with 6 additions and 8 deletions

View File

@ -219,12 +219,10 @@ int beep(double freq_hz, double duration_sec)
int up_count = (int)(SAMPLE_RATE * duration_sec);
f1 = 0.02;
f2 = 0.02;
p1 = p2 = 0.0;
//for (i = 0; i < 3; i++) {
//for (j = 0; j < FRAMES*2; j+=2)
for (j = 0; j < up_count*2; j+=2)
p1 = p2 = f1 = f2 = 0.0;
for (i = 0; i < 3; i++) {
for (j = 0; j < FRAMES*2; j+=2)
//for (j = 0; j < up_count*2; j+=2)
{
buffer[j] = freq_hz*100.0 * sin(p1);
buffer[j+1] = freq_hz*100.0 * sin(p2);
@ -241,7 +239,7 @@ int beep(double freq_hz, double duration_sec)
}
if (frames > 0 && frames < FRAMES)
printf("Short write (expected %li, wrote %li)\n", FRAMES, (long)frames);
//}
}
return 0;
}

View File

@ -50,7 +50,7 @@ int beep_test(void);
#include <alsa/asoundlib.h>
#include <math.h>
#define FRAMES (SAMPLE_RATE*2L) //16384L
#define FRAMES 16384L
int16_t buffer[FRAMES*2]; /* 16bit stereo sound samples */