forked from atx/kvak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.hpp
51 lines (40 loc) · 1004 Bytes
/
main.hpp
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
#pragma once
#include <experimental/filesystem>
#include <optional>
#include "agc.hpp"
#include "demodulator.hpp"
namespace kvak {
class channel {
public:
channel(unsigned int id, agc &agc, const std::experimental::filesystem::path &path,
unsigned int preallocate, bool muted)
:
id(id),
agc_all(agc),
output_path(path),
file(nullptr),
out_data(preallocate, 0),
out_counter(0),
muted(muted)
{
};
~channel();
float get_power();
void mute(bool m);
bool is_muted();
void push_sample(std::complex<float> sample);
void flush();
const unsigned int id;
demodulator demod;
private:
// Note that for vectorization reasons we have single multi-channel AGC object
// for all channels. Maybe this can be patched in a way which makes the
// code more elegant but would get optimized to the same result?
agc &agc_all;
const std::experimental::filesystem::path output_path;
std::FILE *file;
std::vector<std::uint8_t> out_data;
unsigned int out_counter;
bool muted;
};
}