├── .gitignore ├── EndPointController.sln ├── EndPointController.suo ├── EndPointController ├── EndPointController.cpp ├── EndPointController.vcxproj ├── EndPointController.vcxproj.filters ├── EndPointController.vcxproj.user ├── LICENSE.txt └── PolicyConfig.h ├── README.md └── Release ├── EndPointController.exe ├── EndPointController.pdb └── README /.gitignore: -------------------------------------------------------------------------------- 1 | Debug 2 | EndPointController/Debug 3 | EndPointController/Release 4 | ipch 5 | *.sdf -------------------------------------------------------------------------------- /EndPointController.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EndPointController", "EndPointController\EndPointController.vcxproj", "{CA6EA9FE-B049-490C-9203-E65DD13188C7}" 5 | EndProject 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A18107C2-72EF-443D-B005-07FBB2B07206}" 7 | ProjectSection(SolutionItems) = preProject 8 | README.md = README.md 9 | EndProjectSection 10 | EndProject 11 | Global 12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 13 | Debug|Win32 = Debug|Win32 14 | Release|Win32 = Release|Win32 15 | EndGlobalSection 16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 17 | {CA6EA9FE-B049-490C-9203-E65DD13188C7}.Debug|Win32.ActiveCfg = Debug|Win32 18 | {CA6EA9FE-B049-490C-9203-E65DD13188C7}.Debug|Win32.Build.0 = Debug|Win32 19 | {CA6EA9FE-B049-490C-9203-E65DD13188C7}.Release|Win32.ActiveCfg = Release|Win32 20 | {CA6EA9FE-B049-490C-9203-E65DD13188C7}.Release|Win32.Build.0 = Release|Win32 21 | EndGlobalSection 22 | GlobalSection(SolutionProperties) = preSolution 23 | HideSolutionNode = FALSE 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /EndPointController.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanStevens/AudioEndPointController/ee4fb3ac61030d38491699690f6e395b47a692e5/EndPointController.suo -------------------------------------------------------------------------------- /EndPointController/EndPointController.cpp: -------------------------------------------------------------------------------- 1 | // EndPointController.cpp : Defines the entry point for the console application. 2 | // 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "windows.h" 9 | #include "Mmdeviceapi.h" 10 | #include "PolicyConfig.h" 11 | #include "Propidl.h" 12 | #include "Functiondiscoverykeys_devpkey.h" 13 | 14 | // Format default string for outputing a device entry. The following parameters will be used in the following order: 15 | // Index, Device Friendly Name 16 | #define DEVICE_OUTPUT_FORMAT "Audio Device %d: %ws" 17 | 18 | typedef struct TGlobalState 19 | { 20 | HRESULT hr; 21 | int option; 22 | IMMDeviceEnumerator *pEnum; 23 | IMMDeviceCollection *pDevices; 24 | LPWSTR strDefaultDeviceID; 25 | IMMDevice *pCurrentDevice; 26 | LPCWSTR pDeviceFormatStr; 27 | int deviceStateFilter; 28 | } TGlobalState; 29 | 30 | void createDeviceEnumerator(TGlobalState* state); 31 | void prepareDeviceEnumerator(TGlobalState* state); 32 | void enumerateOutputDevices(TGlobalState* state); 33 | HRESULT printDeviceInfo(IMMDevice* pDevice, int index, LPCWSTR outFormat, LPWSTR strDefaultDeviceID); 34 | std::wstring getDeviceProperty(IPropertyStore* pStore, const PROPERTYKEY key); 35 | HRESULT SetDefaultAudioPlaybackDevice(LPCWSTR devID); 36 | void invalidParameterHandler(const wchar_t* expression, const wchar_t* function, const wchar_t* file, 37 | unsigned int line, uintptr_t pReserved); 38 | 39 | // EndPointController.exe [NewDefaultDeviceID] 40 | int _tmain(int argc, LPCWSTR argv[]) 41 | { 42 | TGlobalState state; 43 | 44 | // Process command line arguments 45 | state.option = 0; // 0 indicates list devices. 46 | state.strDefaultDeviceID = '\0'; 47 | state.pDeviceFormatStr = _T(DEVICE_OUTPUT_FORMAT); 48 | state.deviceStateFilter = DEVICE_STATE_ACTIVE; 49 | 50 | for (int i = 1; i < argc; i++) 51 | { 52 | if (wcscmp(argv[i], _T("--help")) == 0) 53 | { 54 | wprintf_s(_T("Lists active audio end-point playback devices or sets default audio end-point\n")); 55 | wprintf_s(_T("playback device.\n\n")); 56 | wprintf_s(_T("USAGE\n")); 57 | wprintf_s(_T(" EndPointController.exe [-a] [-f format_str] Lists audio end-point playback\n")); 58 | wprintf_s(_T(" devices that are enabled.\n")); 59 | wprintf_s(_T(" EndPointController.exe device_index Sets the default playvack device\n")); 60 | wprintf_s(_T(" with the given index.\n")); 61 | wprintf_s(_T("\n")); 62 | wprintf_s(_T("OPTIONS\n")); 63 | wprintf_s(_T(" -a Display all devices, rather than just active devices.\n")); 64 | wprintf_s(_T(" -f format_str Outputs the details of each device using the given format\n")); 65 | wprintf_s(_T(" string. If this parameter is ommitted the format string\n")); 66 | wprintf_s(_T(" defaults to: \"%s\"\n\n"), _T(DEVICE_OUTPUT_FORMAT)); 67 | wprintf_s(_T(" Parameters that are passed to the 'printf' function are\n")); 68 | wprintf_s(_T(" ordered as follows:\n")); 69 | wprintf_s(_T(" - Device index (int)\n")); 70 | wprintf_s(_T(" - Device friendly name (wstring)\n")); 71 | wprintf_s(_T(" - Device state (int)\n")); 72 | wprintf_s(_T(" - Device default? (1 for true 0 for false as int)\n")); 73 | wprintf_s(_T(" - Device description (wstring)\n")); 74 | wprintf_s(_T(" - Device interface friendly name (wstring)\n")); 75 | wprintf_s(_T(" - Device ID (wstring)\n")); 76 | exit(0); 77 | } 78 | else if (wcscmp(argv[i], _T("-a")) == 0) 79 | { 80 | state.deviceStateFilter = DEVICE_STATEMASK_ALL; 81 | continue; 82 | } 83 | else if (wcscmp(argv[i], _T("-f")) == 0) 84 | { 85 | if ((argc - i) >= 2) { 86 | state.pDeviceFormatStr = argv[++i]; 87 | 88 | // If printf is called with an invalid format string, jump to the invalidParameterHandler function. 89 | _set_invalid_parameter_handler(invalidParameterHandler); 90 | _CrtSetReportMode(_CRT_ASSERT, 0); 91 | continue; 92 | } 93 | else 94 | { 95 | wprintf_s(_T("Missing format string")); 96 | exit(1); 97 | } 98 | } 99 | } 100 | 101 | if (argc == 2) state.option = _wtoi(argv[1]); 102 | 103 | state.hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); 104 | if (SUCCEEDED(state.hr)) 105 | { 106 | createDeviceEnumerator(&state); 107 | } 108 | return state.hr; 109 | } 110 | 111 | // Create a multimedia device enumerator. 112 | void createDeviceEnumerator(TGlobalState* state) 113 | { 114 | state->pEnum = NULL; 115 | state->hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), 116 | (void**)&state->pEnum); 117 | if (SUCCEEDED(state->hr)) 118 | { 119 | prepareDeviceEnumerator(state); 120 | } 121 | } 122 | 123 | // Prepare the device enumerator 124 | void prepareDeviceEnumerator(TGlobalState* state) 125 | { 126 | state->hr = state->pEnum->EnumAudioEndpoints(eRender, state->deviceStateFilter, &state->pDevices); 127 | if SUCCEEDED(state->hr) 128 | { 129 | enumerateOutputDevices(state); 130 | } 131 | state->pEnum->Release(); 132 | } 133 | 134 | // Enumerate the output devices 135 | void enumerateOutputDevices(TGlobalState* state) 136 | { 137 | UINT count; 138 | state->pDevices->GetCount(&count); 139 | 140 | // If option is less than 1, list devices 141 | if (state->option < 1) 142 | { 143 | 144 | // Get default device 145 | IMMDevice* pDefaultDevice; 146 | state->hr = state->pEnum->GetDefaultAudioEndpoint(eRender, eMultimedia, &pDefaultDevice); 147 | if (SUCCEEDED(state->hr)) 148 | { 149 | 150 | state->hr = pDefaultDevice->GetId(&state->strDefaultDeviceID); 151 | 152 | // Iterate all devices 153 | for (int i = 1; i <= (int)count; i++) 154 | { 155 | state->hr = state->pDevices->Item(i - 1, &state->pCurrentDevice); 156 | if (SUCCEEDED(state->hr)) 157 | { 158 | state->hr = printDeviceInfo(state->pCurrentDevice, i, state->pDeviceFormatStr, 159 | state->strDefaultDeviceID); 160 | state->pCurrentDevice->Release(); 161 | } 162 | } 163 | } 164 | } 165 | // If option corresponds with the index of an audio device, set it to default 166 | else if (state->option <= (int)count) 167 | { 168 | state->hr = state->pDevices->Item(state->option - 1, &state->pCurrentDevice); 169 | if (SUCCEEDED(state->hr)) 170 | { 171 | LPWSTR strID = NULL; 172 | state->hr = state->pCurrentDevice->GetId(&strID); 173 | if (SUCCEEDED(state->hr)) 174 | { 175 | state->hr = SetDefaultAudioPlaybackDevice(strID); 176 | } 177 | state->pCurrentDevice->Release(); 178 | } 179 | } 180 | // Otherwise inform user than option doesn't correspond with a device 181 | else 182 | { 183 | wprintf_s(_T("Error: No audio end-point device with the index '%d'.\n"), state->option); 184 | } 185 | 186 | state->pDevices->Release(); 187 | } 188 | 189 | HRESULT printDeviceInfo(IMMDevice* pDevice, int index, LPCWSTR outFormat, LPWSTR strDefaultDeviceID) 190 | { 191 | // Device ID 192 | LPWSTR strID = NULL; 193 | HRESULT hr = pDevice->GetId(&strID); 194 | if (!SUCCEEDED(hr)) 195 | { 196 | return hr; 197 | } 198 | 199 | int deviceDefault = (strDefaultDeviceID != '\0' && (wcscmp(strDefaultDeviceID, strID) == 0)); 200 | 201 | // Device state 202 | DWORD dwState; 203 | hr = pDevice->GetState(&dwState); 204 | if (!SUCCEEDED(hr)) 205 | { 206 | return hr; 207 | } 208 | 209 | IPropertyStore *pStore; 210 | hr = pDevice->OpenPropertyStore(STGM_READ, &pStore); 211 | if (SUCCEEDED(hr)) 212 | { 213 | std::wstring friendlyName = getDeviceProperty(pStore, PKEY_Device_FriendlyName); 214 | std::wstring Desc = getDeviceProperty(pStore, PKEY_Device_DeviceDesc); 215 | std::wstring interfaceFriendlyName = getDeviceProperty(pStore, PKEY_DeviceInterface_FriendlyName); 216 | 217 | if (SUCCEEDED(hr)) 218 | { 219 | wprintf_s(outFormat, 220 | index, 221 | friendlyName.c_str(), 222 | dwState, 223 | deviceDefault, 224 | Desc.c_str(), 225 | interfaceFriendlyName.c_str(), 226 | strID 227 | ); 228 | wprintf_s(_T("\n")); 229 | } 230 | 231 | pStore->Release(); 232 | } 233 | return hr; 234 | } 235 | 236 | std::wstring getDeviceProperty(IPropertyStore* pStore, const PROPERTYKEY key) 237 | { 238 | PROPVARIANT prop; 239 | PropVariantInit(&prop); 240 | HRESULT hr = pStore->GetValue(key, &prop); 241 | if (SUCCEEDED(hr)) 242 | { 243 | std::wstring result (prop.pwszVal); 244 | PropVariantClear(&prop); 245 | return result; 246 | } 247 | else 248 | { 249 | return std::wstring (L""); 250 | } 251 | } 252 | 253 | HRESULT SetDefaultAudioPlaybackDevice(LPCWSTR devID) 254 | { 255 | IPolicyConfigVista *pPolicyConfig; 256 | ERole reserved = eConsole; 257 | 258 | HRESULT hr = CoCreateInstance(__uuidof(CPolicyConfigVistaClient), 259 | NULL, CLSCTX_ALL, __uuidof(IPolicyConfigVista), (LPVOID *)&pPolicyConfig); 260 | if (SUCCEEDED(hr)) 261 | { 262 | hr = pPolicyConfig->SetDefaultEndpoint(devID, reserved); 263 | pPolicyConfig->Release(); 264 | } 265 | return hr; 266 | } 267 | 268 | void invalidParameterHandler(const wchar_t* expression, 269 | const wchar_t* function, 270 | const wchar_t* file, 271 | unsigned int line, 272 | uintptr_t pReserved) 273 | { 274 | wprintf_s(_T("\nError: Invalid format_str.\n")); 275 | exit(1); 276 | } -------------------------------------------------------------------------------- /EndPointController/EndPointController.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {CA6EA9FE-B049-490C-9203-E65DD13188C7} 15 | Win32Proj 16 | EndPointController 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | 43 | 44 | false 45 | 46 | 47 | 48 | NotUsing 49 | Level3 50 | Disabled 51 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 52 | 53 | 54 | Console 55 | true 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | Level3 67 | NotUsing 68 | MaxSpeed 69 | true 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | Speed 73 | 74 | 75 | Console 76 | true 77 | true 78 | true 79 | 80 | 81 | copy "$(SolutionDir)README.md" "$(SolutionDir)Release\README" 82 | 83 | 84 | Copy the README.md file to the Release directory 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /EndPointController/EndPointController.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | Resource Files 21 | 22 | 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /EndPointController/EndPointController.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -a -f "%d,%.0ws%d,%d,\"%ws\",\"%ws\"" 5 | WindowsLocalDebugger 6 | 7 | 8 | 9 | 10 | WindowsLocalDebugger 11 | 12 | -------------------------------------------------------------------------------- /EndPointController/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 Dave Amenta 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /EndPointController/PolicyConfig.h: -------------------------------------------------------------------------------- 1 | // ---------------------------------------------------------------------------- 2 | // PolicyConfig.h 3 | // Undocumented COM-interface IPolicyConfig. 4 | // Use for set default audio render endpoint 5 | // @author EreTIk 6 | // ---------------------------------------------------------------------------- 7 | 8 | 9 | #pragma once 10 | 11 | 12 | interface DECLSPEC_UUID("f8679f50-850a-41cf-9c72-430f290290c8") 13 | IPolicyConfig; 14 | class DECLSPEC_UUID("870af99c-171d-4f9e-af0d-e63df40c2bc9") 15 | CPolicyConfigClient; 16 | // ---------------------------------------------------------------------------- 17 | // class CPolicyConfigClient 18 | // {870af99c-171d-4f9e-af0d-e63df40c2bc9} 19 | // 20 | // interface IPolicyConfig 21 | // {f8679f50-850a-41cf-9c72-430f290290c8} 22 | // 23 | // Query interface: 24 | // CComPtr PolicyConfig; 25 | // PolicyConfig.CoCreateInstance(__uuidof(CPolicyConfigClient)); 26 | // 27 | // @compatible: Windows 7 and Later 28 | // ---------------------------------------------------------------------------- 29 | interface IPolicyConfig : public IUnknown 30 | { 31 | public: 32 | 33 | virtual HRESULT GetMixFormat( 34 | PCWSTR, 35 | WAVEFORMATEX ** 36 | ); 37 | 38 | virtual HRESULT STDMETHODCALLTYPE GetDeviceFormat( 39 | PCWSTR, 40 | INT, 41 | WAVEFORMATEX ** 42 | ); 43 | 44 | virtual HRESULT STDMETHODCALLTYPE ResetDeviceFormat( 45 | PCWSTR 46 | ); 47 | 48 | virtual HRESULT STDMETHODCALLTYPE SetDeviceFormat( 49 | PCWSTR, 50 | WAVEFORMATEX *, 51 | WAVEFORMATEX * 52 | ); 53 | 54 | virtual HRESULT STDMETHODCALLTYPE GetProcessingPeriod( 55 | PCWSTR, 56 | INT, 57 | PINT64, 58 | PINT64 59 | ); 60 | 61 | virtual HRESULT STDMETHODCALLTYPE SetProcessingPeriod( 62 | PCWSTR, 63 | PINT64 64 | ); 65 | 66 | virtual HRESULT STDMETHODCALLTYPE GetShareMode( 67 | PCWSTR, 68 | struct DeviceShareMode * 69 | ); 70 | 71 | virtual HRESULT STDMETHODCALLTYPE SetShareMode( 72 | PCWSTR, 73 | struct DeviceShareMode * 74 | ); 75 | 76 | virtual HRESULT STDMETHODCALLTYPE GetPropertyValue( 77 | PCWSTR, 78 | const PROPERTYKEY &, 79 | PROPVARIANT * 80 | ); 81 | 82 | virtual HRESULT STDMETHODCALLTYPE SetPropertyValue( 83 | PCWSTR, 84 | const PROPERTYKEY &, 85 | PROPVARIANT * 86 | ); 87 | 88 | virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint( 89 | __in PCWSTR wszDeviceId, 90 | __in ERole eRole 91 | ); 92 | 93 | virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility( 94 | PCWSTR, 95 | INT 96 | ); 97 | }; 98 | 99 | interface DECLSPEC_UUID("568b9108-44bf-40b4-9006-86afe5b5a620") 100 | IPolicyConfigVista; 101 | class DECLSPEC_UUID("294935CE-F637-4E7C-A41B-AB255460B862") 102 | CPolicyConfigVistaClient; 103 | // ---------------------------------------------------------------------------- 104 | // class CPolicyConfigVistaClient 105 | // {294935CE-F637-4E7C-A41B-AB255460B862} 106 | // 107 | // interface IPolicyConfigVista 108 | // {568b9108-44bf-40b4-9006-86afe5b5a620} 109 | // 110 | // Query interface: 111 | // CComPtr PolicyConfig; 112 | // PolicyConfig.CoCreateInstance(__uuidof(CPolicyConfigVistaClient)); 113 | // 114 | // @compatible: Windows Vista and Later 115 | // ---------------------------------------------------------------------------- 116 | interface IPolicyConfigVista : public IUnknown 117 | { 118 | public: 119 | 120 | virtual HRESULT GetMixFormat( 121 | PCWSTR, 122 | WAVEFORMATEX ** 123 | ); // not available on Windows 7, use method from IPolicyConfig 124 | 125 | virtual HRESULT STDMETHODCALLTYPE GetDeviceFormat( 126 | PCWSTR, 127 | INT, 128 | WAVEFORMATEX ** 129 | ); 130 | 131 | virtual HRESULT STDMETHODCALLTYPE SetDeviceFormat( 132 | PCWSTR, 133 | WAVEFORMATEX *, 134 | WAVEFORMATEX * 135 | ); 136 | 137 | virtual HRESULT STDMETHODCALLTYPE GetProcessingPeriod( 138 | PCWSTR, 139 | INT, 140 | PINT64, 141 | PINT64 142 | ); // not available on Windows 7, use method from IPolicyConfig 143 | 144 | virtual HRESULT STDMETHODCALLTYPE SetProcessingPeriod( 145 | PCWSTR, 146 | PINT64 147 | ); // not available on Windows 7, use method from IPolicyConfig 148 | 149 | virtual HRESULT STDMETHODCALLTYPE GetShareMode( 150 | PCWSTR, 151 | struct DeviceShareMode * 152 | ); // not available on Windows 7, use method from IPolicyConfig 153 | 154 | virtual HRESULT STDMETHODCALLTYPE SetShareMode( 155 | PCWSTR, 156 | struct DeviceShareMode * 157 | ); // not available on Windows 7, use method from IPolicyConfig 158 | 159 | virtual HRESULT STDMETHODCALLTYPE GetPropertyValue( 160 | PCWSTR, 161 | const PROPERTYKEY &, 162 | PROPVARIANT * 163 | ); 164 | 165 | virtual HRESULT STDMETHODCALLTYPE SetPropertyValue( 166 | PCWSTR, 167 | const PROPERTYKEY &, 168 | PROPVARIANT * 169 | ); 170 | 171 | virtual HRESULT STDMETHODCALLTYPE SetDefaultEndpoint( 172 | __in PCWSTR wszDeviceId, 173 | __in ERole eRole 174 | ); 175 | 176 | virtual HRESULT STDMETHODCALLTYPE SetEndpointVisibility( 177 | PCWSTR, 178 | INT 179 | ); // not available on Windows 7, use method from IPolicyConfig 180 | }; 181 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AudioEndPointController 2 | ======================= 3 | 4 | A Windows command-line program for listing audio end-points and setting the default 5 | 6 | >EndPointController.exe --help 7 | Lists active audio end-point playback devices or sets default audio end-point 8 | playback device. 9 | 10 | USAGE 11 | EndPointController.exe [-a] [-f format_str] Lists audio end-point playback 12 | devices that are enabled. 13 | EndPointController.exe device_index Sets the default playback device 14 | with the given index. 15 | 16 | OPTIONS 17 | -a Display all devices, rather than just active devices. 18 | -f format_str Outputs the details of each device using the given format 19 | string. If this parameter is ommitted the format string 20 | defaults to: "Audio Device %d: %ws" 21 | 22 | Parameters that are passed to the 'printf' function are 23 | ordered as follows: 24 | - Device index (int) 25 | - Device friendly name (wstring) 26 | - Device state (int) 27 | - Device default? (1 for true 0 for false as int) 28 | - Device description (wstring) 29 | - Device interface friendly name (wstring) 30 | - Device ID (wstring) -------------------------------------------------------------------------------- /Release/EndPointController.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanStevens/AudioEndPointController/ee4fb3ac61030d38491699690f6e395b47a692e5/Release/EndPointController.exe -------------------------------------------------------------------------------- /Release/EndPointController.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DanStevens/AudioEndPointController/ee4fb3ac61030d38491699690f6e395b47a692e5/Release/EndPointController.pdb -------------------------------------------------------------------------------- /Release/README: -------------------------------------------------------------------------------- 1 | AudioEndPointController 2 | ======================= 3 | 4 | A Windows command-line program for listing audio end-points and setting the default 5 | 6 | >EndPointController.exe --help 7 | Lists active audio end-point playback devices or sets default audio end-point 8 | playback device. 9 | 10 | USAGE 11 | EndPointController.exe [-a] [-f format_str] Lists audio end-point playback 12 | devices that are enabled. 13 | EndPointController.exe device_index Sets the default playback device 14 | with the given index. 15 | 16 | OPTIONS 17 | -a Display all devices, rather than just active devices. 18 | -f format_str Outputs the details of each device using the given format 19 | string. If this parameter is ommitted the format string 20 | defaults to: "Audio Device %d: %ws" 21 | 22 | Parameters that are passed to the 'printf' function are 23 | ordered as follows: 24 | - Device index (int) 25 | - Device friendly name (wstring) 26 | - Device state (int) 27 | - Device default? (1 for true 0 for false as int) 28 | - Device description (wstring) 29 | - Device interface friendly name (wstring) 30 | - Device ID (wstring) --------------------------------------------------------------------------------