--- plugins/rtaudio/rtalsa.c-dist 2004-06-02 16:56:18.000000000 +0200 +++ plugins/rtaudio/rtalsa.c 2004-06-02 17:04:30.000000000 +0200 @@ -141,11 +141,9 @@ static void set_device_params(void *csou } dev->sample_size *= devParms->nChannels; /* correct sample size */ /* sample rate, */ - dev->srate = - (int) snd_pcm_hw_params_set_rate_near(dev->handle, dev->hw_params, - (int) (devParms->sampleRate + 0.5f), - 0); - if (dev->srate < 0) { + dev->srate = (int) (devParms->sampleRate + 0.5f); + if (snd_pcm_hw_params_set_rate_near(dev->handle, dev->hw_params, + &dev->srate, 0) < 0) { ENGINE->Die(csound, Str("unable to set sample rate on soundcard")); return; } @@ -157,10 +155,9 @@ static void set_device_params(void *csou } /* buffer size, */ n = devParms->hwBufSize; - dev->buffer_smps = (snd_pcm_sframes_t) - snd_pcm_hw_params_set_buffer_size_near(dev->handle, dev->hw_params, - (snd_pcm_uframes_t) n); - if (dev->buffer_smps <= (snd_pcm_sframes_t) 0) { + dev->buffer_smps = n; + if (snd_pcm_hw_params_set_buffer_size_near(dev->handle, dev->hw_params, + &dev->buffer_smps) < 0) { ENGINE->Die(csound, Str("failed while trying to set soundcard DMA buffer size")); return; @@ -173,10 +170,9 @@ static void set_device_params(void *csou } /* and period size */ n = devParms->swBufSize; - dev->period_smps = (snd_pcm_sframes_t) - snd_pcm_hw_params_set_period_size_near(dev->handle, dev->hw_params, - (snd_pcm_uframes_t) n, &dir); - if (dev->period_smps <= 0) { + dev->period_smps = n; + if (snd_pcm_hw_params_set_period_size_near(dev->handle, dev->hw_params, + &dev->period_smps, &dir) < 0) { ENGINE->Die(csound, Str("error setting period time for real-time audio")); return;