-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguiinterface.cpp
More file actions
77 lines (60 loc) · 1.81 KB
/
Copy pathguiinterface.cpp
File metadata and controls
77 lines (60 loc) · 1.81 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "guiinterface.h"
GuiInterface::GuiInterface()
{
std::function<void(int)> decoderEventCallback = std::bind(&DecodeTask::processSoundEvent, &decodeTask, std::placeholders::_1);
paddleTask.hookDecoderEvent(decoderEventCallback);
std::function<void()> autoKeyCallback = std::bind(&GuiInterface::fireAutoKeyEnded, this);
paddleTask.hookAutoKeyEnded(autoKeyCallback);
std::function<void(std::string)> prosignCallback = std::bind(&GuiInterface::fireProsignDecoded, this, std::placeholders::_1);
decodeTask.hookProsignDecoded(prosignCallback);
std::function<void(int)> spaceCallback = std::bind(&GuiInterface::fireSpaceDecoded, this, std::placeholders::_1);
decodeTask.hookSpaceDecoded(spaceCallback);
}
GuiInterface::~GuiInterface()
{
paddleTask.processPaddleEvents(PADDLE_TASK_EXIT);
decodeTask.processSoundEvent(SOUND_EXIT);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
void GuiInterface::setWpm(int wpm) {
paddleTask.setWpm(wpm);
decodeTask.setWpm(wpm);
}
void GuiInterface::setFarn(int farn) {
paddleTask.setFarn(farn);
}
void GuiInterface::setVolume(double vol) {
paddleTask.setVolume(vol);
}
void GuiInterface::setTone(double tn) {
paddleTask.setTone(tn);
}
void GuiInterface::initAudio(){
paddleTask.initAudio();
}
void GuiInterface::generateTones(){
paddleTask.generateTones();
}
void GuiInterface::closeAudio(){
paddleTask.closeAudio();
}
void GuiInterface::autoSendKey(char sendChar)
{
paddleTask.autoSendChar(sendChar);
}
void GuiInterface::processPaddleEvents(int paddleEvent)
{
paddleTask.processPaddleEvents(paddleEvent);
}
void GuiInterface::fireProsignDecoded(std::string psign)
{
prosignDecoded(QString(psign.c_str()));
}
void GuiInterface::fireSpaceDecoded(int space)
{
spaceDecoded(space);
}
void GuiInterface::fireAutoKeyEnded()
{
autoKeyEnded();
}