SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
rrc.h
1#pragma once
2
3#include "common/dsp/filter/firdes.h"
4#include "dsp/block.h"
5#include "dsp/filter/fir.h"
6
7namespace satdump
8{
9 namespace ndsp
10 {
11 template <typename T>
12 class RRC_FIRBlock : public FIRBlock<T>
13 {
14 private:
15 double gain = 1;
16 double samplerate = 6e6;
17 double symbolrate = 2e6;
18 double alpha = 0.35;
19 int ntaps = 31;
20
21 public:
22 nlohmann::ordered_json get_cfg_list()
23 {
24 nlohmann::ordered_json p;
25 add_param_simple(p, "gain", "float", "Gain");
26 add_param_simple(p, "samplerate", "float", "Samplerate");
27 add_param_simple(p, "symbolrate", "float", "Symbolrate");
28 add_param_simple(p, "alpha", "float", "Alpha");
29 add_param_simple(p, "ntaps", "int", "NTaps");
30 return p;
31 }
32
33 nlohmann::json get_cfg(std::string key)
34 {
35 if (key == "gain")
36 return gain;
37 else if (key == "samplerate")
38 return samplerate;
39 else if (key == "symbolrate")
40 return symbolrate;
41 else if (key == "alpha")
42 return alpha;
43 else if (key == "ntaps")
44 return ntaps;
45 else
46 return FIRBlock<T>::get_cfg(key);
47 }
48
49 Block::cfg_res_t set_cfg(std::string key, nlohmann::json v)
50 {
51 if (key == "gain")
52 gain = v;
53 else if (key == "samplerate")
54 samplerate = v;
55 else if (key == "symbolrate")
56 symbolrate = v;
57 else if (key == "alpha")
58 alpha = v;
59 else if (key == "ntaps")
60 ntaps = v;
61
62 if (key == "buffer_size")
63 return FIRBlock<T>::set_cfg(key, v);
64 else
65 {
66 auto taps = dsp::firdes::root_raised_cosine(gain, samplerate, symbolrate, alpha, ntaps);
67 return FIRBlock<T>::set_cfg("taps", taps);
68 }
69 }
70 };
71 } // namespace ndsp
72} // namespace satdump
cfg_res_t
set_cfg status.
Definition block.h:227
nlohmann::json get_cfg()
Get parameters of the block as JSON. Unlike get_cfg(key), this returns every single available paramet...
Definition block.h:263
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 fir.h:81
Definition rrc.h:13
Block::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 rrc.h:49
nlohmann::json get_cfg(std::string key)
Get parameters of the block as JSON.
Definition rrc.h:33
nlohmann::ordered_json get_cfg_list()
Get parameters LIST of the block's parameters. This does not contain actual values,...
Definition rrc.h:22