Import from divmod. Original log message:

r1316 | anthony | 2005-03-30 18:46:21 +0200 (Wed, 30 Mar 2005) | 1 line

setchannels() no longer is insane for only-stereo devices



git-svn-id: svn://svn.code.sf.net/p/pyalsaaudio/code/trunk@10 ec2f30ec-7544-0410-870e-f70ca00c83f0
This commit is contained in:
larsimmisch
2008-01-24 11:31:07 +00:00
parent 03325b1561
commit 8bb39b0ff4

View File

@@ -134,6 +134,7 @@ alsapcm_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
self->handle = 0;
res = alsapcm_setup(self);
if (res < 0) {
if (self->handle) {
snd_pcm_close(self->handle);
@@ -269,14 +270,23 @@ static PyObject *
alsapcm_setchannels(alsapcm_t *self, PyObject *args) {
int channels;
int res;
unsigned int val;
snd_pcm_hw_params_t *hwparams;
snd_pcm_hw_params_alloca(&hwparams);
snd_pcm_hw_params_current(self->handle,hwparams);
if (!PyArg_ParseTuple(args,"i",&channels)) return NULL;
self->channels = channels;
res = alsapcm_setup(self);
if (res < 0) {
PyErr_SetString(ALSAAudioError, snd_strerror(res));
return NULL;
}
return PyInt_FromLong(channels);
snd_pcm_hw_params_get_channels(hwparams, &val);
self->channels = val;
return PyInt_FromLong(val);
}
static PyObject *