Work in progress toward "Export .wav file".

This commit is contained in:
Joe Taylor 2024-01-20 15:02:51 -05:00
parent 4ec84087c7
commit adc0345ef3
6 changed files with 48 additions and 19 deletions

View File

@ -39,7 +39,7 @@ subroutine getcand2(ss,savg0,nts_q65,nagain,nhsym,ntx30a,ntx30b, &
nguard=5 !Guard range in bins
i1=1
i2=NFFT-nbw-nguard
if(nagain.eq.1) then
if(nagain.ge.1) then
i1=nint((1000.0*f0_selected-ntol)/df)
i2=nint((1000.0*f0_selected+ntol)/df)
endif

View File

@ -9,12 +9,14 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
! in common/cacb. Decoded messages are sent back to the GUI.
use q65_decode
use wavhdr
use timer_module, only: timer
parameter (MAXFFT1=5376000) !56*96000
parameter (MAXFFT2=336000) !56*6000 (downsampled by 1/16)
parameter (NMAX=60*12000)
parameter (RAD=57.2957795)
type(hdr) h
integer*2 iwave(60*12000)
integer offset
complex ca(MAXFFT1) !FFT of raw I/Q data from Linrad
@ -26,11 +28,13 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
character*6 hisgrid
character*4 grid4
character*3 csubmode
character*17 fname
character*64 result,ctmp
character*20 datetime,datetime1
common/decodes/ndecodes,ncand,nQDecoderDone,nWDecoderBusy, &
nWTransmitting,result(50)
common/cacb/ca
data ifile/0/
save
if(mycall0(1:1).ne.' ') mycall=mycall0
@ -46,8 +50,6 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
nh=nfft2/2
f_mouse=1000.0*(fqso+48.0) + mousedf
k0=nint((ipk*df3-1000.0)/df)
if(nagain.eq.1) k0=nint((f_mouse-1000.0)/df)
if(k0.lt.nh .or. k0.gt.MAXFFT1-nfft2+1) go to 900
fac=1.0/nfft2
cx(0:nfft2-1)=ca(k0:k0+nfft2-1)
@ -87,7 +89,7 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
nsubmode=mode_q65-1
nfa=990 !Tight limits around ipk for the wideband decode
nfb=1010
if(nagain.eq.1) then !For nagain=1, use limits of +/- ntol
if(nagain.ge.1) then !For nagain>=1, use limits of +/- ntol
nfa=max(100,1000-ntol)
nfb=min(2500,1000+ntol)
endif
@ -108,9 +110,23 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
if(iseq.eq.1) datetime1(12:13)='30'
endif
! if(nagain.eq.2) then
! h=default_header(12000,30*12000)
! ifile=ifile+1
! write(fname,1000) ifile
!1000 format('000000_',i6.6,'.wav')
! open(27,file=fname,status='unknown',access='stream')
! ia=ifile*30*12000 + 1
! ib=ia + 30*12000 - 1
! write(27) h,iwave(ia:ib)
! close(27)
! endif
! print*,'A',nagain,ifile,fname
! NB: Frequency of ipk is now shifted to 1000 Hz.
nagain2=0
call map65_mmdec(nutc1,iwave,nqd,ntrperiod,nsubmode,nfa,nfb,1000,ntol, &
newdat,nagain,max_drift,ndepth,mycall,hiscall,hisgrid)
newdat,nagain2,max_drift,ndepth,mycall,hiscall,hisgrid)
MHz=fcenter
freq0=MHz + 0.001d0*ikhz
@ -132,8 +148,6 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
freq1=freq0 + 0.001d0*(ikhz1-ikhz)
frx=0.001*k0*df+nkhz_center-48.0+1.0 - 0.001*nfcal
fsked=frx - 0.001*ndop00/2.0 - 0.001*offset
! if(iand(nCFOM,2).eq.2) write(*,3001) nCFOM,ndop00,frx,fsked
!3001 format('A',i5,i8,f10.3,f10.1)
ctmp=csubmode//' '//trim(msg0)
ndecodes=min(ndecodes+1,50)
write(result(ndecodes),1120) nhhmmss,frx,fsked,xdt0,nsnr0,trim(ctmp)

View File

