Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libossaudio ossaudio(3): these ioctls need to return sam...



details:   https://anonhg.NetBSD.org/src/rev/bd41a35fea5f
branches:  trunk
changeset: 945037:bd41a35fea5f
user:      nia <nia%NetBSD.org@localhost>
date:      Mon Oct 19 09:07:29 2020 +0000

description:
ossaudio(3): these ioctls need to return samples, not bytes

diffstat:

 lib/libossaudio/ossaudio.c |  20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diffs (48 lines):

diff -r 38fb13718964 -r bd41a35fea5f lib/libossaudio/ossaudio.c
--- a/lib/libossaudio/ossaudio.c        Mon Oct 19 09:01:24 2020 +0000
+++ b/lib/libossaudio/ossaudio.c        Mon Oct 19 09:07:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ossaudio.c,v 1.50 2020/10/19 09:01:24 nia Exp $        */
+/*     $NetBSD: ossaudio.c,v 1.51 2020/10/19 09:07:29 nia Exp $        */
 
 /*-
  * Copyright (c) 1997, 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: ossaudio.c,v 1.50 2020/10/19 09:01:24 nia Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.51 2020/10/19 09:07:29 nia Exp $");
 
 /*
  * This is an Open Sound System compatibility layer, which provides
@@ -584,8 +584,12 @@
                        return retval;
                /* XXX: 'samples' may wrap */
                memset(osscount.filler, 0, sizeof(osscount.filler));
-               osscount.samples = tmpinfo.record.samples;
-               osscount.fifo_samples = tmpinfo.record.seek;
+               osscount.samples = tmpinfo.record.samples /
+                   ((tmpinfo.record.precision / NBBY) *
+                       tmpinfo.record.channels);
+               osscount.fifo_samples = tmpinfo.record.seek /
+                   ((tmpinfo.record.precision / NBBY) *
+                       tmpinfo.record.channels);
                *(oss_count_t *)argp = osscount;
                break;
        case SNDCTL_DSP_GETOPTR:
@@ -603,8 +607,12 @@
                        return retval;
                /* XXX: 'samples' may wrap */
                memset(osscount.filler, 0, sizeof(osscount.filler));
-               osscount.samples = tmpinfo.play.samples;
-               osscount.fifo_samples = tmpinfo.play.seek;
+               osscount.samples = tmpinfo.play.samples /
+                   ((tmpinfo.play.precision / NBBY) *
+                       tmpinfo.play.channels);
+               osscount.fifo_samples = tmpinfo.play.seek /
+                   ((tmpinfo.play.precision / NBBY) *
+                       tmpinfo.play.channels);
                *(oss_count_t *)argp = osscount;
                break;
        case SNDCTL_DSP_SETPLAYVOL:



Home | Main Index | Thread Index | Old Index