$NetBSD: patch-ac,v 1.1.1.1 2001/05/23 20:17:22 rh Exp $ --- oss.c.orig Thu Apr 19 13:02:35 2001 +++ oss.c @@ -42,9 +43,10 @@ # include #elif defined(HAVE_MACHINE_SOUNDCARD_H) # include +#elif defined(HAVE_SOUNDCARD_H) +# include #endif - /* output plugin callback prototypes */ static void oss_get_volume (int *l, int *r); static void oss_set_volume (int l, int r); @@ -305,9 +307,9 @@ if(config->oss_use_alt_audio_device && (config->oss_alt_audio_device != NULL)) device_name = g_strdup(config->oss_alt_audio_device); else if(config->oss_audio_device > 0) - device_name = g_strdup_printf("/dev/dsp%d", config->oss_audio_device); + device_name = g_strdup_printf(DEFAULT_OSS_ALT_AUDIO_DEVICE "%d", config->oss_audio_device); else - device_name = g_strdup("/dev/dsp"); + device_name = g_strdup(DEFAULT_OSS_ALT_AUDIO_DEVICE); /* HACK: Test if the device is not locked by another process. This is * just a crude workaround to avoid complete lockup of XMMS. It is @@ -499,13 +507,26 @@ while(dsp_fd != -1) { /* wait for device */ if(dsp_select_works) { - tv.tv_sec = 0; + pthread_mutex_unlock(&buffer_mutex); +#ifdef __NetBSD__ + { int i; + + for (i=0; i<16; i++) { + tv.tv_usec = OSS_FRAGMENT_UTIME/16; +#else tv.tv_usec = OSS_FRAGMENT_UTIME; +#endif + tv.tv_sec = 0; FD_ZERO(&set); FD_SET(dsp_fd, &set); - pthread_mutex_unlock(&buffer_mutex); sel = select(dsp_fd+1, NULL, &set, NULL, &tv); +#ifdef __NetBSD__ + pthread_yield_np(); + + if (sel) break; + }} +#endif pthread_mutex_lock(&buffer_mutex); if(sel == -1) {