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