-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathFT8Generator.cpp
26 lines (23 loc) · 988 Bytes
/
FT8Generator.cpp
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
#include "FT8Generator.h"
#include <wsjtx_lib.h>
#include <regex>
/*R"(
^\s* # optional leading spaces
( [A-Z]{0,2} | [A-Z][0-9] | [0-9][A-Z] ) # part 1
( [0-9][A-Z]{0,3} ) # part 2
(/R | /P)? # optional suffix
\s*$ # optional trailing spaces
*/
bool stdCall(std::string const &w)
{
std::regex standard_call_re{R"(^\s*([A-Z]{0,2}|[A-Z][0-9]|[0-9][A-Z])([0-9][A-Z]{0,3})(/R|/P)?\s*$)", std::regex::icase};
return std::regex_match(w, standard_call_re);
}
std::vector<float> FT8Generator::generate(int frequency, encoding code, std::string message)
{
wsjtx_lib wsjtx;
wsjtx.encode();
printf("frequency %d number of tones %d, samplerate %d no samples %d\n", frequency, nsym, audioinput->get_samplerate(), nwave);
save_wav(signal.data(), signal.size(), audioinput->get_samplerate(), "./wave.wav");
return signal;
}