@ -40,7 +40,7 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, &
save
tsec0=sec_midn()
if(nagain.eq.1) ndepth=3 !Use full depth for click-to-decode
if(nagain.ge.1) ndepth=3 !Use full depth for click-to-decode
nkhz_center=nint(1000.0*(fcenter-int(fcenter)))
mfa=nfa-nkhz_center+48
mfb=nfb-nkhz_center+48
@ -60,8 +60,7 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, &
foffset=0.001*(1270 + nfcal) !Offset from sync tone, plus CAL
fqso=mousefqso + foffset - 0.5*(nfa+nfb) + nfshift !fqso at baseband (khz)
nqd=0
bClickDecode=(nagain.eq.1)
nagain2=0
bClickDecode=(nagain.ge.1)
call timer('fftbig ',0)
call fftbig(dd,NSMAX) !Do the full-length FFT
@ -80,12 +79,14 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, &
ntrperiod=cand(icand)%ntrperiod
iseq=cand(icand)%iseq
! Skip this candidate if we already decoded it.
do j=1,ndecodes
if(abs(f0-found(j)%f).lt.0.005 .and. &
if(nagain.eq.0) then
! Skip this candidate if we already decoded it.
do j=1,ndecodes
if(abs(f0-found(j)%f).lt.0.005 .and. &
ntrperiod.eq.found(j)%ntrperiod .and. &
iseq.eq.found(j)%iseq) go to 10
enddo
enddo
endif
mode_q65_tmp=mode_q65
if(ntrperiod.eq.30) mode_q65_tmp=max(1,mode_q65-1)
@ -95,7 +96,7 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, &
call timer('q65b ',0)
call q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
ntrperiod,iseq,mycall,hiscall,hisgrid,mode_q65_tmp,f0,fqso, &
nkhz_center,newdat,nagain2,bClickDecode,max_drift,offset, &
nkhz_center,newdat,nagain,bClickDecode,max_drift,offset, &
ndepth,datetime,nCFOM,ndop00,nhsym,idec)
call timer('q65b ',1)
if(bClickDecode .and. idec.ge.0) exit

View File

@ -192,7 +192,6 @@ MainWindow::~MainWindow()
soundInThread.quit();
soundInThread.wait(3000);
}
// fftwf_export_wisdom_to_filename (QDir {m_appDir}.absoluteFilePath ("qmap_wisdom.dat").toLocal8Bit ());
delete ui;
}
@ -951,6 +950,7 @@ void MainWindow::decode() //decode()
memcpy(savecom_.revision, m_revision.toLatin1(), len2);
memcpy(savecom_.saveFileName, m_saveFileName.toLatin1(),len1);
ui->actionExport_wav_file_at_fQSO->setEnabled(m_diskData);
watcher3.setFuture(QtConcurrent::run (q65c_));
decodeBusy(true);
}
@ -1184,3 +1184,11 @@ void MainWindow::on_sbMaxDrift_valueChanged(int n)
if(n==5) ui->sbMaxDrift->setStyleSheet("QSpinBox { background-color: #ffff82; }");
if(n>=10) ui->sbMaxDrift->setStyleSheet("QSpinBox { background-color: #ffff00; }");
}
void MainWindow::on_actionExport_wav_file_at_fQSO_triggered()
{
qDebug() << "Export .wav file" << m_path;
datcom_.newdat=0;
datcom_.nagain=2;
decode();
}

View File

@ -83,8 +83,8 @@ private slots:
void on_actionQuick_Start_Guide_to_WSJT_X_2_7_and_QMAP_triggered();
void on_actionAlso_Q65_30x_toggled(bool b);
void on_sbMaxDrift_valueChanged(int arg1);
void on_actionSave_decoded_triggered();
void on_actionExport_wav_file_at_fQSO_triggered();
private:
Ui::MainWindow *ui;

View File

@ -434,6 +434,7 @@ p, li { white-space: pre-wrap; }
<addaction name="separator"/>
<addaction name="actionDelete_all_iq_files_in_SaveDir"/>
<addaction name="separator"/>
<addaction name="actionExport_wav_file_at_fQSO"/>
<addaction name="actionSettings"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
@ -855,6 +856,11 @@ p, li { white-space: pre-wrap; }
<string>Save decoded</string>
</property>
</action>
<action name="actionExport_wav_file_at_fQSO">
<property name="text">
<string>Export .wav file at fQSO</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
@ -873,8 +879,8 @@ p, li { white-space: pre-wrap; }
<slot>update()</slot>
<hints>
<hint type="sourcelabel">
<x>269</x>
<y>255</y>
<x>287</x>
<y>281</y>
</hint>
<hint type="destinationlabel">
<x>126</x>