pub fn get_audio_device_ids(
user_index: impl TryInto<u32>,
) -> Result<AudioDeviceIds, Error>Expand description
[microsoft.com] XInputGetAudioDeviceIds (1.4+)
Get XAudio2 / Windows Core Audio Device Names.
NOTE: This tends to succeed, even when no gamepad is connected, with empty/None paths.
§Arguments
user_index— The controller to get headset/microphone ids for (0 .. xuser::MAX_COUNT.)
§Example
let audio = xinput::get_audio_device_ids(0).unwrap_or_default();
println!("{audio:#?}");§Output
AudioDeviceIds {
render_device_id: None,
capture_device_id: None,
}§Errors
- error::BAD_ARGUMENTS - Invalid
user_index(expected0 .. xuser::MAX_COUNT) - error::BUFFER_TOO_SMALL - Audio device paths exceedingly large (doesn’t fit in e.g.
[wchar_t; 4096].) - error::DEVICE_NOT_CONNECTED - Unreliably.
- error::INVALID_FUNCTION - API unavailable: requires XInput 1.4 or later
| System | Windows ver | Windows SKU | Behavior |
|---|---|---|---|
| Github Actions | 10.0.17763.2366 | Windows 2019 Server | error::DEVICE_NOT_CONNECTED observed. |
| “SACRILEGE” | 10.0.19041.1415 | Windows 10 Pro | Succeeds when called on missing gamepads |
| “NECROMANCY” | 10.0.19045.3930 | Windows 10 Pro | error::DEVICE_NOT_CONNECTED on a valid XB1 gamepad connected via XB1 wireless dongle (would USB work better? XB360 controllers?) |