| 310 | |
| 311 | |
| 312 | bool MakeExtensible(WAVEFORMATEXTENSIBLE *out, const WAVEFORMATEX *in) |
| 313 | { |
| 314 | *out = WAVEFORMATEXTENSIBLE{}; |
| 315 | if(in->wFormatTag == WAVE_FORMAT_EXTENSIBLE) |
| 316 | { |
| 317 | *out = *CONTAINING_RECORD(in, const WAVEFORMATEXTENSIBLE, Format); |
| 318 | out->Format.cbSize = sizeof(*out) - sizeof(out->Format); |
| 319 | } |
| 320 | else if(in->wFormatTag == WAVE_FORMAT_PCM) |
| 321 | { |
| 322 | out->Format = *in; |
| 323 | out->Format.cbSize = 0; |
| 324 | out->Samples.wValidBitsPerSample = out->Format.wBitsPerSample; |
| 325 | if(out->Format.nChannels == 1) |
| 326 | out->dwChannelMask = MONO; |
| 327 | else if(out->Format.nChannels == 2) |
| 328 | out->dwChannelMask = STEREO; |
| 329 | else |
| 330 | ERR("Unhandled PCM channel count: %d\n", out->Format.nChannels); |
| 331 | out->SubFormat = KSDATAFORMAT_SUBTYPE_PCM; |
| 332 | } |
| 333 | else if(in->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) |
| 334 | { |
| 335 | out->Format = *in; |
| 336 | out->Format.cbSize = 0; |
| 337 | out->Samples.wValidBitsPerSample = out->Format.wBitsPerSample; |
| 338 | if(out->Format.nChannels == 1) |
| 339 | out->dwChannelMask = MONO; |
| 340 | else if(out->Format.nChannels == 2) |
| 341 | out->dwChannelMask = STEREO; |
| 342 | else |
| 343 | ERR("Unhandled IEEE float channel count: %d\n", out->Format.nChannels); |
| 344 | out->SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; |
| 345 | } |
| 346 | else |
| 347 | { |
| 348 | ERR("Unhandled format tag: 0x%04x\n", in->wFormatTag); |
| 349 | return false; |
| 350 | } |
| 351 | return true; |
| 352 | } |
| 353 | |
| 354 | void TraceFormat(const char *msg, const WAVEFORMATEX *format) |
| 355 | { |
no outgoing calls
no test coverage detected