mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-08 13:30:03 -05:00
Without this patch it is not possible to link the channel and format
parameter if snd_pcm_extplug_set_param_*() or
snd_pcm_extplug_set_slave_param_*() is called. Therefore the client and
slave parameter can differ. So the extplug has to implement conversion.
To avoid this the new snd_pcm_extplug_set_param_link() function can be
called.
As a reproduction sceanrio the following extplug source code can be used:
===
static snd_pcm_sframes_t my_transfer(snd_pcm_extplug_t *e,
const snd_pcm_channel_area_t *da, snd_pcm_uframes_t dof,
const snd_pcm_channel_area_t *sa, snd_pcm_uframes_t sof,
snd_pcm_uframes_t s) {
return s;
}
static const snd_pcm_extplug_callback_t my_own_callback = {
.transfer = my_transfer
};
SND_PCM_PLUGIN_DEFINE_FUNC(my_plug) {
snd_config_iterator_t i, next;
snd_config_t *slave = NULL;
snd_pcm_extplug_t *myplug;
snd_config_for_each(i, next, conf) {
snd_config_t *n = snd_config_iterator_entry(i);
const char *id;
if (snd_config_get_id(n, &id) < 0)
continue;
if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0)
continue;
if (strcmp(id, "slave") == 0) {
slave = n;
continue;
}
return -EINVAL;
}
myplug = calloc(1, sizeof(*myplug));
myplug->version = SND_PCM_EXTPLUG_VERSION;
myplug->callback = &my_own_callback;
snd_pcm_extplug_create(myplug, name, root, slave, stream, mode);
snd_pcm_extplug_set_param_minmax(myplug,
SND_PCM_EXTPLUG_HW_CHANNELS, 1, 16);
// snd_pcm_extplug_set_param_link(myplug, SND_PCM_EXTPLUG_HW_CHANNELS, 1);
*pcmp = myplug->pcm;
return 0;
}
SND_PCM_PLUGIN_SYMBOL(my_plug);
===
To use this plugin the following ALSA configuration is required:
pcm.myplug {
type my_plug
slave.pcm hw:Dummy
}
With this configuration without this patch
snd_pcm_hw_params_get_channels_max() will always return 16 channels
independent of the supported channels of the dummy device. Due to that for
example the start up of JACK would fail:
$ modprobe snd_dummy
$ jackd -d alsa -P myplug
ALSA: cannot set channel count to 16 for playback
ALSA: cannot configure playback channel
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||
|---|---|---|
| .. | ||
| scopes | ||
| interval.c | ||
| interval.h | ||
| interval_inline.h | ||
| ladspa.h | ||
| Makefile.am | ||
| mask.c | ||
| mask.h | ||
| mask_inline.h | ||
| pcm.c | ||
| pcm_adpcm.c | ||
| pcm_alaw.c | ||
| pcm_asym.c | ||
| pcm_copy.c | ||
| pcm_direct.c | ||
| pcm_direct.h | ||
| pcm_dmix.c | ||
| pcm_dmix_generic.c | ||
| pcm_dmix_i386.c | ||
| pcm_dmix_i386.h | ||
| pcm_dmix_x86_64.c | ||
| pcm_dmix_x86_64.h | ||
| pcm_dshare.c | ||
| pcm_dsnoop.c | ||
| pcm_empty.c | ||
| pcm_ext_parm.h | ||
| pcm_extplug.c | ||
| pcm_file.c | ||
| pcm_generic.c | ||
| pcm_generic.h | ||
| pcm_hooks.c | ||
| pcm_hw.c | ||
| pcm_iec958.c | ||
| pcm_ioplug.c | ||
| pcm_ladspa.c | ||
| pcm_lfloat.c | ||
| pcm_linear.c | ||
| pcm_local.h | ||
| pcm_meter.c | ||
| pcm_misc.c | ||
| pcm_mmap.c | ||
| pcm_mmap_emul.c | ||
| pcm_mulaw.c | ||
| pcm_multi.c | ||
| pcm_null.c | ||
| pcm_params.c | ||
| pcm_plug.c | ||
| pcm_plugin.c | ||
| pcm_plugin.h | ||
| pcm_rate.c | ||
| pcm_rate_linear.c | ||
| pcm_route.c | ||
| pcm_share.c | ||
| pcm_shm.c | ||
| pcm_simple.c | ||
| pcm_softvol.c | ||
| pcm_symbols.c | ||
| plugin_ops.h | ||