| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ossaudio.c,v 1.43 2020/04/19 13:44:50 nia Exp $ */ | | 1 | /* $NetBSD: ossaudio.c,v 1.44 2020/04/20 12:01:44 nia Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -17,27 +17,27 @@ | | | @@ -17,27 +17,27 @@ |
17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
26 | * POSSIBILITY OF SUCH DAMAGE. | | 26 | * POSSIBILITY OF SUCH DAMAGE. |
27 | */ | | 27 | */ |
28 | | | 28 | |
29 | #include <sys/cdefs.h> | | 29 | #include <sys/cdefs.h> |
30 | __RCSID("$NetBSD: ossaudio.c,v 1.43 2020/04/19 13:44:50 nia Exp $"); | | 30 | __RCSID("$NetBSD: ossaudio.c,v 1.44 2020/04/20 12:01:44 nia Exp $"); |
31 | | | 31 | |
32 | /* | | 32 | /* |
33 | * This is an OSS (Linux) sound API emulator. | | 33 | * This is an OSS (Linux) sound API emulator. |
34 | * It provides the essentials of the API. | | 34 | * It provides the essentials of the API. |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | /* XXX This file is essentially the same as sys/compat/ossaudio.c. | | 37 | /* XXX This file is essentially the same as sys/compat/ossaudio.c. |
38 | * With some preprocessor magic it could be the same file. | | 38 | * With some preprocessor magic it could be the same file. |
39 | */ | | 39 | */ |
40 | | | 40 | |
41 | #include <string.h> | | 41 | #include <string.h> |
42 | #include <sys/types.h> | | 42 | #include <sys/types.h> |
43 | #include <sys/ioctl.h> | | 43 | #include <sys/ioctl.h> |
| @@ -584,27 +584,27 @@ audio_ioctl(int fd, unsigned long com, v | | | @@ -584,27 +584,27 @@ audio_ioctl(int fd, unsigned long com, v |
584 | | | 584 | |
585 | snprintf(tmpaudioinfo->devnode, OSS_DEVNODE_SIZE, | | 585 | snprintf(tmpaudioinfo->devnode, OSS_DEVNODE_SIZE, |
586 | "/dev/audio%d", tmpaudioinfo->dev); | | 586 | "/dev/audio%d", tmpaudioinfo->dev); |
587 | | | 587 | |
588 | retval = ioctl(fd, AUDIO_GETDEV, &tmpaudiodev); | | 588 | retval = ioctl(fd, AUDIO_GETDEV, &tmpaudiodev); |
589 | if (retval < 0) | | 589 | if (retval < 0) |
590 | return retval; | | 590 | return retval; |
591 | retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); | | 591 | retval = ioctl(fd, AUDIO_GETINFO, &tmpinfo); |
592 | if (retval < 0) | | 592 | if (retval < 0) |
593 | return retval; | | 593 | return retval; |
594 | retval = ioctl(fd, AUDIO_GETPROPS, &idata); | | 594 | retval = ioctl(fd, AUDIO_GETPROPS, &idata); |
595 | if (retval < 0) | | 595 | if (retval < 0) |
596 | return retval; | | 596 | return retval; |
597 | idat = DSP_CAP_TRIGGER; /* pretend we have trigger */ | | 597 | idat = DSP_CAP_TRIGGER; |
598 | if (idata & AUDIO_PROP_FULLDUPLEX) | | 598 | if (idata & AUDIO_PROP_FULLDUPLEX) |
599 | idat |= DSP_CAP_DUPLEX; | | 599 | idat |= DSP_CAP_DUPLEX; |
600 | if (idata & AUDIO_PROP_MMAP) | | 600 | if (idata & AUDIO_PROP_MMAP) |
601 | idat |= DSP_CAP_MMAP; | | 601 | idat |= DSP_CAP_MMAP; |
602 | idat = PCM_CAP_INPUT | PCM_CAP_OUTPUT; | | 602 | idat = PCM_CAP_INPUT | PCM_CAP_OUTPUT; |
603 | strlcpy(tmpaudioinfo->name, tmpaudiodev.name, | | 603 | strlcpy(tmpaudioinfo->name, tmpaudiodev.name, |
604 | sizeof tmpaudioinfo->name); | | 604 | sizeof tmpaudioinfo->name); |
605 | tmpaudioinfo->busy = tmpinfo.play.open; | | 605 | tmpaudioinfo->busy = tmpinfo.play.open; |
606 | tmpaudioinfo->pid = -1; | | 606 | tmpaudioinfo->pid = -1; |
607 | tmpaudioinfo->caps = idat; | | 607 | tmpaudioinfo->caps = idat; |
608 | ioctl(fd, SNDCTL_DSP_GETFMTS, &tmpaudioinfo->iformats); | | 608 | ioctl(fd, SNDCTL_DSP_GETFMTS, &tmpaudioinfo->iformats); |
609 | tmpaudioinfo->oformats = tmpaudioinfo->iformats; | | 609 | tmpaudioinfo->oformats = tmpaudioinfo->iformats; |
610 | tmpaudioinfo->magic = -1; | | 610 | tmpaudioinfo->magic = -1; |