|
13 | 13 | DEVICE_STATE, |
14 | 14 | STGM, |
15 | 15 | AudioDeviceState, |
| 16 | + CLSID_CPolicyConfigClient, |
16 | 17 | CLSID_MMDeviceEnumerator, |
17 | 18 | EDataFlow, |
18 | 19 | ERole, |
19 | 20 | IID_Empty, |
20 | | - CLSID_CPolicyConfigClient, |
21 | 21 | ) |
22 | 22 |
|
23 | 23 |
|
@@ -266,18 +266,17 @@ def CreateDevice(dev): |
266 | 266 | return AudioDevice(id, audioState, properties, dev) |
267 | 267 |
|
268 | 268 | @staticmethod |
269 | | - def GetAllDevices(data_flow=EDataFlow.eAll.value, |
270 | | - device_state=DEVICE_STATE.MASK_ALL.value): |
| 269 | + def GetAllDevices( |
| 270 | + data_flow=EDataFlow.eAll.value, device_state=DEVICE_STATE.MASK_ALL.value |
| 271 | + ): |
271 | 272 | devices = [] |
272 | 273 | deviceEnumerator = comtypes.CoCreateInstance( |
273 | 274 | CLSID_MMDeviceEnumerator, IMMDeviceEnumerator, comtypes.CLSCTX_INPROC_SERVER |
274 | 275 | ) |
275 | 276 | if deviceEnumerator is None: |
276 | 277 | return devices |
277 | 278 |
|
278 | | - collection = deviceEnumerator.EnumAudioEndpoints( |
279 | | - data_flow, device_state |
280 | | - ) |
| 279 | + collection = deviceEnumerator.EnumAudioEndpoints(data_flow, device_state) |
281 | 280 | if collection is None: |
282 | 281 | return devices |
283 | 282 |
|
@@ -325,5 +324,7 @@ def SetDefaultDevice(devId, roles=None): |
325 | 324 | for role in roles: |
326 | 325 | hr = policy_config.SetDefaultEndpoint(devId, role.value) |
327 | 326 | if hr != 0: |
328 | | - raise OSError(f"SetDefaultEndpoint failed for role {role} " |
329 | | - f"with HRESULT {hr:#x}") |
| 327 | + raise OSError( |
| 328 | + f"SetDefaultEndpoint failed for role {role} " |
| 329 | + f"with HRESULT {hr:#x}" |
| 330 | + ) |
0 commit comments