diff --git a/DS4Windows/DS4Library/DS4Audio.cs b/DS4Windows/DS4Library/DS4Audio.cs index 662ffaa..5f0748e 100644 --- a/DS4Windows/DS4Library/DS4Audio.cs +++ b/DS4Windows/DS4Library/DS4Audio.cs @@ -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)); diff --git a/DS4Windows/DS4Library/DS4Device.cs b/DS4Windows/DS4Library/DS4Device.cs index a3c0765..b80e13f 100644 --- a/DS4Windows/DS4Library/DS4Device.cs +++ b/DS4Windows/DS4Library/DS4Device.cs @@ -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(); } } diff --git a/DS4Windows/DS4Library/DS4Devices.cs b/DS4Windows/DS4Library/DS4Devices.cs index ce039d6..07f45b8 100644 --- a/DS4Windows/DS4Library/DS4Devices.cs +++ b/DS4Windows/DS4Library/DS4Devices.cs @@ -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)