mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-24 02:12:37 -04:00
1. Turned off debugging messages in start_threads.c, audio_init.f90.
2. Tweaked code that measures sampling rates (in fivehz and fivehztx) so that it works well with both PortAudio and bare ALSA. 3. Added a "Using PortAudio" message to a2d.f90. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@84 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
6189d47595
commit
930a5ab2b1
2
a2d.f90
2
a2d.f90
@ -11,6 +11,8 @@ subroutine a2d(iarg)
|
|||||||
! This call does not normally return, as the background portion of
|
! This call does not normally return, as the background portion of
|
||||||
! JTaudio goes into a test-and-sleep loop.
|
! JTaudio goes into a test-and-sleep loop.
|
||||||
|
|
||||||
|
write(*,1000)
|
||||||
|
1000 format('Using PortAudio.')
|
||||||
idevin=ndevin
|
idevin=ndevin
|
||||||
idevout=ndevout
|
idevout=ndevout
|
||||||
call padevsub(numdevs,ndefin,ndefout,nchin,nchout)
|
call padevsub(numdevs,ndefin,ndefout,nchin,nchout)
|
||||||
|
@ -60,7 +60,7 @@ subroutine audio_init(ndin,ndout)
|
|||||||
m3=SetThreadPriority(Thread2,THREAD_PRIORITY_BELOW_NORMAL)
|
m3=SetThreadPriority(Thread2,THREAD_PRIORITY_BELOW_NORMAL)
|
||||||
m4=ResumeThread(Thread2)
|
m4=ResumeThread(Thread2)
|
||||||
#else
|
#else
|
||||||
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)
|
Tsec,ngo,nmode,tbuf,ibuf,ndsec)
|
||||||
|
17
fivehz.f90
17
fivehz.f90
@ -40,7 +40,7 @@ subroutine fivehz
|
|||||||
ibuf00=-99
|
ibuf00=-99
|
||||||
ncall=-1
|
ncall=-1
|
||||||
tt0=tt
|
tt0=tt
|
||||||
u=0.05d0
|
u=0.1d0
|
||||||
fsample=11025.d0
|
fsample=11025.d0
|
||||||
maxms=0
|
maxms=0
|
||||||
mfsample=110250
|
mfsample=110250
|
||||||
@ -51,8 +51,9 @@ subroutine fivehz
|
|||||||
! Measure average sampling frequency over a recent interval
|
! Measure average sampling frequency over a recent interval
|
||||||
|
|
||||||
ncall=ncall+1
|
ncall=ncall+1
|
||||||
if(ncall.gt.0) then
|
if(ncall.eq.9) tt0=tt
|
||||||
fs=ncall*2048.d0/(tt-tt0)
|
if(ncall.ge.10 .and. mod(ncall,2).eq.1) then
|
||||||
|
fs=(ncall-9)*2048.d0/(tt-tt0)
|
||||||
fsample=u*fs + (1.d0-u)*fsample
|
fsample=u*fs + (1.d0-u)*fsample
|
||||||
mfsample=nint(10.d0*fsample)
|
mfsample=nint(10.d0*fsample)
|
||||||
endif
|
endif
|
||||||
@ -192,17 +193,17 @@ subroutine fivehztx
|
|||||||
ncall=-1
|
ncall=-1
|
||||||
fsample=11025.d0
|
fsample=11025.d0
|
||||||
nsec0=-999
|
nsec0=-999
|
||||||
u=0.05d0
|
u=0.1d0
|
||||||
mfsample2=110250
|
mfsample2=110250
|
||||||
|
tt0=tt
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ncall=ncall+1
|
ncall=ncall+1
|
||||||
if(ncall.eq.8) tt0=tt
|
if(ncall.eq.9) tt0=tt
|
||||||
if(ncall.gt.8) then
|
if(ncall.ge.10 .and. mod(ncall,2).eq.1) then
|
||||||
fs=(ncall-8)*2048.d0/(tt-tt0)
|
fs=(ncall-9)*2048.d0/(tt-tt0)
|
||||||
fsample=u*fs + (1.d0-u)*fsample
|
fsample=u*fs + (1.d0-u)*fsample
|
||||||
mfsample2=nint(10.d0*fsample)
|
mfsample2=nint(10.d0*fsample)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return
|
return
|
||||||
end subroutine fivehztx
|
end subroutine fivehztx
|
||||||
|
@ -17,7 +17,7 @@ extern void a2d_(int *iarg);
|
|||||||
|
|
||||||
#ifdef USE_ALSA
|
#ifdef USE_ALSA
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
#define ALSA_LOG
|
#define ALSA_LOG
|
||||||
#define ALSA_LOG_BUFFERS
|
#define ALSA_LOG_BUFFERS
|
||||||
#endif
|
#endif
|
||||||
@ -266,7 +266,7 @@ static int ao_alsa_open(alsa_driver_t *this_gen, int32_t *input_rate, snd_pcm_st
|
|||||||
/* Check for pause/resume support */
|
/* Check for pause/resume support */
|
||||||
this->has_pause_resume = ( snd_pcm_hw_params_can_pause (params)
|
this->has_pause_resume = ( snd_pcm_hw_params_can_pause (params)
|
||||||
&& snd_pcm_hw_params_can_resume (params) );
|
&& snd_pcm_hw_params_can_resume (params) );
|
||||||
printf( "audio_alsa_out:open pause_resume=%d\n", this->has_pause_resume);
|
// printf( "audio_alsa_out:open pause_resume=%d\n", this->has_pause_resume);
|
||||||
this->sample_rate_factor = (double) this->output_sample_rate / (double) this->input_sample_rate;
|
this->sample_rate_factor = (double) this->output_sample_rate / (double) this->input_sample_rate;
|
||||||
this->bytes_per_frame = snd_pcm_frames_to_bytes (this->audio_fd, 1);
|
this->bytes_per_frame = snd_pcm_frames_to_bytes (this->audio_fd, 1);
|
||||||
/*
|
/*
|
||||||
@ -534,10 +534,10 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
|
|||||||
alsa_driver_playback.nmode = nmode;
|
alsa_driver_playback.nmode = nmode;
|
||||||
alsa_driver_playback.transmitting = Transmitting;
|
alsa_driver_playback.transmitting = Transmitting;
|
||||||
alsa_driver_playback.ndsec = ndsec;
|
alsa_driver_playback.ndsec = ndsec;
|
||||||
printf("start_threads creating thread for decode1\n");
|
// printf("start_threads: creating thread for decode1\n");
|
||||||
iret1 = pthread_create(&thread1,NULL,decode1_,&iarg1);
|
iret1 = pthread_create(&thread1,NULL,decode1_,&iarg1);
|
||||||
/* Open audio card. */
|
/* Open audio card. */
|
||||||
printf("Starting alsa routines\n");
|
printf("Starting alsa routines.\n");
|
||||||
ao_alsa_open(&alsa_driver_playback, &rate, SND_PCM_STREAM_PLAYBACK);
|
ao_alsa_open(&alsa_driver_playback, &rate, SND_PCM_STREAM_PLAYBACK);
|
||||||
ao_alsa_open(&alsa_driver_capture, &rate, SND_PCM_STREAM_CAPTURE);
|
ao_alsa_open(&alsa_driver_capture, &rate, SND_PCM_STREAM_CAPTURE);
|
||||||
|
|
||||||
@ -552,9 +552,9 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
|
|||||||
#endif
|
#endif
|
||||||
#ifdef USE_PORTAUDIO
|
#ifdef USE_PORTAUDIO
|
||||||
/* snd_pcm_start */
|
/* snd_pcm_start */
|
||||||
printf("start_threads creating thread for a2d\n");
|
// printf("start_threads: creating thread for a2d\n");
|
||||||
iret1 = pthread_create(&thread1,NULL,a2d_,&iarg1);
|
iret1 = pthread_create(&thread1,NULL,a2d_,&iarg1);
|
||||||
printf("start_threads creating thread for decode1_\n");
|
// printf("start_threads: creating thread for decode1_\n");
|
||||||
iret2 = pthread_create(&thread2,NULL,decode1_,&iarg2);
|
iret2 = pthread_create(&thread2,NULL,decode1_,&iarg2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user