annotate Plugins/Output/esd/mixer.c @ 115:be5550234631 trunk

[svn] Add build infrastructure for General plugins :)
author nenolod
date Thu, 03 Nov 2005 21:40:28 -0800
parents fa848bd484d8
children cb0f36590d98
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
61
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
3 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
4 * Based on XMMS:
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
6 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
10 * (at your option) any later version.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
11 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
16 *
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
20 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
21
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
22 #include <stdio.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
23 #include <stdlib.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
24 #include <string.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
25 #include <esd.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
26
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
27 #include <unistd.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
28 #include <fcntl.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
29 #include <sys/types.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
30 #include <sys/ioctl.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
31 #include <sys/stat.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
32
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
33 #include "esdout.h"
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
34
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
35 #ifdef HAVE_OSS
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
36 # include <Output/OSS/soundcard.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
37 # define OSS_AVAILABLE TRUE
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
38 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
39 # define OSS_AVAILABLE FALSE
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
40 #endif
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
41
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
42 #include <libaudacious/util.h>
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
43
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
44
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
45
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
46 static void esdout_get_oss_volume(int *l, int *r);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
47 static void esdout_set_oss_volume(int l, int r);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
48
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
49
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
50 static int player = -1;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
51 static int lp = 100, rp = 100;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
52
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
53 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
54 * Find the stream id, and set stream volume to 'persistent' value.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
55 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
56 void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
57 esdout_mixer_init(void)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
58 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
59 esdout_fetch_volume(NULL, NULL);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
60 if (!(OSS_AVAILABLE && esd_cfg.use_oss_mixer && !esd_cfg.use_remote))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
61 esdout_set_volume(lp, rp);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
62 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
63
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
64 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
65 * Grab the stream volume from the server. The problem here is that
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
66 * ESD does not have a built-in function for finding the player ID of
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
67 * a specific player - nor does it let us know what the player ID is
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
68 * when the player is created! So, we grab 'allinfo' and scan the
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
69 * returned player list for the string which we know is our player
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
70 * name (esd_cfg.playername) This function seems to take a long time
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
71 * to run... I'm not sure where to start optimizing, however...
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
72 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
73 void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
74 esdout_fetch_volume(int *l, int *r)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
75 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
76 int fd;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
77 esd_info_t *all_info = NULL;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
78 esd_player_info_t *info;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
79
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
80 fd = esd_open_sound(esd_cfg.hostname);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
81 all_info = esd_get_all_info(fd);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
82
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
83 /* scan linked list for our playername */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
84 for (info = all_info->player_list; info != NULL; info = info->next)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
85 if (!strcmp(esd_cfg.playername, info->name))
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
86 break;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
87
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
88 if (info) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
89 player = info->source_id;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
90 if (l && r) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
91 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
92 * Sometimes we call with NULL
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
93 * args to fetch the player num
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
94 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
95 *l = (info->left_vol_scale * 100) / 256;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
96 *r = (info->right_vol_scale * 100) / 256;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
97 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
98 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
99 else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
100 g_warning("xmms: Couldn't find our player "
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
101 "(was looking for %s) at the server", esd_cfg.playername);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
102
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
103 if (all_info)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
104 esd_free_all_info(all_info);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
105 esd_close(fd);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
106 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
107
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
108 void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
109 esdout_get_volume(int *l, int *r)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
110 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
111 if (OSS_AVAILABLE && esd_cfg.use_oss_mixer && !esd_cfg.use_remote) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
112 esdout_get_oss_volume(l, r);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
113 lp = *l;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
114 rp = *r;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
115 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
116 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
117 /*
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
118 * We assume that the volume hasn't changed from the
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
119 * 'persistant' value. Constantly polling takes too
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
120 * much time/resources. Commenting this section out
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
121 * will consistently check the ESD server to see if
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
122 * someone else changed our stream volume.
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
123 */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
124 *l = lp;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
125 *r = rp;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
126 /* esdout_fetch_volume(l, r); */
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
127 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
128 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
129
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
130 void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
131 esdout_set_volume(int l, int r)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
132 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
133 lp = l;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
134 rp = r;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
135
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
136 if (OSS_AVAILABLE && esd_cfg.use_oss_mixer && !esd_cfg.use_remote) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
137 esdout_set_oss_volume(l, r);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
138 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
139 else if (player != -1 && esd_cfg.playername != NULL) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
140 int fd = esd_open_sound(esd_cfg.hostname);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
141 if (fd >= 0) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
142 esd_set_stream_pan(fd, player, (l * 256) / 100, (r * 256) / 100);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
143 esd_close(fd);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
144 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
145 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
146 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
147
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
148 #ifdef HAVE_OSS
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
149
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
150 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
151 esdout_get_oss_volume(int *l, int *r)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
152 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
153 int fd, v, devs;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
154 long cmd;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
155
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
156 if (esd_cfg.use_remote)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
157 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
158
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
159 fd = open(DEV_MIXER, O_RDONLY);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
160 if (fd != -1) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
161 ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
162 if (devs & SOUND_MASK_PCM)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
163 cmd = SOUND_MIXER_READ_PCM;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
164 else if (devs & SOUND_MASK_VOLUME)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
165 cmd = SOUND_MIXER_READ_VOLUME;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
166 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
167 close(fd);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
168 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
169 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
170 ioctl(fd, cmd, &v);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
171 *r = (v & 0xFF00) >> 8;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
172 *l = (v & 0x00FF);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
173 close(fd);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
174 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
175 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
176
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
177 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
178 esdout_set_oss_volume(int l, int r)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
179 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
180 int fd, v, devs;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
181 long cmd;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
182
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
183 if (esd_cfg.use_remote)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
184 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
185
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
186 fd = open(DEV_MIXER, O_RDONLY);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
187
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
188 if (fd != -1) {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
189 ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
190 if (devs & SOUND_MASK_PCM)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
191 cmd = SOUND_MIXER_WRITE_PCM;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
192 else if (devs & SOUND_MASK_VOLUME)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
193 cmd = SOUND_MIXER_WRITE_VOLUME;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
194 else {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
195 close(fd);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
196 return;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
197 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
198 v = (r << 8) | l;
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
199 ioctl(fd, cmd, &v);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
200 close(fd);
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
201 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
202 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
203
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
204 #else
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
205
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
206 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
207 esdout_get_oss_volume(int *l, int *r)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
208 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
209 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
210
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
211 static void
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
212 esdout_set_oss_volume(int l, int r)
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
213 {
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
214 }
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
215
fa848bd484d8 [svn] Move plugins to Plugins/
nenolod
parents:
diff changeset
216 #endif