Mercurial > pidgin
annotate src/sound.c @ 3258:c92dc6f0e497
[gaim-migrate @ 3276]
Broken light-bulb graphic for buddy presence errors.
committer: Tailor Script <tailor@pidgin.im>
author | Jim Seymour <jseymour> |
---|---|
date | Sat, 18 May 2002 20:32:04 +0000 |
parents | ad8bdd73f2d6 |
children | 86fdd015f40e |
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 |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2048
diff
changeset
|
23 #include <config.h> |
349
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 <fcntl.h> | |
31 #include <sys/wait.h> | |
63 | 32 #include <unistd.h> |
33 #include <sys/types.h> | |
34 #include <sys/stat.h> | |
1 | 35 |
36 #ifdef ESD_SOUND | |
37 #include <esd.h> | |
38 #endif | |
39 | |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
40 #ifdef ARTSC_SOUND |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
41 #include <artsc.h> |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
42 #endif |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
43 |
1 | 44 #ifdef NAS_SOUND |
45 #include <audio/audiolib.h> | |
46 #endif | |
47 | |
48 #include "gaim.h" | |
49 #include "sounds/BuddyArrive.h" | |
50 #include "sounds/BuddyLeave.h" | |
51 #include "sounds/Send.h" | |
52 #include "sounds/Receive.h" | |
1694 | 53 #include "sounds/RedAlert.h" |
1 | 54 |
3060 | 55 /* label and opt are null for the buddy pounce because it's configured * |
56 * per pounce. NULL option means it doesn't get displayed in the sound * | |
57 * preferences box */ | |
58 struct sound_struct sounds[NUM_SOUNDS] = { | |
59 N_("Buddy logs in"), OPT_SOUND_LOGIN, BuddyArrive, sizeof(BuddyArrive), | |
60 N_("Buddy logs out"), OPT_SOUND_LOGOUT, BuddyLeave, sizeof(BuddyLeave), | |
3130 | 61 N_("Message received"), OPT_SOUND_RECV, Receive, sizeof(Receive), |
62 N_("Message received begins conversation"), OPT_SOUND_FIRST_RCV, Receive, sizeof(Receive), | |
3060 | 63 N_("Message sent"), OPT_SOUND_SEND, Send, sizeof(Send), |
64 N_("Person enters chat"), OPT_SOUND_CHAT_JOIN, BuddyArrive, sizeof(BuddyArrive), | |
65 N_("Person leaves chat"), OPT_SOUND_CHAT_PART, BuddyLeave, sizeof(BuddyLeave), | |
66 N_("You talk in chat"), OPT_SOUND_CHAT_YOU_SAY, Send, sizeof(Send), | |
67 N_("Others talk in chat"), OPT_SOUND_CHAT_SAY, Receive, sizeof(Receive), | |
3222 | 68 NULL, 0, RedAlert, sizeof(RedAlert), |
69 N_("Someone says your name in chat"), OPT_SOUND_CHAT_NICK, Receive, sizeof(Receive) | |
3060 | 70 }; |
71 | |
655
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
72 static int check_dev(char *dev) |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
73 { |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
74 struct stat stat_buf; |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
75 uid_t user = getuid(); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
76 gid_t group = getgid(), other_groups[32]; |
899
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
77 int i, numgroups; |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
78 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
79 if ((numgroups = getgroups(32, other_groups)) == -1) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
80 return 0; |
655
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
81 if (stat(dev, &stat_buf)) |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
82 return 0; |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
83 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
|
84 return 1; |
899
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
85 if (stat_buf.st_mode & S_IWGRP) { |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
86 if (group == stat_buf.st_gid) |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
87 return 1; |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
88 for (i = 0; i < numgroups; i++) |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
89 if (other_groups[i] == stat_buf.st_gid) |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
90 return 1; |
88d1edcd7cd6
[gaim-migrate @ 909]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
778
diff
changeset
|
91 } |
655
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
92 if (stat_buf.st_mode & S_IWOTH) |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
93 return 1; |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
94 return 0; |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
95 } |
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
96 |
1 | 97 |
2048
3366311426df
[gaim-migrate @ 2058]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
98 static void play_audio(unsigned char *data, int size) |
1 | 99 { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
100 int fd; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
101 |
2467
cd81f1f2c896
[gaim-migrate @ 2480]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
102 fd = open("/dev/audio", O_WRONLY | O_EXCL | O_NDELAY); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
103 if (fd < 0) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
104 return; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
105 write(fd, data, size); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
106 close(fd); |
1 | 107 } |
108 | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
109 static void play_audio_file(char *file) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
110 { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
111 /* here we can assume that we can write to /dev/audio */ |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
112 char *buf; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
113 struct stat info; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
114 int fd = open(file, O_RDONLY); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
115 if (fd <= 0) { |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
116 return; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
117 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
118 fstat(fd, &info); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
119 if (info.st_size < 24) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
120 return; |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
121 buf = malloc(info.st_size + 1); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
122 read(fd, buf, 24); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
123 read(fd, buf, info.st_size - 24); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
124 close(fd); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
125 |
2467
cd81f1f2c896
[gaim-migrate @ 2480]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
126 fd = open("/dev/audio", O_WRONLY | O_EXCL | O_NDELAY); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
127 if (fd < 0) { |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
128 free(buf); |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
129 return; |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
130 } |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
131 write(fd, buf, info.st_size - 24); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
132 free(buf); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
133 close(fd); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
134 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
135 |
1 | 136 static int can_play_audio() |
137 { | |
655
6ba20a0089d8
[gaim-migrate @ 665]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
606
diff
changeset
|
138 return check_dev("/dev/audio"); |
1 | 139 } |
140 | |
141 | |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
142 #if defined(ESD_SOUND) || defined(ARTSC_SOUND) |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
143 |
1 | 144 /* |
145 ** This routine converts from ulaw to 16 bit linear. | |
146 ** | |
147 ** Craig Reese: IDA/Supercomputing Research Center | |
148 ** 29 September 1989 | |
149 ** | |
150 ** References: | |
151 ** 1) CCITT Recommendation G.711 (very difficult to follow) | |
152 ** 2) MIL-STD-188-113,"Interoperability and Performance Standards | |
153 ** for Analog-to_Digital Conversion Techniques," | |
154 ** 17 February 1987 | |
155 ** | |
156 ** Input: 8 bit ulaw sample | |
157 ** Output: signed 16 bit linear sample | |
158 ** Z-note -- this is from libaudiofile. Thanks guys! | |
159 */ | |
160 | |
2158
9b7cb09e2c06
[gaim-migrate @ 2168]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2090
diff
changeset
|
161 static int _af_ulaw2linear(unsigned char ulawbyte) |
1 | 162 { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
163 static int exp_lut[8] = { 0, 132, 396, 924, 1980, 4092, 8316, 16764 }; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
164 int sign, exponent, mantissa, sample; |
1 | 165 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
166 ulawbyte = ~ulawbyte; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
167 sign = (ulawbyte & 0x80); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
168 exponent = (ulawbyte >> 4) & 0x07; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
169 mantissa = ulawbyte & 0x0F; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
170 sample = exp_lut[exponent] + (mantissa << (exponent + 3)); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
171 if (sign != 0) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
172 sample = -sample; |
1 | 173 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
174 return (sample); |
1 | 175 } |
176 | |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
177 #endif |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
178 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
179 #ifdef ESD_SOUND |
1 | 180 |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
181 int esd_fd; |
1 | 182 |
183 static int play_esd(unsigned char *data, int size) | |
184 { | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
185 int i; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
186 guint16 *lineardata; |
1 | 187 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
188 lineardata = g_malloc(size * 2); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
189 |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
190 for (i = 0; i < size; i++) |
1 | 191 lineardata[i] = _af_ulaw2linear(data[i]); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
192 |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
193 write(esd_fd, lineardata, size * 2); |
1 | 194 |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
195 close(esd_fd); |
1 | 196 g_free(lineardata); |
197 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
198 return 1; |
1 | 199 |
200 } | |
201 | |
202 static int can_play_esd() | |
203 { | |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
204 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
|
205 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
206 esd_fd = esd_play_stream(format, 8012, NULL, "gaim"); |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
207 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
208 if (esd_fd < 0) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
209 return 0; |
354
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
210 } |
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
211 |
2b91e42bff70
[gaim-migrate @ 364]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
349
diff
changeset
|
212 return 1; |
1 | 213 } |
214 | |
215 #endif | |
216 | |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
217 #ifdef ARTSC_SOUND |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
218 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
219 static int play_artsc(unsigned char *data, int size) |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
220 { |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
221 arts_stream_t stream; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
222 guint16 *lineardata; |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
223 int result = 1; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
224 int error; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
225 int i; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
226 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
227 lineardata = g_malloc(size * 2); |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
228 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
229 for (i = 0; i < size; i++) { |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
230 lineardata[i] = _af_ulaw2linear(data[i]); |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
231 } |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
232 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
233 stream = arts_play_stream(8012, 16, 1, "gaim"); |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
234 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
235 error = arts_write(stream, lineardata, size); |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
236 if (error < 0) { |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
237 result = 0; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
238 } |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
239 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
240 arts_close_stream(stream); |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
241 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
242 g_free(lineardata); |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
243 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
244 arts_free(); |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
245 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
246 return result; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
247 } |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
248 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
249 static int can_play_artsc() |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
250 { |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
251 int error; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
252 |
2183
94ee8eacb6f8
[gaim-migrate @ 2193]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2179
diff
changeset
|
253 error = arts_init(); |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
254 if (error < 0) |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
255 return 0; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
256 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
257 return 1; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
258 } |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
259 |
2186
08781af8e3a9
[gaim-migrate @ 2196]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2183
diff
changeset
|
260 static int artsc_play_file(char *file) |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
261 { |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
262 struct stat stat_buf; |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
263 unsigned char *buf = NULL; |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
264 int result = 0; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
265 int fd = -1; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
266 |
2680
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
267 if (!can_play_artsc()) |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
268 return 0; |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
269 |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
270 fd = open(file, O_RDONLY); |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
271 if (fd < 0) |
2680
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
272 return 0; |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
273 |
2680
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
274 if (fstat(fd, &stat_buf)) { |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
275 close(fd); |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
276 return 0; |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
277 } |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
278 |
2680
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
279 if (!stat_buf.st_size) { |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
280 close(fd); |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
281 return 0; |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
282 } |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
283 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
284 buf = g_malloc(stat_buf.st_size); |
2680
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
285 if (!buf) { |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
286 close(fd); |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
287 return 0; |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
288 } |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2370
diff
changeset
|
289 |
2680
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
290 if (read(fd, buf, stat_buf.st_size) < 0) { |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
291 g_free(buf); |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
292 close(fd); |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
293 return 0; |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
294 } |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
295 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
296 result = play_artsc(buf, stat_buf.st_size); |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
297 |
2680
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
298 g_free(buf); |
ab2ca2770d2e
[gaim-migrate @ 2693]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2601
diff
changeset
|
299 close(fd); |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
300 return result; |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
301 } |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
302 |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
303 #endif /* ARTSC_SOUND */ |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
304 |
1 | 305 #ifdef NAS_SOUND |
306 | |
307 char nas_server[] = "localhost"; | |
308 AuServer *nas_serv = NULL; | |
309 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
310 static AuBool NasEventHandler(AuServer * aud, AuEvent * ev, AuEventHandlerRec * handler) |
1 | 311 { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
312 AuElementNotifyEvent *event = (AuElementNotifyEvent *) ev; |
1 | 313 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
314 if (ev->type == AuEventTypeElementNotify) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
315 switch (event->kind) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
316 case AuElementNotifyKindState: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
317 switch (event->cur_state) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
318 case AuStateStop: |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
319 _exit(0); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
320 } |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
321 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
322 } |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
323 } |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
324 return AuTrue; |
1 | 325 } |
326 | |
327 | |
328 static int play_nas(unsigned char *data, int size) | |
329 { | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
330 AuDeviceID device = AuNone; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
331 AuFlowID flow; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
332 AuElement elements[3]; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
333 int i, n, w; |
1 | 334 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
335 /* look for an output device */ |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
336 for (i = 0; i < AuServerNumDevices(nas_serv); i++) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
337 if ((AuDeviceKind(AuServerDevice(nas_serv, i)) == |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
338 AuComponentKindPhysicalOutput) && |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
339 AuDeviceNumTracks(AuServerDevice(nas_serv, i)) == 1) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
340 device = AuDeviceIdentifier(AuServerDevice(nas_serv, i)); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
341 break; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
342 } |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
343 } |
1 | 344 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
345 if (device == AuNone) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
346 return 0; |
1 | 347 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
348 if (!(flow = AuCreateFlow(nas_serv, NULL))) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
349 return 0; |
1 | 350 |
351 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
352 AuMakeElementImportClient(&elements[0], 8012, AuFormatULAW8, 1, AuTrue, size, size / 2, 0, NULL); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
353 AuMakeElementExportDevice(&elements[1], 0, device, 8012, AuUnlimitedSamples, 0, NULL); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
354 AuSetElements(nas_serv, flow, AuTrue, 2, elements, NULL); |
1 | 355 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
356 AuStartFlow(nas_serv, flow, NULL); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
357 |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
358 AuWriteElement(nas_serv, flow, 0, size, data, AuTrue, NULL); |
1 | 359 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
360 AuRegisterEventHandler(nas_serv, AuEventHandlerIDMask, 0, flow, NasEventHandler, NULL); |
1 | 361 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
362 while (1) { |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
363 AuHandleEvents(nas_serv); |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
364 } |
1 | 365 |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
366 return 1; |
1 | 367 } |
368 | |
369 static int can_play_nas() | |
370 { | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
371 if ((nas_serv = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL))) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
372 return 1; |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
373 return 0; |
1 | 374 } |
375 | |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
376 static int play_nas_file(char *file) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
377 { |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
378 struct stat stat_buf; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
379 char *buf; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
380 int ret; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
381 int fd = open(file, O_RDONLY); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
382 if (fd <= 0) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
383 return 0; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
384 |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
385 if (!can_play_nas()) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
386 return 0; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
387 |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
388 if (stat(file, &stat_buf)) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
389 return 0; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
390 |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
391 if (!stat_buf.st_size) |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
392 return 0; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
393 |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
394 buf = malloc(stat_buf.st_size); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
395 read(fd, buf, stat_buf.st_size); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
396 ret = play_nas(buf, stat_buf.st_size); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
397 free(buf); |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
398 return ret; |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
399 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
400 |
1 | 401 #endif |
402 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
403 void play_file(char *filename) |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
404 { |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
405 int pid; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
406 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
407 #ifdef _WIN32 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
408 return; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
409 #endif |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
410 |
3004 | 411 if (sound_options & OPT_SOUND_BEEP) { |
412 gdk_beep(); | |
413 return; | |
414 } | |
415 | |
3060 | 416 else if (sound_options & OPT_SOUND_NORMAL) { |
3072 | 417 debug_printf("attempting to play audio file with internal method -- this is unlikely to work\n"); |
3060 | 418 } |
419 | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
420 pid = fork(); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
421 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
422 if (pid < 0) |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
423 return; |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
424 else if (pid == 0) { |
2601
61952dde7677
[gaim-migrate @ 2614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2580
diff
changeset
|
425 alarm(30); |
3004 | 426 |
3025 | 427 if ((sound_options & OPT_SOUND_CMD) && sound_cmd[0]) { |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
428 char *args[4]; |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
429 char command[4096]; |
2777
0899f8c99a15
[gaim-migrate @ 2790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2680
diff
changeset
|
430 |
0899f8c99a15
[gaim-migrate @ 2790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2680
diff
changeset
|
431 g_snprintf(command, sizeof(command), sound_cmd, filename); |
0899f8c99a15
[gaim-migrate @ 2790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2680
diff
changeset
|
432 |
1214
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
433 args[0] = "sh"; |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
434 args[1] = "-c"; |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
435 args[2] = command; |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
436 args[3] = NULL; |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
437 execvp(args[0], args); |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
438 _exit(0); |
0baf39dc5437
[gaim-migrate @ 1224]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1109
diff
changeset
|
439 } |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
440 #ifdef ESD_SOUND |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
441 else if (sound_options & OPT_SOUND_ESD) { |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
442 if (esd_play_file(NULL, filename, 1)) |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
443 _exit(0); |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
444 } |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
445 #endif |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
446 |
2186
08781af8e3a9
[gaim-migrate @ 2196]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2183
diff
changeset
|
447 #ifdef ARTSC_SOUND |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
448 else if (sound_options & OPT_SOUND_ARTSC) { |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
449 if (artsc_play_file(filename)) |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
450 _exit(0); |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
451 } |
2186
08781af8e3a9
[gaim-migrate @ 2196]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2183
diff
changeset
|
452 #endif |
08781af8e3a9
[gaim-migrate @ 2196]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2183
diff
changeset
|
453 |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
454 #ifdef NAS_SOUND |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
455 else if (sound_options & OPT_SOUND_NAS) { |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
456 if (play_nas_file(filename)) |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
457 _exit(0); |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
458 } |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1057
diff
changeset
|
459 #endif |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
460 else if ((sound_options & OPT_SOUND_NORMAL) && |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
461 can_play_audio()) { |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
462 play_audio_file(filename); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
463 _exit(0); |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
464 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
465 |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
466 _exit(0); |
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 |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
108
diff
changeset
|
470 void play(unsigned char *data, int size) |
1 | 471 { |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
472 int pid; |
1 | 473 |
474 #ifdef _WIN32 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
475 return; |
1 | 476 #endif |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
477 |
3004 | 478 if (sound_options & OPT_SOUND_BEEP) { |
479 gdk_beep(); | |
480 return; | |
481 } | |
3025 | 482 |
483 else if ((sound_options & OPT_SOUND_CMD) && sound_cmd[0]) { | |
484 debug_printf("can't play internal sound with external command -- skipping\n"); | |
485 return; | |
486 } | |
487 | |
1 | 488 pid = fork(); |
3004 | 489 |
1 | 490 if (pid < 0) |
491 return; | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
492 else if (pid == 0) { |
2601
61952dde7677
[gaim-migrate @ 2614]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2580
diff
changeset
|
493 alarm(30); |
3004 | 494 |
1 | 495 #ifdef ESD_SOUND |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
496 /* ESD is our player of choice. Are we OK to |
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
497 * go there? */ |
3004 | 498 if (sound_options & OPT_SOUND_ESD) { |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
499 if (can_play_esd()) { |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
500 if (play_esd(data, size)) |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
501 _exit(0); |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
502 } |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
503 } |
1 | 504 #endif |
505 | |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
506 #ifdef ARTSC_SOUND |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
507 /* ArtsC is the new second choice. */ |
3006 | 508 if (sound_options & OPT_SOUND_ARTSC) { |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
509 if (can_play_artsc()) { |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
510 if (play_artsc(data, size)) |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
511 _exit(0); |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
512 } |
2179
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
513 } |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
514 #endif |
64d8ef561763
[gaim-migrate @ 2189]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2158
diff
changeset
|
515 |
1 | 516 #ifdef NAS_SOUND |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
517 /* NAS is our second choice setup. */ |
3006 | 518 if (sound_options & OPT_SOUND_NAS) { |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
519 if (can_play_nas()) { |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
520 if (play_nas(data, size)) |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
521 _exit(0); |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
522 } |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
523 } |
1 | 524 #endif |
525 | |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
526 /* Lastly, we can try just plain old /dev/audio */ |
3005 | 527 if (sound_options & OPT_SOUND_NORMAL) { |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
528 if (can_play_audio()) { |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
529 play_audio(data, size); |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
530 _exit(0); |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2478
diff
changeset
|
531 } |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
532 } |
668
c9b66c710283
[gaim-migrate @ 678]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
655
diff
changeset
|
533 |
c9b66c710283
[gaim-migrate @ 678]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
655
diff
changeset
|
534 _exit(0); |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
535 } |
1 | 536 } |
537 | |
133
e277d5f0c1dd
[gaim-migrate @ 143]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
108
diff
changeset
|
538 extern int logins_not_muted; |
1 | 539 |
540 void play_sound(int sound) | |
541 { | |
1235
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
542 if (awaymessage && !(sound_options & OPT_SOUND_WHEN_AWAY)) |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
543 return; |
a9cf2f61a7b1
[gaim-migrate @ 1245]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1214
diff
changeset
|
544 |
3060 | 545 if ((sound == SND_BUDDY_ARRIVE) && !logins_not_muted) |
546 return; | |
547 | |
548 if (sound >= NUM_SOUNDS) { | |
3072 | 549 debug_printf("sorry old fruit... can't say I know that sound: ", sound, "\n"); |
3060 | 550 return; |
551 } | |
552 | |
553 /* check NULL for sounds that don't have an option, ie buddy pounce */ | |
3072 | 554 if ((sound_options & sounds[sound].opt) || (sounds[sound].opt == 0)) { |
3060 | 555 if (sound_file[sound]) { |
556 play_file(sound_file[sound]); | |
557 } else { | |
558 play(sounds[sound].snd, sounds[sound].snd_size); | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
899
diff
changeset
|
559 } |
1252
46c09828e929
[gaim-migrate @ 1262]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1235
diff
changeset
|
560 } |
64 | 561 } |