Running OK with sound input, and plotting green line.

Next task: implement specjtms() in new fashion.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/jtms3@2507 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-07-12 21:22:55 +00:00
parent f1da3b1232
commit 94b09f6032
2 changed files with 16 additions and 13 deletions

View File

@ -18,7 +18,6 @@ void getfile(QString fname, bool xpol, int dbDgrd)
// Read (and ignore) a 44-byte WAV header; then read data // Read (and ignore) a 44-byte WAV header; then read data
fread(mscom_.d2,1,44,fp); fread(mscom_.d2,1,44,fp);
int nrd=fread(mscom_.d2,2,npts,fp); int nrd=fread(mscom_.d2,2,npts,fp);
qDebug() << "Getfile" << npts << nrd;
fclose(fp); fclose(fp);
} }
} }

View File

@ -392,6 +392,7 @@ void MainWindow::dataSink(int k)
static int nwrite=0; static int nwrite=0;
static int k0=99999999; static int k0=99999999;
static float px=0.0; static float px=0.0;
static float sqave=0.0;
static float green[704]; static float green[704];
static int ig=0; static int ig=0;
@ -408,9 +409,18 @@ void MainWindow::dataSink(int k)
mscom_.ndiskdat=0; mscom_.ndiskdat=0;
} }
float d,sq=0;
for(int i=0; i<2048; i++) {
d=mscom_.d2[k-2048+i];
sq += d*d;
}
px=10.0*log10(sq/2048.0) - 23.0;
sqave=0.95*sqave + 0.05*sq;
float pxave=10.0*log10(sqave/2048.0) - 23.0;
// specjtms_(&k,&px); // specjtms_(&k,&px);
QString t; QString t;
t.sprintf(" Rx noise: %5.1f ",px); t.sprintf(" Rx noise: %5.1f ",pxave);
lab2->setText(t); lab2->setText(t);
ui->xThermo->setValue((double)px); //Update the Thermo ui->xThermo->setValue((double)px); //Update the Thermo
@ -779,22 +789,16 @@ void MainWindow::on_actionOpen_next_in_directory_triggered() //Open Next
int i,len; int i,len;
QFileInfo fi(m_path); QFileInfo fi(m_path);
QStringList list; QStringList list;
if(m_xpol) { list= fi.dir().entryList().filter(".wav");
list= fi.dir().entryList().filter(".tf2");
len=15;
} else {
list= fi.dir().entryList().filter(".iq");
len=14;
}
for (i = 0; i < list.size()-1; ++i) { for (i = 0; i < list.size()-1; ++i) {
if(i==list.size()-2) m_loopall=false; if(i==list.size()-2) m_loopall=false;
len=list.at(i).length();
if(list.at(i)==m_path.right(len)) { if(list.at(i)==m_path.right(len)) {
int n=m_path.length(); int n=m_path.length();
QString fname=m_path.replace(n-len,len,list.at(i+1)); QString fname=m_path.replace(n-len,len,list.at(i+1));
m_path=fname; m_path=fname;
int i; int i;
i=fname.indexOf(".iq") - 11; i=fname.indexOf(".wav") - 11;
if(m_xpol) i=fname.indexOf(".tf2") - 11;
if(i>=0) { if(i>=0) {
lab1->setStyleSheet("QLabel{background-color: #66ff66}"); lab1->setStyleSheet("QLabel{background-color: #66ff66}");
lab1->setText(" " + fname.mid(i,len) + " "); lab1->setText(" " + fname.mid(i,len) + " ");
@ -817,11 +821,11 @@ void MainWindow::on_actionDecode_remaining_files_in_directory_triggered()
void MainWindow::diskDat() //diskDat() void MainWindow::diskDat() //diskDat()
{ {
int kstep=4096; int kstep=2048;
int nsteps; int nsteps;
m_diskData=true; m_diskData=true;
nsteps=29.5*48000/kstep; nsteps=29.8*48000/kstep;
for(int n=1; n<nsteps; n++) { // Do the half-symbol FFTs for(int n=1; n<nsteps; n++) { // Do the half-symbol FFTs
int k=(n+1)*kstep; int k=(n+1)*kstep;