Clean up the transition from JT9 tones to CW ID.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3151 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-04-10 15:50:40 +00:00
parent 5dfa36988f
commit c652a0338f
3 changed files with 12 additions and 15 deletions

Binary file not shown.

View File

@ -1,4 +1,4 @@
//------------------------------------------------------------ MainWindow
//------------------------------------------------------------- MainWindow
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "devsetup.h"

View File

@ -41,6 +41,7 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
static double freq;
static double snr;
static double fac;
static double amp;
static int ic=0,j=0;
static short int i2;
int isym,nspd;
@ -50,7 +51,7 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
// Time according to this computer
qint64 ms = QDateTime::currentMSecsSinceEpoch() % 86400000;
int mstr = ms % (1000*udata->ntrperiod );
if(mstr<1000) return 0;
if(mstr<1000) return paContinue;
ic=(mstr-1000)*48;
udata->bRestart=false;
srand(mstr); //Initialize random seed
@ -74,7 +75,7 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
phi += dphi;
if(phi>twopi) phi -= twopi;
i2=32767.0*sin(phi);
j=(ic-ic0)/nspd;
j=(ic-ic0)/nspd + 1;
if(icw[j]==0) i2=0;
if(udata->txsnrdb < 0.0) {
int i4=fac*(gran() + i2*snr/32768.0);
@ -89,24 +90,21 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
#endif
ic++;
}
if(j>icw[0]) return paComplete;
return paContinue;
}
if(isym>=85 and icw[0]>=0) {
// qDebug() << "C" << isym << icw[0];
return paComplete;
}
baud=12000.0/udata->nsps;
freq=udata->ntxfreq + itone[isym]*baud;
dphi=twopi*freq/48000.0;
double amp=32767.0;
amp=32767.0;
int i0=84.983*4.0*udata->nsps;
int i1=85*4*udata->nsps;
for(uint i=0 ; i<framesToProcess; i++ ) {
phi += dphi;
if(phi>twopi) phi -= twopi;
if(ic>i0) {
amp=0.98*amp;
}
if(ic>i0) amp=0.98*amp;
if(ic>i1) amp=0.0;
i2=amp*sin(phi);
if(udata->txsnrdb < 0.0) {
int i4=fac*(gran() + i2*snr/32768.0);
@ -121,9 +119,9 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer,
#endif
ic++;
}
if(amp<1.0 and icw[0]==0) {
// qDebug() << "A" << isym << amp << icw[0];
return paComplete;
if(amp==0.0) {
if(icw[0]==0) return paComplete;
phi=0.0;
}
return paContinue;
}
@ -192,7 +190,6 @@ void SoundOutThread::run()
qint64 ms = QDateTime::currentMSecsSinceEpoch();
m_SamFacOut=udata.ncall*FRAMES_PER_BUFFER*1000.0/(48000.0*(ms-ms0-50));
}
//qDebug() << "btxok = " << btxok << "btxMute = " << btxMute;
msleep(100);
}
Pa_StopStream(outStream);