Modified version of patch 2594366.

git-svn-id: svn://svn.code.sf.net/p/pyalsaaudio/code/trunk@30 ec2f30ec-7544-0410-870e-f70ca00c83f0
This commit is contained in:
larsimmisch
2009-04-22 22:10:14 +00:00
parent fc3517b00e
commit 83104faa0b

View File

@@ -183,16 +183,23 @@ static int alsapcm_setup(alsapcm_t *self)
snd_pcm_hw_params_set_access(self->handle, hwparams,
SND_PCM_ACCESS_RW_INTERLEAVED);
snd_pcm_hw_params_set_format(self->handle, hwparams, self->format);
snd_pcm_hw_params_set_channels(self->handle, hwparams, self->channels);
res = snd_pcm_hw_params_set_channels(self->handle, hwparams,
self->channels);
if (res < 0) return res;
dir = 0;
snd_pcm_hw_params_set_rate(self->handle, hwparams, self->rate, dir);
snd_pcm_hw_params_set_period_size(self->handle, hwparams,
res = snd_pcm_hw_params_set_rate(self->handle, hwparams, self->rate, dir);
if (res < 0) return res;
res = snd_pcm_hw_params_set_period_size(self->handle, hwparams,
self->periodsize, dir);
snd_pcm_hw_params_set_periods(self->handle, hwparams, 4, 0);
if (res < 0) return res;
res = snd_pcm_hw_params_set_periods(self->handle, hwparams, 4, 0);
if (res < 0) return res;
/* Write it to the device */
res = snd_pcm_hw_params(self->handle, hwparams);
if (res) return res;
/* Query current settings. These may differ from the requested values,
which should therefore be sync'ed with actual values */