comparison src/sound.c @ 354:2b91e42bff70

[gaim-migrate @ 364] People should stop getting errors because of sound now. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 07 Jun 2000 23:59:43 +0000
parents b402a23f35df
children 7b49c67e561c
comparison
equal deleted inserted replaced
353:a4df8f1cc61a 354:2b91e42bff70
109 109
110 return(sample); 110 return(sample);
111 } 111 }
112 112
113 113
114 int esd_fd;
114 115
115 static int play_esd(unsigned char *data, int size) 116 static int play_esd(unsigned char *data, int size)
116 { 117 {
117 int fd, i; 118 int i;
118 esd_format_t format = ESD_BITS16 | ESD_STREAM | ESD_PLAY | ESD_MONO;
119 guint16 *lineardata; 119 guint16 *lineardata;
120 120
121
122 fd = esd_play_stream_fallback(format, 8012, NULL, "gaim");
123
124 if (fd < 0) {
125 return 0;
126 }
127
128 lineardata = g_malloc(size * 2); 121 lineardata = g_malloc(size * 2);
129 122
130 for (i=0; i<size; i++) 123 for (i=0; i<size; i++)
131 lineardata[i] = _af_ulaw2linear(data[i]); 124 lineardata[i] = _af_ulaw2linear(data[i]);
132 125
133 write(fd, lineardata, size * 2); 126 write(esd_fd, lineardata, size * 2);
134 127
135 close(fd); 128 close(esd_fd);
136 g_free(lineardata); 129 g_free(lineardata);
137 130
138 return 1; 131 return 1;
139 132
140 } 133 }
141 134
142 static int can_play_esd() 135 static int can_play_esd()
143 { 136 {
144 return 1; 137 esd_format_t format = ESD_BITS16 | ESD_STREAM | ESD_PLAY | ESD_MONO;
138
139 esd_fd = esd_play_stream(format, 8012, NULL, "gaim");
140
141 if (esd_fd < 0) {
142 return 0;
143 }
144
145 return 1;
145 } 146 }
146 147
147 #endif 148 #endif
148 149
149 #ifdef NAS_SOUND 150 #ifdef NAS_SOUND