Added brightness to CreativeSoundBlasterXG6Controller

This commit is contained in:
Chris M 2023-11-18 21:02:23 +11:00
parent d886f61de9
commit 8716760e7e
4 changed files with 30 additions and 17 deletions

View file

@ -16,7 +16,10 @@ std::string CreativeSoundBlasterXG6Controller::GetDeviceLocation()
return("HID " + location);
}
void CreativeSoundBlasterXG6Controller::SetLedColor (unsigned char red, unsigned char green, unsigned char blue)
void CreativeSoundBlasterXG6Controller::SetLedColor (unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char brightness)
{
unsigned char usb_buf[64];
@ -69,7 +72,7 @@ void CreativeSoundBlasterXG6Controller::SetLedColor (unsigned char red, unsigned
usb_buf[0x06] = 0x03;
usb_buf[0x07] = 0x01;
usb_buf[0x08] = 0x01;
usb_buf[0x09] = 0x0FF;
usb_buf[0x09] = brightness;
usb_buf[0x0A] = blue;
usb_buf[0x0B] = green;

View file

@ -9,10 +9,14 @@ class CreativeSoundBlasterXG6Controller
public:
CreativeSoundBlasterXG6Controller(hid_device* dev_handle, const char* path);
~CreativeSoundBlasterXG6Controller();
void SetLedColor (unsigned char red, unsigned char green, unsigned char blue);
std::string GetDeviceLocation();
std::string GetSerialString();
void SetLedColor(unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char brightness);
std::string GetDeviceLocation();
std::string GetSerialString();
private:
hid_device* dev;

View file

@ -13,20 +13,23 @@
RGBController_CreativeSoundBlasterXG6::RGBController_CreativeSoundBlasterXG6(CreativeSoundBlasterXG6Controller* controller_ptr)
{
controller = controller_ptr;
controller = controller_ptr;
name = "Creative SoundBlasterX G6 Device";
vendor = "Creative";
type = DEVICE_TYPE_HEADSET;
description = "Creative SoundBlasterX G6 Device";
location = controller->GetDeviceLocation();
serial = "";
name = "Creative SoundBlasterX G6 Device";
vendor = "Creative";
type = DEVICE_TYPE_HEADSET;
description = "Creative SoundBlasterX G6 Device";
location = controller->GetDeviceLocation();
serial = "";
mode Static;
Static.name = "Direct";
Static.value = 0;
Static.flags = MODE_COLORS_PER_LED;
Static.color_mode = MODE_COLORS_PER_LED;
Static.name = "Direct";
Static.value = 0;
Static.flags = MODE_COLORS_PER_LED | MODE_FLAG_HAS_BRIGHTNESS;
Static.color_mode = MODE_COLORS_PER_LED;
Static.brightness_min = XG6_BRIGHTNESS_MIN;
Static.brightness_max = XG6_BRIGHTNESS_MAX;
Static.brightness = XG6_BRIGHTNESS_MAX;
modes.push_back(Static);
SetupZones();
@ -68,7 +71,7 @@ void RGBController_CreativeSoundBlasterXG6::DeviceUpdateLEDs()
unsigned char grn = RGBGetGValue(colors[0]);
unsigned char blu = RGBGetBValue(colors[0]);
controller->SetLedColor(red, grn, blu);
controller->SetLedColor(red, grn, blu, modes[active_mode].brightness);
}
void RGBController_CreativeSoundBlasterXG6::UpdateZoneLEDs(int /*zone*/)

View file

@ -2,6 +2,9 @@
#include "RGBController.h"
#include "CreativeSoundBlasterXG6Controller.h"
#define XG6_BRIGHTNESS_MIN 0x00
#define XG6_BRIGHTNESS_MAX 0xFF
class RGBController_CreativeSoundBlasterXG6: public RGBController
{
public: