예제 #1
0
static int xrun_recovery(snd_pcm_t *handle, int err)
{
	if (err == -EPIPE) {	/* under-run */
		err = alsa_pcm_prepare(handle);
		if (err < 0)
			printf("Can't recover from underrun, prepare failed: %s\n", snd_strerror(err));
		return 0;
	} else if (err == -ESTRPIPE) {
		while ((err = alsa_pcm_resume(handle)) == -EAGAIN)
			sleep(1);	/* wait until the suspend flag is released */
		if (err < 0) {
			err = alsa_pcm_prepare(handle);
			if (err < 0)
				printf("Can't recover from suspend, prepare failed: %s\n", snd_strerror(err));
		}
		return 0;
	}
	return err;
}
예제 #2
0
static int ALSA_PlayStart(void)
{
	int err;

	if (pcm_h == NULL) return 1;
	err = alsa_pcm_prepare(pcm_h);
	if (err == 0)
	    err = alsa_pcm_start(pcm_h);
	if (err < 0) {
		enabled = 0;
		_mm_errno = MMERR_ALSA_PCM_START;
		return 1;
	}

	return VC_PlayStart();
}