summaryrefslogtreecommitdiffstats
path: root/sys/dev/audio.c
diff options
context:
space:
mode:
authorjakemsr <jakemsr@openbsd.org>2007-07-17 22:59:19 +0000
committerjakemsr <jakemsr@openbsd.org>2007-07-17 22:59:19 +0000
commit04f3219a0ba8494ff8d02bdadf91d2ec80796942 (patch)
treeb151b739ba066a05bbe1701b876252b1a217fba4 /sys/dev/audio.c
parentemu(4) works on sgi. (diff)
downloadwireguard-openbsd-04f3219a0ba8494ff8d02bdadf91d2ec80796942.tar.xz
wireguard-openbsd-04f3219a0ba8494ff8d02bdadf91d2ec80796942.zip
more places where the difference between the hardware sample size
and the userland sample size matters. there may be different sample size factors for play and record, so use the appropriate factor when userland sets the blocksize. the reported blocksize, hiwat and lowat are only for the play buffer. IMO, it would be good to report the record blocksize, hiwat and lowat as well, but that is another issue. tested with emu(4) and an auvia(4) modified to only do stereo in hardware.
Diffstat (limited to 'sys/dev/audio.c')
-rw-r--r--sys/dev/audio.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 40e4112abd7..02eb1c213b3 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio.c,v 1.65 2007/07/17 10:35:10 jakemsr Exp $ */
+/* $OpenBSD: audio.c,v 1.66 2007/07/17 22:59:19 jakemsr Exp $ */
/* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */
/*
@@ -2643,10 +2643,14 @@ audiosetinfo(struct audio_softc *sc, struct audio_info *ai)
audio_calc_blksize(sc, AUMODE_PLAY);
sc->sc_blkset = 0;
} else {
- int bs = ai->blocksize;
- if (hw->round_blocksize)
- bs = hw->round_blocksize(sc->hw_hdl, bs);
- sc->sc_pr.blksize = sc->sc_rr.blksize = bs;
+ int rbs = ai->blocksize * sc->sc_rparams.factor;
+ int pbs = ai->blocksize * sc->sc_pparams.factor;
+ if (hw->round_blocksize) {
+ rbs = hw->round_blocksize(sc->hw_hdl, rbs);
+ pbs = hw->round_blocksize(sc->hw_hdl, pbs);
+ }
+ sc->sc_rr.blksize = rbs;
+ sc->sc_pr.blksize = pbs;
sc->sc_blkset = 1;
}
}
@@ -2748,8 +2752,8 @@ audiogetinfo(struct audio_softc *sc, struct audio_info *ai)
} else
ai->monitor_gain = 0;
- p->seek = sc->sc_pr.used;
- r->seek = sc->sc_rr.used;
+ p->seek = sc->sc_pr.used / sc->sc_pparams.factor;
+ r->seek = sc->sc_rr.used / sc->sc_rparams.factor;
p->samples = sc->sc_pr.stamp - sc->sc_pr.drops;
r->samples = sc->sc_rr.stamp - sc->sc_rr.drops;
@@ -2771,10 +2775,10 @@ audiogetinfo(struct audio_softc *sc, struct audio_info *ai)
p->active = sc->sc_pbus;
r->active = sc->sc_rbus;
- p->buffer_size = sc->sc_pr.bufsize;
- r->buffer_size = sc->sc_rr.bufsize;
+ p->buffer_size = sc->sc_pr.bufsize / sc->sc_pparams.factor;
+ r->buffer_size = sc->sc_rr.bufsize / sc->sc_rparams.factor;
- if ((ai->blocksize = sc->sc_pr.blksize) != 0) {
+ if ((ai->blocksize = sc->sc_pr.blksize / sc->sc_pparams.factor) != 0) {
ai->hiwat = sc->sc_pr.usedhigh / sc->sc_pr.blksize;
ai->lowat = sc->sc_pr.usedlow / sc->sc_pr.blksize;
} else {