37 |
static BOOL g_reopened; |
static BOOL g_reopened; |
38 |
static BOOL g_swapaudio; |
static BOOL g_swapaudio; |
39 |
static short g_samplewidth; |
static short g_samplewidth; |
40 |
|
static char *dsp_dev; |
41 |
|
|
42 |
BOOL |
BOOL |
43 |
wave_out_open(void) |
sun_open(void) |
44 |
{ |
{ |
|
char *dsp_dev = getenv("AUDIODEV"); |
|
|
|
|
|
if (dsp_dev == NULL) |
|
|
{ |
|
|
dsp_dev = xstrdup(DEFAULTDEVICE); |
|
|
} |
|
|
|
|
45 |
if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1) |
if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1) |
46 |
{ |
{ |
47 |
perror(dsp_dev); |
perror(dsp_dev); |
58 |
} |
} |
59 |
|
|
60 |
void |
void |
61 |
wave_out_close(void) |
sun_close(void) |
62 |
{ |
{ |
63 |
/* Ack all remaining packets */ |
/* Ack all remaining packets */ |
64 |
while (!rdpsnd_queue_empty()) |
while (!rdpsnd_queue_empty()) |
79 |
} |
} |
80 |
|
|
81 |
BOOL |
BOOL |
82 |
wave_out_format_supported(WAVEFORMATEX * pwfx) |
sun_format_supported(WAVEFORMATEX * pwfx) |
83 |
{ |
{ |
84 |
if (pwfx->wFormatTag != WAVE_FORMAT_PCM) |
if (pwfx->wFormatTag != WAVE_FORMAT_PCM) |
85 |
return False; |
return False; |
92 |
} |
} |
93 |
|
|
94 |
BOOL |
BOOL |
95 |
wave_out_set_format(WAVEFORMATEX * pwfx) |
sun_set_format(WAVEFORMATEX * pwfx) |
96 |
{ |
{ |
97 |
audio_info_t info; |
audio_info_t info; |
98 |
|
|
146 |
} |
} |
147 |
|
|
148 |
void |
void |
149 |
wave_out_volume(uint16 left, uint16 right) |
sun_volume(uint16 left, uint16 right) |
150 |
{ |
{ |
151 |
audio_info_t info; |
audio_info_t info; |
152 |
uint balance; |
uint balance; |
178 |
} |
} |
179 |
|
|
180 |
void |
void |
181 |
wave_out_play(void) |
sun_play(void) |
182 |
{ |
{ |
183 |
struct audio_packet *packet; |
struct audio_packet *packet; |
184 |
audio_info_t info; |
audio_info_t info; |
271 |
} |
} |
272 |
} |
} |
273 |
} |
} |
274 |
|
|
275 |
|
struct audio_driver * |
276 |
|
sun_register(char *options) |
277 |
|
{ |
278 |
|
static struct audio_driver sun_driver; |
279 |
|
|
280 |
|
sun_driver.wave_out_write = rdpsnd_queue_write; |
281 |
|
sun_driver.wave_out_open = sun_open; |
282 |
|
sun_driver.wave_out_close = sun_close; |
283 |
|
sun_driver.wave_out_format_supported = sun_format_supported; |
284 |
|
sun_driver.wave_out_set_format = sun_set_format; |
285 |
|
sun_driver.wave_out_volume = sun_volume; |
286 |
|
sun_driver.wave_out_play = sun_play; |
287 |
|
sun_driver.name = xstrdup("sun"); |
288 |
|
sun_driver.description = |
289 |
|
xstrdup("SUN/BSD output driver, default device: " DEFAULTDEVICE " or $AUDIODEV"); |
290 |
|
sun_driver.next = NULL; |
291 |
|
|
292 |
|
if (options) |
293 |
|
{ |
294 |
|
dsp_dev = xstrdup(options); |
295 |
|
} |
296 |
|
else |
297 |
|
{ |
298 |
|
dsp_dev = getenv("AUDIODEV"); |
299 |
|
|
300 |
|
if (dsp_dev == NULL) |
301 |
|
{ |
302 |
|
dsp_dev = xstrdup(DEFAULTDEVICE); |
303 |
|
} |
304 |
|
} |
305 |
|
|
306 |
|
return &sun_driver; |
307 |
|
} |