More cleanup; correct the value of NSMAX in GUI.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2639 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-10-03 15:42:13 +00:00
parent fd8b86cef2
commit d0997e4740
11 changed files with 25 additions and 185 deletions

View File

@ -1,12 +1,12 @@
#ifndef COMMONS_H
#define COMMONS_H
#define NSMAX 10000
#define NSMAX 22000
extern "C" {
extern struct {
short int d2[1800*12000]; //This is "common/jt8com/..." in fortran
short int d2[1800*12000]; //This is "common/jt9com/..." in fortran
float ss[184*NSMAX];
float savg[NSMAX];
double fcenter; //USB dial freq (kHz)
@ -27,7 +27,7 @@ extern struct {
int kin;
int kline;
char datetime[20];
} jt8com_;
} jt9com_;
}

View File

@ -12,14 +12,14 @@ void getfile(QString fname, int ntrperiod)
FILE* fp=fopen(name,"rb");
int npts=ntrperiod*12000;
memset(jt8com_.d2,0,2*npts);
memset(jt9com_.d2,0,2*npts);
if(fp != NULL) {
// Read (and ignore) a 44-byte WAV header; then read data
fread(jt8com_.d2,1,44,fp);
int nrd=fread(jt8com_.d2,2,npts,fp);
fread(jt9com_.d2,1,44,fp);
int nrd=fread(jt9com_.d2,2,npts,fp);
fclose(fp);
// for(int i=0; i<npts; i++) jt8com_.d2[i]/=100;
// for(int i=0; i<npts; i++) jt9com_.d2[i]/=100;
}
}
@ -76,9 +76,9 @@ void savewav(QString fname, int ntrperiod)
hdr.ndata=2*npts;
fwrite(&hdr,sizeof(hdr),1,fp);
// memcpy(jt8com_.d2,buf,2*npts);
// memcpy(jt9com_.d2,buf,2*npts);
// fwrite(buf,2,npts,fp);
fwrite(jt8com_.d2,2,npts,fp);
fwrite(jt9com_.d2,2,npts,fp);
fclose(fp);
}
// free(buf);

View File

@ -16,7 +16,7 @@ program jt9
character*22 msg
integer*2 id2
complex c0
common/jt8com/id2(NMAX),ss(184,NSMAX),savg(NSMAX),c0(NDMAX), &
common/jt9com/id2(NMAX),ss(184,NSMAX),savg(NSMAX),c0(NDMAX), &
nutc,npts8,junk(20)
nargs=iargc()
@ -90,20 +90,9 @@ program jt9
10 continue
do i=0,512
if(lstrong(i)) print*,'Strong signal at ',12000.0*i/1024.0
enddo
nz=1000.0/df3
do i=1,nz
freq=f0a + (i-1)*df3
write(78,3001) i,freq,savg(i)
3001 format(i8,2f12.3)
enddo
nutc=nutc0
nstandalone=1
call sync9(ss,tstep,f0a,df3,lagpk,fpk)
call sync9(ss,tstep,f0a,df3,lagpk,fpk) !Find sig, get rough DT and DF
call spec9(c0,npts8,nsps,f0a,lagpk,fpk,i1SoftSymbols)
call decode9(i1SoftSymbols,msg)
xdt=lagpk*0.5*nsps/12000.0

View File

@ -1,37 +0,0 @@
program ms3
! Starting code for a JTMS3 decoder.
character*80 infile
integer hdr(11)
integer*2 id
common/mscom/id(1440000),s1(215,703),s2(215,703)
nargs=iargc()
if(nargs.lt.1) then
print*,'Usage: ms3 file1 [file2 ...]'
print*,' Reads data from *.wav files.'
go to 999
endif
npts=30*48000
kstep=4096
do ifile=1,nargs
call getarg(ifile,infile)
open(10,file=infile,access='stream',status='old',err=998)
read(10) hdr
read(10) id
close(10)
do k=kstep,npts,kstep
call specjtms(k)
enddo
enddo
go to 999
998 print*,'Cannot open file:'
print*,infile
999 end program ms3

View File

@ -1,63 +0,0 @@
program msk
! Program to test decoding routines for mode JTMSK.
parameter (NSMAX=30*48000)
character*80 infile
character*6 cfile6
character*12 arg
character*12 mycall
real dat(NSMAX)
real x(NSMAX)
complex cx(0:NSMAX/2)
integer hdr(11)
integer*2 id
common/mscom/id(NSMAX),s1(215,703),s2(215,703)
nargs=iargc()
if(nargs.lt.2) then
print*,'Usage: msk nslow snr'
go to 999
endif
call getarg(1,arg)
read(arg,*) nslow
call getarg(2,arg)
read(arg,*) snr
! Read simulated pings from a file
open(71,file='dat.71',form='unformatted',status='old')
read(71) id
cfile6='123400'
npts=30*48000
kstep=2048
minsigdb=1
mousedf=0
ntol=200
mycall='W8WN'
! Make some band-limited noise.
call random_number(x)
nfft=NSMAX
call four2a(x,nfft,1,-1,0)
df=48000.0/nfft
ia=nint(300.0/df)
ib=nint(2700.0/df)
cx(:ia)=0.
cx(ib:)=0.
call four2a(cx,nfft,1,1,-1)
x(1)=0.
rms=sqrt(dot_product(x,x)/NSMAX)
x=x/rms
sig=(10.0**(0.05*snr))/32768.0 !Scaled signal strength
dat=sig*id + x !Add pings to noise
! This loop simulates being called from "datasink()" in program JTMSK.
do iblk=1,npts/kstep
k=iblk*kstep
call rtping(dat,k,cfile6,MinSigdB,MouseDF,ntol,mycall)
if(nslow.ne.0) call usleep(42000)
enddo
999 end program msk

