Changeset 522


Ignore:
Timestamp:
Oct 9, 2015, 11:59:26 PM (8 years ago)
Author:
roman
Message:

VS2013 upgrade, added some detail to the output

Location:
trunk/Utilities/EnumerateAudioDevices
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Utilities/EnumerateAudioDevices/EnumerateAudioDevices.rc

    r351 r522  
    116116
    117117VS_VERSION_INFO VERSIONINFO
    118  FILEVERSION  1, 0, 0, 50
     118 FILEVERSION  1, 0, 0, 62
    119119 PRODUCTVERSION 1,0,0,1
    120120 FILEFLAGSMASK 0x3fL
     
    135135            VALUE "Created By", "Roman Ryltsov <roman@alax.info>"
    136136            VALUE "FileDescription", "Enumerate WASAPI Audio Devices Utility"
    137             VALUE "FileVersion",  "1, 0, 0, 50\0"
     137            VALUE "FileVersion",  "1, 0, 0, 62\0"
    138138            VALUE "InternalName", "EnumerateAudioDevices"
    139139            VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-2011"
  • trunk/Utilities/EnumerateAudioDevices/EnumerateAudioDevices.sln

    r351 r522  
    11
    22Microsoft Visual Studio Solution File, Format Version 11.00
    3 # Visual Studio 2012
     3# Visual Studio 2013
    44Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EnumerateAudioDevices", "EnumerateAudioDevices.vcxproj", "{1AB74749-013C-4258-8B40-CB8B2E44F2B7}"
    55EndProject
  • trunk/Utilities/EnumerateAudioDevices/EnumerateAudioDevices.vcxproj

    r351 r522  
    11<?xml version="1.0" encoding="utf-8"?>
    2 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     2<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    33  <ItemGroup Label="ProjectConfigurations">
    44    <ProjectConfiguration Include="Debug|Win32">
     
    2929    <CharacterSet>Unicode</CharacterSet>
    3030    <WholeProgramOptimization>true</WholeProgramOptimization>
    31     <PlatformToolset>v110_xp</PlatformToolset>
     31    <PlatformToolset>v120_xp</PlatformToolset>
    3232  </PropertyGroup>
    3333  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    3434    <ConfigurationType>Application</ConfigurationType>
    3535    <CharacterSet>Unicode</CharacterSet>
    36     <PlatformToolset>v110_xp</PlatformToolset>
     36    <PlatformToolset>v120_xp</PlatformToolset>
    3737  </PropertyGroup>
    3838  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     
    4141    <CharacterSet>Unicode</CharacterSet>
    4242    <WholeProgramOptimization>true</WholeProgramOptimization>
    43     <PlatformToolset>v110_xp</PlatformToolset>
     43    <PlatformToolset>v120_xp</PlatformToolset>
    4444  </PropertyGroup>
    4545  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    4646    <ConfigurationType>Application</ConfigurationType>
    4747    <CharacterSet>Unicode</CharacterSet>
    48     <PlatformToolset>v110_xp</PlatformToolset>
     48    <PlatformToolset>v120_xp</PlatformToolset>
    4949  </PropertyGroup>
    5050  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  • trunk/Utilities/EnumerateAudioDevices/MainDialog.h

    r351 r522  
    66
    77#include <mmdeviceapi.h>
     8#include <mmreg.h>
    89#include <functiondiscoverykeys.h>
    910#include <propkey.h>
     
    4041public:
    4142// CMainDialog
     43        static BOOL IsWaveFormatExKey(const PROPERTYKEY& Key)
     44        {
     45                if(Key == PKEY_AudioEngine_DeviceFormat)
     46                        return TRUE;
     47                if(Key == PKEY_AudioEngine_OEMFormat)
     48                        return TRUE;
     49                class __declspec(uuid("{3D6E1656-2E50-4C4C-8D85-D0ACAE3C6C68}")) A;
     50                if(Key.fmtid == __uuidof(A) && (Key.pid == 2 || Key.pid == 3))
     51                        return TRUE;
     52                class __declspec(uuid("{E4870E26-3CC5-4CD2-BA46-CA0A9A70ED04}")) B;
     53                if(Key.fmtid == __uuidof(B) && Key.pid == 0) // PKEY_AudioEngine_??? endpointkeys.h
     54                        return TRUE;
     55                class __declspec(uuid("{624F56DE-FD24-473E-814A-DE40AACAED16}")) C;
     56                if(Key.fmtid == __uuidof(C) && Key.pid == 3)
     57                        return TRUE;
     58                return FALSE;
     59        }
    4260
    4361// Window message handelrs
     
    7391                                                __C(pMmDevice->GetId(&pszIdentifier));
    7492                                                sText.AppendFormat(_T("\t") _T("Identifier\t%ls\r\n"), pszIdentifier);
     93                                                #pragma region State
    7594                                                DWORD nState = 0;
    7695                                                __C(pMmDevice->GetState(&nState));
    77                                                 CRoArrayT<CString> StateStringArray;
    78                                                 #pragma region State Strings
    79                                                 const DWORD& nValue = nState;
    80                                                 static const struct
     96                                                static const CFlagNameT<DWORD> g_pDeviceStateMap[] =
    8197                                                {
    82                                                         DWORD nValue;
    83                                                         LPCTSTR pszName;
    84                                                 } g_pMap[] =
    85                                                 {
    86                                                         { DEVICE_STATE_ACTIVE, _T("DEVICE_STATE_ACTIVE") },
    87                                                         { DEVICE_STATE_DISABLED, _T("DEVICE_STATE_DISABLED") },
    88                                                         { DEVICE_STATE_NOTPRESENT, _T("DEVICE_STATE_NOTPRESENT") },
    89                                                         { DEVICE_STATE_UNPLUGGED, _T("DEVICE_STATE_UNPLUGGED") },
     98                                                        #define A(x) { x, #x },
     99                                                        A(DEVICE_STATE_ACTIVE)
     100                                                        A(DEVICE_STATE_DISABLED)
     101                                                        A(DEVICE_STATE_NOTPRESENT)
     102                                                        A(DEVICE_STATE_UNPLUGGED)
     103                                                        #undef A
    90104                                                };
    91                                                 DWORD nMask = 0;
    92                                                 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++)
    93                                                 {
    94                                                         if(nValue & g_pMap[nIndex].nValue)
    95                                                                 _W(StateStringArray.Add(g_pMap[nIndex].pszName) >= 0);
    96                                                         nMask |= g_pMap[nIndex].nValue;
    97                                                 }
    98                                                 if(nValue & ~nMask)
    99                                                         _W(StateStringArray.Add(AtlFormatString(_T("0x%x"), nValue & ~nMask)) >= 0);
    100                                                 #pragma endregion
    101                                                 sText.AppendFormat(_T("\t") _T("State\t%s\t0x%02x\r\n"), _StringHelper::Join(StateStringArray, _T(" | ")), nState);
     105                                                sText.AppendFormat(_T("\t") _T("State\t%s\t0x%02X\r\n"), FormatFlagsT(g_pDeviceStateMap, nState), nState);
     106                                                #pragma endregion State
    102107                                                #pragma region Property Store
    103108                                                sText.AppendFormat(_T("\t") _T("Properties:\r\n"));
     
    119124                                                                        // NOTE: This is brought to you by regexp .+{PKEY_[^,]+}.+ -> A(\1)
    120125                                                                        #pragma region Named SDK constants
    121 #define A(x) { &x, #x },
    122 #define B(x) { &reinterpret_cast<const PROPERTYKEY&>(x), #x },
    123                                                                         static const struct { const PROPERTYKEY* pKey; LPCSTR pszName; } g_pMap[] = {
     126                                                                        #define A(x) { &x, #x },
     127                                                                        #define B(x) { &reinterpret_cast<const PROPERTYKEY&>(x), #x },
     128                                                                        static const struct
     129                                                                        {
     130                                                                                const PROPERTYKEY* pKey;
     131                                                                                LPCSTR pszName;
     132                                                                        } g_pMap[] =
     133                                                                        {
    124134                                                                                #pragma region functiondiscoverykeys.h
    125135                                                                                A(PKEY_NAME)
     
    11441154                                                                                #pragma endregion
    11451155                                                                        };
    1146 #undef A
    1147 #undef B
     1156                                                                        #undef A
     1157                                                                        #undef B
    11481158                                                                        #pragma endregion
    11491159                                                                        for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++)
     
    12091219                                                                        #pragma endregion
    12101220                                                                        #pragma endregion
     1221                                                                        #pragma region Variant Type
    12111222                                                                        static const CEnumerationNameT<VARTYPE> g_pVarTypeMap[] =
    12121223                                                                        {
     
    12581269                                                                                #undef A
    12591270                                                                        };
    1260                                                                         sText.Append(_StringHelper::Join<CString>(5, _T("\t"),
     1271                                                                        #pragma endregion
     1272                                                                        #pragma region Detail
     1273                                                                        CString sDetail;
     1274                                                                        if(Key == PKEY_AudioEndpoint_FormFactor && Value.vt == VT_UI4)
     1275                                                                        {
     1276                                                                                static const CEnumerationNameT<UINT32> g_pMap[] =
     1277                                                                                {
     1278                                                                                        #define A(x) { x, #x },
     1279                                                                                        A(RemoteNetworkDevice)
     1280                                                                                        A(Speakers)
     1281                                                                                        A(LineLevel)
     1282                                                                                        A(Headphones)
     1283                                                                                        A(Microphone)
     1284                                                                                        A(Headset)
     1285                                                                                        A(Handset)
     1286                                                                                        A(UnknownDigitalPassthrough)
     1287                                                                                        A(SPDIF)
     1288                                                                                        A(DigitalAudioDisplayDevice)
     1289                                                                                        A(UnknownFormFactor)
     1290                                                                                        #undef A
     1291                                                                                };
     1292                                                                                sDetail = FormatEnumerationT(g_pMap, Value.uintVal);
     1293                                                                        } else
     1294                                                                        if(IsWaveFormatExKey(Key) && Value.vt == VT_BLOB && Value.blob.cbSize >= sizeof (WAVEFORMATEX))
     1295                                                                        {
     1296                                                                                const WAVEFORMATEX* pWaveFormatEx = (const WAVEFORMATEX*) Value.blob.pBlobData;
     1297                                                                                CRoArrayT<CString> Array;
     1298                                                                                Array.Add(AtlFormatString(_T("wFormatTag 0x%02X"), pWaveFormatEx->wFormatTag));
     1299                                                                                Array.Add(AtlFormatString(_T("nChannels %d"), pWaveFormatEx->nChannels));
     1300                                                                                Array.Add(AtlFormatString(_T("nSamplesPerSec %d"), pWaveFormatEx->nSamplesPerSec));
     1301                                                                                Array.Add(AtlFormatString(_T("nAvgBytesPerSec %d"), pWaveFormatEx->nAvgBytesPerSec));
     1302                                                                                Array.Add(AtlFormatString(_T("nBlockAlign %d"), pWaveFormatEx->nBlockAlign));
     1303                                                                                Array.Add(AtlFormatString(_T("wBitsPerSample %d"), pWaveFormatEx->wBitsPerSample));
     1304                                                                                Array.Add(AtlFormatString(_T("cbSize %d"), pWaveFormatEx->cbSize));
     1305                                                                                if(Value.blob.cbSize >= sizeof (WAVEFORMATEXTENSIBLE) && pWaveFormatEx->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
     1306                                                                                {
     1307                                                                                        const WAVEFORMATEXTENSIBLE* pWaveFormatExtensible = (const WAVEFORMATEXTENSIBLE*) pWaveFormatEx;
     1308                                                                                        Array.Add(AtlFormatString(_T("wValidBitsPerSample %d"), pWaveFormatExtensible->Samples.wValidBitsPerSample));
     1309                                                                                        Array.Add(AtlFormatString(_T("dwChannelMask 0x%02X"), pWaveFormatExtensible->dwChannelMask));
     1310                                                                                        Array.Add(AtlFormatString(_T("SubFormat %ls"), _PersistHelper::StringFromIdentifier(pWaveFormatExtensible->SubFormat)));
     1311                                                                                }
     1312                                                                                sDetail = _StringHelper::Join(Array, _T("; "));
     1313                                                                        }
     1314                                                                        #pragma endregion
     1315                                                                        sText.Append(_StringHelper::Join<CString>(6, _T("\t"),
    12611316                                                                                _T(""),
    12621317                                                                                _T(""),
     
    12641319                                                                                sValue,
    12651320                                                                                FormatEnumerationT(g_pVarTypeMap, Value.vt),
     1321                                                                                sDetail,
    12661322                                                                                0) + _T("\r\n"));
    12671323                                                                }
     
    12761332                                                        {
    12771333                                                                _Z_ATLEXCEPTION(Exception);
    1278                                                                 sText.AppendFormat(_T("\t\t") _T("Error 0x%08x\r\n"), (HRESULT) Exception);
     1334                                                                sText.AppendFormat(_T("\t\t") _T("Error 0x%08X\r\n"), (HRESULT) Exception);
    12791335                                                        }
    12801336                                                #pragma endregion
     
    12831339                                        {
    12841340                                                _Z_ATLEXCEPTION(Exception);
    1285                                                 sText.AppendFormat(_T("\t") _T("Error 0x%08x\r\n"), (HRESULT) Exception);
     1341                                                sText.AppendFormat(_T("\t") _T("Error 0x%08X\r\n"), (HRESULT) Exception);
    12861342                                        }
    12871343                        }
     
    12891345                        {
    12901346                                _Z_ATLEXCEPTION(Exception);
    1291                                 sText.AppendFormat(_T("Error 0x%08x\r\n"), (HRESULT) Exception);
     1347                                sText.AppendFormat(_T("Error 0x%08X\r\n"), (HRESULT) Exception);
    12921348                        }
    12931349                        #pragma endregion
  • trunk/Utilities/EnumerateAudioDevices/stdafx.h

    r351 r522  
    11////////////////////////////////////////////////////////////
    2 // Copyright (C) Roman Ryltsov, 2008-2011
     2// Copyright (C) Roman Ryltsov, 2008-2015
    33// Created by Roman Ryltsov roman@alax.info
    4 //
    5 // $Id$
    64
    75#pragma once
     
    4745#define _WTL_NEW_PAGE_NOTIFY_HANDLERS
    4846
    49 #undef _SYSINFOAPI_H_
    5047#include <atlapp.h>
    51 #define _SYSINFOAPI_H_
    52 
    5348#include <atlgdi.h>
    5449#include <atluser.h>
Note: See TracChangeset for help on using the changeset viewer.