-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfft.h
62 lines (48 loc) · 1.57 KB
/
fft.h
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
This file is part of fm-multimix, A multiple channel fm downmixer.
Copyright (C) 2013 Hendrik van Wyk
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This is the header file for a wrapper for FFTW that attempts to identify
* transmitting channels.
*/
#ifndef FFT_CHANFINDER_H
#define FFT_CHANFINDER_H
#include <fftw3.h>
#include <stdint.h>
#define FFT_LEN 2048
#define FFT_AVG 2
#define DETECTION_LEVEL 2
#define SAMP_RATE 1014300
#define BANDWIDTH 12500
#define BANDWIDTH_BINS (int)((double)BANDWIDTH/((double)SAMP_RATE/(double)FFT_LEN))
typedef struct fft_s
{
double avg;
double avg_calc;
double fftavg [FFT_LEN];
double band_power [FFT_LEN];
double result [FFT_LEN];
double window [FFT_LEN];
int fftavg_counter;
float threshold;
fftw_complex *in;
fftw_complex *out;
fftw_plan p;
}
fft_obj;
fft_obj* fft_init(float threshold);
void fft_free(fft_obj* obj);
int do_fft(fft_obj* obj, uint8_t* buff, int len);
double* get_fft_results(fft_obj* obj);
#endif