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

Function TraceFormat

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

Source from the content-addressed store, hash-verified

352}
353
354void TraceFormat(const char *msg, const WAVEFORMATEX *format)
355{
356 constexpr size_t fmtex_extra_size{sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX)};
357 if(format->wFormatTag == WAVE_FORMAT_EXTENSIBLE && format->cbSize >= fmtex_extra_size)
358 {
359 class GuidPrinter {
360 char mMsg[64];
361
362 public:
363 GuidPrinter(const GUID &guid)
364 {
365 std::snprintf(mMsg, al::size(mMsg),
366 "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
367 DWORD{guid.Data1}, guid.Data2, guid.Data3,
368 guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
369 guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
370 }
371 const char *c_str() const { return mMsg; }
372 };
373
374 const WAVEFORMATEXTENSIBLE *fmtex{
375 CONTAINING_RECORD(format, const WAVEFORMATEXTENSIBLE, Format)};
376 TRACE("%s:\n"
377 " FormatTag = 0x%04x\n"
378 " Channels = %d\n"
379 " SamplesPerSec = %lu\n"
380 " AvgBytesPerSec = %lu\n"
381 " BlockAlign = %d\n"
382 " BitsPerSample = %d\n"
383 " Size = %d\n"
384 " Samples = %d\n"
385 " ChannelMask = 0x%lx\n"
386 " SubFormat = %s\n",
387 msg, fmtex->Format.wFormatTag, fmtex->Format.nChannels, fmtex->Format.nSamplesPerSec,
388 fmtex->Format.nAvgBytesPerSec, fmtex->Format.nBlockAlign, fmtex->Format.wBitsPerSample,
389 fmtex->Format.cbSize, fmtex->Samples.wReserved, fmtex->dwChannelMask,
390 GuidPrinter{fmtex->SubFormat}.c_str());
391 }
392 else
393 TRACE("%s:\n"
394 " FormatTag = 0x%04x\n"
395 " Channels = %d\n"
396 " SamplesPerSec = %lu\n"
397 " AvgBytesPerSec = %lu\n"
398 " BlockAlign = %d\n"
399 " BitsPerSample = %d\n"
400 " Size = %d\n",
401 msg, format->wFormatTag, format->nChannels, format->nSamplesPerSec,
402 format->nAvgBytesPerSec, format->nBlockAlign, format->wBitsPerSample, format->cbSize);
403}
404
405
406enum class MsgType {

Callers 2

wasapi.cppFile · 0.85
WasapiCaptureClass · 0.85

Calls 1

c_strMethod · 0.45

Tested by

no test coverage detected