Code cleanup round 3
This commit is contained in:
parent
97e154ea84
commit
c09e4c9c92
52 changed files with 2953 additions and 3065 deletions
|
|
@ -1,30 +1,31 @@
|
|||
#include "CreativeSoundBlasterXG6Controller.h"
|
||||
#include "RGBController_CreativeSoundBlasterXG6.h"
|
||||
#include "Detector.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Creative vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CREATIVE_VID 0x041E
|
||||
/*-----------------------------------------------------*\
|
||||
| SoundCards |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CREATIVE_SOUNDBLASTERX_G6_PID 0x3256
|
||||
|
||||
void DetectCreativeDevice(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
if(dev)
|
||||
{
|
||||
CreativeSoundBlasterXG6Controller* controller = new CreativeSoundBlasterXG6Controller(dev, info->path);
|
||||
RGBController_CreativeSoundBlasterXG6* rgb_controller = new RGBController_CreativeSoundBlasterXG6(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Sound Cards |
|
||||
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_I("Creative SoundBlasterX G6", DetectCreativeDevice, CREATIVE_VID, CREATIVE_SOUNDBLASTERX_G6_PID, 4);
|
||||
#include "CreativeSoundBlasterXG6Controller.h"
|
||||
#include "RGBController_CreativeSoundBlasterXG6.h"
|
||||
#include "Detector.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Creative vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CREATIVE_VID 0x041E
|
||||
/*-----------------------------------------------------*\
|
||||
| SoundCards |
|
||||
\*-----------------------------------------------------*/
|
||||
#define CREATIVE_SOUNDBLASTERX_G6_PID 0x3256
|
||||
|
||||
void DetectCreativeDevice(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CreativeSoundBlasterXG6Controller* controller = new CreativeSoundBlasterXG6Controller(dev, info->path);
|
||||
RGBController_CreativeSoundBlasterXG6* rgb_controller = new RGBController_CreativeSoundBlasterXG6(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------------------------------------------------------*\
|
||||
| Sound Cards |
|
||||
\*-------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
REGISTER_HID_DETECTOR_I("Creative SoundBlasterX G6", DetectCreativeDevice, CREATIVE_VID, CREATIVE_SOUNDBLASTERX_G6_PID, 4);
|
||||
|
|
|
|||
|
|
@ -1,81 +1,81 @@
|
|||
#include "RGBController_CreativeSoundBlasterXG6.h"
|
||||
|
||||
RGBController_CreativeSoundBlasterXG6::RGBController_CreativeSoundBlasterXG6(CreativeSoundBlasterXG6Controller* creative_device)
|
||||
{
|
||||
creative = creative_device;
|
||||
|
||||
name = "Creative SoundBlasterX G6 Device";
|
||||
vendor = "Creative";
|
||||
type = DEVICE_TYPE_HEADSET;
|
||||
description = "Creative SoundBlasterX G6 Device";
|
||||
location = creative_device->GetDeviceLocation();
|
||||
serial = "";
|
||||
|
||||
mode Static;
|
||||
Static.name = "Direct";
|
||||
Static.value = 0;
|
||||
Static.flags = MODE_COLORS_PER_LED;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CreativeSoundBlasterXG6::~RGBController_CreativeSoundBlasterXG6()
|
||||
{
|
||||
delete creative;
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::SetupZones()
|
||||
{
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
logo_zone.leds_min = 1;
|
||||
logo_zone.leds_max = 1;
|
||||
logo_zone.leds_count = 1;
|
||||
logo_zone.matrix_map = NULL;
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Logo";
|
||||
leds.push_back(logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
|
||||
creative->SetLedColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
#include "RGBController_CreativeSoundBlasterXG6.h"
|
||||
|
||||
RGBController_CreativeSoundBlasterXG6::RGBController_CreativeSoundBlasterXG6(CreativeSoundBlasterXG6Controller* 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 = "";
|
||||
|
||||
mode Static;
|
||||
Static.name = "Direct";
|
||||
Static.value = 0;
|
||||
Static.flags = MODE_COLORS_PER_LED;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CreativeSoundBlasterXG6::~RGBController_CreativeSoundBlasterXG6()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::SetupZones()
|
||||
{
|
||||
zone logo_zone;
|
||||
logo_zone.name = "Logo";
|
||||
logo_zone.type = ZONE_TYPE_SINGLE;
|
||||
logo_zone.leds_min = 1;
|
||||
logo_zone.leds_max = 1;
|
||||
logo_zone.leds_count = 1;
|
||||
logo_zone.matrix_map = NULL;
|
||||
zones.push_back(logo_zone);
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Logo";
|
||||
leds.push_back(logo_led);
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::DeviceUpdateLEDs()
|
||||
{
|
||||
unsigned char red = RGBGetRValue(colors[0]);
|
||||
unsigned char grn = RGBGetGValue(colors[0]);
|
||||
unsigned char blu = RGBGetBValue(colors[0]);
|
||||
|
||||
controller->SetLedColor(red, grn, blu);
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CreativeSoundBlasterXG6::DeviceUpdateMode()
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CreativeSoundBlasterXG6Controller.h"
|
||||
|
||||
class RGBController_CreativeSoundBlasterXG6: public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CreativeSoundBlasterXG6(CreativeSoundBlasterXG6Controller* creative_device);
|
||||
~RGBController_CreativeSoundBlasterXG6();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CreativeSoundBlasterXG6Controller* creative;
|
||||
};
|
||||
#pragma once
|
||||
#include "RGBController.h"
|
||||
#include "CreativeSoundBlasterXG6Controller.h"
|
||||
|
||||
class RGBController_CreativeSoundBlasterXG6: public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CreativeSoundBlasterXG6(CreativeSoundBlasterXG6Controller* controller_ptr);
|
||||
~RGBController_CreativeSoundBlasterXG6();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
private:
|
||||
CreativeSoundBlasterXG6Controller* controller;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue