1 |
/* -*- c-basic-offset: 8 -*- |
/* -*- c-basic-offset: 8 -*- |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Sound Channel Process Functions - libao-driver |
Sound Channel Process Functions - libao-driver |
4 |
Copyright (C) Matthew Chapman 2003 |
Copyright (C) Matthew Chapman 2003-2007 |
5 |
Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 |
Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 |
6 |
Copyright (C) Michael Gernoth mike@zerfleddert.de 2005-2006 |
Copyright (C) Michael Gernoth mike@zerfleddert.de 2005-2007 |
7 |
|
|
8 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
9 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
33 |
|
|
34 |
static ao_device *o_device = NULL; |
static ao_device *o_device = NULL; |
35 |
static int default_driver; |
static int default_driver; |
36 |
static BOOL reopened; |
static RD_BOOL reopened; |
37 |
static char *libao_device = NULL; |
static char *libao_device = NULL; |
38 |
|
|
39 |
void libao_play(void); |
void libao_play(void); |
42 |
libao_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) |
libao_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) |
43 |
{ |
{ |
44 |
/* We need to be called rather often... */ |
/* We need to be called rather often... */ |
45 |
FD_SET(0, wfds); |
if (o_device != NULL && !rdpsnd_queue_empty()) |
46 |
|
FD_SET(0, wfds); |
47 |
} |
} |
48 |
|
|
49 |
void |
void |
56 |
libao_play(); |
libao_play(); |
57 |
} |
} |
58 |
|
|
59 |
BOOL |
RD_BOOL |
60 |
libao_open(void) |
libao_open(void) |
61 |
{ |
{ |
62 |
ao_sample_format format; |
ao_sample_format format; |
106 |
ao_shutdown(); |
ao_shutdown(); |
107 |
} |
} |
108 |
|
|
109 |
BOOL |
RD_BOOL |
110 |
libao_set_format(WAVEFORMATEX * pwfx) |
libao_set_format(RD_WAVEFORMATEX * pwfx) |
111 |
{ |
{ |
112 |
ao_sample_format format; |
ao_sample_format format; |
113 |
|
|
188 |
(packet->tick + duration) % 65536, next_tick % 65536)); |
(packet->tick + duration) % 65536, next_tick % 65536)); |
189 |
} |
} |
190 |
|
|
191 |
delay_us = ((out->size/4) * (1000000 / 44100)); |
delay_us = ((out->size / 4) * (1000000 / 44100)); |
192 |
|
|
193 |
rdpsnd_queue_next(delay_us); |
rdpsnd_queue_next(delay_us); |
194 |
} |
} |
199 |
{ |
{ |
200 |
static struct audio_driver libao_driver; |
static struct audio_driver libao_driver; |
201 |
|
|
202 |
libao_driver.name = xstrdup("libao"); |
memset(&libao_driver, 0, sizeof(libao_driver)); |
203 |
libao_driver.description = xstrdup("libao output driver, default device: system dependent"); |
|
204 |
|
libao_driver.name = "libao"; |
205 |
|
libao_driver.description = "libao output driver, default device: system dependent"; |
206 |
|
|
207 |
libao_driver.add_fds = libao_add_fds; |
libao_driver.add_fds = libao_add_fds; |
208 |
libao_driver.check_fds = libao_check_fds; |
libao_driver.check_fds = libao_check_fds; |