The following patch fixes the following problem: sound drowned
out by loud pulses when recording via oss-emulation if doing
channel reduction (in my case, 2 channels -> 1 channel).
There were three mistakes in the code:
(1) A typo (src_channels rather than src_channel) in route.c.
This was not serious, it meant that two copies of the first
channel was used for reduction rather than one copy of each
channel.
(2) A thinko (just one element rather than all of an array copied)
in route.c. This meant that incorrect weights were being used
for channel reduction, causing junk to be output. My fix may
not be in accordance with whatever your coding style is.
(3) A typo (src_format rather than dst_format) in pcm_oss.c.
This meant that too few frames were being read, leaving the
end of the buffer filled with junk.
All the best,
Duncan.
diff -urN alsa-driver/kernel/oss/pcm_oss.c alsa-driver2/kernel/oss/pcm_oss.c
--- alsa-driver/kernel/oss/pcm_oss.c Thu Aug 30 09:16:18 2001
+++ alsa-driver2/kernel/oss/pcm_oss.c Fri Sep 14 14:16:52 2001
@@ -664,7 +664,7 @@
char *final_dst = buf;
if (runtime->oss.plugin_first) {
snd_pcm_plugin_channel_t *channels;
- size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width *
runtime->oss.plugin_last->src_format.channels) / 8;
+ size_t oss_frame_bytes = (runtime->oss.plugin_last->dst_width *
runtime->oss.plugin_last->dst_format.channels) / 8;
if (!in_kernel)
buf = runtime->oss.buffer;
frames = bytes / oss_frame_bytes;
diff -urN alsa-driver/kernel/oss/route.c alsa-driver2/kernel/oss/route.c
--- alsa-driver/kernel/oss/route.c Wed May 9 22:09:48 2001
+++ alsa-driver2/kernel/oss/route.c Fri Sep 14 09:41:14 2001
@@ -187,7 +187,7 @@
const snd_pcm_plugin_channel_t *src_channel =
&src_channels[ttable->srcs[srcidx].channel];
if (!src_channel->enabled)
continue;
- srcs[srcidx1] = src_channel->area.addr + src_channels->area.first / 8;
+ srcs[srcidx1] = src_channel->area.addr + src_channel->area.first / 8;
src_steps[srcidx1] = src_channel->area.step / 8;
src_tt[srcidx1] = ttable->srcs[srcidx];
srcidx1++;
@@ -454,8 +454,10 @@
else
dptr->func = route_to_channel;
if (nsrcs > 0) {
+ int srcidx;
dptr->srcs = snd_kcalloc(nsrcs * sizeof(*srcs), GFP_KERNEL);
- *dptr->srcs = *srcs;
+ for(srcidx = 0; srcidx < nsrcs; srcidx++)
+ dptr->srcs[srcidx] = srcs[srcidx];
} else
dptr->srcs = 0;
dptr++;
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel