| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: audio.c,v 1.454 2018/05/15 00:28:00 nat Exp $ */ | | 1 | /* $NetBSD: audio.c,v 1.455 2018/05/15 10:23:03 nat Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2016 Nathanial Sloss <nathanialsloss@yahoo.com.au> | | 4 | * Copyright (c) 2016 Nathanial Sloss <nathanialsloss@yahoo.com.au> |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 7 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
8 | * All rights reserved. | | 8 | * All rights reserved. |
9 | * | | 9 | * |
10 | * This code is derived from software contributed to The NetBSD Foundation | | 10 | * This code is derived from software contributed to The NetBSD Foundation |
11 | * by Andrew Doran. | | 11 | * by Andrew Doran. |
12 | * | | 12 | * |
13 | * Redistribution and use in source and binary forms, with or without | | 13 | * Redistribution and use in source and binary forms, with or without |
14 | * modification, are permitted provided that the following conditions | | 14 | * modification, are permitted provided that the following conditions |
| @@ -138,27 +138,27 @@ | | | @@ -138,27 +138,27 @@ |
138 | * query_devinfo - x | | 138 | * query_devinfo - x |
139 | * allocm - - Called at attach time | | 139 | * allocm - - Called at attach time |
140 | * freem - - Called at attach time | | 140 | * freem - - Called at attach time |
141 | * round_buffersize - x | | 141 | * round_buffersize - x |
142 | * mappage - - Mem. unchanged after attach | | 142 | * mappage - - Mem. unchanged after attach |
143 | * get_props - x | | 143 | * get_props - x |
144 | * trigger_output x x | | 144 | * trigger_output x x |
145 | * trigger_input x x | | 145 | * trigger_input x x |
146 | * dev_ioctl - x | | 146 | * dev_ioctl - x |
147 | * get_locks - - Called at attach time | | 147 | * get_locks - - Called at attach time |
148 | */ | | 148 | */ |
149 | | | 149 | |
150 | #include <sys/cdefs.h> | | 150 | #include <sys/cdefs.h> |
151 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.454 2018/05/15 00:28:00 nat Exp $"); | | 151 | __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.455 2018/05/15 10:23:03 nat Exp $"); |
152 | | | 152 | |
153 | #ifdef _KERNEL_OPT | | 153 | #ifdef _KERNEL_OPT |
154 | #include "audio.h" | | 154 | #include "audio.h" |
155 | #include "midi.h" | | 155 | #include "midi.h" |
156 | #endif | | 156 | #endif |
157 | | | 157 | |
158 | #if NAUDIO > 0 | | 158 | #if NAUDIO > 0 |
159 | | | 159 | |
160 | #include <sys/types.h> | | 160 | #include <sys/types.h> |
161 | #include <sys/param.h> | | 161 | #include <sys/param.h> |
162 | #include <sys/ioctl.h> | | 162 | #include <sys/ioctl.h> |
163 | #include <sys/fcntl.h> | | 163 | #include <sys/fcntl.h> |
164 | #include <sys/file.h> | | 164 | #include <sys/file.h> |
| @@ -4557,26 +4557,27 @@ audiosetinfo(struct audio_softc *sc, str | | | @@ -4557,26 +4557,27 @@ audiosetinfo(struct audio_softc *sc, str |
4557 | DPRINTF(("%s sc=%p ai=%p\n", __func__, sc, ai)); | | 4557 | DPRINTF(("%s sc=%p ai=%p\n", __func__, sc, ai)); |
4558 | r = &ai->record; | | 4558 | r = &ai->record; |
4559 | p = &ai->play; | | 4559 | p = &ai->play; |
4560 | rbus = vc->sc_rbus; | | 4560 | rbus = vc->sc_rbus; |
4561 | pbus = vc->sc_pbus; | | 4561 | pbus = vc->sc_pbus; |
4562 | error = 0; | | 4562 | error = 0; |
4563 | cleared = false; | | 4563 | cleared = false; |
4564 | modechange = false; | | 4564 | modechange = false; |
4565 | pausechange = false; | | 4565 | pausechange = false; |
4566 | | | 4566 | |
4567 | pp = vc->sc_pparams; /* Temporary encoding storage in */ | | 4567 | pp = vc->sc_pparams; /* Temporary encoding storage in */ |
4568 | rp = vc->sc_rparams; /* case setting the modes fails. */ | | 4568 | rp = vc->sc_rparams; /* case setting the modes fails. */ |
4569 | nr = np = 0; | | 4569 | nr = np = 0; |
| | | 4570 | setmode = 0; |
4570 | | | 4571 | |
4571 | if (vc == &sc->sc_mixring) | | 4572 | if (vc == &sc->sc_mixring) |
4572 | goto done; | | 4573 | goto done; |
4573 | | | 4574 | |
4574 | if (SPECIFIED(p->sample_rate)) { | | 4575 | if (SPECIFIED(p->sample_rate)) { |
4575 | pp.sample_rate = p->sample_rate; | | 4576 | pp.sample_rate = p->sample_rate; |
4576 | np++; | | 4577 | np++; |
4577 | } | | 4578 | } |
4578 | if (SPECIFIED(r->sample_rate)) { | | 4579 | if (SPECIFIED(r->sample_rate)) { |
4579 | rp.sample_rate = r->sample_rate; | | 4580 | rp.sample_rate = r->sample_rate; |
4580 | nr++; | | 4581 | nr++; |
4581 | } | | 4582 | } |
4582 | if (SPECIFIED(p->encoding)) { | | 4583 | if (SPECIFIED(p->encoding)) { |
| @@ -4614,27 +4615,26 @@ audiosetinfo(struct audio_softc *sc, str | | | @@ -4614,27 +4615,26 @@ audiosetinfo(struct audio_softc *sc, str |
4614 | np = 0; | | 4615 | np = 0; |
4615 | | | 4616 | |
4616 | #ifdef AUDIO_DEBUG | | 4617 | #ifdef AUDIO_DEBUG |
4617 | if (audiodebug && nr > 0) | | 4618 | if (audiodebug && nr > 0) |
4618 | audio_print_params("audiosetinfo() Setting record params:", &rp); | | 4619 | audio_print_params("audiosetinfo() Setting record params:", &rp); |
4619 | if (audiodebug && np > 0) | | 4620 | if (audiodebug && np > 0) |
4620 | audio_print_params("audiosetinfo() Setting play params:", &pp); | | 4621 | audio_print_params("audiosetinfo() Setting play params:", &pp); |
4621 | #endif | | 4622 | #endif |
4622 | if (nr > 0 && (error = audio_check_params(&rp))) | | 4623 | if (nr > 0 && (error = audio_check_params(&rp))) |
4623 | return error; | | 4624 | return error; |
4624 | if (np > 0 && (error = audio_check_params(&pp))) | | 4625 | if (np > 0 && (error = audio_check_params(&pp))) |
4625 | return error; | | 4626 | return error; |
4626 | | | 4627 | |
4627 | setmode = 0; | | | |
4628 | if (nr > 0) { | | 4628 | if (nr > 0) { |
4629 | if (!cleared) { | | 4629 | if (!cleared) { |
4630 | audio_clear_intr_unlocked(sc, vc); | | 4630 | audio_clear_intr_unlocked(sc, vc); |
4631 | cleared = true; | | 4631 | cleared = true; |
4632 | } | | 4632 | } |
4633 | modechange = true; | | 4633 | modechange = true; |
4634 | setmode |= AUMODE_RECORD; | | 4634 | setmode |= AUMODE_RECORD; |
4635 | } | | 4635 | } |
4636 | if (np > 0) { | | 4636 | if (np > 0) { |
4637 | if (!cleared) { | | 4637 | if (!cleared) { |
4638 | audio_clear_intr_unlocked(sc, vc); | | 4638 | audio_clear_intr_unlocked(sc, vc); |
4639 | cleared = true; | | 4639 | cleared = true; |
4640 | } | | 4640 | } |