#
# Ilmari-2003 IHU telemetry codes
#
# for tests you need KA9Q AO40-FEC prototype tools
#


include ../Makefile.defs

OBJS = ao40fec-encoder.o  ao40-basic.o

all:  ao40.a


clean:
	-rm -f *.o *.a *~ test *.wav *.ub *.ogg *.sw

ao40.a: $(OBJS)
	-rm -f ao40.a
	ar q ao40.a $(OBJS)

test: ao40.a test.o Makefile
	$(CC) $(CFLAGS) -o test test.o ao40.a -lm

testrun: test
	./test > test.sw
	sox -r 9600 -c 1 test.sw -s -b test.wav
	oggenc test.wav
	fade --fade-period 2.0 --sample-rate 9600 --bit-rate 160 --ebn0 10 < test.sw > test2.sw
	fade --fade-period 2.0 --sample-rate 9600 --bit-rate 160 --ebn0 6 < test.sw > test1.sw
	sox -r 9600 -c 1 test2.sw -s -b test2.wav
	fade --fade-period 2.0 --sample-rate 9600 --bit-rate 160 --ebn0 16 < test.sw > test3.sw
	fade --fade-period 2.0 --sample-rate 9600 --bit-rate 160 --ebn0 23 < test.sw > test4.sw
	sox -r 9600 -c 1 test3.sw -s -b test3.wav
	sox -r 9600 -c 1 test4.sw -s -b test4.wav

publish: testrun test.wav test2.wav test3.wav test4.wav
	scp test.wav mea@zmailer.org:public_html/test-ihu-ao40bpsk-ka9qfec.wav
	#scp test.ogg mea@zmailer.org:public_html/test-ihu-ao40bpsk-ka9qfec.ogg
	scp test2.wav mea@zmailer.org:public_html/test-ihu-ao40bpsk-ka9qfec-fade-ebn10.wav
	scp test3.wav mea@zmailer.org:public_html/test-ihu-ao40bpsk-ka9qfec-fade-ebn16.wav
	scp test4.wav mea@zmailer.org:public_html/test-ihu-ao40bpsk-ka9qfec-fade-ebn23.wav
