--- fluid_alsa.c_1.0.1 2003-04-03 05:41:32.000000000 -0800 +++ fluid_alsa.c 2003-04-22 16:10:30.000000000 -0700 @@ -178,12 +178,15 @@ char* device; pthread_attr_t attr; int sched = SCHED_FIFO; + struct sched_param priority; int i, err, dir = 0; snd_pcm_hw_params_t* hwparams; snd_pcm_sw_params_t* swparams = NULL; snd_pcm_uframes_t uframes; unsigned int tmp; + priority.sched_priority = 90; + dev = FLUID_NEW(fluid_alsa_audio_driver_t); if (dev == NULL) { FLUID_LOG(FLUID_ERR, "Out of memory"); @@ -334,6 +337,8 @@ goto error_recovery; } } + if (sched == SCHED_FIFO) + pthread_attr_setschedparam (&attr, &priority); err = pthread_create(&dev->thread, &attr, fluid_alsa_formats[i].run, (void*) dev); if (err) { @@ -407,6 +412,11 @@ handle[0] = left; handle[1] = right; + if (snd_pcm_nonblock(dev->pcm, 0) != 0) { /* double negation */ + FLUID_LOG(FLUID_ERR, "Failed to set the audio device to blocking mode"); + goto error_recovery; + } + if (snd_pcm_prepare(dev->pcm) != 0) { FLUID_LOG(FLUID_ERR, "Failed to prepare the audio device"); goto error_recovery; @@ -486,6 +496,11 @@ handle[0] = left; handle[1] = right; + if (snd_pcm_nonblock(dev->pcm, 0) != 0) { /* double negation */ + FLUID_LOG(FLUID_ERR, "Failed to set the audio device to blocking mode"); + goto error_recovery; + } + if (snd_pcm_prepare(dev->pcm) != 0) { FLUID_LOG(FLUID_ERR, "Failed to prepare the audio device"); goto error_recovery;