22 |
|
|
23 |
#include "rdesktop.h" |
#include "rdesktop.h" |
24 |
#include "rdpsnd.h" |
#include "rdpsnd.h" |
25 |
|
#include "rdpsnd_dsp.h" |
26 |
#include <unistd.h> |
#include <unistd.h> |
27 |
#include <fcntl.h> |
#include <fcntl.h> |
28 |
#include <errno.h> |
#include <errno.h> |
37 |
static BOOL reopened; |
static BOOL reopened; |
38 |
static short samplewidth; |
static short samplewidth; |
39 |
static int audiochannels; |
static int audiochannels; |
40 |
|
static char *pcm_name; |
41 |
|
|
42 |
BOOL |
BOOL |
43 |
wave_out_open(void) |
alsa_open(void) |
44 |
{ |
{ |
|
char *pcm_name; |
|
45 |
int err; |
int err; |
46 |
|
|
|
pcm_name = xstrdup(DEFAULTDEVICE); |
|
|
|
|
47 |
if ((err = snd_pcm_open(&pcm_handle, pcm_name, stream, 0)) < 0) |
if ((err = snd_pcm_open(&pcm_handle, pcm_name, stream, 0)) < 0) |
48 |
{ |
{ |
49 |
error("snd_pcm_open: %s\n", snd_strerror(err)); |
error("snd_pcm_open: %s\n", snd_strerror(err)); |
59 |
} |
} |
60 |
|
|
61 |
void |
void |
62 |
wave_out_close(void) |
alsa_close(void) |
63 |
{ |
{ |
64 |
/* Ack all remaining packets */ |
/* Ack all remaining packets */ |
65 |
while (!rdpsnd_queue_empty()) |
while (!rdpsnd_queue_empty()) |
69 |
rdpsnd_queue_next(); |
rdpsnd_queue_next(); |
70 |
} |
} |
71 |
|
|
|
|
|
72 |
if (pcm_handle) |
if (pcm_handle) |
73 |
{ |
{ |
74 |
snd_pcm_drop(pcm_handle); |
snd_pcm_drop(pcm_handle); |
77 |
} |
} |
78 |
|
|
79 |
BOOL |
BOOL |
80 |
wave_out_format_supported(WAVEFORMATEX * pwfx) |
alsa_format_supported(WAVEFORMATEX * pwfx) |
81 |
{ |
{ |
82 |
#if 0 |
#if 0 |
83 |
int err; |
int err; |
110 |
} |
} |
111 |
|
|
112 |
BOOL |
BOOL |
113 |
wave_out_set_format(WAVEFORMATEX * pwfx) |
alsa_set_format(WAVEFORMATEX * pwfx) |
114 |
{ |
{ |
115 |
snd_pcm_hw_params_t *hwparams = NULL; |
snd_pcm_hw_params_t *hwparams = NULL; |
116 |
unsigned int rate, exact_rate; |
unsigned int rate, exact_rate; |
208 |
} |
} |
209 |
|
|
210 |
void |
void |
211 |
wave_out_volume(uint16 left, uint16 right) |
alsa_play(void) |
|
{ |
|
|
static int warned = 0; |
|
|
|
|
|
if (!warned) |
|
|
{ |
|
|
warning("volume changes currently not supported with experimental alsa-output\n"); |
|
|
warned = 1; |
|
|
} |
|
|
} |
|
|
|
|
|
void |
|
|
wave_out_play(void) |
|
212 |
{ |
{ |
213 |
struct audio_packet *packet; |
struct audio_packet *packet; |
214 |
STREAM out; |
STREAM out; |
271 |
g_dsp_busy = 1; |
g_dsp_busy = 1; |
272 |
return; |
return; |
273 |
} |
} |
274 |
|
|
275 |
|
struct audio_driver * |
276 |
|
alsa_register(char *options) |
277 |
|
{ |
278 |
|
static struct audio_driver alsa_driver; |
279 |
|
|
280 |
|
alsa_driver.wave_out_write = rdpsnd_queue_write; |
281 |
|
alsa_driver.wave_out_open = alsa_open; |
282 |
|
alsa_driver.wave_out_close = alsa_close; |
283 |
|
alsa_driver.wave_out_format_supported = alsa_format_supported; |
284 |
|
alsa_driver.wave_out_set_format = alsa_set_format; |
285 |
|
alsa_driver.wave_out_volume = rdpsnd_dsp_softvol_set; |
286 |
|
alsa_driver.wave_out_play = alsa_play; |
287 |
|
alsa_driver.name = xstrdup("alsa"); |
288 |
|
alsa_driver.description = xstrdup("ALSA output driver, default device: " DEFAULTDEVICE); |
289 |
|
alsa_driver.need_byteswap_on_be = 0; |
290 |
|
alsa_driver.need_resampling = 0; |
291 |
|
alsa_driver.next = NULL; |
292 |
|
|
293 |
|
if (options) |
294 |
|
{ |
295 |
|
pcm_name = xstrdup(options); |
296 |
|
} |
297 |
|
else |
298 |
|
{ |
299 |
|
pcm_name = xstrdup(DEFAULTDEVICE); |
300 |
|
} |
301 |
|
|
302 |
|
return &alsa_driver; |
303 |
|
} |