diff options
author | cg <cg@FreeBSD.org> | 2000-12-23 03:16:13 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2000-12-23 03:16:13 +0000 |
commit | d0b795f25b705ff883368ba3e49f31c3541d3b11 (patch) | |
tree | 076eb63fe5bbf4764062f83df117a0ee11cfc3ed /sys/dev/sound/pci/csapcm.c | |
parent | 818087b543b4be6d1211cb39cb7b7204e9ae9f6c (diff) | |
download | FreeBSD-src-d0b795f25b705ff883368ba3e49f31c3541d3b11.zip FreeBSD-src-d0b795f25b705ff883368ba3e49f31c3541d3b11.tar.gz |
update code dealing with snd_dbuf objects to do so using a functional interface
modify chn_setblocksize() to pick a default soft-blocksize appropriate to the
sample rate and format in use. it will aim for a power of two size small
enough to generate block sizes of at most 20ms. it will also set the
hard-blocksize taking into account rate/format conversions in use.
update drivers to implement setblocksize correctly:
updated, tested: sb16, emu10k1, maestro, solo
updated, untested: ad1816, ess, mss, sb8, csa
not updated: ds1, es137x, fm801, neomagic, t4dwave, via82c686
i lack hardware to test: ad1816, csa, fm801, neomagic
others will be updated/tested in the next few days.
Diffstat (limited to 'sys/dev/sound/pci/csapcm.c')
-rw-r--r-- | sys/dev/sound/pci/csapcm.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/sys/dev/sound/pci/csapcm.c b/sys/dev/sound/pci/csapcm.c index c3ae93e..8bad7b5 100644 --- a/sys/dev/sound/pci/csapcm.c +++ b/sys/dev/sound/pci/csapcm.c @@ -523,8 +523,7 @@ csachan_init(kobj_t obj, void *devinfo, snd_dbuf *b, pcm_channel *c, int dir) ch->parent = csa; ch->channel = c; ch->buffer = b; - ch->buffer->bufsize = CS461x_BUFFSIZE; - if (chn_allocbuf(ch->buffer, csa->parent_dmat) == -1) return NULL; + if (sndbuf_alloc(ch->buffer, csa->parent_dmat, CS461x_BUFFSIZE) == -1) return NULL; return ch; } @@ -538,9 +537,9 @@ csachan_setdir(kobj_t obj, void *data, int dir) resp = &csa->res; if (dir == PCMDIR_PLAY) - csa_writemem(resp, BA1_PBA, vtophys(ch->buffer->buf)); + csa_writemem(resp, BA1_PBA, vtophys(sndbuf_getbuf(ch->buffer))); else - csa_writemem(resp, BA1_CBA, vtophys(ch->buffer->buf)); + csa_writemem(resp, BA1_CBA, vtophys(sndbuf_getbuf(ch->buffer))); ch->dir = dir; return 0; } @@ -606,12 +605,7 @@ csachan_setspeed(kobj_t obj, void *data, u_int32_t speed) static int csachan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize) { -#if notdef - return blocksize; -#else - struct csa_chinfo *ch = data; - return ch->buffer->bufsize / 2; -#endif /* notdef */ + return CS461x_BUFFSIZE / 2; } static int @@ -648,11 +642,11 @@ csachan_getptr(kobj_t obj, void *data) resp = &csa->res; if (ch->dir == PCMDIR_PLAY) { - ptr = csa_readmem(resp, BA1_PBA) - vtophys(ch->buffer->buf); + ptr = csa_readmem(resp, BA1_PBA) - vtophys(sndbuf_getbuf(ch->buffer)); if ((ch->fmt & AFMT_U8) != 0 || (ch->fmt & AFMT_S8) != 0) ptr >>= 1; } else { - ptr = csa_readmem(resp, BA1_CBA) - vtophys(ch->buffer->buf); + ptr = csa_readmem(resp, BA1_CBA) - vtophys(sndbuf_getbuf(ch->buffer)); if ((ch->fmt & AFMT_U8) != 0 || (ch->fmt & AFMT_S8) != 0) ptr >>= 1; } |