Rev 2009 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1528 | jag | 1 | /* |
2 | * fft.h |
||
2097 | jag | 3 | * DIN Is Noise is copyright (c) 2006-2024 Jagannathan Sampath |
1713 | jag | 4 | * DIN Is Noise is released under GNU Public License 2.0 |
1528 | jag | 5 | * For more information, please visit https://dinisnoise.org/ |
6 | */ |
||
7 | |||
8 | #ifndef __fft |
||
9 | #define __fft |
||
10 | |||
11 | #include <vector> |
||
12 | #include "arrow_button.h" |
||
13 | #include "label.h" |
||
14 | #include "levels.h" |
||
15 | #include "kiss_fft.h" |
||
16 | |||
17 | struct multi_curve; |
||
18 | |||
19 | struct fft : widget, click_listener { |
||
20 | |||
21 | // |
||
22 | // FFT of Bezier curve waveform using kissFFT |
||
23 | // |
||
24 | kiss_fft_cfg cfg; |
||
25 | static const int NUM_SAMPLES = 128; |
||
26 | float in [NUM_SAMPLES]; |
||
27 | kiss_fft_cpx cx_in [NUM_SAMPLES], cx_out [NUM_SAMPLES]; |
||
28 | |||
29 | std::vector<float> harms; // harmonics |
||
30 | levels lev; // levels of harmonics |
||
31 | |||
32 | void go (multi_curve* crv); // do fft on a multiple segment bezier curve |
||
33 | |||
34 | float f; // audio frequency used for fft |
||
35 | |||
36 | float x, dx; // on bezier curve, or theta/dtheta on sine. |
||
37 | |||
38 | fft (); |
||
39 | ~fft (); |
||
40 | |||
41 | // ui |
||
42 | arrow_button ab_fold; |
||
43 | label l_title; |
||
44 | void setup (); |
||
45 | void update (); |
||
46 | int handle_input (); |
||
47 | void draw (); |
||
48 | |||
49 | void clicked (button& b); |
||
50 | int folded (); |
||
51 | |||
52 | |||
53 | }; |
||
54 | |||
55 | extern fft fft0; |
||
56 | #endif |