summaryrefslogtreecommitdiff
path: root/streamer.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-10-25 21:51:08 +0200
committerGravatar waker <wakeroid@gmail.com>2012-10-25 21:51:08 +0200
commitb013e081750203b795c4cdd0496110693f439ab3 (patch)
treea6853dbb35a2a81ff22671525bb2bf88f25b6a97 /streamer.c
parentd940812fafd1a71837a3bb3f1c1132c7beea5187 (diff)
new fft code from audacious, now spectrum analyzer looks correctly
Diffstat (limited to 'streamer.c')
-rw-r--r--streamer.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/streamer.c b/streamer.c
index c195d56e..df772917 100644
--- a/streamer.c
+++ b/streamer.c
@@ -47,6 +47,7 @@
#include "premix.h"
#include "ringbuf.h"
#include "replaygain.h"
+#include "fft.h"
//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
#define trace(fmt,...)
@@ -2002,16 +2003,6 @@ streamer_read_async (char *bytes, int size) {
return bytesread;
}
-void rdft(int, int, float *, int *, float *);
-static void do_fft(int n,float *x)
-{
- static int ipsize = 0,wsize=0;
- static int ip[18];
- static float w[256];
-
- rdft(n,1,x,ip,w);
-}
-
int
streamer_read (char *bytes, int size) {
#if 0
@@ -2093,12 +2084,7 @@ streamer_read (char *bytes, int size) {
pcm_convert (&output->fmt, bytes + sz - DDB_AUDIO_MEMORY_FRAMES * in_frame_size, &out_fmt, (char *)audio_data, DDB_AUDIO_MEMORY_FRAMES * in_frame_size);
}
- memcpy (freq_data, audio_data, sizeof (audio_data));
- int N = DDB_AUDIO_MEMORY_FRAMES;
- do_fft(N, freq_data);
- for (int n = 0; n < N / 2 - 1; n ++)
- freq_data[n] = 2 * fabs (freq_data[1 + n]) / N;
- freq_data[N / 2 - 1] = fabs(freq_data[N / 2]) / N;
+ calc_freq (audio_data, freq_data);
mutex_unlock (audio_mem_mutex);