Mercurial > pidgin.yaz
annotate src/sound.c @ 1190:c3ebd5932e32
[gaim-migrate @ 1200]
this is not a drill
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 02 Dec 2000 20:02:59 +0000 |
parents | c73736fa0b7c |
children | 0baf39dc5437 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (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 General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
23 #include "../config.h" |
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
338
diff
changeset
|
24 #endif |
1 | 25 #include <stdio.h> |
1057
d50d3abb9eb7
[gaim-migrate @ 1067]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1006
diff
changeset
|
26 #include <stdlib.h> |
1 | 27 #include <string.h> |
28 #include <sys/time.h> | |
29 #include <unistd.h> | |
30 #include <gtk/gtk.h> | |
31 #include <fcntl.h> | |
32 #include <sys/wait.h> | |
33 #include <sys/signal.h> | |
63 | 34 #include <unistd.h> |
35 #include <sys/types.h> | |
36 #include <sys/stat.h> | |
1 | 37 |
38 #ifdef ESD_SOUND | |
39 #include <esd.h> | |
40 #endif | |
41 | |
42 #ifdef NAS_SOUND | |
43 #include <audio/audiolib.h> | |
44 #endif | |
45 | |
46 #include "gaim.h" | |
47 #include "sounds/BuddyArrive.h" | |
48 #include "sounds/BuddyLeave.h" | |
49 #include "sounds/Send.h" | |
50 #include "sounds/Receive.h" | |
51 | |
655
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
52 static int check_dev(char *dev) |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
53 { |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
54 struct stat stat_buf; |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
55 uid_t user = getuid(); |
899
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
56 gid_t group = getgid(), |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
57 other_groups[32]; |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
58 int i, numgroups; |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
59 |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
60 if ((numgroups = getgroups (32, other_groups)) == -1) |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
61 return 0; |
655
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
62 if (stat(dev, &stat_buf)) |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
63 return 0; |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
64 if (user == stat_buf.st_uid && stat_buf.st_mode & S_IWUSR) |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
65 return 1; |
899
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
66 if (stat_buf.st_mode & S_IWGRP) { |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
67 if (group == stat_buf.st_gid) |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
68 return 1; |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
69 for (i = 0; i < numgroups; i++) |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
70 if (other_groups[i] == stat_buf.st_gid) |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
71 return 1; |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
72 } |
655
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
73 if (stat_buf.st_mode & S_IWOTH) |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
74 return 1; |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
75 return 0; |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
76 } |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
77 |
1 | 78 |
79 static void play_audio(char *data, int size) | |
80 { | |
81 int fd; | |
82 | |
83 fd = open("/dev/audio", O_WRONLY | O_EXCL); | |
84 if (fd < 0) | |
85 return; | |
86 write(fd, data, size); | |
87 close(fd); | |
88 } | |
89 | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
90 static void play_audio_file(char *file) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
91 { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
92 /* here we can assume that we can write to /dev/audio */ |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
93 char *buf; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
94 struct stat info; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
95 int fd = open(file, O_RDONLY); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
96 if (fd <= 0) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
97 return; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
98 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
99 fstat(fd, &info); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
100 if (info.st_size < 24) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
101 return; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
102 buf = malloc(info.st_size + 1); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
103 read(fd, buf, 24); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
104 read(fd, buf, info.st_size - 24); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
105 close(fd); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
106 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
107 fd = open("/dev/audio", O_WRONLY | O_EXCL); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
108 if (fd < 0) { |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
109 free(buf); |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
110 return; |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
111 } |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
112 write(fd, buf, info.st_size - 24); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
113 free(buf); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
114 close(fd); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
115 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
116 |
1 | 117 static int can_play_audio() |
118 { | |
655
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
119 return check_dev("/dev/audio"); |
1 | 120 } |
121 | |
122 | |
123 #ifdef ESD_SOUND | |
124 /* | |
125 ** This routine converts from ulaw to 16 bit linear. | |
126 ** | |
127 ** Craig Reese: IDA/Supercomputing Research Center | |
128 ** 29 September 1989 | |
129 ** | |
130 ** References: | |
131 ** 1) CCITT Recommendation G.711 (very difficult to follow) | |
132 ** 2) MIL-STD-188-113,"Interoperability and Performance Standards | |
133 ** for Analog-to_Digital Conversion Techniques," | |
134 ** 17 February 1987 | |
135 ** | |
136 ** Input: 8 bit ulaw sample | |
137 ** Output: signed 16 bit linear sample | |
138 ** Z-note -- this is from libaudiofile. Thanks guys! | |
139 */ | |
140 | |
141 int _af_ulaw2linear (unsigned char ulawbyte) | |
142 { | |
143 static int exp_lut[8] = {0,132,396,924,1980,4092,8316,16764}; | |
144 int sign, exponent, mantissa, sample; | |
145 | |
146 ulawbyte = ~ulawbyte; | |
147 sign = (ulawbyte & 0x80); | |
148 exponent = (ulawbyte >> 4) & 0x07; | |
149 mantissa = ulawbyte & 0x0F; | |
150 sample = exp_lut[exponent] + (mantissa << (exponent + 3)); | |
151 if (sign != 0) sample = -sample; | |
152 | |
153 return(sample); | |
154 } | |
155 | |
156 | |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
157 int esd_fd; |
1 | 158 |
159 static int play_esd(unsigned char *data, int size) | |
160 { | |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
161 int i; |
79 | 162 guint16 *lineardata; |
1 | 163 |
79 | 164 lineardata = g_malloc(size * 2); |
1 | 165 |
166 for (i=0; i<size; i++) | |
167 lineardata[i] = _af_ulaw2linear(data[i]); | |
168 | |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
169 write(esd_fd, lineardata, size * 2); |
1 | 170 |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
171 close(esd_fd); |
1 | 172 g_free(lineardata); |
173 | |
174 return 1; | |
175 | |
176 } | |
177 | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
178 static int play_esd_file(char *file) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
179 { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
180 int esd_stat; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
181 int fd = open(file, O_RDONLY); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
182 if (fd <= 0) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
183 return 0; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
184 esd_stat = esd_play_file(NULL, file, 1); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
185 return esd_stat; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
186 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
187 |
1 | 188 static int can_play_esd() |
189 { | |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
190 esd_format_t format = ESD_BITS16 | ESD_STREAM | ESD_PLAY | ESD_MONO; |
655
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
191 |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
192 esd_fd = esd_play_stream(format, 8012, NULL, "gaim"); |
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
193 |
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
194 if (esd_fd < 0) { |
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
195 return 0; |
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
196 } |
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
197 |
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
198 return 1; |
1 | 199 } |
200 | |
201 #endif | |
202 | |
203 #ifdef NAS_SOUND | |
204 | |
205 char nas_server[] = "localhost"; | |
206 AuServer *nas_serv = NULL; | |
207 | |
208 static AuBool | |
209 NasEventHandler(AuServer *aud, AuEvent *ev, AuEventHandlerRec *handler) | |
210 { | |
211 AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev; | |
212 | |
213 if (ev->type == AuEventTypeElementNotify) { | |
214 switch (event->kind) { | |
215 case AuElementNotifyKindState: | |
216 switch (event->cur_state) { | |
217 case AuStateStop: | |
218 _exit(0); | |
219 } | |
220 break; | |
221 } | |
222 } | |
223 return AuTrue; | |
224 } | |
225 | |
226 | |
227 static int play_nas(unsigned char *data, int size) | |
228 { | |
229 AuDeviceID device = AuNone; | |
230 AuFlowID flow; | |
231 AuElement elements[3]; | |
232 int i, n, w; | |
233 | |
234 /* look for an output device */ | |
235 for (i = 0; i < AuServerNumDevices(nas_serv); i++) { | |
236 if ((AuDeviceKind(AuServerDevice(nas_serv, i)) == | |
237 AuComponentKindPhysicalOutput) && | |
238 AuDeviceNumTracks(AuServerDevice(nas_serv, i)) == 1) { | |
239 device = AuDeviceIdentifier(AuServerDevice(nas_serv, i)); | |
240 break; | |
241 } | |
242 } | |
243 | |
244 if (device == AuNone) | |
245 return 0; | |
246 | |
247 if (!(flow = AuCreateFlow(nas_serv, NULL))) | |
248 return 0; | |
249 | |
250 | |
251 AuMakeElementImportClient(&elements[0], 8012, AuFormatULAW8, | |
252 1, AuTrue, size, size/2, 0, NULL); | |
253 AuMakeElementExportDevice(&elements[1], 0, device, 8012, | |
254 AuUnlimitedSamples, 0, NULL); | |
255 AuSetElements(nas_serv, flow, AuTrue, 2, elements, NULL); | |
256 | |
257 AuStartFlow(nas_serv, flow, NULL); | |
258 | |
259 AuWriteElement(nas_serv, flow, 0, size, data, AuTrue, NULL); | |
260 | |
261 AuRegisterEventHandler(nas_serv, AuEventHandlerIDMask, 0, flow, | |
262 NasEventHandler, NULL); | |
263 | |
264 while(1) { | |
265 AuHandleEvents(nas_serv); | |
266 } | |
267 | |
268 return 1; | |
269 } | |
270 | |
271 static int can_play_nas() | |
272 { | |
273 if ((nas_serv = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL))) | |
274 return 1; | |
275 return 0; | |
276 } | |
277 | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
278 static int play_nas_file(char *file) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
279 { |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
280 struct stat stat_buf; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
281 char *buf; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
282 int ret; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
283 int fd = open(file, O_RDONLY); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
284 if (fd <= 0) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
285 return 0; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
286 |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
287 if (!can_play_nas()) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
288 return 0; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
289 |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
290 if (stat(file, &stat_buf)) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
291 return 0; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
292 |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
293 if (!stat_buf.st_size) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
294 return 0; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
295 |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
296 buf = malloc(stat_buf.st_size); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
297 read(fd, buf, stat_buf.st_size); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
298 ret = play_nas(buf, stat_buf.st_size); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
299 free(buf); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
300 return ret; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
301 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
302 |
1 | 303 #endif |
304 | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
305 void play_file(char *filename) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
306 int pid; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
307 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
308 #ifdef _WIN32 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
309 return; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
310 #endif |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
311 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
312 pid = fork(); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
313 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
314 if (pid < 0) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
315 return; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
316 else if (pid == 0) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
317 if (sound_options & OPT_SOUND_BEEP) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
318 printf("\a"); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
319 fflush(stdout); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
320 _exit(0); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
321 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
322 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
323 #ifdef ESD_SOUND |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
324 if (play_esd_file(filename)) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
325 _exit(0); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
326 #endif |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
327 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
328 #ifdef NAS_SOUND |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
329 if (play_nas_file(filenae)) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
330 _exit(0); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
331 #endif |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
332 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
333 if (can_play_audio()) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
334 play_audio_file(filename); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
335 _exit(0); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
336 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
337 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
338 _exit(0); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
339 } else { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
340 gtk_timeout_add(100, (GtkFunction)clean_pid, NULL); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
341 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
342 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
343 |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
108
diff
changeset
|
344 void play(unsigned char *data, int size) |
1 | 345 { |
346 int pid; | |
347 | |
348 #ifdef _WIN32 | |
349 return; | |
350 #endif | |
351 | |
352 pid = fork(); | |
353 | |
354 if (pid < 0) | |
355 return; | |
356 else if (pid == 0) { | |
775
9614e69f68ca
[gaim-migrate @ 785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
668
diff
changeset
|
357 if (sound_options & OPT_SOUND_BEEP) { |
777
1d60fb2c3b3b
[gaim-migrate @ 787]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
775
diff
changeset
|
358 printf("\a"); |
778
035d3115c6fe
[gaim-migrate @ 788]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
777
diff
changeset
|
359 fflush(stdout); |
775
9614e69f68ca
[gaim-migrate @ 785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
668
diff
changeset
|
360 _exit(0); |
9614e69f68ca
[gaim-migrate @ 785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
668
diff
changeset
|
361 } |
9614e69f68ca
[gaim-migrate @ 785]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
668
diff
changeset
|
362 |
1 | 363 #ifdef ESD_SOUND |
364 /* ESD is our player of choice. Are we OK to | |
365 * go there? */ | |
366 if (can_play_esd()) { | |
367 if (play_esd(data, size)) | |
368 _exit(0); | |
369 } | |
370 #endif | |
371 | |
372 #ifdef NAS_SOUND | |
373 /* NAS is our second choice setup. */ | |
374 if (can_play_nas()) { | |
375 if (play_nas(data, size)) | |
376 _exit(0); | |
377 } | |
378 #endif | |
379 | |
380 /* Lastly, we can try just plain old /dev/audio */ | |
381 if (can_play_audio()) { | |
382 play_audio(data, size); | |
383 _exit(0); | |
384 } | |
668
c9b66c710283
[gaim-migrate @ 678]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
655
diff
changeset
|
385 |
c9b66c710283
[gaim-migrate @ 678]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
655
diff
changeset
|
386 _exit(0); |
1 | 387 } else { |
388 gtk_timeout_add(100, (GtkFunction)clean_pid, NULL); | |
389 } | |
390 } | |
391 | |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
108
diff
changeset
|
392 extern int logins_not_muted; |
1 | 393 |
394 void play_sound(int sound) | |
395 { | |
396 | |
397 switch(sound) { | |
398 case BUDDY_ARRIVE: | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
399 if ((sound_options & OPT_SOUND_LOGIN) && logins_not_muted) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
400 if (sound_file[BUDDY_ARRIVE]) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
401 play_file(sound_file[BUDDY_ARRIVE]); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
402 } else { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
403 play(BuddyArrive, sizeof(BuddyArrive)); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
404 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
405 } |
1 | 406 break; |
407 case BUDDY_LEAVE: | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
408 if (sound_options & OPT_SOUND_LOGOUT) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
409 if (sound_file[BUDDY_LEAVE]) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
410 play_file(sound_file[BUDDY_LEAVE]); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
411 } else { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
412 play(BuddyLeave, sizeof(BuddyLeave)); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
413 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
414 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
415 break; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
416 case FIRST_RECEIVE: |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
417 if (sound_options & OPT_SOUND_FIRST_RCV) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
418 if (sound_file[FIRST_RECEIVE]) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
419 play_file(sound_file[FIRST_RECEIVE]); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
420 } else { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
421 play(Receive, sizeof(Receive)); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
422 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
423 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
424 break; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
425 case RECEIVE: |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
426 if (sound_options & OPT_SOUND_RECV) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
427 if (sound_file[RECEIVE]) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
428 play_file(sound_file[RECEIVE]); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
429 } else { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
430 play(Receive, sizeof(Receive)); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
431 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
432 } |
1 | 433 break; |
434 case SEND: | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
435 if (sound_options & OPT_SOUND_SEND) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
436 if (sound_file[SEND]) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
437 play_file(sound_file[SEND]); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
438 } else { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
439 play(Send, sizeof(Send)); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
440 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
441 } |
1 | 442 break; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
443 case CHAT_JOIN: |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
444 if (sound_options & OPT_SOUND_CHAT_JOIN) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
445 if (sound_file[CHAT_JOIN]) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
446 play_file(sound_file[CHAT_JOIN]); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
447 } else { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
448 play(BuddyArrive, sizeof(BuddyArrive)); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
449 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
450 } |
1 | 451 break; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
452 case CHAT_LEAVE: |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
453 if (sound_options & OPT_SOUND_CHAT_PART) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
454 if (sound_file[CHAT_LEAVE]) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
455 play_file(sound_file[CHAT_LEAVE]); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
456 } else { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
457 play(BuddyLeave, sizeof(BuddyLeave)); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
458 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
459 } |
1 | 460 break; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
461 case CHAT_YOU_SAY: |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
462 if (sound_options & OPT_SOUND_CHAT_YOU_SAY) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
463 if (sound_file[CHAT_YOU_SAY]) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
464 play_file(sound_file[CHAT_YOU_SAY]); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
465 } else { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
466 play(Send, sizeof(Send)); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
467 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
468 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
469 break; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
470 case CHAT_SAY: |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
471 if (sound_options & OPT_SOUND_CHAT_SAY) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
472 if (sound_file[CHAT_SAY]) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
473 play_file(sound_file[CHAT_SAY]); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
474 } else { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
475 play(Receive, sizeof(Receive)); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
476 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
477 } |
1 | 478 break; |
479 } | |
64 | 480 } |
1 | 481 |