-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tuner.h
49 lines (37 loc) · 1.01 KB
/
Tuner.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
#ifndef Tuner_H
#define Tuner_H
#include <vector>
#include <boost/lockfree/spsc_queue.hpp>
#include <complex>
#include "liquid.h"
#include <array>
#include <iostream>
#include "global.h"
class Tuner {
public:
// Constructor
Tuner();
// Destructor
~Tuner();
// Setup method for initializing SDR components
void setupTuner();
// Method for setting RX frequency offset
void setRXFrequencyOffset(float value);
// read the current freq shift
float getFrequencyShift();
// Decode method for processing samples
ClientInfo doTuning(ClientInfo clientInfo);
private:
msresamp_crcf resampler_480to48 = nullptr;
nco_crcf nco = nullptr;
float normalized_frequency;
float frequency_shift;
int change_frequency;
// Helper methods
float roundToNearestStep(float num, float step);
// Constants
const float SAMPLE_RATE = 480000.0f;
const float AUDIO_SAMPLE_RATE = 48000.0f;
float r_480to48 = AUDIO_SAMPLE_RATE / SAMPLE_RATE;
};
#endif // Tuner_H