diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-03-22 07:48:59 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-03-22 07:48:59 +0000 |
commit | 49820f3b84d10e6a36681c2ef114f41c0a10c9ec (patch) | |
tree | 35a58058bb22d78151292ab0b1b3b930a18b94eb | |
parent | 08530e953d6381f4029f85ac85c15a6deac4d800 (diff) |
when setting the block size, use the scale factor only once in
audiosetinfo(), so the block size don't get scaled twice. Also fix the
formula used in audiosetinfo().
ok jakemsr
-rw-r--r-- | sys/dev/audio.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c index f38c1f34b07..4c621a04437 100644 --- a/sys/dev/audio.c +++ b/sys/dev/audio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audio.c,v 1.91 2008/03/12 20:33:13 ratchov Exp $ */ +/* $OpenBSD: audio.c,v 1.92 2008/03/22 07:48:58 ratchov Exp $ */ /* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */ /* @@ -1350,7 +1350,7 @@ audio_set_blksize(struct audio_softc *sc, int mode, int fpb) { rb = &sc->sc_rr; } - fs = parm->channels * parm->precision / NBBY * parm->factor; + fs = parm->channels * parm->precision / NBBY; bs = fpb * fs; maxbs = rb->bufsize / 2; if (bs > maxbs) @@ -2746,8 +2746,8 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai) if (ai->blocksize == ~0 || ai->blocksize == 0) { fpb = rp.sample_rate * audio_blk_ms / 1000; } else { - fs = rp.channels * (rp.precision / 8) * rp.factor; - fpb = ai->blocksize / fs; + fs = rp.channels * (rp.precision / 8); + fpb = (ai->blocksize * rp.factor) / fs; } if (sc->sc_blkset == 0) audio_set_blksize(sc, AUMODE_RECORD, fpb); @@ -2756,8 +2756,8 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai) if (ai->blocksize == ~0 || ai->blocksize == 0) { fpb = pp.sample_rate * audio_blk_ms / 1000; } else { - fs = pp.channels * (pp.precision / 8) * pp.factor; - fpb = ai->blocksize / fs; + fs = pp.channels * (pp.precision / 8); + fpb = (ai->blocksize * pp.factor) / fs; } if (sc->sc_blkset == 0) audio_set_blksize(sc, AUMODE_PLAY, fpb); |