FreeBSD kernel sound device code
channel_if.m
Go to the documentation of this file.
1#-
2# KOBJ
3#
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>
7# All rights reserved.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions
11# are met:
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.
17#
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
28# SUCH DAMAGE.
29#
30# $FreeBSD$
31#
32
33#include <dev/sound/pcm/sound.h>
34
35INTERFACE channel;
36
38
39 static int
40 channel_noreset(kobj_t obj, void *data)
41 {
42 return 0;
43 }
44
45 static int
46 channel_noresetdone(kobj_t obj, void *data)
47 {
48 return 0;
49 }
50
51 static int
52 channel_nofree(kobj_t obj, void *data)
53 {
54 return 1;
55 }
56
57 static u_int32_t
58 channel_nogetptr(kobj_t obj, void *data)
59 {
60 return 0;
61 }
62
63 static int
64 channel_nonotify(kobj_t obj, void *data, u_int32_t changed)
65 {
66 return 0;
67 }
68
69 static int
70 channel_nogetpeaks(kobj_t obj, void *data, int *lpeak, int *rpeak)
71 {
72 return -1;
73 }
74
75 static int
76 channel_nogetrates(kobj_t obj, void *data, int **rates)
77 {
78 *rates = NULL;
79 return 0;
80 }
81
82 static int
83 channel_nosetfragments(kobj_t obj, void *data, u_int32_t blocksize, u_int32_t blockcount)
84 {
85 return ENOTSUP;
86 }
87
88 static struct pcmchan_matrix *
89 channel_nogetmatrix(kobj_t obj, void *data, u_int32_t format)
90 {
93 }
94
95 static int
96 channel_nosetmatrix(kobj_t obj, void *data, struct pcmchan_matrix *m)
97 {
98 return ENOTSUP;
99 }
100};
101
102METHOD void* init {
103 kobj_t obj;
104 void *devinfo;
105 struct snd_dbuf *b;
106 struct pcm_channel *c;
107 int dir;
108};
109
110METHOD int free {
111 kobj_t obj;
112 void *data;
114
115METHOD int reset {
116 kobj_t obj;
117 void *data;
119
120METHOD int resetdone {
121 kobj_t obj;
122 void *data;
124
125METHOD int setformat {
126 kobj_t obj;
127 void *data;
128 u_int32_t format;
129};
130
131METHOD u_int32_t setspeed {
132 kobj_t obj;
133 void *data;
134 u_int32_t speed;
135};
136
137METHOD u_int32_t setblocksize {
138 kobj_t obj;
139 void *data;
140 u_int32_t blocksize;
141};
142
143METHOD int setfragments {
144 kobj_t obj;
145 void *data;
146 u_int32_t blocksize;
147 u_int32_t blockcount;
149
150METHOD int trigger {
151 kobj_t obj;
152 void *data;
153 int go;
154};
155
156METHOD u_int32_t getptr {
157 kobj_t obj;
158 void *data;
160
161METHOD struct pcmchan_caps* getcaps {
162 kobj_t obj;
163 void *data;
164};
165
166METHOD int notify {
167 kobj_t obj;
168 void *data;
169 u_int32_t changed;
171
192METHOD int getpeaks {
193 kobj_t obj;
194 void *data;
195 int *lpeak;
196 int *rpeak;
198
217METHOD int getrates {
218 kobj_t obj;
219 void *data;
220 int **rates;
222
223METHOD struct pcmchan_matrix * getmatrix {
224 kobj_t obj;
225 void *data;
226 u_int32_t format;
228
229METHOD int setmatrix {
230 kobj_t obj;
231 void *data;
void * devinfo
Definition: channel_if.m:104
METHOD u_int32_t setblocksize
Definition: channel_if.m:137
struct pcm_channel * c
Definition: channel_if.m:106
u_int32_t format
Definition: channel_if.m:128
METHOD u_int32_t setspeed
Definition: channel_if.m:131
u_int32_t speed
Definition: channel_if.m:134
METHOD int setmatrix
Definition: channel_if.m:229
DEFAULT channel_nosetmatrix
Definition: channel_if.m:233
METHOD int notify
Definition: channel_if.m:166
METHOD int trigger
Definition: channel_if.m:150
METHOD int setfragments
Definition: channel_if.m:143
METHOD int setformat
Definition: channel_if.m:125
METHOD int reset
Definition: channel_if.m:115
METHOD int resetdone
Definition: channel_if.m:120
u_int32_t blockcount
Definition: channel_if.m:147
METHOD struct pcmchan_caps * getcaps
Definition: channel_if.m:161
METHOD int free
Definition: channel_if.m:110
METHOD int getrates
Retrieve discrete supported sample rates.
Definition: channel_if.m:217
DEFAULT channel_noresetdone
Definition: channel_if.m:123
int ** rates
Definition: channel_if.m:220
INTERFACE channel
Definition: channel_if.m:35
DEFAULT channel_nogetrates
Definition: channel_if.m:221
void * data
Definition: channel_if.m:112
METHOD int getpeaks
Retrieve channel peak values.
Definition: channel_if.m:192
int dir
Definition: channel_if.m:107
DEFAULT channel_nonotify
Definition: channel_if.m:170
int go
Definition: channel_if.m:153
METHOD struct pcmchan_matrix * getmatrix
Definition: channel_if.m:223
METHOD u_int32_t getptr
Definition: channel_if.m:156
DEFAULT channel_nogetptr
Definition: channel_if.m:159
DEFAULT channel_nofree
Definition: channel_if.m:113
DEFAULT channel_nogetpeaks
Definition: channel_if.m:197
CODE
Definition: channel_if.m:37
int * lpeak
Definition: channel_if.m:195
DEFAULT channel_nogetmatrix
Definition: channel_if.m:227
u_int32_t blocksize
Definition: channel_if.m:140
DEFAULT channel_noreset
Definition: channel_if.m:118
METHOD void * init
Definition: channel_if.m:102
u_int32_t changed
Definition: channel_if.m:169
DEFAULT channel_nosetfragments
Definition: channel_if.m:148
int * rpeak
Definition: channel_if.m:196
struct pcmchan_matrix * m
Definition: channel_if.m:232
struct snd_dbuf * b
Definition: channel_if.m:105
uint32_t feeder_matrix_default_format(uint32_t)
struct pcmchan_matrix * feeder_matrix_format_map(uint32_t)