diff --git a/libm65/gen65.f90 b/libm65/gen65.f90 index 87944305e..d2f84ff7c 100644 --- a/libm65/gen65.f90 +++ b/libm65/gen65.f90 @@ -3,7 +3,7 @@ subroutine gen65(message,mode65,nfast,samfac,nsendingsh,msgsent,iwave,nwave) ! Encodes a JT65 message into a wavefile. ! Executes in 17 ms on opti-745. - parameter (NMAX=60*11025) !Max length of wave file + parameter (NMAX=2*60*11025) !Max length of wave file character*22 message !Message to be generated character*22 msgsent !Message as it will be received character*3 cok !' ' or 'OOO' @@ -54,27 +54,31 @@ subroutine gen65(message,mode65,nfast,samfac,nsendingsh,msgsent,iwave,nwave) f0=118*11025.d0/1024 dfgen=mode65*11025.d0/4096.d0 phi=0.d0 + dphi=twopi*dt*f0 i=0 k=0 do j=1,nsym - f=f0 - if(nspecial.ne.0 .and. mod(j,2).eq.0) f=f0+10*nspecial*dfgen - if(nspecial.eq.0 .and. flip*pr(j).lt.0.0) then - k=k+1 - f=f0+(sent(k)+2)*dfgen + if(message(1:5).ne.'@TUNE') then + f=f0 + if(nspecial.ne.0 .and. mod(j,2).eq.0) f=f0+10*nspecial*dfgen + if(nspecial.eq.0 .and. flip*pr(j).lt.0.0) then + k=k+1 + f=f0+(sent(k)+2)*dfgen + endif + dphi=twopi*dt*f endif - dphi=twopi*dt*f do ii=1,nsps phi=phi+dphi if(phi.gt.twopi) phi=phi-twopi xphi=phi i=i+1 - iwave(i)=32767.0*sin(xphi) + iwave(2*i-1)=32767.0*cos(xphi) + iwave(2*i)=32767.0*sin(xphi) enddo enddo - iwave(nsym*nsps+1:)=0 - nwave=nsym*nsps + 5512 + iwave(2*nsym*nsps+1:)=0 + nwave=2*nsym*nsps + 5512 call unpackmsg(dgen,msgsent) if(flip.lt.0.0) then do i=22,1,-1 diff --git a/mainwindow.cpp b/mainwindow.cpp index bc696259e..b8f79a85c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -13,7 +13,7 @@ #define NFFT 32768 -short int iwave[60*11025]; //Wave file for Tx audio +short int iwave[2*60*11025]; //Wave file for Tx audio int nwave; //Length of Tx waveform bool btxok; //True if OK to transmit double outputLatency; //Latency in seconds diff --git a/map65.iss b/map65.iss index 8ae7a8181..c5d89f4ed 100644 --- a/map65.iss +++ b/map65.iss @@ -1,7 +1,7 @@ [Setup] AppName=MAP65 -AppVerName=MAP65 Version 2.4.1 r2587 -AppCopyright=Copyright (C) 2001-2012 by Joe Taylor, K1JT +AppVerName=MAP65 Version 2.4.1 r3120 +AppCopyright=Copyright (C) 2001-2013 by Joe Taylor, K1JT DefaultDirName=c:\MAP65 DefaultGroupName=MAP65 diff --git a/soundout.cpp b/soundout.cpp index 2f850f4c1..55f4ce33f 100644 --- a/soundout.cpp +++ b/soundout.cpp @@ -8,7 +8,7 @@ extern "C" { extern float gran(); //Noise generator (for tests only) -extern short int iwave[60*11025]; //Wave file for Tx audio +extern short int iwave[2*60*11025]; //Wave file for Tx audio extern int nwave; extern bool btxok; extern double outputLatency; @@ -28,7 +28,7 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer, paUserData *udata=(paUserData*)userData; short *wptr = (short*)outputBuffer; unsigned int i; - int n; + static int n; static int ic=0; static bool btxok0=false; static int nStart=0; @@ -51,6 +51,7 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer, } else { if(n != nStart) { //Late start in new Tx cycle: compute starting index ic=(int)(tstart*11025.0); + ic=2*ic; nStart=n; } } @@ -59,19 +60,18 @@ extern "C" int d2aCallback(const void *inputBuffer, void *outputBuffer, if(btxok) { for(i=0 ; i nwave) i2=0; + short int i2a=iwave[ic++]; + short int i2b=iwave[ic++]; + if(ic > nwave) {i2a=0; i2b=0;} // i2 = 500.0*(i2/32767.0 + 5.0*gran()); //Add noise (tests only!) - if(!btxok) i2=0; - *wptr++ = i2; //left - *wptr++ = i2; //right - ic++; + *wptr++ = i2a; //left + *wptr++ = i2b; //right } } else { for(i=0 ; i nwave) {