diff --git a/KeyboardVisualizerCommon/Visualizer.cpp b/KeyboardVisualizerCommon/Visualizer.cpp index b790d88..08b6ba9 100644 --- a/KeyboardVisualizerCommon/Visualizer.cpp +++ b/KeyboardVisualizerCommon/Visualizer.cpp @@ -33,6 +33,102 @@ Visualizer::Visualizer() } +void Visualizer::BeginLEDMatrix(int size) +{ + matrix_setup_size = size; + matrix_setup_pos = 1; +} + +void Visualizer::LEDStripSections(int size) +{ + ledstrip_sections_size = size; +} + +void Visualizer::LEDMirrorX() +{ + ledstrip_mirror_x = true; +} + +void Visualizer::LEDMirrorY() +{ + ledstrip_mirror_y = true; +} + +void Visualizer::LEDSingleColor() +{ + ledstrip_single_color = true; +} + +void Visualizer::LEDRotateX(int rotate) +{ + ledstrip_rotate_x = rotate; +} + +void Visualizer::AddLEDStrip(int led_type, char* ledstring) +{ + //Scan through already registered LED strips and + //verify that the port name is not already in use + for (unsigned int i = 0; i < str.size(); i++) + { + if (strcmp(str[i]->GetLEDString(), ledstring) == 0) + { + return; + } + } + + LEDStrip *newstr = new LEDStrip(); + newstr->Initialize(led_type, ledstring, matrix_setup_size, matrix_setup_pos, ledstrip_sections_size, ledstrip_rotate_x, ledstrip_mirror_x, ledstrip_mirror_y, ledstrip_single_color); + str.push_back(newstr); + + ledstrip_sections_size = 1; + ledstrip_mirror_x = false; + ledstrip_mirror_y = false; + ledstrip_single_color = false; + ledstrip_rotate_x = 0; + + if (matrix_setup_pos < matrix_setup_size) + { + matrix_setup_pos += ledstrip_sections_size; + } + else + { + matrix_setup_size = 0; + matrix_setup_pos = 0; + } +} + +void Visualizer::SetDeviceProperty(char * devprop, char * argument) +{ + //Save device property to list of device properties + char * buf = new char[strlen(devprop) + 1]; + strcpy(buf, devprop); + device_properties.push_back(buf); + + //Parse device properties exclusive to Windows +#ifdef WIN32 + if (strcmp(devprop, "razer_use_keyboard_custom_effect") == 0) + { + rkb.use_keyboard_custom_effect = true; + } + else if (strcmp(devprop, "razer_use_headset_custom_effect") == 0) + { + rkb.use_headset_custom_effect = true; + } + else if (strcmp(devprop, "razer_use_chromalink_single_color") == 0) + { + rkb.use_chromalink_single_color = true; + } + else if (strcmp(devprop, "razer_disable_chromalink") == 0) + { + rkb.disable_chromalink = true; + } + else if (strcmp(devprop, "razer_chroma_box_mode") == 0) + { + rkb.chroma_box_mode = atoi(argument); + } +#endif +} + void Visualizer::InitAudioDeviceList() { #ifdef WIN32 @@ -396,6 +492,31 @@ void Visualizer::SaveSettings() snprintf(out_str, 1024, "audio_device_idx=%d\r\n", audio_device_idx); outfile.write(out_str, strlen(out_str)); + //Save LED Strip Configurations + for (unsigned int i = 0; i < str.size(); i++) + { + switch (str[i]->led_type) + { + case LED_STRIP_NORMAL: + //Save LED Strip Configuration + snprintf(out_str, 1024, "ledstrip=%s\r\n", str[i]->GetLEDString()); + outfile.write(out_str, strlen(out_str)); + break; + + case LED_STRIP_XMAS: + //Save Xmas Strip Configuration + snprintf(out_str, 1024, "xmas=%s\r\n", str[i]->GetLEDString()); + outfile.write(out_str, strlen(out_str)); + break; + + case LED_STRIP_HUE_PLUS: + //Save HuePlus Configuration + snprintf(out_str, 1024, "hueplus=%s\r\n", str[i]->GetLEDString()); + outfile.write(out_str, strlen(out_str)); + break; + } + } + //Save Network Mode switch (netmode) { @@ -951,6 +1072,13 @@ void Visualizer::DrawPattern(VISUALIZER_PATTERN pattern, int bright, vis_pixels } break; + case VISUALIZER_PATTERN_STATIC_FLAG_BULGARIA: + { + COLORREF colors[] = { 0x000000FF, 0x0000FF00, 0x00FFFFFF }; + DrawHorizontalBars(bright, colors, 3, pixels); + } + break; + case VISUALIZER_PATTERN_STATIC_BLUE_CYAN_WHITE: { RGBColor colors[] = { 0x00FF0000, 0x00FFFF00, 0x00FFFFFF }; @@ -1499,6 +1627,8 @@ void Visualizer::LEDUpdateThreadFunction() for(int z = 0; z < rgb_controllers[c]->zones.size(); z++) { + str[i]->SetPixels(pixels_out->pixels); + str[i]->SetDelay(delay); int x_count = rgb_controllers[c]->zones[z].leds_count; int y_count = 0; zone_type type = rgb_controllers[c]->zones[z].type; @@ -1605,6 +1735,8 @@ void Visualizer::LEDUpdateThreadFunction() controller_found = true; } } + + Sleep(delay); if(controller_found == false) { diff --git a/KeyboardVisualizerCommon/VisualizerDefines.h b/KeyboardVisualizerCommon/VisualizerDefines.h index c90dbbf..9e08e27 100644 --- a/KeyboardVisualizerCommon/VisualizerDefines.h +++ b/KeyboardVisualizerCommon/VisualizerDefines.h @@ -61,6 +61,7 @@ enum VISUALIZER_PATTERN_STATIC_RED_WHITE_BLUE, VISUALIZER_PATTERN_STATIC_RAINBOW, VISUALIZER_PATTERN_STATIC_RAINBOW_INVERSE, + VISUALIZER_PATTERN_STATIC_FLAG_BULGARIA, //Animated Patterns VISUALIZER_PATTERN_ANIM_RAINBOW_SINUSOIDAL, VISUALIZER_PATTERN_ANIM_RAINBOW_HSV, @@ -90,6 +91,7 @@ const char * const visualizer_pattern_labels[VISUALIZER_NUM_PATTERNS] = "Red/White/Blue", "Rainbow Bars", "Rainbow Bars Inverse", + "Bulgarian flag", "Original", "Rainbow", "Color Wheel", diff --git a/Settings/CUESDK_2013.dll b/Settings/CUESDK_2013.dll new file mode 100644 index 0000000..efa2cdf Binary files /dev/null and b/Settings/CUESDK_2013.dll differ diff --git a/Settings/KeyboardVisualizerVC.ilk b/Settings/KeyboardVisualizerVC.ilk new file mode 100644 index 0000000..4a40d7e Binary files /dev/null and b/Settings/KeyboardVisualizerVC.ilk differ diff --git a/Settings/KeyboardVisualizerVC.pdb b/Settings/KeyboardVisualizerVC.pdb new file mode 100644 index 0000000..0e2f0e4 Binary files /dev/null and b/Settings/KeyboardVisualizerVC.pdb differ diff --git a/Settings/SDKDLL.dll b/Settings/SDKDLL.dll new file mode 100644 index 0000000..699d1f4 Binary files /dev/null and b/Settings/SDKDLL.dll differ diff --git a/Settings/settings.txt b/Settings/settings.txt new file mode 100644 index 0000000..290ae38 --- /dev/null +++ b/Settings/settings.txt @@ -0,0 +1,18 @@ +amplitude=1300 +bkgd_bright=100 +avg_size=8 +decay=80 +delay=50 +nrml_ofst=0.040000 +nrml_scl=0.500000 +fltr_const=1.000000 +window_mode=1 +bkgd_mode=0 +frgd_mode=15 +single_color_mode=11 +avg_mode=0 +anim_speed=100.000000 +reactive_bkgd=0 +silent_bkgd=0 +background_timeout=120 +audio_device_idx=9