• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Mixer Interface - local header file
3  *  Copyright (c) 2000 by Jaroslav Kysela <perex@perex.cz>
4  *  Copyright (c) 2001 by Abramo Bagnara <abramo@alsa-project.org>
5  *
6  *
7  *   This library is free software; you can redistribute it and/or modify
8  *   it under the terms of the GNU Lesser General Public License as
9  *   published by the Free Software Foundation; either version 2.1 of
10  *   the License, or (at your option) any later version.
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU Lesser General Public License for more details.
16  *
17  *   You should have received a copy of the GNU Lesser General Public
18  *   License along with this library; if not, write to the Free Software
19  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20  *
21  */
22 
23 #include "local.h"
24 
25 typedef struct _bag1 {
26 	void *ptr;
27 	struct list_head list;
28 } bag1_t;
29 
30 typedef struct list_head bag_t;
31 
32 int bag_new(bag_t **bag);
33 void bag_free(bag_t *bag);
34 int bag_add(bag_t *bag, void *ptr);
35 int bag_del(bag_t *bag, void *ptr);
36 int bag_empty(bag_t *bag);
37 void bag_del_all(bag_t *bag);
38 
39 typedef struct list_head *bag_iterator_t;
40 
41 #define bag_iterator_entry(i) (list_entry((i), bag1_t, list)->ptr)
42 #define bag_for_each(pos, bag) list_for_each(pos, bag)
43 #define bag_for_each_safe(pos, next, bag) list_for_each_safe(pos, next, bag)
44 
45 struct _snd_mixer_class {
46 	struct list_head list;
47 	snd_mixer_t *mixer;
48 	snd_mixer_event_t event;
49 	void *private_data;
50 	void (*private_free)(snd_mixer_class_t *class);
51 	snd_mixer_compare_t compare;
52 };
53 
54 struct _snd_mixer_elem {
55 	snd_mixer_elem_type_t type;
56 	struct list_head list;		/* links for list of all elems */
57 	snd_mixer_class_t *class;
58 	void *private_data;
59 	void (*private_free)(snd_mixer_elem_t *elem);
60 	snd_mixer_elem_callback_t callback;
61 	void *callback_private;
62 	bag_t helems;
63 	int compare_weight;		/* compare weight (reversed) */
64 };
65 
66 struct _snd_mixer {
67 	struct list_head slaves;	/* list of all slaves */
68 	struct list_head classes;	/* list of all elem classes */
69 	struct list_head elems;		/* list of all elems */
70 	snd_mixer_elem_t **pelems;	/* array of all elems */
71 	unsigned int count;
72 	unsigned int alloc;
73 	unsigned int events;
74 	snd_mixer_callback_t callback;
75 	void *callback_private;
76 	snd_mixer_compare_t compare;
77 };
78 
79 struct _snd_mixer_selem_id {
80 	char name[60];
81 	unsigned int index;
82 };
83