Use genwave() to create Q65 audio signal. Send "include averaging" flag to Q65 decoder.

This commit is contained in:
Joe Taylor 2020-11-11 11:14:02 -05:00
parent 56a3201d14
commit 3068f0c61f
6 changed files with 82 additions and 11 deletions

View File

@ -423,6 +423,7 @@ set (wsjt_FSRCS
lib/gen65.f90
lib/gen9.f90
lib/geniscat.f90
lib/genwave.f90
lib/ft8/genft8.f90
lib/qra/q65/genq65.f90
lib/genmsk_128_90.f90

View File

@ -11,7 +11,7 @@ JT9+JT65 111010000001111000010000000000001000
JT65 111010000000111000010000000000001000
JT65/VHF 111110010000110110101100010000000000
QRA64 111110010110110110000000001000000000
QRA65 111111010110110100010000001100000000
Q65 111111010110110100011000001100000000
ISCAT 100111000000000110000000000000000000
MSK144 101111110100000000010001000000000000
WSPR 000000000000000001010000000000000000

52
lib/genwave.f90 Normal file
View File

@ -0,0 +1,52 @@
subroutine genwave(itone,nsym,nsps,nwave,fsample,hmod,f0,icmplx,cwave,wave)
real wave(nwave)
complex cwave(nwave)
integer hmod
integer itone(nsym)
logical ex
real*8 dt,phi,dphi,twopi,freq,baud
dt=1.d0/fsample
twopi=8.d0*atan(1.d0)
baud=fsample/nsps
! Calculate the audio waveform
phi=0.d0
if(icmplx.le.0) wave=0.
if(icmplx.eq.1) cwave=0.
k=0
do j=1,nsym
freq=f0 + itone(j)*hmod*baud
dphi=twopi*freq*dt
do i=1,nsps
k=k+1
if(icmplx.eq.1) then
cwave(k)=cmplx(cos(phi),sin(phi))
else
wave(k)=sin(phi)
endif
phi=phi+dphi
if(phi.gt.twopi) phi=phi-twopi
enddo
enddo
!### TEMPORARY code to allow transmitting both A and B submodes
inquire(file='Q65_Tx2',exist=ex)
if(ex) then
k=0
do j=1,nsym
freq=f0 + itone(j)*2.d0*hmod*baud + 500.d0
dphi=twopi*freq*dt
do i=1,nsps
k=k+1
wave(k)=0.5*(wave(k)+sin(phi))
phi=phi+dphi
if(phi.gt.twopi) phi=phi-twopi
enddo
enddo
endif
!###
return
end subroutine genwave

View File

@ -38,7 +38,7 @@ contains
! nsubmode Tone-spacing indicator, 0-4 for A-E
! nfqso Target signal frequency (Hz)
! ntol Search range around nfqso (Hz)
! ndepth Optional decoding level (???)
! ndepth Optional decoding level
! Output: sent to the callback routine for display to user
use timer_module, only: timer

View File

@ -34,7 +34,9 @@ subroutine q65_loops(c00,npts2,nsps,mode,mode64,nsubmode,nFadingModel, &
napmin=99
baud=6000.0/nsps
do iavg=0,1
maxavg=0
if(iand(ndepth,16).ne.0) maxavg=1
do iavg=0,maxavg
if(iavg.eq.1) then
idfmax=1
idtmax=1

View File

@ -117,6 +117,9 @@ extern "C" {
void gen_fst4wave_(int itone[], int* nsym, int* nsps, int* nwave, float* fsample,
int* hmod, float* f0, int* icmplx, float xjunk[], float wave[]);
void genwave_(int itone[], int* nsym, int* nsps, int* nwave, float* fsample,
int* hmod, float* f0, int* icmplx, float xjunk[], float wave[]);
void gen4_(char* msg, int* ichk, char* msgsent, int itone[],
int* itext, fortran_charlen_t, fortran_charlen_t);
@ -3991,6 +3994,20 @@ void MainWindow::guiUpdate()
int i3=-1;
int n3=-1;
genq65_(message,&ichk,msgsent,const_cast<int *>(itone),&i3,&n3,37,37);
int nsps=1800;
if(m_TRperiod==30) nsps=3600;
if(m_TRperiod==60) nsps=7200;
if(m_TRperiod==120) nsps=16000;
if(m_TRperiod==300) nsps=41472;
int nsps4=4*nsps; //48000 Hz sampling
int nsym=85;
float fsample=48000.0;
int nwave=(nsym+2)*nsps4;
int icmplx=0;
int hmod=1;
float f0=ui->TxFreqSpinBox->value()-m_XIT;
genwave_(const_cast<int *>(itone),&nsym,&nsps4,&nwave,
&fsample,&hmod,&f0,&icmplx,foxcom_.wave,foxcom_.wave);
}
if(m_modeTx=="WSPR") genwspr_(message, msgsent, const_cast<int *> (itone),
22, 22);
@ -6416,7 +6433,7 @@ void MainWindow::on_actionQ65_triggered()
m_wideGraph->setTxFreq(ui->TxFreqSpinBox->value());
switch_mode (Modes::Q65);
// 012345678901234567890123456789012345
displayWidgets(nWidgets("111111010110110100010000001100000000"));
displayWidgets(nWidgets("111111010110110100011000000100000000"));
statusChanged();
}
@ -6770,8 +6787,6 @@ void MainWindow::on_actionInclude_averaging_toggled (bool checked)
m_ndepth ^= (-checked ^ m_ndepth) & 0x00000010;
}
void MainWindow::on_actionInclude_correlation_toggled (bool checked)
{
m_ndepth ^= (-checked ^ m_ndepth) & 0x00000020;
@ -7321,8 +7336,9 @@ void MainWindow::transmit (double snr)
if(m_TRperiod==60) nsps=7200;
if(m_TRperiod==120) nsps=16000;
if(m_TRperiod==300) nsps=41472;
int mode65=pow(2.0,double(m_nSubMode));
toneSpacing=mode65*12000.0/nsps;
// int mode65=pow(2.0,double(m_nSubMode));
// toneSpacing=mode65*12000.0/nsps;
toneSpacing=-4.0;
Q_EMIT sendMessage (m_mode, NUM_Q65_SYMBOLS,
double(nsps), ui->TxFreqSpinBox->value () - m_XIT,
toneSpacing, m_soundOutput, m_config.audio_output_channel (),
@ -7563,13 +7579,13 @@ void MainWindow::on_sbFtol_valueChanged(int value)
void::MainWindow::VHF_features_enabled(bool b)
{
if(m_mode!="JT4" and m_mode!="JT65") b=false;
if(m_mode!="JT4" and m_mode!="JT65" and m_mode!="Q65") b=false;
if(b and (ui->actionInclude_averaging->isChecked() or
ui->actionInclude_correlation->isChecked())) {
ui->actionDeepestDecode->setChecked (true);
}
ui->actionInclude_averaging->setVisible (b);
ui->actionInclude_correlation->setVisible (b);
ui->actionInclude_correlation->setVisible (b && m_mode!="Q65");
ui->actionMessage_averaging->setEnabled(b);
ui->actionEnable_AP_DXcall->setVisible (m_mode=="QRA64");
ui->actionEnable_AP_JT65->setVisible (b && m_mode=="JT65");