From 96264ece63a30c39c0f5a6330e8bc64df0730b0c Mon Sep 17 00:00:00 2001 From: Gerolf Ziegenhain Date: Tue, 4 Oct 2016 17:08:16 +0200 Subject: [PATCH] wip --- src/beep.c | 12 +++++------- src/beep.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/beep.c b/src/beep.c index b9950c4..071481c 100644 --- a/src/beep.c +++ b/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; } diff --git a/src/beep.h b/src/beep.h index 2027655..50f1cf1 100644 --- a/src/beep.h +++ b/src/beep.h @@ -50,7 +50,7 @@ int beep_test(void); #include #include -#define FRAMES (SAMPLE_RATE*2L) //16384L +#define FRAMES 16384L int16_t buffer[FRAMES*2]; /* 16bit stereo sound samples */