-
Notifications
You must be signed in to change notification settings - Fork 0
/
transmitter.hpp
29 lines (25 loc) · 1.07 KB
/
transmitter.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
#pragma once
#include "wave_reader.hpp"
#include <condition_variable>
#include <thread>
class ClockOutput;
class Transmitter
{
public:
Transmitter();
virtual ~Transmitter();
Transmitter(const Transmitter &) = delete;
Transmitter(Transmitter &&) = delete;
Transmitter &operator=(const Transmitter &) = delete;
void Transmit(WaveReader &reader, float frequency, float bandwidth, unsigned dmaChannel, bool preserveCarrier);
void Stop();
private:
void TxViaCpu(WaveReader &reader, unsigned sampleRate, unsigned bufferSize, unsigned clockDivisor, unsigned divisorRange);
void TxViaDma(WaveReader &reader, unsigned sampleRate, unsigned bufferSize, unsigned clockDivisor, unsigned divisorRange, unsigned dmaChannel);
void CpuTxThread(unsigned sampleRate, unsigned clockDivisor, unsigned divisorRange, unsigned *sampleOffset, std::vector<Sample> *samples, bool *stop);
std::condition_variable cv;
std::thread txThread;
ClockOutput *output;
std::mutex mtx;
bool enable;
};