29 |
#include <ao/ao.h> |
#include <ao/ao.h> |
30 |
#include <sys/time.h> |
#include <sys/time.h> |
31 |
|
|
32 |
#define WAVEOUTLEN 1024 |
#define WAVEOUTLEN 16 |
33 |
|
|
34 |
static ao_device *o_device = NULL; |
static ao_device *o_device = NULL; |
35 |
static int default_driver; |
static int default_driver; |
65 |
} |
} |
66 |
|
|
67 |
g_dsp_fd = 0; |
g_dsp_fd = 0; |
|
rdpsnd_queue_init(); |
|
68 |
|
|
69 |
reopened = True; |
reopened = True; |
70 |
|
|
77 |
/* Ack all remaining packets */ |
/* Ack all remaining packets */ |
78 |
while (!rdpsnd_queue_empty()) |
while (!rdpsnd_queue_empty()) |
79 |
{ |
{ |
80 |
rdpsnd_send_completion(rdpsnd_queue_current_packet()->tick, |
rdpsnd_queue_next(0); |
|
rdpsnd_queue_current_packet()->index); |
|
|
rdpsnd_queue_next(); |
|
81 |
} |
} |
82 |
|
|
83 |
if (o_device != NULL) |
if (o_device != NULL) |
168 |
(packet->tick + duration) % 65536, next_tick % 65536)); |
(packet->tick + duration) % 65536, next_tick % 65536)); |
169 |
} |
} |
170 |
|
|
171 |
rdpsnd_send_completion(((packet->tick + duration) % 65536), packet->index); |
rdpsnd_queue_next(duration); |
|
rdpsnd_queue_next(); |
|
172 |
} |
} |
173 |
|
|
174 |
g_dsp_busy = 1; |
g_dsp_busy = 1; |
175 |
return; |
return; |
176 |
} |
} |
177 |
|
|
178 |
|
static struct audio_driver libao_driver = { |
179 |
|
.name = "libao", |
180 |
|
.description = "libao output driver, default device: system dependent", |
181 |
|
|
182 |
|
.wave_out_open = libao_open, |
183 |
|
.wave_out_close = libao_close, |
184 |
|
.wave_out_format_supported = rdpsnd_dsp_resample_supported, |
185 |
|
.wave_out_set_format = libao_set_format, |
186 |
|
.wave_out_volume = rdpsnd_dsp_softvol_set, |
187 |
|
.wave_out_play = libao_play, |
188 |
|
|
189 |
|
.need_byteswap_on_be = 1, |
190 |
|
.need_resampling = 1, |
191 |
|
}; |
192 |
|
|
193 |
struct audio_driver * |
struct audio_driver * |
194 |
libao_register(char *options) |
libao_register(char *options) |
195 |
{ |
{ |
|
static struct audio_driver libao_driver; |
|
|
struct ao_info *libao_info; |
|
|
static char description[101]; |
|
|
|
|
|
libao_driver.wave_out_write = rdpsnd_queue_write; |
|
|
libao_driver.wave_out_open = libao_open; |
|
|
libao_driver.wave_out_close = libao_close; |
|
|
libao_driver.wave_out_format_supported = rdpsnd_dsp_resample_supported; |
|
|
libao_driver.wave_out_set_format = libao_set_format; |
|
|
libao_driver.wave_out_volume = rdpsnd_dsp_softvol_set; |
|
|
libao_driver.wave_out_play = libao_play; |
|
|
libao_driver.name = xstrdup("libao"); |
|
|
libao_driver.description = description; |
|
|
libao_driver.need_byteswap_on_be = 1; |
|
|
libao_driver.need_resampling = 1; |
|
|
libao_driver.next = NULL; |
|
|
|
|
|
ao_initialize(); |
|
|
|
|
|
libao_info = ao_driver_info(ao_default_driver_id()); |
|
|
|
|
|
if (libao_info) |
|
|
{ |
|
|
snprintf(description, 100, "libao output driver, default device: %s", |
|
|
libao_info->short_name); |
|
|
} |
|
|
else |
|
|
{ |
|
|
snprintf(description, 100, "libao output driver, default device: none"); |
|
|
} |
|
|
|
|
|
ao_shutdown(); |
|
|
|
|
196 |
if (options) |
if (options) |
197 |
{ |
{ |
198 |
libao_device = xstrdup(options); |
libao_device = xstrdup(options); |