mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-12-28 08:57:30 -05:00
Changes for auto loader..
This commit is contained in:
parent
9225699798
commit
d0ca621a75
8 changed files with 62 additions and 15 deletions
|
|
@ -44,11 +44,15 @@ int snd_pcm_open(void **handle, int card, int device, int mode)
|
|||
snd_pcm_t *pcm;
|
||||
|
||||
*handle = NULL;
|
||||
|
||||
if (card < 0 || card >= SND_CARDS)
|
||||
return -EINVAL;
|
||||
sprintf(filename, SND_FILE_PCM, card, device);
|
||||
if ((fd = open(filename, mode)) < 0)
|
||||
return -errno;
|
||||
if ((fd = open(filename, mode)) < 0) {
|
||||
snd_card_load(card);
|
||||
if ((fd = open(filename, mode)) < 0)
|
||||
return -errno;
|
||||
}
|
||||
if (ioctl(fd, SND_PCM_IOCTL_PVERSION, &ver) < 0) {
|
||||
close(fd);
|
||||
return -errno;
|
||||
|
|
|
|||
|
|
@ -44,12 +44,16 @@ int snd_pcm_loopback_open(void **handle, int card, int device, int mode)
|
|||
snd_pcm_loopback_t *lb;
|
||||
|
||||
*handle = NULL;
|
||||
|
||||
if (card < 0 || card >= SND_CARDS)
|
||||
return -EINVAL;
|
||||
sprintf(filename, SND_FILE_PCM_LB, card, device,
|
||||
mode == SND_PCM_LB_OPEN_RECORD ? "r" : "p");
|
||||
if ((fd = open(filename, mode)) < 0)
|
||||
return -errno;
|
||||
if ((fd = open(filename, mode)) < 0) {
|
||||
snd_card_load(card);
|
||||
if ((fd = open(filename, mode)) < 0)
|
||||
return -errno;
|
||||
}
|
||||
if (ioctl(fd, SND_PCM_IOCTL_PVERSION, &ver) < 0) {
|
||||
close(fd);
|
||||
return -errno;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue