Skip to content

Commit 47f2a72

Browse files
Code cleanup for version 4.0
1 parent 3fda2ff commit 47f2a72

6 files changed

Lines changed: 113 additions & 79 deletions

File tree

KeyboardVisualizer.pro

Lines changed: 66 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
#-------------------------------------------------
2-
#
3-
# Project created by QtCreator 2016-12-18T13:03:22
4-
#
5-
#-------------------------------------------------
6-
7-
QT += core gui
1+
#-----------------------------------------------------------------------#
2+
# Keyboard Visualizer 4.x QMake Project #
3+
# #
4+
# Adam Honse (CalcProgrammer1) 5/15/2020 #
5+
#-----------------------------------------------------------------------#
6+
7+
#-----------------------------------------------------------------------#
8+
# Qt Configuration #
9+
#-----------------------------------------------------------------------#
10+
QT += \
11+
core \
12+
gui \
813

914
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
1015

11-
TARGET = KeyboardVisualizer
12-
TEMPLATE = app
13-
14-
macx: {
15-
LIBS += -framework OpenAL
16-
}
17-
18-
unix:!macx {
19-
LIBS += -lopenal
20-
}
21-
22-
DISTFILES +=
16+
#-----------------------------------------------------------------------#
17+
# Application Configuration #
18+
#-----------------------------------------------------------------------#
19+
TARGET = KeyboardVisualizer
20+
TEMPLATE = app
2321

24-
INCLUDEPATH += \
25-
OpenRGB/ \
26-
OpenRGB/dependencies/libe131/src/ \
27-
OpenRGB/net_port/ \
28-
OpenRGB/RGBController/ \
29-
OpenRGB/qt/ \
22+
#-----------------------------------------------------------------------#
23+
# Keyboard Visualizer #
24+
#-----------------------------------------------------------------------#
25+
HEADERS += \
26+
KeyboardVisualizerCommon/chuck_fft.h \
27+
KeyboardVisualizerCommon/hsv.h \
28+
KeyboardVisualizerCommon/Visualizer.h \
29+
KeyboardVisualizerCommon/VisualizerDefines.h \
30+
KeyboardVisualizerQT/KeyboardVisDlg.h \
3031

3132
SOURCES += \
3233
KeyboardVisualizerCommon/hsv.cpp \
@@ -35,38 +36,41 @@ SOURCES += \
3536
KeyboardVisualizerQT/KeyboardVisDlg.cpp \
3637
KeyboardVisualizerQT/main.cpp \
3738

38-
# From OpenRGB
39-
SOURCES += \
40-
OpenRGB/NetworkClient.cpp \
41-
OpenRGB/net_port/net_port.cpp \
42-
OpenRGB/RGBController/RGBController.cpp \
43-
OpenRGB/RGBController/RGBController_Network.cpp \
39+
RESOURCES += \
40+
KeyboardVisualizerQT/resources.qrc
4441

45-
HEADERS += \
46-
KeyboardVisualizerCommon/chuck_fft.h \
47-
KeyboardVisualizerCommon/hsv.h \
48-
KeyboardVisualizerCommon/Visualizer.h \
49-
KeyboardVisualizerCommon/VisualizerDefines.h \
50-
KeyboardVisualizerQT/KeyboardVisDlg.h \
42+
FORMS += \
43+
KeyboardVisualizerQT/keyboardvisualizer.ui
44+
45+
RC_ICONS += \
46+
KeyboardVisualizerQT/KeyboardVisualizer.ico
47+
48+
DISTFILES += \
49+
50+
#-----------------------------------------------------------------------#
51+
# OpenRGB SDK #
52+
#-----------------------------------------------------------------------#
53+
INCLUDEPATH += \
54+
OpenRGB/ \
55+
OpenRGB/net_port/ \
56+
OpenRGB/RGBController/ \
5157

52-
# From OpenRGB
53-
HEADERS += \
58+
HEADERS += \
5459
OpenRGB/NetworkClient.h \
5560
OpenRGB/NetworkProtocol.h \
5661
OpenRGB/net_port/net_port.h \
5762
OpenRGB/RGBController/RGBController.h \
5863
OpenRGB/RGBController/RGBController_Network.h \
5964

60-
RESOURCES += \
61-
KeyboardVisualizerQT/resources.qrc
62-
63-
FORMS += \
64-
KeyboardVisualizerQT/keyboardvisualizer.ui
65-
66-
#-----------------------------------------------
67-
# Windows specific project configuration
68-
#-----------------------------------------------
65+
SOURCES += \
66+
OpenRGB/NetworkClient.cpp \
67+
OpenRGB/net_port/net_port.cpp \
68+
OpenRGB/RGBController/RGBController.cpp \
69+
OpenRGB/RGBController/RGBController_Network.cpp \
6970

