31 |
ALconfig audioconfig; |
ALconfig audioconfig; |
32 |
ALport output_port; |
ALport output_port; |
33 |
|
|
|
static BOOL g_swapaudio; |
|
34 |
static int g_snd_rate; |
static int g_snd_rate; |
|
static BOOL g_swapaudio; |
|
35 |
static int width = AL_SAMPLE_16; |
static int width = AL_SAMPLE_16; |
36 |
static char *sgi_output_device = NULL; |
static char *sgi_output_device = NULL; |
37 |
|
|
68 |
min_volume, max_volume, volume_range); |
min_volume, max_volume, volume_range); |
69 |
#endif |
#endif |
70 |
|
|
|
rdpsnd_queue_init(); |
|
|
|
|
71 |
audioconfig = alNewConfig(); |
audioconfig = alNewConfig(); |
72 |
if (audioconfig == (ALconfig) 0) |
if (audioconfig == (ALconfig) 0) |
73 |
{ |
{ |
137 |
fprintf(stderr, "sgi_set_format: init...\n"); |
fprintf(stderr, "sgi_set_format: init...\n"); |
138 |
#endif |
#endif |
139 |
|
|
|
g_swapaudio = False; |
|
140 |
if (pwfx->wBitsPerSample == 8) |
if (pwfx->wBitsPerSample == 8) |
141 |
width = AL_SAMPLE_8; |
width = AL_SAMPLE_8; |
142 |
else if (pwfx->wBitsPerSample == 16) |
else if (pwfx->wBitsPerSample == 16) |
|
{ |
|
143 |
width = AL_SAMPLE_16; |
width = AL_SAMPLE_16; |
|
/* Do we need to swap the 16bit values? (Are we BigEndian) */ |
|
|
#if (defined(B_ENDIAN)) |
|
|
g_swapaudio = 1; |
|
|
#else |
|
|
g_swapaudio = 0; |
|
|
#endif |
|
|
} |
|
144 |
|
|
145 |
/* Limited support to configure an opened audio port in IRIX. The |
/* Limited support to configure an opened audio port in IRIX. The |
146 |
number of channels is a static setting and can not be changed after |
number of channels is a static setting and can not be changed after |
240 |
struct audio_packet *packet; |
struct audio_packet *packet; |
241 |
ssize_t len; |
ssize_t len; |
242 |
unsigned int i; |
unsigned int i; |
|
uint8 swap; |
|
243 |
STREAM out; |
STREAM out; |
|
static BOOL swapped = False; |
|
244 |
int gf; |
int gf; |
245 |
|
|
246 |
while (1) |
while (1) |
254 |
packet = rdpsnd_queue_current_packet(); |
packet = rdpsnd_queue_current_packet(); |
255 |
out = &packet->s; |
out = &packet->s; |
256 |
|
|
|
/* Swap the current packet, but only once */ |
|
|
if (g_swapaudio && !swapped) |
|
|
{ |
|
|
for (i = 0; i < out->end - out->p; i += 2) |
|
|
{ |
|
|
swap = *(out->p + i); |
|
|
*(out->p + i) = *(out->p + i + 1); |
|
|
*(out->p + i + 1) = swap; |
|
|
} |
|
|
swapped = True; |
|
|
} |
|
|
|
|
257 |
len = out->end - out->p; |
len = out->end - out->p; |
258 |
|
|
259 |
alWriteFrames(output_port, out->p, len / combinedFrameSize); |
alWriteFrames(output_port, out->p, len / combinedFrameSize); |
264 |
gf = alGetFilled(output_port); |
gf = alGetFilled(output_port); |
265 |
if (gf < (4 * maxFillable / 10)) |
if (gf < (4 * maxFillable / 10)) |
266 |
{ |
{ |
267 |
rdpsnd_send_completion(packet->tick, packet->index); |
rdpsnd_queue_next(0); |
|
rdpsnd_queue_next(); |
|
|
swapped = False; |
|
268 |
} |
} |
269 |
else |
else |
270 |
{ |
{ |
279 |
} |
} |
280 |
} |
} |
281 |
|
|
|
static struct audio_driver sgi_driver = { |
|
|
wave_out_write:rdpsnd_queue_write, |
|
|
wave_out_open:sgi_open, |
|
|
wave_out_close:sgi_close, |
|
|
wave_out_format_supported:sgi_format_supported, |
|
|
wave_out_set_format:sgi_set_format, |
|
|
wave_out_volume:sgi_volume, |
|
|
wave_out_play:sgi_play, |
|
|
name:"sgi", |
|
|
description:"SGI output driver", |
|
|
next:NULL, |
|
|
}; |
|
|
|
|
282 |
struct audio_driver * |
struct audio_driver * |
283 |
sgi_register(char *options) |
sgi_register(char *options) |
284 |
{ |
{ |
285 |
|
static struct audio_driver sgi_driver; |
286 |
|
|
287 |
|
sgi_driver.wave_out_open = sgi_open; |
288 |
|
sgi_driver.wave_out_close = sgi_close; |
289 |
|
sgi_driver.wave_out_format_supported = sgi_format_supported; |
290 |
|
sgi_driver.wave_out_set_format = sgi_set_format; |
291 |
|
sgi_driver.wave_out_volume = sgi_volume; |
292 |
|
sgi_driver.wave_out_play = sgi_play; |
293 |
|
sgi_driver.name = xstrdup("sgi"); |
294 |
|
sgi_driver.description = xstrdup("SGI output driver"); |
295 |
|
sgi_driver.need_byteswap_on_be = 1; |
296 |
|
sgi_driver.need_resampling = 0; |
297 |
|
sgi_driver.next = NULL; |
298 |
|
|
299 |
if (options) |
if (options) |
300 |
{ |
{ |
301 |
sgi_output_device = xstrdup(options); |
sgi_output_device = xstrdup(options); |