From 802f6cc51df708d707f5a9c4c65935c58861c3e2 Mon Sep 17 00:00:00 2001 From: Diane Bruce Date: Mon, 17 Apr 2006 00:10:03 +0000 Subject: [PATCH] - backed out second boo-boo git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@168 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- audio_init.F90 | 2 +- gcom1.f90 | 3 +-- gcom2.f90 | 3 +-- options.py | 11 ++++------- specjt.py | 17 ++++------------- start_oss.c | 46 +++++++++++++++++++++------------------------- wsjt.py | 40 ++++++++++------------------------------ 7 files changed, 42 insertions(+), 80 deletions(-) diff --git a/audio_init.F90 b/audio_init.F90 index 92bbb7c1e..ff6cd46b0 100644 --- a/audio_init.F90 +++ b/audio_init.F90 @@ -70,7 +70,7 @@ subroutine audio_init(ndin,ndout) ! print*,'Audio INIT called.' ierr=start_threads(ndevin,ndevout,y1,y2,nmax,iwrite,iwave,nwave, & 11025,NSPB,TRPeriod,TxOK,ndebug,Transmitting, & - Tsec,ngo,nmode,tbuf,ibuf,ndsec,PttPort,devin_name,devout_name) + Tsec,ngo,nmode,tbuf,ibuf,ndsec) #endif diff --git a/gcom1.f90 b/gcom1.f90 index 192e7658c..abbb013f4 100644 --- a/gcom1.f90 +++ b/gcom1.f90 @@ -40,13 +40,12 @@ integer nx !x coordinate for waterfall pixmap GUI integer mfsample !Measured sample rate, input SoundIn integer mfsample2 !Measured sample rate, output SoundOut 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, & samfacin,samfacout,txsnrdb,y1(NRXMAX),y2(NRXMAX), & nmax,iwrite,iread,iwave(NTXMAX),nwave,TxOK,Receiving,Transmitting, & 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/ diff --git a/gcom2.f90 b/gcom2.f90 index bb91f4c53..109858b64 100644 --- a/gcom2.f90 +++ b/gcom2.f90 @@ -79,7 +79,6 @@ character*24 decodedfile character*80 AppDir !WSJT installation directory GUI character*80 filetokilla !Filenames (full path) Decoder character*80 filetokillb -character*12 pttport common/gcom2/ps0(431),psavg(450),s2(64,3100),ccf(-5:540), & 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, & ndepth,nspecial,ndf,ss1(-224:224),ss2(-224:224), & mycall,hiscall,hisgrid,txmsg,sending,mode,fname0,fnamea, & - fnameb,decodedfile,AppDir,filetokilla,filetokillb,utcdate,pttport + fnameb,decodedfile,AppDir,filetokilla,filetokillb,utcdate !### volatile /gcom2/ diff --git a/options.py b/options.py index b57025ea3..df7b361d6 100644 --- a/options.py +++ b/options.py @@ -25,11 +25,8 @@ MyGrid=StringVar() #TxDelay=StringVar() IDinterval=IntVar() ComPort=IntVar() -PttPort=StringVar() ndevin=IntVar() ndevout=IntVar() -DevinName=StringVar() -DevoutName=StringVar() samfacin=DoubleVar() samfacout=DoubleVar() Template1=StringVar() @@ -109,12 +106,12 @@ mygrid=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Grid Locator:', ## value='0.2',entry_textvariable=TxDelay) idinterval=Pmw.EntryField(g1.interior(),labelpos=W,label_text='ID Interval (m):', value=10,entry_textvariable=IDinterval,entry_width=12) -comport=Pmw.EntryField(g1.interior(),labelpos=W,label_text='PTT Port:', - value='1',entry_textvariable=PttPort,entry_width=12) +comport=Pmw.EntryField(g1.interior(),labelpos=W,label_text='COM Port:', + value=1,entry_textvariable=ComPort,entry_width=12) 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:', - 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:', value=1.0000,entry_textvariable=samfacin,entry_width=12) rateout=Pmw.EntryField(g1.interior(),labelpos=W,label_text='Rate Out:', diff --git a/specjt.py b/specjt.py index a204f2084..013681974 100644 --- a/specjt.py +++ b/specjt.py @@ -489,19 +489,10 @@ if g.cmap == "AFMHot": #---------------------------------------------- Display GUI and start mainloop draw_axis() -try: - ndevin=g.ndevin.get() -except: - ndevin=0 -Audio.gcom1.ndevin=ndevin - -try: - ndevout=g.ndevout.get() -except: - ndevout=0 -Audio.gcom1.ndevout=ndevout - # Only valid for windows - # for now +Audio.gcom1.ndevin=g.ndevin.get() +Audio.gcom1.ndevout=g.ndevout.get() +ndevin=g.ndevin.get() +ndevout=g.ndevout.get() Audio.audio_init(ndevin,ndevout) #Start the audio stream ltime.after(200,update) diff --git a/start_oss.c b/start_oss.c index dc85524af..c241829e3 100644 --- a/start_oss.c +++ b/start_oss.c @@ -80,8 +80,7 @@ start_threads_(int *ndevin, int *ndevout, short y1[], short y2[], int *nwave, int *nfsample, int *nsamperbuf, int *TRPeriod, int *TxOK, int *ndebug, int *Transmitting, double *Tsec, int *ngo, int *nmode, - double tbuf[], int *ibuf, int *ndsec, - char *PttPort, char *devin_name, char *devout_name) + double tbuf[], int *ibuf, int *ndsec) { pthread_t thread1,thread2; int iret1,iret2; @@ -91,35 +90,32 @@ start_threads_(int *ndevin, int *ndevout, short y1[], short y2[], int format; int channels; 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'; data.fd_in = open (dsp_in, O_RDWR, 0); if (data.fd_in < 0) { fprintf(stderr, "Cannot open %s for input.\n", dsp_in); - return(-1); + exit(-1); } - data.fd_out = data.fd_in; - strncpy(dsp_out, dsp_in, sizeof(dsp_out)); - dsp_out[sizeof(dsp_out)] = '\0'; + if (*ndevin == *ndevout) { + data.fd_out = data.fd_in; + strncpy(dsp_out, dsp_in, sizeof(dsp_out)); + dsp_out[sizeof(dsp_out)] = '\0'; - if (ioctl(data.fd_in, SNDCTL_DSP_SETDUPLEX, 0) < 0) { - fprintf(stderr, "Cannot use %s for full duplex.\n", dsp_in); - return(-1); + if (ioctl(data.fd_in, SNDCTL_DSP_SETDUPLEX, 0) < 0) { + fprintf(stderr, "Cannot use %s for full duplex.\n", dsp_in); + exit(-1); + } } data.Tsec = Tsec; @@ -144,23 +140,23 @@ start_threads_(int *ndevin, int *ndevout, short y1[], short y2[], channels = 2; if (ioctl (data.fd_in, SNDCTL_DSP_CHANNELS, &channels) == -1) { fprintf (stderr, "Unable to set 2 channels for input.\n"); - return (-1); + exit (-1); } if (channels != 2) { fprintf (stderr, "Unable to set 2 channels.\n"); - return (-1); + exit (-1); } format = AFMT_S16_NE; if (ioctl (data.fd_in, SNDCTL_DSP_SETFMT, &format) == -1) { fprintf (stderr, "Unable to set format for input.\n"); - return (-1); + exit (-1); } if (ioctl (data.fd_in, SNDCTL_DSP_SPEED, &rate) == -1) { fprintf (stderr, "Unable to set rate for input\n"); - return (-1); + exit (-1); } printf("Audio OSS streams running normally.\n"); diff --git a/wsjt.py b/wsjt.py index 1d495ea5e..af5d98472 100644 --- a/wsjt.py +++ b/wsjt.py @@ -98,8 +98,6 @@ g.freeze_decode=0 g.mode="" g.ndevin=IntVar() g.ndevout=IntVar() -g.DevinName=StringVar() -g.DevoutName=StringVar() g.focus=0 #------------------------------------------------------ showspecjt def showspecjt(event=NONE): @@ -1514,7 +1512,7 @@ def update(): Audio.gcom2.nslim2=isync-4 if nosh441.get()==1 and mode.get()=='FSK441': Audio.gcom2.nslim2=99 try: - Audio.gcom2.nport=options.ComPort.get() + Audio.gcom2.nport=int(options.ComPort.get()) except: Audio.gcom2.nport=0 @@ -2015,35 +2013,17 @@ try: # elif key == 'TxDelay': options.TxDelay.set(value) elif key == 'IDinterval': options.IDinterval.set(value) elif key == 'ComPort': - try: - options.ComPort.set(value) - Audio.gcom2.nport=options.ComPort.get() - except: - options.ComPort.set(0) - Audio.gcom2.nport=0 - - Audio.gcom2.PttPort=options.ComPort.get() - + options.ComPort.set(value) + Audio.gcom2.nport=int(options.ComPort.get()) elif key == 'Mileskm': options.mileskm.set(value) elif key == 'MsgStyle': options.ireport.set(value) elif key == 'Region': options.iregion.set(value) elif key == 'AudioIn': - try: - g.ndevin.set(value) - except: - g.ndevin.set(0) - g.DevinName.set(value) - options.DevinName.set(value) - Audio.gcom1.devin_name=(options.DevinName.get()+' ')[:12] + g.ndevin.set(value) + options.ndevin.set(value) elif key == 'AudioOut': - try: - g.ndevout.set(value) - Audio.gcom1.devout_name=(options.DevoutName.get()+' ')[:12] - except: - g.ndevout.set(0) - g.DevoutName.set(value) - options.DevoutName.set(value) - Audio.gcom1.devout_name=(options.DevoutName.get()+' ')[:12] + g.ndevout.set(value) + options.ndevout.set(value) elif key == 'SamFacIn': options.samfacin.set(value) elif key == 'SamFacOut': options.samfacout.set(value) 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("TxDelay " + str(options.TxDelay.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("MsgStyle " + str(options.ireport.get()) + "\n") f.write("Region " + str(options.iregion.get()) + "\n") -f.write("AudioIn " + options.DevinName.get() + "\n") -f.write("AudioOut " + options.DevoutName.get() + "\n") +f.write("AudioIn " + str(options.ndevin.get()) + "\n") +f.write("AudioOut " + str(options.ndevout.get()) + "\n") f.write("SamFacIn " + str(options.samfacin.get()) + "\n") f.write("SamFacOut " + str(options.samfacout.get()) + "\n") if options.Template6.get()=="": options.Template6.set("_")