SBC driver

Hans Petter Selasky hselasky at c2i.net
Sat Dec 23 03:19:43 PST 2006


On Friday 22 December 2006 11:30, Hans Petter Selasky wrote:
> Hi,
>
> I installed FreeBSD 6.2 BETA3 on a box with a soundcard that is detected as
> "sbc0:". After some while of playing sound, it suddenly turns into white
> noise. I think this is because of some buffer underrun, hence the computer
> is not so fast, and it is running KDE, and the byte sync is lost.
>
> In the following piece of code:
>
> int
> sndbuf_dmaptr(struct snd_dbuf *b)
> {
>         int i;
>
>         KASSERT(b, ("sndbuf_dmaptr called with b == NULL"));
>         KASSERT(sndbuf_getflags(b) & SNDBUF_F_DMA, ("sndbuf_dmaptr called
> on non-ISA buffer"));
>
>         if (!sndbuf_runsz(b))
>                 return 0;
>         i = isa_dmastatus(b->dmachan);
>         KASSERT(i >= 0, ("isa_dmastatus returned %d", i));
>         return b->bufsize - i;
> }
>

I tried out the following patch, and it didn't work. It only made it worse. 
The sound works OK under XMMS and Amarok, but under Artsd it can suddenly all 
turn into white noise. Then in the end when the sound becomes more quiet, you 
can hear something again. So I think that there is a byte swap, in the 16-bit 
samples, or something else is wrong.

> Can it be a good idea to align "i" for 16-bit stereo?
>
>         i = isa_dmastatus(b->dmachan) & ~3;
>
> Or even a little bit more:
>
>         i = isa_dmastatus(b->dmachan) & ~7;
>
> So that one doesn't write 1 byte, then it underruns, and then one write 3
> bytes at the new position?
>

Yours
--HPS


More information about the freebsd-multimedia mailing list