| 
									
										
										
										
											2005-12-23 17:07:54 +00:00
										 |  |  | !---------------------------------------------------- a2d
 | 
					
						
							|  |  |  | subroutine a2d(iarg)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ! Start the PortAudio streams for audio input and output.
 | 
					
						
							|  |  |  |   integer nchin(0:20),nchout(0:20)
 | 
					
						
							|  |  |  |   include 'gcom1.f90'
 | 
					
						
							|  |  |  |   include 'gcom2.f90'
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ! This call does not normally return, as the background portion of
 | 
					
						
							|  |  |  | ! JTaudio goes into a test-and-sleep loop.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-11 17:06:25 +00:00
										 |  |  |   write(*,1000)
 | 
					
						
							| 
									
										
										
										
											2007-01-12 17:57:41 +00:00
										 |  |  | 1000 format('Using Linrad for input, PortAudio for output.')
 | 
					
						
							| 
									
										
										
										
											2005-12-23 17:07:54 +00:00
										 |  |  |   idevout=ndevout
 | 
					
						
							|  |  |  |   call padevsub(numdevs,ndefin,ndefout,nchin,nchout)
 | 
					
						
							|  |  |  |   
 | 
					
						
							| 
									
										
										
										
											2007-01-12 17:57:41 +00:00
										 |  |  |   write(*,1002) ndefout
 | 
					
						
							|  |  |  | 1002 format(/'Default Output:',i3)
 | 
					
						
							|  |  |  |   write(*,1004) idevout
 | 
					
						
							|  |  |  | 1004 format('Requested Output:',i3)
 | 
					
						
							| 
									
										
										
										
											2005-12-23 17:07:54 +00:00
										 |  |  |   if(idevout.lt.0 .or. idevout.ge.numdevs) idevout=ndefout
 | 
					
						
							| 
									
										
										
										
											2007-01-12 17:57:41 +00:00
										 |  |  |   if(idevout.eq.0) idevout=ndefout
 | 
					
						
							|  |  |  |   idevin=0
 | 
					
						
							| 
									
										
										
										
											2005-12-23 17:07:54 +00:00
										 |  |  |   ierr=jtaudio(idevin,idevout,y1,y2,NMAX,iwrite,iwave,nwave,    &
 | 
					
						
							|  |  |  |        11025,NSPB,TRPeriod,TxOK,ndebug,Transmitting,            &
 | 
					
						
							|  |  |  |        Tsec,ngo,nmode,tbuf,ibuf,ndsec)
 | 
					
						
							|  |  |  |   if(ierr.ne.0) then
 | 
					
						
							|  |  |  |      print*,'Error ',ierr,' in JTaudio, cannot continue.'
 | 
					
						
							|  |  |  |   else
 | 
					
						
							|  |  |  |      write(*,1006) 
 | 
					
						
							| 
									
										
										
										
											2007-01-12 17:57:41 +00:00
										 |  |  | 1006 format('Audio output stream terminated normally.')
 | 
					
						
							| 
									
										
										
										
											2005-12-23 17:07:54 +00:00
										 |  |  |   endif
 | 
					
						
							|  |  |  |   return
 | 
					
						
							|  |  |  | end subroutine a2d
 |