Added times to finder.c

This commit is contained in:
Sebastian 2021-12-15 22:17:00 +01:00
parent f47dec6b22
commit b7289714da
1 changed files with 6 additions and 1 deletions

View File

@ -36,8 +36,11 @@ int main() {
int pos = 0; int pos = 0;
float in[2]; float in[2];
uint64_t sample_count = 0;
while(fread(in, sizeof(float), 2, input) == 2) { while(fread(in, sizeof(float), 2, input) == 2) {
complex float cplx_in = (in[1] + I * in[0]); complex float cplx_in = (in[1] + I * in[0]);
sample_count++;
if(next_fft_in <= 0) { if(next_fft_in <= 0) {
fft_in[pos] = cplx_in; fft_in[pos] = cplx_in;
@ -90,7 +93,7 @@ int main() {
fprintf(output_csv, "\n"); fprintf(output_csv, "\n");
next_fft_in = SAMPLINGRATE / 10; next_fft_in = SAMPLINGRATE / 4;
} }
} else { } else {
next_fft_in--; next_fft_in--;
@ -108,6 +111,8 @@ int main() {
fwrite(buffer, sizeof(float), 2, output); fwrite(buffer, sizeof(float), 2, output);
} }
printf("Processed %fs\n", sample_count / SAMPLINGRATE);
fft_destroy_plan(fft); fft_destroy_plan(fft);
free(fft_in); free(fft_in);
free(fft_out); free(fft_out);