- reconcile start_threads.c to agree with Bob's version in branch portaudio

Notice that I have an explicit #ifdef USE_PORTAUDIO for later use.
  The alsa code was swapping around the original iret1 iret2 and thread1
  thread2 also making it confusing. This should 100% agree with what
  Bob had now for USE_PORTAUDIO.

  This code should be re-factored if we are keeping alsa, start_threads.c
  should have no audio code in it. Something like jtaudio_portaudio.c
  jtaudio_alsa.c jtaudio_oss.c would be what I would do, with the
  file to compile chosen at configure time.



git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@83 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Diane Bruce 2006-01-11 02:57:23 +00:00
parent 0df428a28b
commit 6189d47595

View File

@ -515,9 +515,9 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
pthread_t thread1,thread2; pthread_t thread1,thread2;
int iret1,iret2; int iret1,iret2;
int iarg1 = 1,iarg2 = 2; int iarg1 = 1,iarg2 = 2;
#ifdef USE_ALSA
//int32_t rate=11025; //int32_t rate=11025;
int32_t rate=*nfsample; int32_t rate=*nfsample;
#ifdef USE_ALSA
alsa_driver_capture.app_buffer_y1 = y1; alsa_driver_capture.app_buffer_y1 = y1;
alsa_driver_capture.app_buffer_y2 = y2; alsa_driver_capture.app_buffer_y2 = y2;
alsa_driver_capture.app_buffer_offset = iwrite; alsa_driver_capture.app_buffer_offset = iwrite;
@ -534,10 +534,8 @@ 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;
#endif
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);
#ifdef USE_ALSA
/* 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);
@ -551,10 +549,12 @@ int start_threads_(int *ndevin, int *ndevout, short y1[], short y2[],
snd_pcm_start(alsa_driver_capture.audio_fd); snd_pcm_start(alsa_driver_capture.audio_fd);
snd_pcm_prepare(alsa_driver_playback.audio_fd); snd_pcm_prepare(alsa_driver_playback.audio_fd);
//snd_pcm_start(alsa_driver_playback.audio_fd); //snd_pcm_start(alsa_driver_playback.audio_fd);
#else #endif
#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(&thread2,NULL,a2d_,&iarg1); iret1 = pthread_create(&thread1,NULL,a2d_,&iarg1);
// iret2 = pthread_create(&thread2,NULL,decode1_,&iarg2); printf("start_threads creating thread for decode1_\n");
iret2 = pthread_create(&thread2,NULL,decode1_,&iarg2);
#endif #endif
} }