35 |
#define DEFAULTDEVICE "/dev/audio" |
#define DEFAULTDEVICE "/dev/audio" |
36 |
|
|
37 |
static BOOL g_reopened; |
static BOOL g_reopened; |
|
static BOOL g_swapaudio; |
|
38 |
static short g_samplewidth; |
static short g_samplewidth; |
39 |
static char *dsp_dev; |
static char *dsp_dev; |
40 |
|
|
96 |
audio_info_t info; |
audio_info_t info; |
97 |
|
|
98 |
ioctl(g_dsp_fd, AUDIO_DRAIN, 0); |
ioctl(g_dsp_fd, AUDIO_DRAIN, 0); |
|
g_swapaudio = False; |
|
99 |
AUDIO_INITINFO(&info); |
AUDIO_INITINFO(&info); |
100 |
|
|
101 |
|
|
106 |
else if (pwfx->wBitsPerSample == 16) |
else if (pwfx->wBitsPerSample == 16) |
107 |
{ |
{ |
108 |
info.play.encoding = AUDIO_ENCODING_LINEAR; |
info.play.encoding = AUDIO_ENCODING_LINEAR; |
|
/* Do we need to swap the 16bit values? (Are we BigEndian) */ |
|
|
#ifdef B_ENDIAN |
|
|
g_swapaudio = 1; |
|
|
#else |
|
|
g_swapaudio = 0; |
|
|
#endif |
|
109 |
} |
} |
110 |
|
|
111 |
g_samplewidth = pwfx->wBitsPerSample / 8; |
g_samplewidth = pwfx->wBitsPerSample / 8; |
176 |
audio_info_t info; |
audio_info_t info; |
177 |
ssize_t len; |
ssize_t len; |
178 |
unsigned int i; |
unsigned int i; |
|
uint8 swap; |
|
179 |
STREAM out; |
STREAM out; |
|
static BOOL swapped = False; |
|
180 |
static BOOL sentcompletion = True; |
static BOOL sentcompletion = True; |
181 |
static uint32 samplecnt = 0; |
static uint32 samplecnt = 0; |
182 |
static uint32 numsamples; |
static uint32 numsamples; |
187 |
{ |
{ |
188 |
/* Device was just (re)openend */ |
/* Device was just (re)openend */ |
189 |
samplecnt = 0; |
samplecnt = 0; |
|
swapped = False; |
|
190 |
sentcompletion = True; |
sentcompletion = True; |
191 |
g_reopened = False; |
g_reopened = False; |
192 |
} |
} |
200 |
packet = rdpsnd_queue_current_packet(); |
packet = rdpsnd_queue_current_packet(); |
201 |
out = &packet->s; |
out = &packet->s; |
202 |
|
|
|
/* 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; |
|
|
} |
|
|
|
|
203 |
if (sentcompletion) |
if (sentcompletion) |
204 |
{ |
{ |
205 |
sentcompletion = False; |
sentcompletion = False; |
237 |
* playing this packet */ |
* playing this packet */ |
238 |
rdpsnd_send_completion(packet->tick + 50, packet->index); |
rdpsnd_send_completion(packet->tick + 50, packet->index); |
239 |
rdpsnd_queue_next(); |
rdpsnd_queue_next(); |
|
swapped = False; |
|
240 |
sentcompletion = True; |
sentcompletion = True; |
241 |
} |
} |
242 |
else |
else |
248 |
} |
} |
249 |
} |
} |
250 |
|
|
|
static struct audio_driver sun_driver = { |
|
|
wave_out_write:rdpsnd_queue_write, |
|
|
wave_out_open:sun_open, |
|
|
wave_out_close:sun_close, |
|
|
wave_out_format_supported:sun_format_supported, |
|
|
wave_out_set_format:sun_set_format, |
|
|
wave_out_volume:sun_volume, |
|
|
wave_out_play:sun_play, |
|
|
name:"sun", |
|
|
description:"SUN/BSD output driver, default device: " DEFAULTDEVICE " or $AUDIODEV", |
|
|
next:NULL, |
|
|
}; |
|
|
|
|
251 |
struct audio_driver * |
struct audio_driver * |
252 |
sun_register(char *options) |
sun_register(char *options) |
253 |
{ |
{ |
254 |
|
static struct audio_driver sun_driver; |
255 |
|
|
256 |
|
sun_driver.wave_out_write = rdpsnd_queue_write; |
257 |
|
sun_driver.wave_out_open = sun_open; |
258 |
|
sun_driver.wave_out_close = sun_close; |
259 |
|
sun_driver.wave_out_format_supported = sun_format_supported; |
260 |
|
sun_driver.wave_out_set_format = sun_set_format; |
261 |
|
sun_driver.wave_out_volume = sun_volume; |
262 |
|
sun_driver.wave_out_play = sun_play; |
263 |
|
sun_driver.name = xstrdup("sun"); |
264 |
|
sun_driver.description = |
265 |
|
xstrdup("SUN/BSD output driver, default device: " DEFAULTDEVICE " or $AUDIODEV"); |
266 |
|
sun_driver.need_byteswap_on_be = 1; |
267 |
|
sun_driver.next = NULL; |
268 |
|
|
269 |
if (options) |
if (options) |
270 |
{ |
{ |
271 |
dsp_dev = xstrdup(options); |
dsp_dev = xstrdup(options); |