194 |
static uint16 tick, format; |
static uint16 tick, format; |
195 |
static uint8 packet_index; |
static uint8 packet_index; |
196 |
static BOOL awaiting_data_packet; |
static BOOL awaiting_data_packet; |
197 |
|
static unsigned char missing_bytes[4] = { 0, 0, 0, 0 }; |
198 |
|
|
199 |
#ifdef RDPSND_DEBUG |
#ifdef RDPSND_DEBUG |
200 |
printf("RDPSND recv:\n"); |
printf("RDPSND recv:\n"); |
227 |
current_format = format; |
current_format = format; |
228 |
} |
} |
229 |
|
|
230 |
current_driver->wave_out_write(s, tick, packet_index); |
/* Insert the 4 missing bytes retrieved from last RDPSND_WRITE */ |
231 |
|
memcpy(s->data, missing_bytes, 4); |
232 |
|
|
233 |
|
current_driver-> |
234 |
|
wave_out_write(rdpsnd_dsp_process |
235 |
|
(s, current_driver, &formats[current_format]), tick, |
236 |
|
packet_index); |
237 |
awaiting_data_packet = False; |
awaiting_data_packet = False; |
238 |
return; |
return; |
239 |
} |
} |
248 |
in_uint16_le(s, tick); |
in_uint16_le(s, tick); |
249 |
in_uint16_le(s, format); |
in_uint16_le(s, format); |
250 |
in_uint8(s, packet_index); |
in_uint8(s, packet_index); |
251 |
|
/* Here are our lost bytes, but why? */ |
252 |
|
memcpy(missing_bytes, s->end - 4, 4); |
253 |
awaiting_data_packet = True; |
awaiting_data_packet = True; |
254 |
break; |
break; |
255 |
case RDPSND_CLOSE: |
case RDPSND_CLOSE: |
289 |
BOOL |
BOOL |
290 |
rdpsnd_auto_open(void) |
rdpsnd_auto_open(void) |
291 |
{ |
{ |
292 |
current_driver = drivers; |
static BOOL failed = False; |
293 |
while (current_driver != NULL) |
|
294 |
|
if (!failed) |
295 |
{ |
{ |
296 |
DEBUG(("trying %s...\n", current_driver->name)); |
struct audio_driver *auto_driver = current_driver; |
297 |
if (current_driver->wave_out_open()) |
|
298 |
|
current_driver = drivers; |
299 |
|
while (current_driver != NULL) |
300 |
{ |
{ |
301 |
DEBUG(("selected %s\n", current_driver->name)); |
DEBUG(("trying %s...\n", current_driver->name)); |
302 |
return True; |
if (current_driver->wave_out_open()) |
303 |
|
{ |
304 |
|
DEBUG(("selected %s\n", current_driver->name)); |
305 |
|
return True; |
306 |
|
} |
307 |
|
g_dsp_fd = 0; |
308 |
|
current_driver = current_driver->next; |
309 |
} |
} |
|
g_dsp_fd = 0; |
|
|
current_driver = current_driver->next; |
|
|
} |
|
310 |
|
|
311 |
warning("no working audio-driver found\n"); |
warning("no working audio-driver found\n"); |
312 |
|
failed = True; |
313 |
|
current_driver = auto_driver; |
314 |
|
} |
315 |
|
|
316 |
return False; |
return False; |
317 |
} |
} |
328 |
*reg = alsa_register(options); |
*reg = alsa_register(options); |
329 |
reg = &((*reg)->next); |
reg = &((*reg)->next); |
330 |
#endif |
#endif |
|
#if defined(RDPSND_OSS) |
|
|
*reg = oss_register(options); |
|
|
reg = &((*reg)->next); |
|
|
#endif |
|
331 |
#if defined(RDPSND_SUN) |
#if defined(RDPSND_SUN) |
332 |
*reg = sun_register(options); |
*reg = sun_register(options); |
333 |
reg = &((*reg)->next); |
reg = &((*reg)->next); |
334 |
#endif |
#endif |
335 |
|
#if defined(RDPSND_OSS) |
336 |
|
*reg = oss_register(options); |
337 |
|
reg = &((*reg)->next); |
338 |
|
#endif |
339 |
#if defined(RDPSND_SGI) |
#if defined(RDPSND_SGI) |
340 |
*reg = sgi_register(options); |
*reg = sgi_register(options); |
341 |
reg = &((*reg)->next); |
reg = &((*reg)->next); |
412 |
queue_hi = next_hi; |
queue_hi = next_hi; |
413 |
|
|
414 |
packet->s = *s; |
packet->s = *s; |
|
packet->s.data = |
|
|
rdpsnd_dsp_process(s->data, s->size, current_driver, &formats[current_format]); |
|
|
packet->s.p = packet->s.data + 4; |
|
|
packet->s.end = packet->s.data + s->size; |
|
415 |
packet->tick = tick; |
packet->tick = tick; |
416 |
packet->index = index; |
packet->index = index; |
417 |
|
|
|
#if 0 /* Handled by DSP */ |
|
|
/* we steal the data buffer from s, give it a new one */ |
|
|
s->data = xmalloc(s->size); |
|
|
#endif |
|
|
|
|
418 |
if (!g_dsp_busy) |
if (!g_dsp_busy) |
419 |
current_driver->wave_out_play(); |
current_driver->wave_out_play(); |
420 |
} |
} |