forked from auracaster/pyalsaaudio
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:
17
alsaaudio.c
17
alsaaudio.c
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user