22 #include <linux/time.h>
27 static void zero_areas(
struct snd_pcm_plugin_channel *dvp,
int ndsts,
31 for (; dst < ndsts; ++
dst) {
39 static inline void copy_area(
const struct snd_pcm_plugin_channel *src_channel,
40 struct snd_pcm_plugin_channel *dst_channel,
43 dst_channel->enabled = 1;
48 const struct snd_pcm_plugin_channel *src_channels,
49 struct snd_pcm_plugin_channel *dst_channels,
52 int nsrcs, ndsts,
dst;
53 struct snd_pcm_plugin_channel *dvp;
56 if (
snd_BUG_ON(!plugin || !src_channels || !dst_channels))
61 nsrcs = plugin->src_format.channels;
62 ndsts = plugin->dst_format.channels;
64 format = plugin->dst_format.format;
68 for (dst = 0; dst < ndsts; ++
dst) {
69 copy_area(src_channels, dvp, frames, format);
75 for (dst = 0; dst < ndsts && dst < nsrcs; ++
dst) {
76 copy_area(src_channels, dvp, frames, format);
81 zero_areas(dvp, ndsts - dst, frames, format);
86 struct snd_pcm_plugin_format *src_format,
87 struct snd_pcm_plugin_format *dst_format,
88 struct snd_pcm_plugin **r_plugin)
90 struct snd_pcm_plugin *plugin;
96 if (
snd_BUG_ON(src_format->rate != dst_format->rate))
98 if (
snd_BUG_ON(src_format->format != dst_format->format))
102 src_format, dst_format, 0, &plugin);
106 plugin->transfer = route_transfer;