@@ -115,7 +115,7 @@ static struct adev_s {
115
115
/* e.g. 4 for stereo 16 bit. */
116
116
117
117
#else
118
- oss_audio_device_fd ; /* Single device, both directions. */
118
+ int oss_audio_device_fd ; /* Single device, both directions. */
119
119
120
120
#endif
121
121
@@ -144,7 +144,7 @@ static struct adev_s {
144
144
static int set_alsa_params (int a , snd_pcm_t * handle , struct audio_s * pa , char * name , char * dir );
145
145
//static void alsa_select_device (char *pick_dev, int direction, char *result);
146
146
#else
147
- static int set_oss_params (int fd , struct audio_s * pa );
147
+ static int set_oss_params (int a , int fd , struct audio_s * pa );
148
148
#endif
149
149
150
150
@@ -351,17 +351,17 @@ int audio_open (struct audio_s *pa)
351
351
adev [a ].inbuf_size_in_bytes = set_alsa_params (a , adev [a ].audio_in_handle , pa , audio_in_name , "input" );
352
352
353
353
#else // OSS
354
- oss_audio_device_fd = open (pa -> adev [a ].adevice_in , O_RDWR );
354
+ adev [ a ]. oss_audio_device_fd = open (pa -> adev [a ].adevice_in , O_RDWR );
355
355
356
- if (oss_audio_device_fd < 0 ) {
356
+ if (adev [ a ]. oss_audio_device_fd < 0 ) {
357
357
text_color_set (DW_COLOR_ERROR );
358
358
dw_printf ("%s:\n" , pa -> adev [a ].adevice_in );
359
359
// snprintf (message, sizeof(message), "Could not open audio device %s", pa->adev[a].adevice_in);
360
360
// perror (message);
361
361
return (-1 );
362
362
}
363
363
364
- adev [a ].outbuf_size_in_bytes = adev [a ].inbuf_size_in_bytes = set_oss_params (oss_audio_device_fd , pa );
364
+ adev [a ].outbuf_size_in_bytes = adev [a ].inbuf_size_in_bytes = set_oss_params (a , adev [ a ]. oss_audio_device_fd , pa );
365
365
366
366
if (adev [a ].inbuf_size_in_bytes <= 0 || adev [a ].outbuf_size_in_bytes <= 0 ) {
367
367
return (-1 );
@@ -686,7 +686,7 @@ static int set_alsa_params (int a, snd_pcm_t *handle, struct audio_s *pa, char *
686
686
* See /usr/include/sys/soundcard.h for details.
687
687
*/
688
688
689
- static int set_oss_params (int fd , struct audio_s * pa )
689
+ static int set_oss_params (int a , int fd , struct audio_s * pa )
690
690
{
691
691
int err ;
692
692
int devcaps ;
@@ -770,7 +770,7 @@ static int set_oss_params (int fd, struct audio_s *pa)
770
770
*
771
771
* This was long ago under different conditions.
772
772
* Should study this again some day.
773
- */
773
+ *
774
774
* Your milage may vary.
775
775
*/
776
776
err = ioctl (fd , SNDCTL_DSP_GETBLKSIZE , & ossbuf_size_in_bytes );
@@ -966,9 +966,9 @@ int audio_get (int a)
966
966
/* Fixed in 1.2. This was formerly outside of the switch */
967
967
/* so the OSS version did not process stdin or UDP. */
968
968
969
- while (adev [a ].. g_audio_in_type == AUDIO_IN_TYPE_SOUNDCARD && adev [a ].inbuf_next >= adev [a ].inbuf_len ) {
970
- assert (oss_audio_device_fd > 0 );
971
- n = read (oss_audio_device_fd , adev [a ].inbuf_ptr , adev [a ].inbuf_size_in_bytes );
969
+ while (adev [a ].g_audio_in_type == AUDIO_IN_TYPE_SOUNDCARD && adev [a ].inbuf_next >= adev [a ].inbuf_len ) {
970
+ assert (adev [ a ]. oss_audio_device_fd > 0 );
971
+ n = read (adev [ a ]. oss_audio_device_fd , adev [a ].inbuf_ptr , adev [a ].inbuf_size_in_bytes );
972
972
//text_color_set(DW_COLOR_DEBUG);
973
973
// dw_printf ("audio_get(): read %d returns %d\n", adev[a].inbuf_size_in_bytes, n);
974
974
if (n < 0 ) {
@@ -1236,8 +1236,8 @@ int audio_flush (int a)
1236
1236
len = adev [a ].outbuf_len ;
1237
1237
1238
1238
while (len > 0 ) {
1239
- assert (oss_audio_device_fd > 0 );
1240
- k = write (oss_audio_device_fd , ptr , len );
1239
+ assert (adev [ a ]. oss_audio_device_fd > 0 );
1240
+ k = write (adev [ a ]. oss_audio_device_fd , ptr , len );
1241
1241
#if DEBUGx
1242
1242
text_color_set (DW_COLOR_DEBUG );
1243
1243
dw_printf ("audio_flush(): write %d returns %d\n" , len , k );
@@ -1329,12 +1329,12 @@ void audio_wait (int a)
1329
1329
1330
1330
#else
1331
1331
1332
- assert (oss_audio_device_fd > 0 );
1332
+ assert (adev [ a ]. oss_audio_device_fd > 0 );
1333
1333
1334
1334
// This caused a crash later on Cygwin.
1335
1335
// Haven't tried it on other (non-Linux) Unix yet.
1336
1336
1337
- // err = ioctl (oss_audio_device_fd, SNDCTL_DSP_SYNC, NULL);
1337
+ // err = ioctl (adev[a]. oss_audio_device_fd, SNDCTL_DSP_SYNC, NULL);
1338
1338
1339
1339
#endif
1340
1340
@@ -1375,13 +1375,13 @@ int audio_close (void)
1375
1375
1376
1376
#else
1377
1377
1378
- if (oss_audio_device_fd > 0 ) {
1378
+ if (adev [ a ]. oss_audio_device_fd > 0 ) {
1379
1379
1380
1380
audio_wait (a );
1381
1381
1382
- close (oss_audio_device_fd );
1382
+ close (adev [ a ]. oss_audio_device_fd );
1383
1383
1384
- oss_audio_device_fd = -1 ;
1384
+ adev [ a ]. oss_audio_device_fd = -1 ;
1385
1385
#endif
1386
1386
1387
1387
free (adev [a ].inbuf_ptr );
0 commit comments