78 |
unsigned int in_format_count, i; |
unsigned int in_format_count, i; |
79 |
WAVEFORMATEX *format; |
WAVEFORMATEX *format; |
80 |
STREAM out; |
STREAM out; |
81 |
|
BOOL device_available = False; |
82 |
|
int readcnt; |
83 |
|
int discardcnt; |
84 |
|
|
85 |
in_uint8s(in, 14); /* flags, volume, pitch, UDP port */ |
in_uint8s(in, 14); /* flags, volume, pitch, UDP port */ |
86 |
in_uint16_le(in, in_format_count); |
in_uint16_le(in, in_format_count); |
87 |
in_uint8s(in, 4); /* pad, status, pad */ |
in_uint8s(in, 4); /* pad, status, pad */ |
88 |
|
|
89 |
|
if (wave_out_open()) |
90 |
|
{ |
91 |
|
wave_out_close(); |
92 |
|
device_available = True; |
93 |
|
} |
94 |
|
|
95 |
format_count = 0; |
format_count = 0; |
96 |
if (s_check_rem(in, 18*in_format_count)) |
if (s_check_rem(in, 18*in_format_count)) |
97 |
{ |
{ |
106 |
in_uint16_le(in, format->wBitsPerSample); |
in_uint16_le(in, format->wBitsPerSample); |
107 |
in_uint16_le(in, format->cbSize); |
in_uint16_le(in, format->cbSize); |
108 |
|
|
109 |
if (wave_out_format_supported(format)) |
/* read in the buffer of unknown use */ |
110 |
|
readcnt = format->cbSize; |
111 |
|
discardcnt = 0; |
112 |
|
if (format->cbSize > MAX_CBSIZE) |
113 |
|
{ |
114 |
|
fprintf(stderr, "cbSize too large for buffer: %d\n", format->cbSize); |
115 |
|
readcnt = MAX_CBSIZE; |
116 |
|
discardcnt = format->cbSize - MAX_CBSIZE; |
117 |
|
} |
118 |
|
in_uint8a(in, format->cb, readcnt); |
119 |
|
in_uint8s(in, discardcnt); |
120 |
|
|
121 |
|
if (device_available && wave_out_format_supported(format)) |
122 |
{ |
{ |
123 |
format_count++; |
format_count++; |
124 |
if (format_count == MAX_FORMATS) |
if (format_count == MAX_FORMATS) |
176 |
{ |
{ |
177 |
uint8 type; |
uint8 type; |
178 |
uint16 datalen; |
uint16 datalen; |
179 |
|
uint32 volume; |
180 |
static uint16 tick, format; |
static uint16 tick, format; |
181 |
static uint8 packet_index; |
static uint8 packet_index; |
182 |
static BOOL awaiting_data_packet; |
static BOOL awaiting_data_packet; |
240 |
rdpsnd_process_unknown6(s); |
rdpsnd_process_unknown6(s); |
241 |
break; |
break; |
242 |
case RDPSND_SET_VOLUME: |
case RDPSND_SET_VOLUME: |
243 |
/* uint32 volume */ |
in_uint32(s, volume); |
244 |
|
if ( device_open ) |
245 |
|
{ |
246 |
|
wave_out_volume((volume & 0xffff), (volume & 0xffff0000) >> 16); |
247 |
|
} |
248 |
break; |
break; |
249 |
default: |
default: |
250 |
unimpl("RDPSND packet type %d\n", type); |
unimpl("RDPSND packet type %d\n", type); |