Make the Tx audio stereo, i.e., I and Q signals in left and right channels.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@3594 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-11-04 16:42:51 +00:00
parent a035ca5772
commit 214737ae54
4 changed files with 26 additions and 22 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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<framesToProcess; i++ ) {
short int i2=iwave[ic];
if(ic > 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<framesToProcess; i++ ) {
*wptr++ = 0;
*wptr++ = 0;
ic++;
ic++; ic++;
}
}
if(ic > nwave) {