wip
This commit is contained in:
parent
6e24a9e0ba
commit
96264ece63
12
src/beep.c
12
src/beep.c
@ -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;
|
||||
|
||||
}
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user