View File

@ -1,49 +0,0 @@
program msk
! Starting code for a JTMSK decoder.
parameter (NSMAX=30*48000)
character*80 infile
character*6 cfile6
real dat(NSMAX)
integer hdr(11)
integer*2 id
common/mscom/id(NSMAX),s1(215,703),s2(215,703)
nargs=iargc()
if(nargs.lt.1) then
print*,'Usage: msk file1 [file2 ...]'
print*,' Reads data from *.wav files.'
go to 999
endif
npts=30*48000
kstep=2048
minsigdb=6
mousedf=0
ntol=200
do ifile=1,nargs
call getarg(ifile,infile)
open(10,file=infile,access='stream',status='old',err=998)
read(10) hdr
read(10) id
close(10)
hdr(1)=hdr(2)
i1=index(infile,'.wav')
cfile6=infile(i1-6:i1-1)
dat=id
k=0
do iblk=1,npts/kstep
k=k+kstep
call rtping(dat,k,cfile6,MinSigdB,MouseDF,ntol)
enddo
enddo
go to 999
998 print*,'Cannot open file:'
print*,infile
999 end program msk

View File

@ -37,7 +37,7 @@ subroutine symspec(k,ntrperiod,nsps,ndiskdat,nb,nbslider,pxdb,s,f0a,df3, &
logical*1 lstrong(0:1023) !Should be (0:512)
integer*2 id2
complex c0
common/jt8com/id2(NMAX),ss(184,NSMAX),savg(NSMAX),c0(NDMAX), &
common/jt9com/id2(NMAX),ss(184,NSMAX),savg(NSMAX),c0(NDMAX), &
nutc,npts8,junk(20)
equivalence (x2,cx2)
data rms/999.0/,k0/99999999/,ntrperiod0/0/,nfft3z/0/

View File

@ -317,10 +317,10 @@ void MainWindow::dataSink(int k)
if(m_diskData) {
ndiskdat=1;
jt8com_.ndiskdat=1;
jt9com_.ndiskdat=1;
} else {
ndiskdat=0;
jt8com_.ndiskdat=0;
jt9com_.ndiskdat=0;
}
// Get power, spectrum, nkhz, and ihsym
nb=0;
@ -365,8 +365,8 @@ void MainWindow::dataSink(int k)
n=0;
}
if(ihsym == 179) {
jt8com_.newdat=1;
jt8com_.nagain=0;
jt9com_.newdat=1;
jt9com_.nagain=0;
QDateTime t = QDateTime::currentDateTimeUtc();
m_dateTime=t.toString("yyyy-MMM-dd hh:mm");
decode(); //Start the decoder

View File

@ -151,9 +151,9 @@ void CPlotter::draw(float swide[], int i0, float splot[]) //draw()
void CPlotter::UTCstr()
{
int ihr,imin,isec;
if(jt8com_.ndiskdat != 0) {
ihr=jt8com_.nutc/10000;
imin=(jt8com_.nutc/100) % 100;
if(jt9com_.ndiskdat != 0) {
ihr=jt9com_.nutc/10000;
imin=(jt9com_.nutc/100) % 100;
} else {
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
imin=ms/60000;

View File

@ -2,12 +2,12 @@
#include <stdexcept>
#define FRAMES_PER_BUFFER 1024
#define NSMAX 10000
#define NSMAX 22000
extern "C" {
#include <portaudio.h>
extern struct {
short int d2[1800*12000]; //This is "common/jt8com/..." in fortran
short int d2[1800*12000]; //This is "common/jt9com/..." in fortran
float ss[184*NSMAX];
float savg[NSMAX];
double fcenter; //USB dial freq (kHz)
@ -28,7 +28,7 @@ extern struct {
int kin;
int kline;
char datetime[20];
} jt8com_;
} jt9com_;
}
typedef struct
@ -67,9 +67,9 @@ extern "C" int a2dCallback( const void *inputBuffer, void *outputBuffer,
nbytes=2*framesToProcess; //Bytes per frame
k=udata->kin;
memcpy(&jt8com_.d2[k],inputBuffer,nbytes); //Copy all samples to d2
memcpy(&jt9com_.d2[k],inputBuffer,nbytes); //Copy all samples to d2
udata->kin += framesToProcess;
jt8com_.kin=udata->kin;
jt9com_.kin=udata->kin;
return paContinue;
}

View File

@ -1,7 +1,7 @@
#include "widegraph.h"
#include "ui_widegraph.h"
#define NSMAX 10000
#define NSMAX 22000
WideGraph::WideGraph(QWidget *parent) :
QDialog(parent),