mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
Added functions:
snd_ctl_rawmidi_prefer_subdevice snd_rawmidi_open_subdevice Fixed functions: snd_pcm_hw_open - fixed prefer subdevice code
This commit is contained in:
parent
8a625fd63b
commit
0e561770c6
10 changed files with 93 additions and 9 deletions
|
|
@ -104,6 +104,12 @@ int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info)
|
|||
return ctl->ops->rawmidi_info(ctl, info);
|
||||
}
|
||||
|
||||
int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev)
|
||||
{
|
||||
assert(ctl);
|
||||
return ctl->ops->rawmidi_prefer_subdevice(ctl, subdev);
|
||||
}
|
||||
|
||||
int snd_ctl_read1(snd_ctl_t *ctl, snd_ctl_event_t *event)
|
||||
{
|
||||
assert(ctl && event);
|
||||
|
|
|
|||
|
|
@ -126,6 +126,14 @@ static int snd_ctl_hw_rawmidi_info(snd_ctl_t *handle, snd_rawmidi_info_t * info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int snd_ctl_hw_rawmidi_prefer_subdevice(snd_ctl_t *handle, int subdev)
|
||||
{
|
||||
snd_ctl_hw_t *hw = handle->private;
|
||||
if (ioctl(hw->fd, SND_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE, &subdev) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event)
|
||||
{
|
||||
snd_ctl_hw_t *hw = handle->private;
|
||||
|
|
@ -144,6 +152,7 @@ struct snd_ctl_ops snd_ctl_hw_ops = {
|
|||
pcm_info: snd_ctl_hw_pcm_info,
|
||||
pcm_prefer_subdevice: snd_ctl_hw_pcm_prefer_subdevice,
|
||||
rawmidi_info: snd_ctl_hw_rawmidi_info,
|
||||
rawmidi_prefer_subdevice: snd_ctl_hw_rawmidi_prefer_subdevice,
|
||||
read: snd_ctl_hw_read,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ struct snd_ctl_ops {
|
|||
int (*pcm_info)(snd_ctl_t *handle, snd_pcm_info_t * info);
|
||||
int (*pcm_prefer_subdevice)(snd_ctl_t *handle, int subdev);
|
||||
int (*rawmidi_info)(snd_ctl_t *handle, snd_rawmidi_info_t * info);
|
||||
int (*rawmidi_prefer_subdevice)(snd_ctl_t *handle, int subdev);
|
||||
int (*read)(snd_ctl_t *handle, snd_ctl_event_t *event);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -239,6 +239,19 @@ static int snd_ctl_shm_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int snd_ctl_shm_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev)
|
||||
{
|
||||
snd_ctl_shm_t *shm = ctl->private;
|
||||
snd_ctl_shm_ctrl_t *ctrl = shm->ctrl;
|
||||
int err;
|
||||
ctrl->u.rawmidi_prefer_subdevice = subdev;
|
||||
ctrl->cmd = SND_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE;
|
||||
err = snd_ctl_shm_action(ctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return err;
|
||||
}
|
||||
|
||||
static int snd_ctl_shm_read(snd_ctl_t *ctl, snd_ctl_event_t *event)
|
||||
{
|
||||
snd_ctl_shm_t *shm = ctl->private;
|
||||
|
|
@ -265,6 +278,7 @@ struct snd_ctl_ops snd_ctl_shm_ops = {
|
|||
pcm_info: snd_ctl_shm_pcm_info,
|
||||
pcm_prefer_subdevice: snd_ctl_shm_pcm_prefer_subdevice,
|
||||
rawmidi_info: snd_ctl_shm_rawmidi_info,
|
||||
rawmidi_prefer_subdevice: snd_ctl_shm_rawmidi_prefer_subdevice,
|
||||
read: snd_ctl_shm_read,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue