SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
fft_pan.h
1#pragma once
2
3#include "common/dsp/complex.h"
4#include "dsp/block.h"
5#include <fftw3.h>
6#include <functional>
7#include <mutex>
8#include <volk/volk_alloc.hh>
9
10namespace satdump
11{
12 namespace ndsp
13 {
14 class FFTPanBlock : public Block
15 {
16 private:
17 std::mutex fft_mutex;
18 volk::vector<float> fft_taps;
19 int fft_size;
20 bool work();
21
22 void destroy_fft();
23
24 complex_t *fft_input_buffer;
25 float *fft_output_buffer = nullptr;
26
27 int in_reshape_buffer = 0;
28 complex_t *fft_reshape_buffer;
29
30 fftwf_complex *fftw_in;
31 fftwf_complex *fftw_out;
32 fftwf_plan fftw_plan;
33
34 int rbuffer_rate = 0;
35 int rbuffer_size = 0;
36 int rbuffer_skip = 0;
37
38 int reshape_buffer_size = 0;
39
40 public:
41 FFTPanBlock();
42 ~FFTPanBlock();
43 void set_fft_settings(int size, uint64_t samplerate, int rate = 60);
44
45 std::function<void(float *)> on_fft = [](float *) {};
46
47 float *output_fft_buff;
48
49 float avg_num = 10;
50
51 nlohmann::json get_cfg(std::string key)
52 {
53 // if (key == "max_gain")
54 // return p_max_gain;
55 // else
56 throw satdump_exception(key);
57 }
58
59 cfg_res_t set_cfg(std::string key, nlohmann::json v)
60 {
61 // if (key == "max_gain")
62 // p_max_gain = v;
63 // else
64 throw satdump_exception(key);
65 return RES_OK;
66 }
67 };
68 } // namespace ndsp
69} // namespace satdump
cfg_res_t
set_cfg status.
Definition block.h:227
virtual bool work()=0
The actual looping work function meant to handle all the DSP (well, in most blocks)
Block(std::string id, std::vector< BlockIO > in={}, std::vector< BlockIO > out={})
Generic constructor, to be overloaded.
Definition block.h:206
nlohmann::json get_cfg(std::string key)
Get parameters of the block as JSON.
Definition fft_pan.h:51
cfg_res_t set_cfg(std::string key, nlohmann::json v)
Set parameters of the block from JSON, including potentially IO configurations for blocks that may ha...
Definition fft_pan.h:59