1 |
/* |
/* -*- c-basic-offset: 8 -*- |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Sound Channel Process Functions - SGI/IRIX |
Sound Channel Process Functions - SGI/IRIX |
4 |
Copyright (C) Matthew Chapman 2003 |
Copyright (C) Matthew Chapman 2003 |
5 |
Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 |
Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 |
6 |
Copyright (C) Jeremy Meng voidfoo@cwazy.co.uk 2004 |
Copyright (C) Jeremy Meng void.foo@gmail.com 2004, 2005 |
7 |
|
|
8 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
9 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
24 |
#include <errno.h> |
#include <errno.h> |
25 |
#include <dmedia/audio.h> |
#include <dmedia/audio.h> |
26 |
|
|
27 |
#define IRIX_DEBUG 1 |
/* #define IRIX_DEBUG 1 */ |
28 |
|
|
29 |
#define IRIX_MAX_VOL 65535 |
#define IRIX_MAX_VOL 65535 |
30 |
|
|
77 |
queue_lo = queue_hi = 0; |
queue_lo = queue_hi = 0; |
78 |
|
|
79 |
audioconfig = alNewConfig(); |
audioconfig = alNewConfig(); |
80 |
if (audioconfig < 0) |
if (audioconfig == (ALconfig) 0) |
81 |
{ |
{ |
82 |
fprintf(stderr, "wave_out_open: alNewConfig failed: %s\n", |
fprintf(stderr, "wave_out_open: alNewConfig failed: %s\n", |
83 |
alGetErrorString(oserror())); |
alGetErrorString(oserror())); |
159 |
#endif |
#endif |
160 |
} |
} |
161 |
|
|
162 |
/* Limited support to configure an opened audio port in IRIX The |
/* Limited support to configure an opened audio port in IRIX. The |
163 |
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 |
164 |
a port is opened. So if the number of channels remains the same, we |
a port is opened. So if the number of channels remains the same, we |
165 |
can configure other settings Otherwise we have to reopen the audio |
can configure other settings; otherwise we have to reopen the audio |
166 |
port, using same config. */ |
port, using same config. */ |
167 |
|
|
168 |
channels = pwfx->nChannels; |
channels = pwfx->nChannels; |
169 |
g_snd_rate = pwfx->nSamplesPerSec; |
g_snd_rate = pwfx->nSamplesPerSec; |
170 |
|
|
171 |
alSetSampFmt(audioconfig, AL_SAMPFMT_TWOSCOMP); |
alSetSampFmt(audioconfig, AL_SAMPFMT_TWOSCOMP); |
172 |
alSetWidth(audioconfig, width); |
alSetWidth(audioconfig, width); |
173 |
if ( channels != alGetChannels(audioconfig) ) |
if (channels != alGetChannels(audioconfig)) |
174 |
{ |
{ |
175 |
alClosePort(output_port); |
alClosePort(output_port); |
176 |
alSetChannels(audioconfig, channels); |
alSetChannels(audioconfig, channels); |
179 |
if (output_port == (ALport) 0) |
if (output_port == (ALport) 0) |
180 |
{ |
{ |
181 |
fprintf(stderr, "wave_out_set_format: alOpenPort failed: %s\n", |
fprintf(stderr, "wave_out_set_format: alOpenPort failed: %s\n", |
182 |
alGetErrorString(oserror())); |
alGetErrorString(oserror())); |
183 |
return False; |
return False; |
184 |
} |
} |
185 |
|
|
319 |
if (out->p == out->end) |
if (out->p == out->end) |
320 |
{ |
{ |
321 |
gf = alGetFilled(output_port); |
gf = alGetFilled(output_port); |
322 |
if ( gf < (4 * maxFillable / 10) ) |
if (gf < (4 * maxFillable / 10)) |
323 |
{ |
{ |
324 |
rdpsnd_send_completion(packet->tick, packet->index); |
rdpsnd_send_completion(packet->tick, packet->index); |
325 |
free(out->data); |
free(out->data); |
332 |
/* fprintf(stderr,"Busy playing...\n"); */ |
/* fprintf(stderr,"Busy playing...\n"); */ |
333 |
#endif |
#endif |
334 |
g_dsp_busy = True; |
g_dsp_busy = True; |
335 |
|
usleep(10); |
336 |
return; |
return; |
337 |
} |
} |
338 |
} |
} |