summaryrefslogtreecommitdiff
path: root/gfft.h
blob: a92b81c76d59bdf6d0b9595a4810e0278e4e2c01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef _GFFT_H
#define _GFFT_H

#include <glib.h>
#include <fftw3.h>

#include "galsa.h"

typedef void window_func(sample *in, double *out, size_t size, int ch, int nch);

struct fft_runner {
	struct device *dev;
	GAsyncQueue *queue;
	GThread *thread;
	window_func *winf;
	size_t span;
};

enum fe_message {
	FE_DATA,
	FE_DEV_ERROR,
	FE_STOPPED,
};

struct fe {
	enum fe_message message;
	int errcode;
	char *errp;
	fftw_complex *data;
	size_t size;
};

extern void window_hard(sample *in, double *out, size_t size, int ch, int nch);
extern void window_hann(sample *in, double *out, size_t size, int ch, int nch);

extern struct fft_runner *fftrun_attach(struct device *device,
	window_func *winf, size_t span);

#endif