4 # Copyright (c) 2005-2009 Ariff Abdullah <ariff@FreeBSD.org>
5 # Portions Copyright (c) Ryan Beasley <ryan.beasley@gmail.com> - GSoC 2006
6 # Copyright (c) 2000 Cameron Grant <cg@FreeBSD.org>
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
18 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 #include <dev/sound/pcm/sound.h>
40 channel_noreset(kobj_t obj, void *data)
46 channel_noresetdone(kobj_t obj, void *data)
52 channel_nofree(kobj_t obj, void *data)
58 channel_nogetptr(kobj_t obj, void *data)
64 channel_nonotify(kobj_t obj, void *data, u_int32_t changed)
70 channel_nogetpeaks(kobj_t obj, void *data, int *lpeak, int *rpeak)
76 channel_nogetrates(kobj_t obj, void *data, int **rates)
83 channel_nosetfragments(kobj_t obj, void *data, u_int32_t blocksize, u_int32_t blockcount)
88 static struct pcmchan_matrix *
89 channel_nogetmatrix(kobj_t obj, void *data, u_int32_t format)
91 format = feeder_matrix_default_format(format);
92 return (feeder_matrix_format_map(format));
96 channel_nosetmatrix(kobj_t obj, void *data, struct pcmchan_matrix *m)
106 struct pcm_channel *c;
113 } DEFAULT channel_nofree;
118 } DEFAULT channel_noreset;
120 METHOD int resetdone {
123 } DEFAULT channel_noresetdone;
125 METHOD int setformat {
131 METHOD u_int32_t setspeed {
137 METHOD u_int32_t setblocksize {
143 METHOD int setfragments {
147 u_int32_t blockcount;
148 } DEFAULT channel_nosetfragments;
156 METHOD u_int32_t getptr {
159 } DEFAULT channel_nogetptr;
161 METHOD struct pcmchan_caps* getcaps {
170 } DEFAULT channel_nonotify;
173 * @brief Retrieve channel peak values
175 * This function is intended to obtain peak volume values for samples
176 * played/recorded on a channel. Values are on a linear scale from 0 to
177 * 32767. If the channel is monaural, a single value should be recorded
180 * If hardware support isn't available, the SNDCTL_DSP_GET[IO]PEAKS
181 * operation should return EINVAL. However, we may opt to provide
182 * software support that the user may toggle via sysctl/mixext.
184 * @param obj standard kobj object (usually @c channel->methods)
185 * @param data driver-specific data (usually @c channel->devinfo)
186 * @param lpeak pointer to store left peak level
187 * @param rpeak pointer to store right peak level
189 * @retval -1 Error; usually operation isn't supported.
192 METHOD int getpeaks {
197 } DEFAULT channel_nogetpeaks;
200 * @brief Retrieve discrete supported sample rates
202 * Some cards operate at fixed rates, and this call is intended to retrieve
203 * those rates primarily for when in-kernel rate adjustment is undesirable
204 * (e.g., application wants direct DMA access after setting a channel to run
207 * The parameter @c rates is a double pointer which will be reset to
208 * point to an array of supported sample rates. The number of elements
209 * in the array is returned to the caller.
211 * @param obj standard kobj object (usually @c channel->methods)
212 * @param data driver-specific data (usually @c channel->devinfo)
213 * @param rates rate array pointer
215 * @return Number of rates in the array
217 METHOD int getrates {
221 } DEFAULT channel_nogetrates;
223 METHOD struct pcmchan_matrix * getmatrix {
227 } DEFAULT channel_nogetmatrix;
229 METHOD int setmatrix {
232 struct pcmchan_matrix *m;
233 } DEFAULT channel_nosetmatrix;