summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-08 07:44:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-01-08 07:44:57 +0000
commit6c52914c1f14b56640f7bcde297a4d85330779a4 (patch)
tree9d8ab9e7d7707b7cd429e1c9d20a729bb40136d7 /sys/dev
parent5206e2dfad8c881637d2223553b5c424c3ef2979 (diff)
from netbsd; Make the block size always a whole number of samples
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/audio.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 1ba137da917..123faa0fe78 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.11 1995/07/19 19:58:16 brezak Exp $ */
+/* $NetBSD: audio.c,v 1.14 1996/01/07 06:21:02 mycroft Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@@ -31,7 +31,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
*/
/*
@@ -809,18 +808,17 @@ audio_calc_blksize(sc)
struct audio_hw_if *hw = sc->hw_if;
int bs;
- bs = hw->get_precision(sc->hw_hdl) / NBBY;
- bs = hw->get_out_sr(sc->hw_hdl) * audio_blk_ms * bs / 1000;
+ bs = hw->get_out_sr(sc->hw_hdl) * audio_blk_ms / 1000;
+ if (bs == 0)
+ bs = 1;
bs *= hw->get_channels(sc->hw_hdl);
+ bs *= hw->get_precision(sc->hw_hdl) / NBBY;
if (bs > AU_RING_SIZE/2)
bs = AU_RING_SIZE/2;
bs = hw->round_blocksize(sc->hw_hdl, bs);
if (bs > AU_RING_SIZE)
bs = AU_RING_SIZE;
- bs &= ~1; /* make it even, in case of stereo */
- if (bs == 0)
- bs = 2;
return(bs);
}