• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Mixer Interface - simple abstact module - base library
3  *  Copyright (c) 2005 by Jaroslav Kysela <perex@perex.cz>
4  *
5  *
6  *   This library is free software; you can redistribute it and/or modify
7  *   it under the terms of the GNU Lesser General Public License as
8  *   published by the Free Software Foundation; either version 2.1 of
9  *   the License, or (at your option) any later version.
10  *
11  *   This program is distributed in the hope that it will be useful,
12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *   GNU Lesser General Public License for more details.
15  *
16  *   You should have received a copy of the GNU Lesser General Public
17  *   License along with this library; if not, write to the Free Software
18  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21 
22 #ifndef __SMIXER_BASE_H
23 
24 #include "list.h"
25 
26 #define MAX_CHANNEL	6
27 
28 #define SID_MASTER	0
29 #define SID_HEADPHONE	1
30 #define SID_FRONT	2
31 #define SID_PCM		3
32 #define SID_CD		4
33 
34 struct melem_sids {
35 	unsigned short sid;
36 	const char *sname;
37 	unsigned short sindex;
38 	unsigned short weight;
39 	unsigned int chanmap[2];
40 	struct sm_elem_ops *sops;
41 };
42 
43 #define PURPOSE_VOLUME		0
44 #define PURPOSE_SWITCH		1
45 #define PURPOSE_ENUMLIST	2
46 
47 struct helem_selector {
48 	snd_ctl_elem_iface_t iface;
49 	const char *name;
50 	unsigned short index;
51 	unsigned short sid;
52 	unsigned short purpose;
53 	unsigned short caps;
54 };
55 
56 struct helem_base {
57 	struct list_head list;
58 	snd_hctl_elem_t *helem;
59 	unsigned short purpose;
60 	unsigned int caps;
61 	unsigned int inactive: 1;
62 	long min, max;
63 	unsigned int count;
64 };
65 
66 struct selem_base {
67 	sm_selem_t selem;
68 	struct list_head helems;
69 	unsigned short sid;
70 	struct {
71 		unsigned int chanmap;
72 		unsigned int forced_range: 1;
73 		long min, max;
74 		long vol[MAX_CHANNEL];
75 	} dir[2];
76 };
77 
78 struct bclass_selector {
79 	struct list_head list;
80 	struct helem_selector *selectors;
81 	unsigned int count;
82 };
83 
84 struct bclass_sid {
85 	struct list_head list;
86 	struct melem_sids *sids;
87 	unsigned int count;
88 };
89 
90 typedef struct bclass_base_ops {
91 	int (*event)(snd_mixer_class_t *class, unsigned int mask,
92 		     snd_hctl_elem_t *helem, snd_mixer_elem_t *melem);
93 	int (*selreg)(snd_mixer_class_t *class,
94 		      struct helem_selector *selectors,
95 		      unsigned int count);
96 	int (*sidreg)(snd_mixer_class_t *class,
97 		      struct melem_sids *sids,
98 		      unsigned int count);
99 } bclass_base_ops_t;
100 
101 struct bclass_private {
102 	struct list_head selectors;
103 	struct list_head sids;
104 	void *dl_sbase;
105 	bclass_base_ops_t ops;
106 };
107 
108 int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
109 			      bclass_base_ops_t **ops);
110 
111 #endif /* __SMIXER_BASE_H */
112