Changeset 522 for trunk/Utilities
- Timestamp:
- Oct 9, 2015, 11:59:26 PM (8 years ago)
- Location:
- trunk/Utilities/EnumerateAudioDevices
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Utilities/EnumerateAudioDevices/EnumerateAudioDevices.rc
r351 r522 116 116 117 117 VS_VERSION_INFO VERSIONINFO 118 FILEVERSION 1, 0, 0, 50118 FILEVERSION 1, 0, 0, 62 119 119 PRODUCTVERSION 1,0,0,1 120 120 FILEFLAGSMASK 0x3fL … … 135 135 VALUE "Created By", "Roman Ryltsov <roman@alax.info>" 136 136 VALUE "FileDescription", "Enumerate WASAPI Audio Devices Utility" 137 VALUE "FileVersion", "1, 0, 0, 50\0"137 VALUE "FileVersion", "1, 0, 0, 62\0" 138 138 VALUE "InternalName", "EnumerateAudioDevices" 139 139 VALUE "LegalCopyright", "Copyright © Alax.Info, Roman Ryltsov, 2008-2011" -
trunk/Utilities/EnumerateAudioDevices/EnumerateAudioDevices.sln
r351 r522 1 1 2 2 Microsoft Visual Studio Solution File, Format Version 11.00 3 # Visual Studio 201 23 # Visual Studio 2013 4 4 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EnumerateAudioDevices", "EnumerateAudioDevices.vcxproj", "{1AB74749-013C-4258-8B40-CB8B2E44F2B7}" 5 5 EndProject -
trunk/Utilities/EnumerateAudioDevices/EnumerateAudioDevices.vcxproj
r351 r522 1 1 <?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"> 3 3 <ItemGroup Label="ProjectConfigurations"> 4 4 <ProjectConfiguration Include="Debug|Win32"> … … 29 29 <CharacterSet>Unicode</CharacterSet> 30 30 <WholeProgramOptimization>true</WholeProgramOptimization> 31 <PlatformToolset>v1 10_xp</PlatformToolset>31 <PlatformToolset>v120_xp</PlatformToolset> 32 32 </PropertyGroup> 33 33 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> 34 34 <ConfigurationType>Application</ConfigurationType> 35 35 <CharacterSet>Unicode</CharacterSet> 36 <PlatformToolset>v1 10_xp</PlatformToolset>36 <PlatformToolset>v120_xp</PlatformToolset> 37 37 </PropertyGroup> 38 38 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> … … 41 41 <CharacterSet>Unicode</CharacterSet> 42 42 <WholeProgramOptimization>true</WholeProgramOptimization> 43 <PlatformToolset>v1 10_xp</PlatformToolset>43 <PlatformToolset>v120_xp</PlatformToolset> 44 44 </PropertyGroup> 45 45 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> 46 46 <ConfigurationType>Application</ConfigurationType> 47 47 <CharacterSet>Unicode</CharacterSet> 48 <PlatformToolset>v1 10_xp</PlatformToolset>48 <PlatformToolset>v120_xp</PlatformToolset> 49 49 </PropertyGroup> 50 50 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> -
trunk/Utilities/EnumerateAudioDevices/MainDialog.h
r351 r522 6 6 7 7 #include <mmdeviceapi.h> 8 #include <mmreg.h> 8 9 #include <functiondiscoverykeys.h> 9 10 #include <propkey.h> … … 40 41 public: 41 42 // 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 } 42 60 43 61 // Window message handelrs … … 73 91 __C(pMmDevice->GetId(&pszIdentifier)); 74 92 sText.AppendFormat(_T("\t") _T("Identifier\t%ls\r\n"), pszIdentifier); 93 #pragma region State 75 94 DWORD nState = 0; 76 95 __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[] = 81 97 { 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 90 104 }; 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 102 107 #pragma region Property Store 103 108 sText.AppendFormat(_T("\t") _T("Properties:\r\n")); … … 119 124 // NOTE: This is brought to you by regexp .+{PKEY_[^,]+}.+ -> A(\1) 120 125 #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 { 124 134 #pragma region functiondiscoverykeys.h 125 135 A(PKEY_NAME) … … 1144 1154 #pragma endregion 1145 1155 }; 1146 #undef A1147 #undef B1156 #undef A 1157 #undef B 1148 1158 #pragma endregion 1149 1159 for(SIZE_T nIndex = 0; nIndex < DIM(g_pMap); nIndex++) … … 1209 1219 #pragma endregion 1210 1220 #pragma endregion 1221 #pragma region Variant Type 1211 1222 static const CEnumerationNameT<VARTYPE> g_pVarTypeMap[] = 1212 1223 { … … 1258 1269 #undef A 1259 1270 }; 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"), 1261 1316 _T(""), 1262 1317 _T(""), … … 1264 1319 sValue, 1265 1320 FormatEnumerationT(g_pVarTypeMap, Value.vt), 1321 sDetail, 1266 1322 0) + _T("\r\n")); 1267 1323 } … … 1276 1332 { 1277 1333 _Z_ATLEXCEPTION(Exception); 1278 sText.AppendFormat(_T("\t\t") _T("Error 0x%08 x\r\n"), (HRESULT) Exception);1334 sText.AppendFormat(_T("\t\t") _T("Error 0x%08X\r\n"), (HRESULT) Exception); 1279 1335 } 1280 1336 #pragma endregion … … 1283 1339 { 1284 1340 _Z_ATLEXCEPTION(Exception); 1285 sText.AppendFormat(_T("\t") _T("Error 0x%08 x\r\n"), (HRESULT) Exception);1341 sText.AppendFormat(_T("\t") _T("Error 0x%08X\r\n"), (HRESULT) Exception); 1286 1342 } 1287 1343 } … … 1289 1345 { 1290 1346 _Z_ATLEXCEPTION(Exception); 1291 sText.AppendFormat(_T("Error 0x%08 x\r\n"), (HRESULT) Exception);1347 sText.AppendFormat(_T("Error 0x%08X\r\n"), (HRESULT) Exception); 1292 1348 } 1293 1349 #pragma endregion -
trunk/Utilities/EnumerateAudioDevices/stdafx.h
r351 r522 1 1 //////////////////////////////////////////////////////////// 2 // Copyright (C) Roman Ryltsov, 2008-201 12 // Copyright (C) Roman Ryltsov, 2008-2015 3 3 // Created by Roman Ryltsov roman@alax.info 4 //5 // $Id$6 4 7 5 #pragma once … … 47 45 #define _WTL_NEW_PAGE_NOTIFY_HANDLERS 48 46 49 #undef _SYSINFOAPI_H_50 47 #include <atlapp.h> 51 #define _SYSINFOAPI_H_52 53 48 #include <atlgdi.h> 54 49 #include <atluser.h>
Note: See TracChangeset
for help on using the changeset viewer.