4 # Copyright (c) 2000 Cameron Grant <cg@freebsd.org>
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #include <dev/sound/pcm/sound.h>
38 channel_nosetdir(kobj_t obj, void *data, int dir)
44 channel_noreset(kobj_t obj, void *data)
50 channel_noresetdone(kobj_t obj, void *data)
56 channel_nofree(kobj_t obj, void *data)
62 channel_nogetptr(kobj_t obj, void *data)
68 channel_nonotify(kobj_t obj, void *data, u_int32_t changed)
74 channel_nogetpeaks(kobj_t obj, void *data, int *lpeak, int *rpeak)
80 channel_nogetrates(kobj_t obj, void *data, int **rates)
87 channel_nosetfragments(kobj_t obj, void *data, u_int32_t blocksize, u_int32_t blockcount)
98 struct pcm_channel *c;
105 } DEFAULT channel_nofree;
110 } DEFAULT channel_noreset;
112 METHOD int resetdone {
115 } DEFAULT channel_noresetdone;
121 } DEFAULT channel_nosetdir;
123 METHOD u_int32_t setformat {
129 METHOD u_int32_t setspeed {
135 METHOD u_int32_t setblocksize {
141 METHOD int setfragments {
145 u_int32_t blockcount;
146 } DEFAULT channel_nosetfragments;
154 METHOD u_int32_t getptr {
157 } DEFAULT channel_nogetptr;
159 METHOD struct pcmchan_caps* getcaps {
168 } DEFAULT channel_nonotify;
171 * @brief Retrieve channel peak values
173 * This function is intended to obtain peak volume values for samples
174 * played/recorded on a channel. Values are on a linear scale from 0 to
175 * 32767. If the channel is monaural, a single value should be recorded
178 * If hardware support isn't available, the SNDCTL_DSP_GET[IO]PEAKS
179 * operation should return EINVAL. However, we may opt to provide
180 * software support that the user may toggle via sysctl/mixext.
182 * @param obj standard kobj object (usually @c channel->methods)
183 * @param data driver-specific data (usually @c channel->devinfo)
184 * @param lpeak pointer to store left peak level
185 * @param rpeak pointer to store right peak level
187 * @retval -1 Error; usually operation isn't supported.
190 METHOD int getpeaks {
195 } DEFAULT channel_nogetpeaks;
198 * @brief Retrieve discrete supported sample rates
200 * Some cards operate at fixed rates, and this call is intended to retrieve
201 * those rates primarily for when in-kernel rate adjustment is undesirable
202 * (e.g., application wants direct DMA access after setting a channel to run
205 * The parameter @c rates is a double pointer which will be reset to
206 * point to an array of supported sample rates. The number of elements
207 * in the array is returned to the caller.
209 * @param obj standard kobj object (usually @c channel->methods)
210 * @param data driver-specific data (usually @c channel->devinfo)
211 * @param rates rate array pointer
213 * @return Number of rates in the array
215 METHOD int getrates {
219 } DEFAULT channel_nogetrates;