mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
uniformed alsa-lib interfaces
This commit is contained in:
parent
fc0a0352db
commit
d2911f9f34
6 changed files with 88 additions and 105 deletions
|
|
@ -34,10 +34,10 @@ int snd_pcm_playback_go(snd_pcm_t *handle);
|
|||
int snd_pcm_capture_go(snd_pcm_t *handle);
|
||||
int snd_pcm_channel_go(snd_pcm_t *handle, int channel);
|
||||
int snd_pcm_sync_go(snd_pcm_t *handle, snd_pcm_sync_t *sync);
|
||||
int snd_pcm_drain_playback(snd_pcm_t *handle);
|
||||
int snd_pcm_flush_playback(snd_pcm_t *handle);
|
||||
int snd_pcm_flush_capture(snd_pcm_t *handle);
|
||||
int snd_pcm_flush_channel(snd_pcm_t *handle, int channel);
|
||||
int snd_pcm_playback_drain(snd_pcm_t *handle);
|
||||
int snd_pcm_playback_flush(snd_pcm_t *handle);
|
||||
int snd_pcm_capture_flush(snd_pcm_t *handle);
|
||||
int snd_pcm_channel_flush(snd_pcm_t *handle, int channel);
|
||||
int snd_pcm_playback_pause(snd_pcm_t *handle, int enable);
|
||||
ssize_t snd_pcm_transfer_size(snd_pcm_t *handle, int channel);
|
||||
ssize_t snd_pcm_write(snd_pcm_t *handle, const void *buffer, size_t size);
|
||||
|
|
|
|||
|
|
@ -23,13 +23,12 @@ int snd_rawmidi_close(snd_rawmidi_t *handle);
|
|||
int snd_rawmidi_file_descriptor(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_block_mode(snd_rawmidi_t *handle, int enable);
|
||||
int snd_rawmidi_info(snd_rawmidi_t *handle, snd_rawmidi_info_t * info);
|
||||
int snd_rawmidi_output_params(snd_rawmidi_t *handle, snd_rawmidi_output_params_t * params);
|
||||
int snd_rawmidi_input_params(snd_rawmidi_t *handle, snd_rawmidi_input_params_t * params);
|
||||
int snd_rawmidi_output_status(snd_rawmidi_t *handle, snd_rawmidi_output_status_t * status);
|
||||
int snd_rawmidi_input_status(snd_rawmidi_t *handle, snd_rawmidi_input_status_t * status);
|
||||
int snd_rawmidi_drain_output(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_flush_output(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_flush_input(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_channel_params(snd_rawmidi_t *handle, snd_rawmidi_params_t * params);
|
||||
int snd_rawmidi_channel_status(snd_rawmidi_t *handle, snd_rawmidi_status_t * status);
|
||||
int snd_rawmidi_output_drain(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_output_flush(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_input_flush(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_channel_flush(snd_rawmidi_t *handle, int channel);
|
||||
ssize_t snd_rawmidi_write(snd_rawmidi_t *handle, const void *buffer, size_t size);
|
||||
ssize_t snd_rawmidi_read(snd_rawmidi_t *handle, void *buffer, size_t size);
|
||||
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ int snd_ctl_rawmidi_info(snd_ctl_t *handle, int dev, snd_rawmidi_info_t * info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int snd_ctl_rawmidi_output_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t *list)
|
||||
int snd_ctl_rawmidi_channel_switch_list(snd_ctl_t *handle, int dev, int chn, snd_switch_list_t *list)
|
||||
{
|
||||
snd_ctl_t *ctl;
|
||||
|
||||
|
|
@ -362,79 +362,73 @@ int snd_ctl_rawmidi_output_switch_list(snd_ctl_t *handle, int dev, snd_switch_li
|
|||
return -EINVAL;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_OSWITCH_LIST, list) < 0)
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_CHANNEL, &chn) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_SWITCH_LIST, list) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_ctl_rawmidi_channel_switch_read(snd_ctl_t *handle, int dev, int chn, snd_switch_t * sw)
|
||||
{
|
||||
snd_ctl_t *ctl;
|
||||
|
||||
ctl = handle;
|
||||
if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
|
||||
return -EINVAL;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_CHANNEL, &chn) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_SWITCH_READ, sw) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_ctl_rawmidi_channel_switch_write(snd_ctl_t *handle, int dev, int chn, snd_switch_t * sw)
|
||||
{
|
||||
snd_ctl_t *ctl;
|
||||
|
||||
ctl = handle;
|
||||
if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
|
||||
return -EINVAL;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_CHANNEL, &chn) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_SWITCH_WRITE, sw) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_ctl_rawmidi_output_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t *list)
|
||||
{
|
||||
return snd_ctl_rawmidi_channel_switch_list(handle, dev, SND_RAWMIDI_CHANNEL_OUTPUT, list);
|
||||
}
|
||||
|
||||
int snd_ctl_rawmidi_output_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw)
|
||||
{
|
||||
snd_ctl_t *ctl;
|
||||
|
||||
ctl = handle;
|
||||
if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
|
||||
return -EINVAL;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_OSWITCH_READ, sw) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
return snd_ctl_rawmidi_channel_switch_read(handle, dev, SND_RAWMIDI_CHANNEL_OUTPUT, sw);
|
||||
}
|
||||
|
||||
int snd_ctl_rawmidi_output_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw)
|
||||
{
|
||||
snd_ctl_t *ctl;
|
||||
|
||||
ctl = handle;
|
||||
if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
|
||||
return -EINVAL;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_OSWITCH_WRITE, sw) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
return snd_ctl_rawmidi_channel_switch_write(handle, dev, SND_RAWMIDI_CHANNEL_OUTPUT, sw);
|
||||
}
|
||||
|
||||
int snd_ctl_rawmidi_input_switch_list(snd_ctl_t *handle, int dev, snd_switch_list_t *list)
|
||||
{
|
||||
snd_ctl_t *ctl;
|
||||
|
||||
ctl = handle;
|
||||
if (!ctl || !list || dev < 0)
|
||||
return -EINVAL;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_ISWITCH_LIST, list) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
return snd_ctl_rawmidi_channel_switch_list(handle, dev, SND_RAWMIDI_CHANNEL_INPUT, list);
|
||||
}
|
||||
|
||||
int snd_ctl_rawmidi_input_switch_read(snd_ctl_t *handle, int dev, snd_switch_t * sw)
|
||||
{
|
||||
snd_ctl_t *ctl;
|
||||
|
||||
ctl = handle;
|
||||
if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
|
||||
return -EINVAL;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_ISWITCH_READ, sw) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
return snd_ctl_rawmidi_channel_switch_read(handle, dev, SND_RAWMIDI_CHANNEL_INPUT, sw);
|
||||
}
|
||||
|
||||
int snd_ctl_rawmidi_input_switch_write(snd_ctl_t *handle, int dev, snd_switch_t * sw)
|
||||
{
|
||||
snd_ctl_t *ctl;
|
||||
|
||||
ctl = handle;
|
||||
if (!ctl || !sw || dev < 0 || sw->name[0] == '\0')
|
||||
return -EINVAL;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_DEVICE, &dev) < 0)
|
||||
return -errno;
|
||||
if (ioctl(ctl->fd, SND_CTL_IOCTL_RAWMIDI_ISWITCH_WRITE, sw) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
return snd_ctl_rawmidi_channel_switch_write(handle, dev, SND_RAWMIDI_CHANNEL_INPUT, sw);
|
||||
}
|
||||
|
||||
int snd_control_read(snd_ctl_t *handle, snd_ctl_callbacks_t * callbacks)
|
||||
|
|
|
|||
|
|
@ -363,7 +363,7 @@ int snd_pcm_sync_go(snd_pcm_t *pcm, snd_pcm_sync_t *sync)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int snd_pcm_drain_playback(snd_pcm_t *pcm)
|
||||
int snd_pcm_playback_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
if (!pcm)
|
||||
return -EINVAL;
|
||||
|
|
@ -374,7 +374,7 @@ int snd_pcm_drain_playback(snd_pcm_t *pcm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int snd_pcm_flush_playback(snd_pcm_t *pcm)
|
||||
int snd_pcm_playback_flush(snd_pcm_t *pcm)
|
||||
{
|
||||
if (!pcm)
|
||||
return -EINVAL;
|
||||
|
|
@ -385,7 +385,7 @@ int snd_pcm_flush_playback(snd_pcm_t *pcm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int snd_pcm_flush_capture(snd_pcm_t *pcm)
|
||||
int snd_pcm_capture_flush(snd_pcm_t *pcm)
|
||||
{
|
||||
if (!pcm)
|
||||
return -EINVAL;
|
||||
|
|
@ -396,13 +396,13 @@ int snd_pcm_flush_capture(snd_pcm_t *pcm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int snd_pcm_flush_channel(snd_pcm_t *pcm, int channel)
|
||||
int snd_pcm_channel_flush(snd_pcm_t *pcm, int channel)
|
||||
{
|
||||
switch (channel) {
|
||||
case SND_PCM_CHANNEL_PLAYBACK:
|
||||
return snd_pcm_flush_playback(pcm);
|
||||
return snd_pcm_playback_flush(pcm);
|
||||
case SND_PCM_CHANNEL_CAPTURE:
|
||||
return snd_pcm_flush_capture(pcm);
|
||||
return snd_pcm_capture_flush(pcm);
|
||||
default:
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ int snd_pcm_plugin_drain_playback(snd_pcm_t *pcm)
|
|||
|
||||
if ((err = snd_pcm_plugin_action(pcm, SND_PCM_CHANNEL_PLAYBACK, DRAIN))<0)
|
||||
return err;
|
||||
return snd_pcm_drain_playback(pcm);
|
||||
return snd_pcm_playback_drain(pcm);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_flush(snd_pcm_t *pcm, int channel)
|
||||
|
|
@ -368,7 +368,7 @@ int snd_pcm_plugin_flush(snd_pcm_t *pcm, int channel)
|
|||
pdprintf("flush\n");
|
||||
if ((err = snd_pcm_plugin_action(pcm, channel, FLUSH))<0)
|
||||
return err;
|
||||
return snd_pcm_flush_channel(pcm, channel);
|
||||
return snd_pcm_channel_flush(pcm, channel);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_pointer(snd_pcm_t *pcm, int channel, void **ptr, size_t *size)
|
||||
|
|
|
|||
|
|
@ -122,67 +122,57 @@ int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int snd_rawmidi_output_params(snd_rawmidi_t *rmidi, snd_rawmidi_output_params_t * params)
|
||||
int snd_rawmidi_channel_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params)
|
||||
{
|
||||
if (!rmidi || !params)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_OUTPUT_PARAMS, params) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_rawmidi_input_params(snd_rawmidi_t *rmidi, snd_rawmidi_input_params_t * params)
|
||||
{
|
||||
if (!rmidi || !params)
|
||||
if (params->channel < 0 || params->channel > 1)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_INPUT_PARAMS, params) < 0)
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_CHANNEL_PARAMS, params) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_rawmidi_output_status(snd_rawmidi_t *rmidi, snd_rawmidi_output_status_t * status)
|
||||
int snd_rawmidi_output_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status)
|
||||
{
|
||||
if (!rmidi || !status)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_OUTPUT_STATUS, status) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_rawmidi_input_status(snd_rawmidi_t *rmidi, snd_rawmidi_input_status_t * status)
|
||||
{
|
||||
if (!rmidi || !status)
|
||||
if (status->channel < 0 || status->channel > 1)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_INPUT_STATUS, status) < 0)
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_CHANNEL_STATUS, status) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_rawmidi_drain_output(snd_rawmidi_t *rmidi)
|
||||
int snd_rawmidi_output_drain(snd_rawmidi_t *rmidi)
|
||||
{
|
||||
int chn = SND_RAWMIDI_CHANNEL_OUTPUT;
|
||||
if (!rmidi)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_CHANNEL_DRAIN, &chn) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_rawmidi_channel_flush(snd_rawmidi_t *rmidi, int chn)
|
||||
{
|
||||
if (!rmidi)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_DRAIN_OUTPUT) < 0)
|
||||
if (chn < 0 || chn > 1)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_CHANNEL_FLUSH) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_rawmidi_flush_output(snd_rawmidi_t *rmidi)
|
||||
int snd_rawmidi_output_flush(snd_rawmidi_t *rmidi)
|
||||
{
|
||||
if (!rmidi)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_FLUSH_OUTPUT) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
return snd_rawmidi_channel_flush(rmidi, SND_RAWMIDI_CHANNEL_OUTPUT);
|
||||
}
|
||||
|
||||
int snd_rawmidi_flush_input(snd_rawmidi_t *rmidi)
|
||||
int snd_rawmidi_input_flush(snd_rawmidi_t *rmidi)
|
||||
{
|
||||
if (!rmidi)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_FLUSH_INPUT) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
return snd_rawmidi_channel_flush(rmidi, SND_RAWMIDI_CHANNEL_INPUT);
|
||||
}
|
||||
|
||||
ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue