2016-06-01 19:46:36 -04:00
|
|
|
program msk144d
|
|
|
|
|
|
|
|
! Test the msk144 decoder for WSJT-X
|
|
|
|
|
|
|
|
use options
|
|
|
|
use timer_module, only: timer
|
|
|
|
use timer_impl, only: init_timer
|
|
|
|
use readwav
|
|
|
|
|
2016-06-10 10:18:10 -04:00
|
|
|
character c
|
2016-06-01 19:46:36 -04:00
|
|
|
character*80 line(100)
|
2016-06-09 18:09:06 -04:00
|
|
|
character*512 pchk_file
|
2016-06-01 19:46:36 -04:00
|
|
|
logical :: display_help=.false.
|
2016-07-08 20:07:07 -04:00
|
|
|
logical*1 bShMsgs
|
2016-06-01 19:46:36 -04:00
|
|
|
type(wav_header) :: wav
|
2016-06-16 19:18:22 -04:00
|
|
|
integer*2 id2(30*12000)
|
|
|
|
character*500 infile
|
2016-07-07 18:41:35 -04:00
|
|
|
character*12 mycall,hiscall
|
2016-06-01 19:46:36 -04:00
|
|
|
character(len=500) optarg
|
|
|
|
|
2016-08-31 20:42:32 -04:00
|
|
|
type (option) :: long_options(6) = [ &
|
|
|
|
option ('dxcall',.true.,'d','hiscall',''), &
|
2016-07-14 20:59:19 -04:00
|
|
|
option ('evemode',.true.,'e','',''), &
|
2016-08-31 20:42:32 -04:00
|
|
|
option ('help',.false.,'h','Display this help message',''), &
|
|
|
|
option ('mycall',.true.,'m','mycall',''), &
|
2016-07-08 20:07:07 -04:00
|
|
|
option ('nftol',.true.,'n','nftol',''), &
|
2016-08-31 20:42:32 -04:00
|
|
|
option ('short',.false.,'s','enable Sh','') &
|
2016-06-01 19:46:36 -04:00
|
|
|
]
|
2016-07-14 20:59:19 -04:00
|
|
|
t0=0.0
|
2016-07-08 20:07:07 -04:00
|
|
|
ntol=100
|
|
|
|
mycall=''
|
|
|
|
hiscall=''
|
2016-08-31 20:42:32 -04:00
|
|
|
bShMsgs=.false.
|
2016-07-08 20:07:07 -04:00
|
|
|
|
2016-06-01 19:46:36 -04:00
|
|
|
do
|
2016-09-02 16:42:43 -04:00
|
|
|
call getopt('d:ehm:n:s',long_options,c,optarg,narglen,nstat,noffset,nremain,.true.)
|
2016-06-01 19:46:36 -04:00
|
|
|
if( nstat .ne. 0 ) then
|
|
|
|
exit
|
|
|
|
end if
|
|
|
|
select case (c)
|
2016-08-31 20:42:32 -04:00
|
|
|
case ('d')
|
|
|
|
read (optarg(:narglen), *) hiscall
|
|
|
|
case ('e')
|
|
|
|
t0=1e-4
|
2016-06-01 19:46:36 -04:00
|
|
|
case ('h')
|
|
|
|
display_help = .true.
|
2016-08-31 20:42:32 -04:00
|
|
|
case ('m')
|
2016-07-07 18:41:35 -04:00
|
|
|
read (optarg(:narglen), *) mycall
|
2016-07-08 20:07:07 -04:00
|
|
|
case ('n')
|
|
|
|
read (optarg(:narglen), *) ntol
|
2016-08-31 20:42:32 -04:00
|
|
|
case ('s')
|
|
|
|
bShMsgs=.true.
|
2016-06-01 19:46:36 -04:00
|
|
|
end select
|
|
|
|
end do
|
|
|
|
|
|
|
|
if(display_help .or. nstat.lt.0 .or. nremain.lt.1) then
|
|
|
|
print *, ''
|
|
|
|
print *, 'Usage: msk144d [OPTIONS] file1 [file2 ...]'
|
|
|
|
print *, ''
|
|
|
|
print *, ' msk144 decode pre-recorded .WAV file(s)'
|
|
|
|
print *, ''
|
|
|
|
print *, 'OPTIONS:'
|
|
|
|
do i = 1, size (long_options)
|
|
|
|
call long_options(i) % print (6)
|
|
|
|
end do
|
|
|
|
go to 999
|
|
|
|
endif
|
|
|
|
|
|
|
|
call init_timer ('timer.out')
|
2016-07-17 16:05:27 -04:00
|
|
|
call timer('msk144 ',0)
|
2016-06-09 18:09:06 -04:00
|
|
|
pchk_file='./peg-128-80-reg3.pchk'
|
2016-06-01 19:46:36 -04:00
|
|
|
ndecoded=0
|
|
|
|
do ifile=noffset+1,noffset+nremain
|
|
|
|
call get_command_argument(ifile,optarg,narglen)
|
|
|
|
infile=optarg(:narglen)
|
|
|
|
call timer('read ',0)
|
|
|
|
call wav%read (infile)
|
|
|
|
i1=index(infile,'.wav')
|
|
|
|
if( i1 .eq. 0 ) i1=index(infile,'.WAV')
|
2016-06-05 12:02:26 -04:00
|
|
|
read(infile(i1-6:i1-1),*,err=998) nutc
|
2016-06-16 19:18:22 -04:00
|
|
|
inquire(FILE=infile,SIZE=isize)
|
|
|
|
npts=min((isize-216)/2,360000)
|
2016-06-01 19:46:36 -04:00
|
|
|
read(unit=wav%lun) id2(1:npts)
|
|
|
|
close(unit=wav%lun)
|
|
|
|
call timer('read ',1)
|
2016-09-02 16:42:43 -04:00
|
|
|
call msk144_decode(id2,npts,nutc,1,mycall,hiscall,bShMsgs,ntol,t0,line)
|
2016-06-01 19:46:36 -04:00
|
|
|
enddo
|
|
|
|
|
2016-07-17 16:05:27 -04:00
|
|
|
call timer('msk144 ',1)
|
|
|
|
call timer('msk144 ',101)
|
2016-06-01 19:46:36 -04:00
|
|
|
go to 999
|
|
|
|
|
|
|
|
998 print*,'Cannot read from file:'
|
|
|
|
print*,infile
|
|
|
|
|
|
|
|
999 continue
|
|
|
|
end program msk144d
|