- backed out second boo-boo

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@168 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Diane Bruce 2006-04-17 00:10:03 +00:00
parent 33a7229bf3
commit 802f6cc51d
7 changed files with 42 additions and 80 deletions

View File

@ -70,7 +70,7 @@ subroutine audio_init(ndin,ndout)
! print*,'Audio INIT called.' ! print*,'Audio INIT called.'
ierr=start_threads(ndevin,ndevout,y1,y2,nmax,iwrite,iwave,nwave, & ierr=start_threads(ndevin,ndevout,y1,y2,nmax,iwrite,iwave,nwave, &
11025,NSPB,TRPeriod,TxOK,ndebug,Transmitting, & 11025,NSPB,TRPeriod,TxOK,ndebug,Transmitting, &
Tsec,ngo,nmode,tbuf,ibuf,ndsec,PttPort,devin_name,devout_name) Tsec,ngo,nmode,tbuf,ibuf,ndsec)
#endif #endif

View File

@ -40,13 +40,12 @@ integer nx !x coordinate for waterfall pixmap GUI
integer mfsample !Measured sample rate, input SoundIn integer mfsample !Measured sample rate, input SoundIn
integer mfsample2 !Measured sample rate, output SoundOut integer mfsample2 !Measured sample rate, output SoundOut
integer ns0 !Time at last ALL.TXT date entry Decoder integer ns0 !Time at last ALL.TXT date entry Decoder
character*12 devin_name,devout_name ! GUI
common/gcom1/Tbuf(1024),ntrbuf(1024),Tsec,rxdelay,txdelay, & common/gcom1/Tbuf(1024),ntrbuf(1024),Tsec,rxdelay,txdelay, &
samfacin,samfacout,txsnrdb,y1(NRXMAX),y2(NRXMAX), & samfacin,samfacout,txsnrdb,y1(NRXMAX),y2(NRXMAX), &
nmax,iwrite,iread,iwave(NTXMAX),nwave,TxOK,Receiving,Transmitting, & nmax,iwrite,iread,iwave(NTXMAX),nwave,TxOK,Receiving,Transmitting, &
TxFirst,TRPeriod,ibuf,ibuf0,ave,rms,ngo,level,mute,newdat,ndsec, & TxFirst,TRPeriod,ibuf,ibuf0,ave,rms,ngo,level,mute,newdat,ndsec, &
ndevin,ndevout,nx,mfsample,mfsample2,ns0,devin_name,devout_name ndevin,ndevout,nx,mfsample,mfsample2,ns0
!### volatile /gcom1/ !### volatile /gcom1/

View File

@ -79,7 +79,6 @@ character*24 decodedfile
character*80 AppDir !WSJT installation directory GUI character*80 AppDir !WSJT installation directory GUI
character*80 filetokilla !Filenames (full path) Decoder character*80 filetokilla !Filenames (full path) Decoder
character*80 filetokillb character*80 filetokillb
character*12 pttport
common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), & common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), &
green(500),ngreen,dgain,iter,ndecoding,ndecoding0,mousebutton, & green(500),ngreen,dgain,iter,ndecoding,ndecoding0,mousebutton, &
@ -91,6 +90,6 @@ common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), &
idinterval,msmax,lenappdir,ndiskdat,nlines,nflat,ntxreq,ntxnow, & idinterval,msmax,lenappdir,ndiskdat,nlines,nflat,ntxreq,ntxnow, &
ndepth,nspecial,ndf,ss1(-224:224),ss2(-224:224), & ndepth,nspecial,ndf,ss1(-224:224),ss2(-224:224), &
mycall,hiscall,hisgrid,txmsg,sending,mode,fname0,fnamea, & mycall,hiscall,hisgrid,txmsg,sending,mode,fname0,fnamea, &
fnameb,decodedfile,AppDir,filetokilla,filetokillb,utcdate,pttport fnameb,decodedfile,AppDir,filetokilla,filetokillb,utcdate
!### volatile /gcom2/ !### volatile /gcom2/

View File

