MCPcopy Create free account
hub / github.com/crownengine/crown / MakeExtensible

Function MakeExtensible

3rdparty/openal/alc/backends/wasapi.cpp:312–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310
311
312bool 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
354void TraceFormat(const char *msg, const WAVEFORMATEX *format)
355{

Callers 2

wasapi.cppFile · 0.85
WasapiCaptureClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected