0

The game Titanfall 2 shows the audio configuration for the playback device. https://i.stack.imgur.com/WcGpK.png

Is there anything I can do to get this information via code in C#?

Update & correction (September 29, 2019 at around 3:12pm UTC): The above linked image shows the audio option for the free-to-play game Apex Legends. The link for Titanfall 2 audio settings is http://i.imgur.com/6OSSysd.gif. For both games Windows Audio Configuration shows information, it is not an option users can change in game.

Some may find information at https://satsun.org/audio/ useful.

  • 1
    All of the information in that image seem to be game specific, not output device specific. You want to get information out of the game? Your title says different. Could you please clarify what exactly you want to get? – Sami Kuhmonen Sep 29 '19 at 05:02

1 Answers1

0

You enumerate devices on Windows Vista or later via the MMDevice

IMMDeviceEnumerator *enumerator = nullptr;
IMMDevice *device = nullptr;

hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&enumerator);
if (FAILED(hr))
       ...

// Get the default renderer
hr = enumerator->GetDefaultAudioEndpoint(eRender, eConsole, &device);
if (FAILED(hr))
       ...

    hr = pEndpoint->OpenPropertyStore(
                      STGM_READ, &pProps);
if (FAILED(hr))
       ...

    PROPVARIANT varName;
    // Initialize container for property value.
    PropVariantInit(&varName);

    // Get the endpoint's physical speaker property.
    hr = pProps->GetValue(
                   PKEY_AudioEndpoint_PhysicalSpeakers, &varName);
if (FAILED(hr))
       …

    // See https://learn.microsoft.com/en-us/windows/win32/coreaudio/pkey-audioendpoint-physicalspeakers

    PropVariantClear(&varName);

See Microsoft Docs

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81