LegacyGipGameControllerProvider.FromGameControllerProvider 方法

定义

为给定的控制器提供程序构造 LegacyGipGameControllerProvider

public:
 static LegacyGipGameControllerProvider ^ FromGameControllerProvider(IGameControllerProvider ^ provider);
 static LegacyGipGameControllerProvider FromGameControllerProvider(IGameControllerProvider const& provider);
public static LegacyGipGameControllerProvider FromGameControllerProvider(IGameControllerProvider provider);
function fromGameControllerProvider(provider)
Public Shared Function FromGameControllerProvider (provider As IGameControllerProvider) As LegacyGipGameControllerProvider

参数

provider
IGameControllerProvider

用于为其构造 LegacyGipGameControllerProvider 的控制器提供程序。

返回

如果控制器是 GIP (游戏输入协议) 控制器,则为 LegacyGipGameControllerProvider。 如果控制器不是 GIP 控制器,则为 Null。

示例

public void SetupHeadset(IGameControllerProvider headsetProvider)
{
    LegacyGipGameControllerProvider legacyGipGameControllerProvider =
        LegacyGipGameControllerProvider.FromGameControllerProvider(headsetProvider);

    // Reset the device
    legacyGipGameControllerProvider.ExecuteCommand(DeviceCommand.Reset);

    // Check the smart mute level
    byte[] smartMuteBuffer =
        legacyGipGameControllerProvider.GetHeadsetOperation(HeadsetOperation.SmartMute);
    HeadsetLevel smartMuteValue = (HeadsetLevel)smartMuteBuffer[0];

    // Set bass boost to 3db
    byte[] bassBuffer = BitConverter.GetBytes((UInt32)3);
    legacyGipGameControllerProvider.SetHeadsetOperation(HeadsetOperation.BassBoostGain,
        bassBuffer);
}

适用于

另请参阅