71+
#-----------------------------------------------------------------------#
72+
# Windows-specific Configuration #
73+
#-----------------------------------------------------------------------#
7074
win32:contains(QMAKE_TARGET.arch, x86_64) {
7175
LIBS += \
7276
-lws2_32 \
@@ -88,3 +92,17 @@ win32:DEFINES += \
8892
_CRT_SECURE_NO_WARNINGS \
8993
_WINSOCK_DEPRECATED_NO_WARNINGS \
9094
WIN32_LEAN_AND_MEAN
95+
96+
#-----------------------------------------------------------------------#
97+
# Linux-specific Configuration #
98+
#-----------------------------------------------------------------------#
99+
unix:!macx {
100+
LIBS += -lopenal
101+
}
102+
103+
#-----------------------------------------------------------------------#
104+
# MacOS-specific Configuration #
105+
#-----------------------------------------------------------------------#
106+
macx: {
107+
LIBS += -framework OpenAL
108+
}

KeyboardVisualizerCommon/Visualizer.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,29 @@
55
\*---------------------------------------------------------*/
66

77
#include "Visualizer.h"
8-
#include <string.h>
98

109
#ifndef TRUE
1110
#define TRUE 1
1211
#define FALSE 0
1312
#endif
1413

15-
char * net_string;
16-
int ledstrip_sections_size = 1;
17-
int matrix_setup_pos;
18-
int matrix_setup_size;
19-
float fft_nrml[256];
20-
float fft_fltr[256];
21-
bool ledstrip_mirror_x = false;
22-
bool ledstrip_mirror_y = false;
23-
bool ledstrip_single_color = false;
24-
int ledstrip_rotate_x = 0;
14+
/*---------------------------------------------------------*\
15+
| Global variables |
16+
\*---------------------------------------------------------*/
17+
char * net_string;
18+
int ledstrip_sections_size = 1;
19+
int matrix_setup_pos;
20+
int matrix_setup_size;
21+
float fft_nrml[256];
22+
float fft_fltr[256];
23+
bool ledstrip_mirror_x = false;
24+
bool ledstrip_mirror_y = false;
25+
bool ledstrip_single_color = false;
26+
int ledstrip_rotate_x = 0;
2527

28+
/*---------------------------------------------------------*\
29+
| Visualizer class implementation |
30+
\*---------------------------------------------------------*/
2631
Visualizer::Visualizer()
2732
{
2833

KeyboardVisualizerCommon/Visualizer.h

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,51 @@
77
#ifndef VISUALIZER_H
88
#define VISUALIZER_H
99

10+
/*---------------------------------------------------------*\
11+
| C/C++ Standard Library Includes |
12+
\*---------------------------------------------------------*/
1013
#include <math.h>
1114
#include <fstream>
1215
#include <string>
16+
#include <string.h>
1317
#include <vector>
1418
#include <thread>
1519

16-
//Project includes
20+
/*---------------------------------------------------------*\
21+
| Project Includes |
22+
\*---------------------------------------------------------*/
1723
#include "VisualizerDefines.h"
1824
#include "chuck_fft.h"
1925
#include "hsv.h"
2026
#include "net_port.h"
2127

22-
//OpenRGB SDK
28+
/*---------------------------------------------------------*\
29+
| OpenRGB SDK Includes |
30+
\*---------------------------------------------------------*/
2331
#include "OpenRGB.h"
2432
#include "NetworkClient.h"
2533
#include "RGBController.h"
2634

27-
//If building on Windows, use WASAPI
28-
#ifdef WIN32
35+
/*---------------------------------------------------------*\
36+
| Audio Library Includes |
37+
\*---------------------------------------------------------*/
38+
#ifdef _WIN32
2939
#include <mmsystem.h>
3040
#include <mmdeviceapi.h>
3141
#include <audioclient.h>
3242
#include <initguid.h>
3343
#include <mmdeviceapi.h>
3444
#include <functiondiscoverykeys_devpkey.h>
45+
#endif
3546

36-
//If not building on Windows, use OpenAL
37-
#else
38-
#ifdef __APPLE__
39-
#include <OpenAL/al.h>
40-
#include <OpenAL/alc.h>
41-
#else
47+
#ifdef __linux__
4248
#include <AL/al.h>
4349
#include <AL/alc.h>
4450
#endif
51+
52+
#ifdef __APPLE__
53+
#include <OpenAL/al.h>
54+
#include <OpenAL/alc.h>
4555
#endif
4656

4757
typedef struct

KeyboardVisualizerCommon/VisualizerDefines.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
#ifndef VISUALIZER_DEFINES_H
88
#define VISUALIZER_DEFINES_H
99

10+
/*---------------------------------------------------------*\
11+
| Project Includes |
12+
\*---------------------------------------------------------*/
1013
#include "RGBController.h"
1114

12-
#ifdef WIN32
13-
#ifndef _WINDOWS_
14-
#endif
15-
#else
16-
//Includes for non-Windows builds
15+
/*---------------------------------------------------------*\
16+
| Define Windows types for non-Windows builds |
17+
\*---------------------------------------------------------*/
18+
#ifndef _WIN32
1719
#include <unistd.h>
1820

19-
//Define Windows types for non-Windows Builds
2021
typedef unsigned int COLORREF;
2122
typedef unsigned char BYTE;
2223
typedef bool boolean;
21.9 KB
Binary file not shown.

KeyboardVisualizerQT/resources.qrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<!DOCTYPE RCC><RCC version="1.0">
2-
<qresource>
3-
<file>Icon.png</file>
4-
</qresource>
1+
<RCC>
2+
<qresource prefix="/">
3+
<file>Icon.png</file>
4+
</qresource>
55
</RCC>

0 commit comments

Comments
 (0)