Fixed compilation errors
This commit is contained in:
parent
4e5bd7ce69
commit
bff6589f7f
2 changed files with 16 additions and 10 deletions
10
Makefile
10
Makefile
|
@ -1,9 +1,12 @@
|
||||||
CXXFLAGS = -std=c++14 -I.
|
CXXFLAGS = -std=c++14 -I.
|
||||||
LDFLAGS = -lm
|
LDFLAGS = -lm
|
||||||
|
|
||||||
.PHONY: run_tests all
|
TARGETS = gen_ft8
|
||||||
|
#TARGETS = gen_ft8 decode_ft8 test
|
||||||
|
|
||||||
all: gen_ft8 # decode_ft8 test
|
.PHONY: run_tests all clean
|
||||||
|
|
||||||
|
all: $(TARGETS)
|
||||||
|
|
||||||
run_tests: test
|
run_tests: test
|
||||||
@./test
|
@./test
|
||||||
|
@ -16,3 +19,6 @@ gen_ft8: gen_ft8.o ft8/constants.o ft8/text.o ft8/pack_v2.o ft8/encode_v2.o comm
|
||||||
|
|
||||||
#decode_ft8: decode_ft8.o fft/kiss_fftr.o fft/kiss_fft.o ft8/ldpc.o ft8/unpack.o ft8/text.o common/wave.o
|
#decode_ft8: decode_ft8.o fft/kiss_fftr.o fft/kiss_fft.o ft8/ldpc.o ft8/unpack.o ft8/text.o common/wave.o
|
||||||
# $(CXX) $(LDFLAGS) -o $@ $^
|
# $(CXX) $(LDFLAGS) -o $@ $^
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.o ft8/*.o common/*.o fft/*.o $(TARGETS)
|
||||||
|
|
16
gen_ft8.cpp
16
gen_ft8.cpp
|
@ -4,11 +4,11 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "common/wave.h"
|
#include "common/wave.h"
|
||||||
#include "ft8/pack.h"
|
//#include "ft8/v1/pack.h"
|
||||||
#include "ft8/encode.h"
|
//#include "ft8/v1/encode.h"
|
||||||
#include "ft8/pack_v2.h"
|
#include "ft8/pack_v2.h"
|
||||||
#include "ft8/encode_v2.h"
|
#include "ft8/encode_v2.h"
|
||||||
|
#include "ft8/constants.h"
|
||||||
|
|
||||||
// Convert a sequence of symbols (tones) into a sinewave of continuous phase (FSK).
|
// Convert a sequence of symbols (tones) into a sinewave of continuous phase (FSK).
|
||||||
// Symbol 0 gets encoded as a sine of frequency f0, the others are spaced in increasing
|
// Symbol 0 gets encoded as a sine of frequency f0, the others are spaced in increasing
|
||||||
|
@ -56,7 +56,7 @@ int main(int argc, char **argv) {
|
||||||
const char *message = argv[1];
|
const char *message = argv[1];
|
||||||
const char *wav_path = argv[2];
|
const char *wav_path = argv[2];
|
||||||
|
|
||||||
// First, pack the text data into 72-bit binary message
|
// First, pack the text data into binary message
|
||||||
uint8_t packed[10];
|
uint8_t packed[10];
|
||||||
//int rc = packmsg(message, packed);
|
//int rc = packmsg(message, packed);
|
||||||
int rc = ft8_v2::pack77(message, packed);
|
int rc = ft8_v2::pack77(message, packed);
|
||||||
|
@ -73,25 +73,25 @@ int main(int argc, char **argv) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
// Second, encode the binary message as a sequence of FSK tones
|
// Second, encode the binary message as a sequence of FSK tones
|
||||||
uint8_t tones[NN]; // NN = 79, lack of better name at the moment
|
uint8_t tones[FT8_NN]; // FT8_NN = 79, lack of better name at the moment
|
||||||
//genft8(packed, 0, tones);
|
//genft8(packed, 0, tones);
|
||||||
ft8_v2::genft8(packed, tones);
|
ft8_v2::genft8(packed, tones);
|
||||||
|
|
||||||
printf("FSK tones: ");
|
printf("FSK tones: ");
|
||||||
for (int j = 0; j < NN; ++j) {
|
for (int j = 0; j < FT8_NN; ++j) {
|
||||||
printf("%d", tones[j]);
|
printf("%d", tones[j]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
// Third, convert the FSK tones into an audio signal
|
// Third, convert the FSK tones into an audio signal
|
||||||
const int num_samples = (int)(0.5 + NN / 6.25 * 12000);
|
const int num_samples = (int)(0.5 + FT8_NN / 6.25 * 12000);
|
||||||
const int num_silence = (15 * 12000 - num_samples) / 2;
|
const int num_silence = (15 * 12000 - num_samples) / 2;
|
||||||
float signal[num_silence + num_samples + num_silence];
|
float signal[num_silence + num_samples + num_silence];
|
||||||
for (int i = 0; i < num_silence + num_samples + num_silence; i++) {
|
for (int i = 0; i < num_silence + num_samples + num_silence; i++) {
|
||||||
signal[i] = 0;
|
signal[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
synth_fsk(tones, NN, 1000, 6.25, 6.25, 12000, signal + num_silence);
|
synth_fsk(tones, FT8_NN, 1000, 6.25, 6.25, 12000, signal + num_silence);
|
||||||
save_wav(signal, num_silence + num_samples + num_silence, 12000, wav_path);
|
save_wav(signal, num_silence + num_samples + num_silence, 12000, wav_path);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue