36 |
static BOOL reopened; |
static BOOL reopened; |
37 |
static short samplewidth; |
static short samplewidth; |
38 |
static int audiochannels; |
static int audiochannels; |
39 |
|
static char *pcm_name; |
40 |
|
|
41 |
BOOL |
BOOL |
42 |
wave_out_open(void) |
alsa_open(void) |
43 |
{ |
{ |
|
char *pcm_name; |
|
44 |
int err; |
int err; |
45 |
|
|
|
pcm_name = xstrdup(DEFAULTDEVICE); |
|
|
|
|
46 |
if ((err = snd_pcm_open(&pcm_handle, pcm_name, stream, 0)) < 0) |
if ((err = snd_pcm_open(&pcm_handle, pcm_name, stream, 0)) < 0) |
47 |
{ |
{ |
48 |
error("snd_pcm_open: %s\n", snd_strerror(err)); |
error("snd_pcm_open: %s\n", snd_strerror(err)); |
58 |
} |
} |
59 |
|
|
60 |
void |
void |
61 |
wave_out_close(void) |
alsa_close(void) |
62 |
{ |
{ |
63 |
/* Ack all remaining packets */ |
/* Ack all remaining packets */ |
64 |
while (!rdpsnd_queue_empty()) |
while (!rdpsnd_queue_empty()) |
68 |
rdpsnd_queue_next(); |
rdpsnd_queue_next(); |
69 |
} |
} |
70 |
|
|
|
|
|
71 |
if (pcm_handle) |
if (pcm_handle) |
72 |
{ |
{ |
73 |
snd_pcm_drop(pcm_handle); |
snd_pcm_drop(pcm_handle); |
76 |
} |
} |
77 |
|
|
78 |
BOOL |
BOOL |
79 |
wave_out_format_supported(WAVEFORMATEX * pwfx) |
alsa_format_supported(WAVEFORMATEX * pwfx) |
80 |
{ |
{ |
81 |
#if 0 |
#if 0 |
82 |
int err; |
int err; |
109 |
} |
} |
110 |
|
|
111 |
BOOL |
BOOL |
112 |
wave_out_set_format(WAVEFORMATEX * pwfx) |
alsa_set_format(WAVEFORMATEX * pwfx) |
113 |
{ |
{ |
114 |
snd_pcm_hw_params_t *hwparams = NULL; |
snd_pcm_hw_params_t *hwparams = NULL; |
115 |
unsigned int rate, exact_rate; |
unsigned int rate, exact_rate; |
207 |
} |
} |
208 |
|
|
209 |
void |
void |
210 |
wave_out_volume(uint16 left, uint16 right) |
alsa_volume(uint16 left, uint16 right) |
211 |
{ |
{ |
212 |
static int warned = 0; |
static int warned = 0; |
213 |
|
|
214 |
if (!warned) |
if (!warned) |
215 |
{ |
{ |
216 |
warning("volume changes currently not supported with experimental alsa-output\n"); |
warning("volume changes currently not supported with alsa-output\n"); |
217 |
warned = 1; |
warned = 1; |
218 |
} |
} |
219 |
} |
} |
220 |
|
|
221 |
void |
void |
222 |
wave_out_play(void) |
alsa_play(void) |
223 |
{ |
{ |
224 |
struct audio_packet *packet; |
struct audio_packet *packet; |
225 |
STREAM out; |
STREAM out; |
282 |
g_dsp_busy = 1; |
g_dsp_busy = 1; |
283 |
return; |
return; |
284 |
} |
} |
285 |
|
|
286 |
|
static struct audio_driver alsa_driver = { |
287 |
|
wave_out_write:rdpsnd_queue_write, |
288 |
|
wave_out_open:alsa_open, |
289 |
|
wave_out_close:alsa_close, |
290 |
|
wave_out_format_supported:alsa_format_supported, |
291 |
|
wave_out_set_format:alsa_set_format, |
292 |
|
wave_out_volume:alsa_volume, |
293 |
|
wave_out_play:alsa_play, |
294 |
|
name:"alsa", |
295 |
|
description:"ALSA output driver, default device: " DEFAULTDEVICE, |
296 |
|
next:NULL, |
297 |
|
}; |
298 |
|
|
299 |
|
struct audio_driver * |
300 |
|
alsa_register(char *options) |
301 |
|
{ |
302 |
|
if (options) |
303 |
|
{ |
304 |
|
pcm_name = xstrdup(options); |
305 |
|
} |
306 |
|
else |
307 |
|
{ |
308 |
|
pcm_name = xstrdup(DEFAULTDEVICE); |
309 |
|
} |
310 |
|
|
311 |
|
return &alsa_driver; |
312 |
|
} |