mirror of
https://github.com/larsimmisch/pyalsaaudio.git
synced 2026-06-01 10:57:01 +00:00
Fix build (#133)
[Revisionist Note] This is a squashed commit formed from commitsf374adb,3743cf5, andcd44517, still found in the main-pre-rewrite branch. It incorporates a suggestion from PR #134.
This commit is contained in:
committed by
Oswald Buddenhagen
parent
438e52e3fc
commit
9637703ab5
+6
-5
@@ -1423,8 +1423,6 @@ alsapcm_read(alsapcm_t *self, PyObject *args)
|
|||||||
|
|
||||||
static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args)
|
static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args)
|
||||||
{
|
{
|
||||||
snd_pcm_state_t state;
|
|
||||||
int res;
|
|
||||||
int datalen;
|
int datalen;
|
||||||
char *data;
|
char *data;
|
||||||
PyObject *rc = NULL;
|
PyObject *rc = NULL;
|
||||||
@@ -1464,10 +1462,13 @@ static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int res;
|
||||||
snd_pcm_state_t state = snd_pcm_state(self->handle);
|
snd_pcm_state_t state = snd_pcm_state(self->handle);
|
||||||
|
|
||||||
if (state != SND_PCM_STATE_SETUP) {
|
|
||||||
res = snd_pcm_prepare(self->handle));
|
if ((state != SND_PCM_STATE_XRUN && state != SND_PCM_STATE_SETUP) ||
|
||||||
|
(res = snd_pcm_prepare(self->handle)) >= 0) {
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
res = snd_pcm_writei(self->handle, data, datalen/self->framesize);
|
res = snd_pcm_writei(self->handle, data, datalen/self->framesize);
|
||||||
if (res == -EPIPE) {
|
if (res == -EPIPE) {
|
||||||
@@ -1477,8 +1478,8 @@ static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args)
|
|||||||
res = snd_pcm_writei(self->handle, data, datalen/self->framesize);
|
res = snd_pcm_writei(self->handle, data, datalen/self->framesize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Py_END_ALLOW_THREADS
|
||||||
}
|
}
|
||||||
Py_END_ALLOW_THREADS
|
|
||||||
|
|
||||||
if (res == -EAGAIN) {
|
if (res == -EAGAIN) {
|
||||||
rc = PyLong_FromLong(0);
|
rc = PyLong_FromLong(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user