|
|
|
|
@ -1,3 +1,5 @@ |
|
|
|
|
#include <unistd.h> |
|
|
|
|
#define BUFSIZE 1024 |
|
|
|
|
int rc; |
|
|
|
|
|
|
|
|
|
struct audio_data { |
|
|
|
|
@ -20,13 +22,14 @@ void* input_fifo(void* data) |
|
|
|
|
struct audio_data *audio = (struct audio_data *)data; |
|
|
|
|
int fd; |
|
|
|
|
int n = 0; |
|
|
|
|
signed char buf[1024]; |
|
|
|
|
//signed char buf[1024];
|
|
|
|
|
int tempr, templ, lo; |
|
|
|
|
int q, i; |
|
|
|
|
int t = 0; |
|
|
|
|
int size = 1024; |
|
|
|
|
int bytes = 0; |
|
|
|
|
int flags; |
|
|
|
|
int16_t buf[BUFSIZE / 2]; |
|
|
|
|
struct timespec req = { .tv_sec = 0, .tv_nsec = 10000000 }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -50,6 +53,22 @@ void* input_fifo(void* data) |
|
|
|
|
} |
|
|
|
|
} else { //if bytes read go ahead
|
|
|
|
|
t = 0; |
|
|
|
|
|
|
|
|
|
for (i = 0; i < BUFSIZE / 2; i += 2) { |
|
|
|
|
|
|
|
|
|
if (audio->channels == 1) audio->audio_out_l[n] = (buf[i] + buf[i + 1]) / 2; |
|
|
|
|
|
|
|
|
|
//stereo storing channels in buffer
|
|
|
|
|
if (audio->channels == 2) { |
|
|
|
|
audio->audio_out_l[n] = buf[i]; |
|
|
|
|
audio->audio_out_r[n] = buf[i + 1]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
n++; |
|
|
|
|
if (n == 2048 - 1) n = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
for (q = 0; q < (size / 4); q++) { |
|
|
|
|
|
|
|
|
|
tempr = ( buf[ 4 * q + 3] << 2); |
|
|
|
|
@ -77,9 +96,12 @@ templ) / |
|
|
|
|
audio->audio_out_r[n] = tempr; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
n++; |
|
|
|
|
if (n == 2048 - 1)n = 0; |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (audio->terminate == 1) { |
|
|
|
|
|