Added Razer Raiju Tournament Edition support

Related to issue #580
This commit is contained in:
Travis Nickles 2019-04-29 22:17:15 -05:00
parent f4c05533fc
commit 78dcbe666c
3 changed files with 16 additions and 18 deletions

View File

@ -40,7 +40,8 @@ namespace DS4Windows.DS4Library
RefreshVolume();
}
public DS4Audio(DataFlow audioFlags = DataFlow.Render)
public DS4Audio(DataFlow audioFlags = DataFlow.Render,
string searchName = "Wireless Controller")
{
var audioEnumerator = new MMDeviceEnumeratorComObject() as IMMDeviceEnumerator;
IMMDeviceCollection audioDevices;
@ -55,21 +56,7 @@ namespace DS4Windows.DS4Library
Marshal.ThrowExceptionForHR(audioDevices.Item(deviceNumber, out audioDevice));
string deviceName = GetAudioDeviceName(ref audioDevice);
if (deviceName.Contains("DUALSHOCK®4 USB Wireless Adaptor"))
{
object interfacePointer;
Marshal.ThrowExceptionForHR(audioDevice.Activate(ref IID_IAudioEndpointVolume, ClsCtx.ALL, IntPtr.Zero, out interfacePointer));
endpointVolume = interfacePointer as IAudioEndpointVolume;
endpointVolume.RegisterControlChangeNotify(this);
}
else if (deviceName.Contains("Wireless Controller"))
{
object interfacePointer;
Marshal.ThrowExceptionForHR(audioDevice.Activate(ref IID_IAudioEndpointVolume, ClsCtx.ALL, IntPtr.Zero, out interfacePointer));
endpointVolume = interfacePointer as IAudioEndpointVolume;
endpointVolume.RegisterControlChangeNotify(this);
}
else if (deviceName.Contains("PS4 Fun Controller"))
if (deviceName.Contains(searchName))
{
object interfacePointer;
Marshal.ThrowExceptionForHR(audioDevice.Activate(ref IID_IAudioEndpointVolume, ClsCtx.ALL, IntPtr.Zero, out interfacePointer));

View File

@ -122,6 +122,8 @@ namespace DS4Windows
internal const int BATTERY_MAX = 8;
internal const int BATTERY_MAX_USB = 11;
public const string blankSerial = "00:00:00:00:00:00";
private const string SONYWA_AUDIO_SEARCHNAME = "DUALSHOCK®4 USB Wireless Adaptor";
private const string RAIJU_TE_AUDIO_SEARCHNAME = "Razer Raiju Tournament Edition Wired";
private HidDevice hDevice;
private string Mac;
private DS4State cState = new DS4State();
@ -426,14 +428,22 @@ namespace DS4Windows
{
runCalib = false;
}
else if (tempAttr.VendorId == DS4Devices.RAZER_VID &&
tempAttr.ProductId == 0x1007)
{
audio = new DS4Audio(searchName: RAIJU_TE_AUDIO_SEARCHNAME);
micAudio = new DS4Audio(DS4Library.CoreAudio.DataFlow.Capture,
RAIJU_TE_AUDIO_SEARCHNAME);
}
synced = true;
}
else
{
warnInterval = WARN_INTERVAL_BT;
audio = new DS4Audio();
micAudio = new DS4Audio(DS4Library.CoreAudio.DataFlow.Capture);
audio = new DS4Audio(searchName: SONYWA_AUDIO_SEARCHNAME);
micAudio = new DS4Audio(DS4Library.CoreAudio.DataFlow.Capture,
SONYWA_AUDIO_SEARCHNAME);
runCalib = synced = isValidSerial();
}
}

View File

@ -45,6 +45,7 @@ namespace DS4Windows
new VidPidInfo(0x7545, 0x0104),
new VidPidInfo(0x2E95, 0x7725), // Scuf Vantage gamepad
new VidPidInfo(0x11C0, 0x4001), // PS4 Fun Controller
new VidPidInfo(RAZER_VID, 0x1007), // Razer Raiju Tournament Edition
};
private static string devicePathToInstanceId(string devicePath)