Remove the 1 s offset in wave() array. Fix NSPS for 300 s periods.

This commit is contained in:
Joe Taylor 2020-06-27 16:24:11 -04:00
parent bf51dfd61d
commit 51447ef1d3
3 changed files with 20 additions and 22 deletions

View File

@ -92,20 +92,8 @@ void Modulator::start (unsigned symbolsLength, double framesPerSymbol,
if(delay_ms >= mstr) m_silentFrames = m_ic + 0.001*(delay_ms-mstr)*m_frameRate;
}
// Special case for FST280:
// qDebug() << "aa" << m_ic << m_silentFrames << m_symbolsLength << m_nsps;
if(m_nsps==800 or m_nsps==1680 or m_nsps==3888 or m_nsps==8200 or m_nsps==21168) {
m_ic = m_ic + 48000 - 2*m_nsps + 9600; //The 9600 is empirical
m_silentFrames = m_silentFrames - 2*m_nsps;
}
if(m_silentFrames<0) {
m_ic = m_ic - m_silentFrames;
m_silentFrames = 0;
}
// qDebug() << "bb" << m_ic << m_silentFrames;
// qDebug() << "cc" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz")
// << delay_ms << mstr << m_silentFrames << m_ic;
// qDebug() << "aa" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz")
// << delay_ms << mstr << m_silentFrames << m_ic << m_symbolsLength;
initialize (QIODevice::ReadOnly, channel);
Q_EMIT stateChanged ((m_state = (synchronize && m_silentFrames) ?
@ -317,14 +305,18 @@ qint64 Modulator::readData (char * data, qint64 maxSize)
m_amp=32767.0;
sample=qRound(m_amp*foxcom_.wave[m_ic]);
}
/*
if((m_ic<1000 or (4*m_symbolsLength*m_nsps - m_ic) < 1000) and (m_ic%10)==0) {
qDebug() << "cc" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz") << m_ic << sample;
}
*/
samples = load(postProcessSample(sample), samples);
++framesGenerated;
++m_ic;
}
// qDebug() << "dd" << QDateTime::currentDateTimeUtc().toString("hh:mm:ss.zzz")
// << m_ic << m_amp << foxcom_.wave[m_ic];
// << m_ic << i1 << foxcom_.wave[m_ic] << framesGenerated;
if (m_amp == 0.0) { // TODO G4WJS: compare double with zero might not be wise
if (icw[0] == 0) {

View File

@ -66,7 +66,7 @@ subroutine gen_fst240wave(itone,nsym,nsps,nwave,fsample,hmod,f0, &
enddo
! Compute the ramp-up and ramp-down symbols
kshift=nsps-nint(fsample)
kshift=nsps
if(icmplx.eq.0) then
wave(1:nsps)=0.0
wave(nsps+1:nsps+nsps/4)=wave(nsps+1:nsps+nsps/4) * &
@ -86,6 +86,12 @@ subroutine gen_fst240wave(itone,nsym,nsps,nwave,fsample,hmod,f0, &
(1.0+cos(twopi*(/(i,i=0,nsps/4-1)/)/real(nsps/2)))/2.0
cwave=cshift(cwave,kshift)
endif
! do i=1,nwave
! write(71,3071) i,i/48000.0,wave(i)
!3071 format(i10,2f15.9)
! enddo
wave(nsps*nsym:)=0. !Kill a stray spike ??
return
end subroutine gen_fst240wave

View File

@ -3542,7 +3542,7 @@ void MainWindow::guiUpdate()
if(m_TRperiod==30) txDuration=1.0 + 160*1680/12000.0;
if(m_TRperiod==60) txDuration=1.0 + 160*3888/12000.0;
if(m_TRperiod==120) txDuration=1.0 + 160*8200/12000.0;
if(m_TRperiod==300) txDuration=1.0 + 160*21168/12000.0;
if(m_TRperiod==300) txDuration=1.0 + 160*21504/12000.0;
}
if(m_modeTx=="ISCAT" or m_mode=="MSK144" or m_bFast9) {
txDuration=m_TRperiod-0.25; // ISCAT, JT9-fast, MSK144
@ -3886,13 +3886,13 @@ void MainWindow::guiUpdate()
if(m_TRperiod==30) nsps=1680;
if(m_TRperiod==60) nsps=3888;
if(m_TRperiod==120) nsps=8200;
if(m_TRperiod==300) nsps=21168;
if(m_TRperiod==300) nsps=21504;
nsps=4*nsps; //48000 Hz sampling
int nsym=160;
float fsample=48000.0;
float dfreq=hmod*fsample/nsps;
float f0=ui->TxFreqSpinBox->value() - m_XIT + 1.5*dfreq;
int nwave=48000 + (nsym+2)*nsps;
int nwave=(nsym+2)*nsps;
int icmplx=0;
gen_fst240wave_(const_cast<int *>(itone),&nsym,&nsps,&nwave,
&fsample,&hmod,&f0,&icmplx,foxcom_.wave,foxcom_.wave);
@ -7169,7 +7169,7 @@ void MainWindow::transmit (double snr)
if(m_TRperiod==30) nsps=1680;
if(m_TRperiod==60) nsps=3888;
if(m_TRperiod==120) nsps=8200;
if(m_TRperiod==300) nsps=21168;
if(m_TRperiod==300) nsps=21504;
int hmod=int(pow(2.0,double(m_nSubMode)));
double dfreq=hmod*12000.0/nsps;
double f0=ui->TxFreqSpinBox->value() - m_XIT + 1.5*dfreq;