@ -25,11 +25,8 @@ MyGrid=StringVar()
#TxDelay=StringVar() #TxDelay=StringVar()
IDinterval=IntVar() IDinterval=IntVar()
ComPort=IntVar() ComPort=IntVar()
PttPort=StringVar()
ndevin=IntVar() ndevin=IntVar()
ndevout=IntVar() ndevout=IntVar()
DevinName=StringVar()
DevoutName=StringVar()
samfacin=DoubleVar() samfacin=DoubleVar()
samfacout=DoubleVar() samfacout=DoubleVar()
Template1=StringVar() Template1=StringVar()
@ -109,12 +106,12 @@ mygrid=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Grid Locator:',
## value='0.2',entry_textvariable=TxDelay) ## value='0.2',entry_textvariable=TxDelay)
idinterval=Pmw.EntryField(g1.interior(),labelpos=W,label_text='ID Interval (m):', idinterval=Pmw.EntryField(g1.interior(),labelpos=W,label_text='ID Interval (m):',
value=10,entry_textvariable=IDinterval,entry_width=12) value=10,entry_textvariable=IDinterval,entry_width=12)
comport=Pmw.EntryField(g1.interior(),labelpos=W,label_text='PTT Port:', comport=Pmw.EntryField(g1.interior(),labelpos=W,label_text='COM Port:',
value='1',entry_textvariable=PttPort,entry_width=12) value=1,entry_textvariable=ComPort,entry_width=12)
audioin=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Audio In:', audioin=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Audio In:',
value='0',entry_textvariable=DevinName,entry_width=12) value=0,entry_textvariable=ndevin,entry_width=12)
audioout=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Audio Out:', audioout=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Audio Out:',
value='0',entry_textvariable=DevoutName,entry_width=12) value=0,entry_textvariable=ndevout,entry_width=12)
ratein=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Rate In:', ratein=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Rate In:',
value=1.0000,entry_textvariable=samfacin,entry_width=12) value=1.0000,entry_textvariable=samfacin,entry_width=12)
rateout=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Rate Out:', rateout=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Rate Out:',

View File

@ -489,19 +489,10 @@ if g.cmap == "AFMHot":
#---------------------------------------------- Display GUI and start mainloop #---------------------------------------------- Display GUI and start mainloop
draw_axis() draw_axis()
try: Audio.gcom1.ndevin=g.ndevin.get()
ndevin=g.ndevin.get() Audio.gcom1.ndevout=g.ndevout.get()
except: ndevin=g.ndevin.get()
ndevin=0 ndevout=g.ndevout.get()
Audio.gcom1.ndevin=ndevin
try:
ndevout=g.ndevout.get()
except:
ndevout=0
Audio.gcom1.ndevout=ndevout
# Only valid for windows
# for now
Audio.audio_init(ndevin,ndevout) #Start the audio stream Audio.audio_init(ndevin,ndevout) #Start the audio stream
ltime.after(200,update) ltime.after(200,update)

View File

