From 51447ef1d3b0b42dabae31af0f82bde73795d2b9 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 27 Jun 2020 16:24:11 -0400 Subject: [PATCH] Remove the 1 s offset in wave() array. Fix NSPS for 300 s periods. --- Modulator/Modulator.cpp | 24 ++++++++---------------- lib/fst240/gen_fst240wave.f90 | 10 ++++++++-- widgets/mainwindow.cpp | 8 ++++---- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Modulator/Modulator.cpp b/Modulator/Modulator.cpp index 3a33c42f1..f267022e0 100644 --- a/Modulator/Modulator.cpp +++ b/Modulator/Modulator.cpp @@ -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) { diff --git a/lib/fst240/gen_fst240wave.f90 b/lib/fst240/gen_fst240wave.f90 index 0df62c1b7..43170638d 100644 --- a/lib/fst240/gen_fst240wave.f90 +++ b/lib/fst240/gen_fst240wave.f90 @@ -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 diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 575d43202..e7042b59a 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -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(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;