Exemple #1
0
int snd_pcm_close(snd_pcm_t *pcm)
{
	if (pcm->setup) {
		snd_pcm_drop(pcm);
		snd_pcm_hw_free(pcm);
	}
	_snd_pcm_munmap(pcm);
	snd_pcm_hw_munmap_status(pcm);
#if SALSA_HAS_ASYNC_SUPPORT
	if (pcm->async)
		snd_async_del_handler(pcm->async);
#endif
	close(pcm->fd);
	free(pcm);
	return 0;
}	
Exemple #2
0
int audio_alsa_deinit(void)
{
	if (alsa_hw.sighandler) {
		snd_async_del_handler(alsa_hw.sighandler);
		alsa_hw.sighandler = NULL;
	}
	if (alsa_hw.handle) {
		snd_pcm_close(alsa_hw.handle);
		alsa_hw.handle = NULL;
	}
	if (alsa_hw.fd != -1) {
		close(alsa_hw.fd);
		alsa_hw.fd = -1;
	}
	if (hw.fd != -1) {
		close(hw.fd);
		hw.fd = -1;
	}
	return 1;
}