@ -80,8 +80,7 @@ start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
int *nwave, int *nfsample, int *nsamperbuf, int *nwave, int *nfsample, int *nsamperbuf,
int *TRPeriod, int *TxOK, int *ndebug, int *TRPeriod, int *TxOK, int *ndebug,
int *Transmitting, double *Tsec, int *ngo, int *nmode, int *Transmitting, double *Tsec, int *ngo, int *nmode,
double tbuf[], int *ibuf, int *ndsec, double tbuf[], int *ibuf, int *ndsec)
char *PttPort, char *devin_name, char *devout_name)
{ {
pthread_t thread1,thread2; pthread_t thread1,thread2;
int iret1,iret2; int iret1,iret2;
@ -91,35 +90,32 @@ start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
int format; int format;
int channels; int channels;
double dnfs; double dnfs;
int i;
char *p;
p = strchr(devin_name, ' ');
if(p != NULL)
*p = '\0';
p = strchr(devin_name, '/');
if(p != NULL)
snprintf(dsp_in, MAXDSPNAME, "%s", devin_name); /* assume /dev/... */
else
snprintf(dsp_in, MAXDSPNAME, "/dev/%s", devin_name);
/* XXX OSS device is decoded from ndevin and ndevout
* This is not strictly speaking the way to do it and is
* probably specific to FreeBSD for now.
* i.e. the .0 addition is a vchan; I'll add configure magic later. --db
*/
snprintf(dsp_in, MAXDSPNAME,
"/dev/dsp%d.0", *ndevin);
dsp_in[MAXDSPNAME] = '\0'; dsp_in[MAXDSPNAME] = '\0';
data.fd_in = open (dsp_in, O_RDWR, 0); data.fd_in = open (dsp_in, O_RDWR, 0);
if (data.fd_in < 0) { if (data.fd_in < 0) {
fprintf(stderr, "Cannot open %s for input.\n", dsp_in); fprintf(stderr, "Cannot open %s for input.\n", dsp_in);
return(-1); exit(-1);
} }
if (*ndevin == *ndevout) {
data.fd_out = data.fd_in; data.fd_out = data.fd_in;
strncpy(dsp_out, dsp_in, sizeof(dsp_out)); strncpy(dsp_out, dsp_in, sizeof(dsp_out));
dsp_out[sizeof(dsp_out)] = '\0'; dsp_out[sizeof(dsp_out)] = '\0';
if (ioctl(data.fd_in, SNDCTL_DSP_SETDUPLEX, 0) < 0) { if (ioctl(data.fd_in, SNDCTL_DSP_SETDUPLEX, 0) < 0) {
fprintf(stderr, "Cannot use %s for full duplex.\n", dsp_in); fprintf(stderr, "Cannot use %s for full duplex.\n", dsp_in);
return(-1); exit(-1);
}
} }
data.Tsec = Tsec; data.Tsec = Tsec;
@ -144,23 +140,23 @@ start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
channels = 2; channels = 2;
if (ioctl (data.fd_in, SNDCTL_DSP_CHANNELS, &channels) == -1) { if (ioctl (data.fd_in, SNDCTL_DSP_CHANNELS, &channels) == -1) {
fprintf (stderr, "Unable to set 2 channels for input.\n"); fprintf (stderr, "Unable to set 2 channels for input.\n");
return (-1); exit (-1);
} }
if (channels != 2) { if (channels != 2) {
fprintf (stderr, "Unable to set 2 channels.\n"); fprintf (stderr, "Unable to set 2 channels.\n");
return (-1); exit (-1);
} }
format = AFMT_S16_NE; format = AFMT_S16_NE;
if (ioctl (data.fd_in, SNDCTL_DSP_SETFMT, &format) == -1) { if (ioctl (data.fd_in, SNDCTL_DSP_SETFMT, &format) == -1) {
fprintf (stderr, "Unable to set format for input.\n"); fprintf (stderr, "Unable to set format for input.\n");
return (-1); exit (-1);
} }
if (ioctl (data.fd_in, SNDCTL_DSP_SPEED, &rate) == -1) { if (ioctl (data.fd_in, SNDCTL_DSP_SPEED, &rate) == -1) {
fprintf (stderr, "Unable to set rate for input\n"); fprintf (stderr, "Unable to set rate for input\n");
return (-1); exit (-1);
} }
printf("Audio OSS streams running normally.\n"); printf("Audio OSS streams running normally.\n");

34
wsjt.py
View File

@ -98,8 +98,6 @@ g.freeze_decode=0
g.mode="" g.mode=""
g.ndevin=IntVar() g.ndevin=IntVar()
g.ndevout=IntVar() g.ndevout=IntVar()
g.DevinName=StringVar()
g.DevoutName=StringVar()
g.focus=0 g.focus=0
#------------------------------------------------------ showspecjt #------------------------------------------------------ showspecjt
def showspecjt(event=NONE): def showspecjt(event=NONE):
@ -1514,7 +1512,7 @@ def update():
Audio.gcom2.nslim2=isync-4 Audio.gcom2.nslim2=isync-4
if nosh441.get()==1 and mode.get()=='FSK441': Audio.gcom2.nslim2=99 if nosh441.get()==1 and mode.get()=='FSK441': Audio.gcom2.nslim2=99
try: try:
Audio.gcom2.nport=options.ComPort.get() Audio.gcom2.nport=int(options.ComPort.get())
except: except:
Audio.gcom2.nport=0 Audio.gcom2.nport=0
@ -2015,35 +2013,17 @@ try:
# elif key == 'TxDelay': options.TxDelay.set(value) # elif key == 'TxDelay': options.TxDelay.set(value)
elif key == 'IDinterval': options.IDinterval.set(value) elif key == 'IDinterval': options.IDinterval.set(value)
elif key == 'ComPort': elif key == 'ComPort':
try:
options.ComPort.set(value) options.ComPort.set(value)
Audio.gcom2.nport=options.ComPort.get() Audio.gcom2.nport=int(options.ComPort.get())
except:
options.ComPort.set(0)
Audio.gcom2.nport=0
Audio.gcom2.PttPort=options.ComPort.get()
elif key == 'Mileskm': options.mileskm.set(value) elif key == 'Mileskm': options.mileskm.set(value)
elif key == 'MsgStyle': options.ireport.set(value) elif key == 'MsgStyle': options.ireport.set(value)
elif key == 'Region': options.iregion.set(value) elif key == 'Region': options.iregion.set(value)
elif key == 'AudioIn': elif key == 'AudioIn':
try:
g.ndevin.set(value) g.ndevin.set(value)
except: options.ndevin.set(value)
g.ndevin.set(0)
g.DevinName.set(value)
options.DevinName.set(value)
Audio.gcom1.devin_name=(options.DevinName.get()+' ')[:12]
elif key == 'AudioOut': elif key == 'AudioOut':
try:
g.ndevout.set(value) g.ndevout.set(value)
Audio.gcom1.devout_name=(options.DevoutName.get()+' ')[:12] options.ndevout.set(value)
except:
g.ndevout.set(0)
g.DevoutName.set(value)
options.DevoutName.set(value)
Audio.gcom1.devout_name=(options.DevoutName.get()+' ')[:12]
elif key == 'SamFacIn': options.samfacin.set(value) elif key == 'SamFacIn': options.samfacin.set(value)
elif key == 'SamFacOut': options.samfacout.set(value) elif key == 'SamFacOut': options.samfacout.set(value)
elif key == 'Template1': options.Template1.set(value.replace("_"," ")) elif key == 'Template1': options.Template1.set(value.replace("_"," "))
@ -2133,12 +2113,12 @@ f.write("HisGrid " + t + "\n")
#f.write("RxDelay " + str(options.RxDelay.get()) + "\n") #f.write("RxDelay " + str(options.RxDelay.get()) + "\n")
#f.write("TxDelay " + str(options.TxDelay.get()) + "\n") #f.write("TxDelay " + str(options.TxDelay.get()) + "\n")
f.write("IDinterval " + str(options.IDinterval.get()) + "\n") f.write("IDinterval " + str(options.IDinterval.get()) + "\n")
f.write("ComPort " + options.PttPort.get() + "\n") f.write("ComPort " + str(options.ComPort.get()) + "\n")
f.write("Mileskm " + str(options.mileskm.get()) + "\n") f.write("Mileskm " + str(options.mileskm.get()) + "\n")
f.write("MsgStyle " + str(options.ireport.get()) + "\n") f.write("MsgStyle " + str(options.ireport.get()) + "\n")
f.write("Region " + str(options.iregion.get()) + "\n") f.write("Region " + str(options.iregion.get()) + "\n")
f.write("AudioIn " + options.DevinName.get() + "\n") f.write("AudioIn " + str(options.ndevin.get()) + "\n")
f.write("AudioOut " + options.DevoutName.get() + "\n") f.write("AudioOut " + str(options.ndevout.get()) + "\n")
f.write("SamFacIn " + str(options.samfacin.get()) + "\n") f.write("SamFacIn " + str(options.samfacin.get()) + "\n")
f.write("SamFacOut " + str(options.samfacout.get()) + "\n") f.write("SamFacOut " + str(options.samfacout.get()) + "\n")
if options.Template6.get()=="": options.Template6.set("_") if options.Template6.get()=="": options.Template6.set("_")