aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-09-03 19:00:41 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-09-03 19:00:41 +0000
commita5cc6ec7f4b449f255087e20b04cd4e4f607a52a (patch)
tree5daa8e5a1c3aa79ed1eed7ae34d2ba1db363767f
parentdade6d9d0244cb53579fc682379004a849c3dedc (diff)
sync header
-rw-r--r--alsa.c2
-rw-r--r--cms.c2
-rw-r--r--fft.c6
-rw-r--r--fft.h5
-rw-r--r--sio.c2
-rw-r--r--sio.h2
-rw-r--r--spectrogram.c4
7 files changed, 16 insertions, 7 deletions
diff --git a/alsa.c b/alsa.c
index f2f1770..fe8e352 100644
--- a/alsa.c
+++ b/alsa.c
@@ -20,6 +20,8 @@
#include <stdlib.h>
#include <alsa/asoundlib.h>
+#include "sio.h"
+
#define STEREO 2
#define RATE 44100
diff --git a/cms.c b/cms.c
index 741ba99..435089a 100644
--- a/cms.c
+++ b/cms.c
@@ -22,6 +22,8 @@
#include <stdint.h>
+#include "cms.h"
+
void
hsv2rgb(unsigned short *r, unsigned short *g, unsigned short *b,
double h, double s, double v)
diff --git a/fft.c b/fft.c
index 2655d79..412148e 100644
--- a/fft.c
+++ b/fft.c
@@ -22,6 +22,8 @@
#include <math.h>
#include <fftw3.h>
+#include "fft.h"
+
struct fft {
fftw_plan plan;
double *in;
@@ -66,12 +68,12 @@ init_fft(size_t n)
}
int
-exec_fft(struct fft *p, int16_t *data, double *out, int odd)
+exec_fft(struct fft *p, int16_t *data, double *out, enum fft_chan chan)
{
int i;
for (i = 0; i < p->n; i++)
- p->in[i] = p->window[i] * data[2 * i + odd]
+ p->in[i] = p->window[i] * data[2 * i + chan]
/ (double)INT16_MAX;
fftw_execute(p->plan);
diff --git a/fft.h b/fft.h
index 02b1a69..eeeaffd 100644
--- a/fft.h
+++ b/fft.h
@@ -19,10 +19,11 @@
#define __FFT_H
struct fft;
+enum fft_chan { FFT_LEFT, FFT_RIGHT };
__BEGIN_DECLS
-struct fft *init_fft(int);
-int exec_fft(struct fft *, int16_t *, double *, int);
+struct fft *init_fft(size_t);
+int exec_fft(struct fft *, int16_t *, double *, enum fft_chan);
void free_fft(struct fft *);
__END_DECLS
diff --git a/sio.c b/sio.c
index f2b8f50..e57f8be 100644
--- a/sio.c
+++ b/sio.c
@@ -20,6 +20,8 @@
#include <sndio.h>
#include <stdlib.h>
+#include "sio.h"
+
#define STEREO 2
#define BITS 16
#define SIGNED 1
diff --git a/sio.h b/sio.h
index 25c2e65..b9df7a8 100644
--- a/sio.h
+++ b/sio.h
@@ -21,7 +21,7 @@
struct sio;
__BEGIN_DECLS
-struct sio *init_sio(int);
+struct sio *init_sio(unsigned int);
int16_t *read_sio(struct sio *);
void free_sio(struct sio *);
__END_DECLS
diff --git a/spectrogram.c b/spectrogram.c
index 028a4d2..43ab315 100644
--- a/spectrogram.c
+++ b/spectrogram.c
@@ -515,8 +515,8 @@ main(int argc, char **argv)
while (!die) {
buffer = read_sio(sio);
- exec_fft(fft, buffer, left->data, 0);
- exec_fft(fft, buffer, right->data, 1);
+ exec_fft(fft, buffer, left->data, FFT_LEFT);
+ exec_fft(fft, buffer, right->data, FFT_RIGHT);
draw_panel(dsp, left);
draw_panel(dsp, right);