Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotcue RGB colors #2520

Merged
merged 164 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from 144 commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
75e6e2a
Create HotcueColorPalette class
ferranpujolcamins Oct 27, 2019
393ac12
Add methods to store QColor in the config
ferranpujolcamins Oct 27, 2019
42a22b0
Add class to store HotcueColorPalette in userconfig
ferranpujolcamins Oct 27, 2019
86bda12
Add tests for color config methods
ferranpujolcamins Nov 1, 2019
48b2b02
Make Cue related code use QColor instead of PredefinedColorPointer
ferranpujolcamins Nov 2, 2019
fcb4a1d
Migrate hotcue color id to RGBA in DB
ferranpujolcamins Nov 2, 2019
c22b737
Remove PredefinedColorRepresentation
ferranpujolcamins Nov 2, 2019
f017447
Make UserSettings available in ControllerEngine
ferranpujolcamins Nov 3, 2019
f68f28c
Remove PredefinedColors from controller scripts
ferranpujolcamins Nov 3, 2019
66d3ffa
Remove PredefinedColor
ferranpujolcamins Nov 3, 2019
30b82cf
Update midi-components library
ferranpujolcamins Nov 3, 2019
1a3b8aa
Avoid constructing HotcueColorPaletteSettings every time its used
ferranpujolcamins Nov 3, 2019
7a5d13f
Change test names
ferranpujolcamins Nov 4, 2019
23e114f
Reorder constructor parameters
ferranpujolcamins Nov 4, 2019
0ef7da4
Rename member variable
ferranpujolcamins Nov 4, 2019
bbc4503
Rename some color related classes
ferranpujolcamins Nov 4, 2019
2259321
Remove cues tab on TrackInfo
ferranpujolcamins Nov 4, 2019
e1f92ec
Set hotcue color to the first predefined color
ferranpujolcamins Nov 11, 2019
413c17c
Set hotcue color CO to -1 when no hotcue is loaded
ferranpujolcamins Nov 11, 2019
74b098c
Make hotcue skin buttons use the cue color
ferranpujolcamins Nov 11, 2019
75fdbed
Allow skins to configure text color depending on background
ferranpujolcamins Nov 11, 2019
7702c6c
Highlight hotcue buttons when hovered
ferranpujolcamins Nov 11, 2019
738db3a
Fix Shade hotcue buttons color
ferranpujolcamins Nov 12, 2019
123172c
Make hotcue button hover highlighting configurable
ferranpujolcamins Nov 12, 2019
f3153b7
Fix auto_hotcue_colors not assigning first color
ferranpujolcamins Nov 17, 2019
39928d6
Migrate hotcue color logic to mixxx::RgbColor
Holzhaus Feb 26, 2020
f259558
engine/controls/cuecontrol: Use constant for no color control value
Holzhaus Feb 27, 2020
5732911
Use *value instead of value.value() for std::optional
Holzhaus Feb 27, 2020
fafe58b
Fix RgbColor typecasts and range checks
Holzhaus Feb 27, 2020
37133d9
engine/controls/cuecontrol: Pass RgbColor by value
Holzhaus Feb 27, 2020
ac28f21
color/colorpalette: Improve readability by adding names to constants
Holzhaus Feb 27, 2020
a477c87
src/controllers/colorjsproxy: Add nearestColorMidiCode function
Holzhaus Nov 14, 2019
d803ea8
res/controllers/midi-components: Update HotcueButton to use new API
Holzhaus Nov 14, 2019
78c5101
Roland DJ-505: Update controller script for new color API
Holzhaus Nov 14, 2019
080663c
src/controllers/colorjsproxy: Fix indentation in colorDistance function
Holzhaus Nov 15, 2019
3864c80
src/controllers/colorjsproxy: Add comment to colorDistance algorithm
Holzhaus Nov 15, 2019
16a4778
src/controllers: Add ColorMapper class for controller scripts
Holzhaus Nov 16, 2019
b3b9c0d
.eslintrc.json: Add ColorMapper class to globals
Holzhaus Feb 27, 2020
d4a0508
res/controllers/midi-components: Add support for ColorMapper class
Holzhaus Nov 16, 2019
e1cc9be
Roland DJ-505: Add support for ColorMapper class
Holzhaus Nov 16, 2019
f97a15b
controllers/colormapperjsproxy: Add separate getNearestValue method
Holzhaus Nov 19, 2019
f8ccbcd
Roland DJ-505: Switch to ControllerMapper::getNearestValue
Holzhaus Nov 19, 2019
8fe1bd2
controllers/midi-components: Remove default value for HotcueButton.co…
Holzhaus Nov 19, 2019
f313cc7
controllers/midi-components: Rename HotcueButton.colors to .colorMapper
Holzhaus Nov 19, 2019
1dad294
res/controllers/midi-components-0.0: Fix some eslint issues
Holzhaus Feb 27, 2020
09f6982
Roland DJ-505: Rename Component.colors to .colorMapper
Holzhaus Nov 19, 2019
5da79b0
util/color: Remove obsolete hotcuecolorpalette.h file
Holzhaus Feb 27, 2020
7e90a64
widget/wcolorpicker: Remove use of std::optional::value()
Holzhaus Feb 27, 2020
6c8496f
widget: Add ColorPalette support to WColorPicker
Holzhaus Feb 27, 2020
8a4e87d
preferences: Make HotcuePaletteSettings support other palette types, too
Holzhaus Feb 27, 2020
df91a83
util/color/colorpalette: Add support for a dedicated track color palette
Holzhaus Feb 27, 2020
dac8810
widget/wcolorpicker: Determine best number of columns for palette size
Holzhaus Feb 27, 2020
0e27925
engine/controls/cuecontrol: Add some debug asserts for color conversions
Holzhaus Feb 27, 2020
327702e
engine/control/cuecontrol: Add helper func to convert RgbColor values
Holzhaus Feb 27, 2020
e964345
engine/controls/cuecontrol: Fix wrong color index in hotcueFocusColor…
Holzhaus Feb 27, 2020
a2d789c
Roland DJ-505: Fix eslint issues in controller script
Holzhaus Feb 27, 2020
982f7b7
res/skins: Fix trailing whitespace errors in style.qss files
Holzhaus Feb 27, 2020
e8ce23e
controllers/controller: Fix end-of-line linter issues
Holzhaus Feb 27, 2020
4938898
preferences/configobject: Replace mixxx::RgbColor::optional_t with op…
Holzhaus Feb 27, 2020
ba3b84d
widget/cuemenupopup: Remove usage of std::optional::value()
Holzhaus Feb 28, 2020
11935e2
Do not pass RgbColor/RgbColor::optional_t by reference
Holzhaus Feb 28, 2020
74e884a
preferences/configobject: Use RgbColor conversion functions
Holzhaus Feb 28, 2020
d54fd95
widget/wcolorpicker: Add tooltip to color picker
Holzhaus Feb 28, 2020
709cb3f
controllers: Remove obsolete ColorJSProxy
Holzhaus Feb 29, 2020
e6a4735
controllers/colormapperjsproxy: Remove alpha channel from JS script c…
Holzhaus Feb 29, 2020
5b846c5
res/controllers: Remove global color constant from .eslint.json
Holzhaus Feb 29, 2020
52062f3
res/controllers/midi-components: Remove references to global color ob…
Holzhaus Mar 1, 2020
6181401
test/controllerengine_test: Remove test for ColorJSProxy
Holzhaus Mar 1, 2020
dc9e476
cuecontrol: Remove unnecessary instantiation of ColorPaletteSettings
Holzhaus Mar 1, 2020
fcf2401
track/cue: Remove misleading alpha channel
Holzhaus Mar 1, 2020
b8ee8d6
util/color/colorpalette: Enclose color consts in anonymous namespace
Holzhaus Mar 1, 2020
26f8c3b
Remove unnecessary const from (optional) RgbColor parameters
Holzhaus Mar 1, 2020
a0379dc
engine/controls/cuecontrol: Use emit without braces
Holzhaus Mar 1, 2020
dd353e6
library/dao/cuedao: Replace static_cast with RgbColor::toQVariant
Holzhaus Mar 1, 2020
328edfb
engine/controls/cuecontrol: Clean up auto_hotcue_colors logic
Holzhaus Mar 1, 2020
bb2f30b
engine/controls/cuecontrol: Improve HotcueControl::setColor code
Holzhaus Mar 1, 2020
129e0e6
engine/controls/cuecontrol: Use kNoColorControlValue const instead of -1
Holzhaus Mar 1, 2020
7022535
preferences/colorpalettesettings: Do not access m_colorList directly
Holzhaus Mar 1, 2020
35e2e79
util/color/colorpalette: Make sure that ColorPalette has at least 1 c…
Holzhaus Mar 1, 2020
8060f91
util/color/colorpalette: Make m_colorList private
Holzhaus Mar 1, 2020
d7557ad
util/color/colorpalette: Add nextColor/previousColor methods
Holzhaus Mar 1, 2020
9d1cbf4
test/colorpalette_test: Add tests for ColorPalette methods
Holzhaus Mar 1, 2020
b648a5d
library/dao/cuedao: Use RgbColor::fromQVariant in cueFromRow method
Holzhaus Mar 1, 2020
c8ad295
Make all single argument constructors explicit
Holzhaus Mar 1, 2020
6841da6
library/dlgtrackinfo: Swap DlgTrackInfo constructor arguments
Holzhaus Mar 1, 2020
8d36723
Merge branch 'master' of github.com:mixxxdj/mixxx into hotcue-rgb-colors
Holzhaus Mar 1, 2020
fa6dba8
Merge branch 'master' of github.com:mixxxdj/mixxx into hotcue-rgb-colors
Holzhaus Mar 2, 2020
4180310
controllers/colormapper: Use static_casts instead of C-style casts
Holzhaus Mar 2, 2020
1ef5084
engine/controls/cuecontrol: Use auto to avoid repeating type names
Holzhaus Mar 2, 2020
43cbedb
preferences/colorpalettesettings: Move group constans into anon names…
Holzhaus Mar 2, 2020
287855a
util/color/colorpalette: Simplify ColorPalette::previousColor modulo …
Holzhaus Mar 2, 2020
0621d0a
widget/wcolorpicker: Avoid negation in if (expr) { } else { } conditions
Holzhaus Mar 2, 2020
3f94fd6
Add support for multiple named color palettes
Holzhaus Mar 3, 2020
5b4c695
widget/wcolorpicker: Add support for switching palettes with differen…
Holzhaus Mar 3, 2020
4bc091e
wcolorpickeraction: Use current track color palette when opening menu
Holzhaus Mar 3, 2020
dcec320
widget/wcuemenupopup: Use current hotcue color palette when menu is s…
Holzhaus Mar 3, 2020
80eb2ba
res/schema.xml: Fix comment of hotcue color migration (s/RGBA/RGB/)
Holzhaus Mar 4, 2020
9b68234
controllers/colormapper: Do not inherit from QObject
Holzhaus Mar 4, 2020
df02dec
engine/controls/cuecontrol: Remove superfluous comment
Holzhaus Mar 4, 2020
c4be500
preferences/colorpalettesettings: Use constant for fallback color
Holzhaus Mar 4, 2020
448d1b7
preferences/configobject: Remove key if color value is not set
Holzhaus Mar 4, 2020
f1ac5de
util/color/colorpalette: Make class final
Holzhaus Mar 4, 2020
8b222ff
widget/wcolorpicker: Swap order of captured lambda variables
Holzhaus Mar 4, 2020
c52f8b3
track/cue: Reuse default cue color constant from ColorPalette
Holzhaus Mar 4, 2020
9e0c651
res/schema.xml: Remove useless alpha channel
Holzhaus Mar 6, 2020
abea669
util/color/colorpalette: Use shorter initialization for color constexprs
Holzhaus Mar 6, 2020
67af302
preferences/colorpalettesettings: Fix order of palettes with >=10 colors
Holzhaus Mar 6, 2020
ef8e535
util/color/colorpalette: Add colorForHotcueIndex method
Holzhaus Mar 5, 2020
fbcea0b
engine/controls/cuecontrol: Use default color if auto_hotcue_colors i…
Holzhaus Mar 6, 2020
5cda96d
Use orange (not in palette) for "no color" schema migration and new cues
Holzhaus Mar 6, 2020
e719af5
Roland DJ-505: Remove unnecessary alpha channel from ColorMapper
Holzhaus Mar 6, 2020
74e6cf7
preferences/colorpalettesettings: Replace maxDigits with numDigits
Holzhaus Mar 6, 2020
078e595
Use #FF8C00 instead of #FF8000 as "no color" replacement
Holzhaus Mar 7, 2020
43fc59d
engine/controls/cuecontrol: Remove commented lines
Holzhaus Mar 8, 2020
ee5e5e4
controllers/colormapper: Improve constructor and remove destructor
Holzhaus Mar 8, 2020
7fe6f81
controllers/colormapperjsproxy: Add small code style improvements
Holzhaus Mar 8, 2020
0a423a0
res/schema.xml: Add comment regarding hotcue palette to schema
Holzhaus Mar 9, 2020
ba01c5f
controllers/colormapper: Replace qDebug() with kLogger.trace()
Holzhaus Mar 9, 2020
9883318
Add/improve comments for new classes and free functions
Holzhaus Mar 9, 2020
3c0a3fe
controllers/colormapperjsproxy: Use auto instead of long type name
Holzhaus Mar 9, 2020
b4e9de9
controllers: Use const refs instead of const-by-value for HID/HSS1394
Holzhaus Mar 9, 2020
90b1109
controllers/controllerengine: Declare immutable m_pConfig member as c…
Holzhaus Mar 9, 2020
20ce76f
Merge branch 'master' of github.com:mixxxdj/mixxx into hotcue-rgb-colors
Holzhaus Mar 9, 2020
8ca8003
controllers/colormapperjsproxy: Use script errors instead of assertions
Holzhaus Mar 9, 2020
6eb2124
controllers/colormapperjsproxy: Add comment to slots with return value
Holzhaus Mar 9, 2020
be415ba
util/color/colorpalette: Fix swapped green/blue hotcue palette colors
Holzhaus Mar 9, 2020
eb2fd28
test/colormapperjsproxy_test: Add tests for ColorMapperJSProxy
Holzhaus Mar 9, 2020
6046abf
controllers/colormapperjsproxy: Use Q_INVOKABLE instead of slots
Holzhaus Mar 9, 2020
a538a09
res/controllers/common-controller-scripts.js: Fix eslint errors
Holzhaus Mar 10, 2020
702050f
res/controllers: Add color conv. functions to common-controller-scripts
Holzhaus Mar 10, 2020
e859c7d
res/controllers/common-controller-scripts.js: Break long lines
Holzhaus Mar 11, 2020
42f82a3
controllers/colormapper: Split function to avoid using QPair
Holzhaus Mar 11, 2020
9e9a56f
controllers/bulk/bulkenumerator: Use one initialization per line
Holzhaus Mar 11, 2020
2a0608b
controllers/colormapperjsproxy: Add comments that explain the invokab…
Holzhaus Mar 11, 2020
a48afde
controllers/colormapperjsproxy: Rename getNearestValue to getValueFor…
Holzhaus Mar 11, 2020
05012ec
res/controllers/common-controller-scripts: Document color conv. funct…
Holzhaus Mar 11, 2020
f3a954e
res/controllers/midi-components-0.0.js: Add range change to outputCol…
Holzhaus Mar 11, 2020
2f95d2d
res/controllers/midi-components-0.0.js: Throw error if sendRGB is und…
Holzhaus Mar 11, 2020
f50ccbe
res/controllers/midi-components-0.0.js: Add some more comments
Holzhaus Mar 11, 2020
44b8237
res/controllers/midi-components-0.0.js: Add HotcueButton.sendRGB func…
Holzhaus Mar 11, 2020
abd663f
preferences/colorpalettesettings: Remove leftover qWarning() statement
Holzhaus Mar 11, 2020
e7a3553
test/colorconfig_test: Use literal names for LoadSavePalettes tests
Holzhaus Mar 11, 2020
ec11d6b
test/colormapperjsproxy_test: Use raw c++ string literals for JS code
Holzhaus Mar 11, 2020
714f446
util/color/colorpalette: Return last color if color not in palette
Holzhaus Mar 11, 2020
8dca9a6
controllers/colormapper: Simplify and speed up code in getNearestColor
Holzhaus Mar 12, 2020
9130b80
controllers/midi-components: Change comment wording in output()
Holzhaus Mar 12, 2020
4a79af3
controllers/midi-components: Print invalid colorCodes
Holzhaus Mar 12, 2020
7cc0444
Merge branch 'master' of github.com:mixxxdj/mixxx into hotcue-rgb-colors
Holzhaus Mar 13, 2020
92df887
engine/controls/cuecontrol: Prevent segfaults in slotHotcueColorChanged
Holzhaus Mar 13, 2020
be48247
widget/wcolorpicker: Simplify (re-)setSelectedColor logic
Holzhaus Mar 13, 2020
b4855e0
widget/wwidget: Early exit for error case in getBackgroundColorRgba()
Holzhaus Mar 13, 2020
9712d26
Merge branch 'master' of github.com:mixxxdj/mixxx into hotcue-rgb-colors
Holzhaus Mar 13, 2020
4e943f8
preferences/colorpalettesettings: Use QStringLiteral for regex
Holzhaus Mar 14, 2020
0e18f19
preferences/colorpalettesettings: Use StringBuilder for group names
Holzhaus Mar 14, 2020
dac09b2
preferences/colorpalettesettings: Prevent setting empty color palettes
Holzhaus Mar 14, 2020
6499025
widget/wcolorpicker: Use const int for remainder
Holzhaus Mar 14, 2020
5380904
widget/wcolorpicker: Do not use else if after break
Holzhaus Mar 14, 2020
233e99f
Merge branch 'master' of github.com:mixxxdj/mixxx into hotcue-rgb-colors
Holzhaus Mar 14, 2020
c0fd0b4
library/dao/cuedao: Fix loading of cue colors from DB
Holzhaus Mar 14, 2020
96ca1d2
preferences/configobject: Make getKeysWithGroup() const
Holzhaus Mar 15, 2020
827f6a0
preferences/colorpalettesettings: Make some methods const
Holzhaus Mar 15, 2020
e18f8d5
preferences/colorpalettesettings: Move keyForIndex into anon namespace
Holzhaus Mar 15, 2020
243fb32
res/schema.xml: Fix cue colors from previous schema migrations
Holzhaus Mar 15, 2020
4944594
res/controllers/midi-components: Add check for CO values > 0xFFFFFF
Holzhaus Mar 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/control/controlproxy.cpp
src/control/controlpushbutton.cpp
src/control/controlttrotary.cpp
src/controllers/colorjsproxy.cpp
src/controllers/colormapper.cpp
src/controllers/colormapperjsproxy.cpp
src/controllers/controller.cpp
src/controllers/controllerdebug.cpp
src/controllers/controllerengine.cpp
Expand Down Expand Up @@ -313,7 +314,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/errordialoghandler.cpp
src/library/analysisfeature.cpp
src/library/analysislibrarytablemodel.cpp
src/library/trackloader.cpp
src/library/autodj/autodjfeature.cpp
src/library/autodj/autodjprocessor.cpp
src/library/autodj/dlgautodj.cpp
Expand Down Expand Up @@ -410,6 +410,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/library/tableitemdelegate.cpp
src/library/trackcollection.cpp
src/library/trackcollectionmanager.cpp
src/library/trackloader.cpp
src/library/traktor/traktorfeature.cpp
src/library/treeitem.cpp
src/library/treeitemmodel.cpp
Expand Down Expand Up @@ -476,6 +477,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/preferences/dialog/dlgprefwaveformdlg.ui
src/preferences/dlgpreferencepage.cpp
src/preferences/effectsettingsmodel.cpp
src/preferences/colorpalettesettings.cpp
src/preferences/replaygainsettings.cpp
src/preferences/settingsmanager.cpp
src/preferences/upgrade.cpp
Expand Down Expand Up @@ -538,7 +540,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/util/cache.cpp
src/util/cmdlineargs.cpp
src/util/color/color.cpp
src/util/color/predefinedcolor.cpp
src/util/color/colorpalette.cpp
src/util/console.cpp
src/util/db/dbconnection.cpp
src/util/db/dbconnectionpool.cpp
Expand Down Expand Up @@ -926,6 +928,9 @@ add_executable(mixxx-test
src/test/broadcastsettings_test.cpp
src/test/cache_test.cpp
src/test/channelhandle_test.cpp
src/test/colorconfig_test.cpp
src/test/colormapperjsproxy_test.cpp
src/test/colorpalette_test.cpp
src/test/compatibility_test.cpp
src/test/configobject_test.cpp
src/test/controller_preset_validation_test.cpp
Expand Down
8 changes: 5 additions & 3 deletions build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ def sources(self, build):
"src/preferences/effectsettingsmodel.cpp",
"src/preferences/broadcastprofile.cpp",
"src/preferences/upgrade.cpp",
"src/preferences/colorpalettesettings.cpp",
"src/preferences/dlgpreferencepage.cpp",

"src/effects/effectmanifest.cpp",
Expand Down Expand Up @@ -925,7 +926,8 @@ def sources(self, build):
"src/controllers/midi/midioutputhandler.cpp",
"src/controllers/softtakeover.cpp",
"src/controllers/keyboard/keyboardeventfilter.cpp",
"src/controllers/colorjsproxy.cpp",
"src/controllers/colormapper.cpp",
"src/controllers/colormapperjsproxy.cpp",

"src/main.cpp",
"src/mixxx.cpp",
Expand Down Expand Up @@ -1283,6 +1285,7 @@ def sources(self, build):
"src/util/cache.cpp",
"src/util/console.cpp",
"src/util/color/color.cpp",
"src/util/color/colorpalette.cpp",
"src/util/db/dbconnection.cpp",
"src/util/db/dbconnectionpool.cpp",
"src/util/db/dbconnectionpooler.cpp",
Expand All @@ -1309,8 +1312,7 @@ def sources(self, build):
"src/util/desktophelper.cpp",
"src/util/widgetrendertimer.cpp",
"src/util/workerthread.cpp",
"src/util/workerthreadscheduler.cpp",
"src/util/color/predefinedcolor.cpp"
"src/util/workerthreadscheduler.cpp"
]

proto_args = {
Expand Down
18 changes: 16 additions & 2 deletions res/controllers/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
{
"globals": {
"ColorMapper": "readonly",
"_": "readonly",
"color": "readonly",
"components": "readonly",
"engine": "readonly",
"midi": "readonly",
"script": "readonly"
"printObject": "readonly",
"stringifyObject": "readonly",
"arrayContains": "readonly",
"secondstominutes": "readonly",
"msecondstominutes": "readonly",
"colorCodeToObject": "readonly",
"colorCodeFromObject": "readonly",
"script": "readonly",
"bpm": "readonly",
"ButtonState": "readonly",
"LedState": "readonly",
"Controller": "readonly",
"Button": "readonly",
"Control": "readonly",
"Deck": "readonly"
}
}
56 changes: 30 additions & 26 deletions res/controllers/Roland_DJ-505-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -970,17 +970,24 @@ DJ505.PadColor = {
DIM_MODIFIER: 0x10,
};

DJ505.PadColorMap = [
DJ505.PadColor.OFF,
DJ505.PadColor.RED,
DJ505.PadColor.GREEN,
DJ505.PadColor.BLUE,
DJ505.PadColor.YELLOW,
DJ505.PadColor.CELESTE,
DJ505.PadColor.PURPLE,
DJ505.PadColor.APRICOT,
DJ505.PadColor.WHITE,
];
DJ505.PadColorMap = new ColorMapper({
Holzhaus marked this conversation as resolved.
Show resolved Hide resolved
"#CC0000": DJ505.PadColor.RED,
"#CC4400": DJ505.PadColor.CORAL,
"#CC8800": DJ505.PadColor.ORANGE,
"#CCCC00": DJ505.PadColor.YELLOW,
"#88CC00": DJ505.PadColor.GREEN,
"#00CC00": DJ505.PadColor.APPLEGREEN,
"#00CC88": DJ505.PadColor.AQUAMARINE,
"#00CCCC": DJ505.PadColor.TURQUOISE,
"#0088CC": DJ505.PadColor.CELESTE,
"#0000CC": DJ505.PadColor.BLUE,
"#4400CC": DJ505.PadColor.AZURE,
"#8800CC": DJ505.PadColor.PURPLE,
"#CC00CC": DJ505.PadColor.MAGENTA,
"#CC0044": DJ505.PadColor.RED,
"#FFCCCC": DJ505.PadColor.APRICOT,
"#FFFFFF": DJ505.PadColor.WHITE,
});

DJ505.PadSection = function(deck, offset) {
// TODO: Add support for missing modes (flip, slicer, slicerloop)
Expand Down Expand Up @@ -1239,7 +1246,6 @@ DJ505.HotcueMode = function(deck, offset) {
this.ledControl = DJ505.PadMode.HOTCUE;
this.color = DJ505.PadColor.WHITE;

var hotcueColors = [this.color].concat(DJ505.PadColorMap.slice(1));
this.pads = new components.ComponentContainer();
for (var i = 0; i <= 7; i++) {
this.pads[i] = new components.HotcueButton({
Expand All @@ -1251,7 +1257,7 @@ DJ505.HotcueMode = function(deck, offset) {
group: deck.currentDeck,
on: this.color,
off: this.color + DJ505.PadColor.DIM_MODIFIER,
colors: hotcueColors,
colorMapper: DJ505.PadColorMap,
outConnect: false,
});
}
Expand Down Expand Up @@ -1287,7 +1293,6 @@ DJ505.CueLoopMode = function(deck, offset) {
this.ledControl = DJ505.PadMode.HOTCUE;
this.color = DJ505.PadColor.BLUE;

var cueloopColors = [this.color].concat(DJ505.PadColorMap.slice(1));
this.PerformancePad = function(n) {
this.midi = [0x94 + offset, 0x14 + n];
this.number = n + 1;
Expand All @@ -1303,7 +1308,7 @@ DJ505.CueLoopMode = function(deck, offset) {
group: deck.currentDeck,
on: this.color,
off: this.color + DJ505.PadColor.DIM_MODIFIER,
colors: cueloopColors,
colorMapper: DJ505.PadColorMap,
outConnect: false,
unshift: function() {
this.input = function(channel, control, value, status, group) {
Expand Down Expand Up @@ -1596,14 +1601,13 @@ DJ505.PitchPlayMode = function(deck, offset) {
this.color = DJ505.PadColor.GREEN;
this.cuepoint = 1;
this.range = PitchPlayRange.MID;
var pitchplayColors = [this.color].concat(DJ505.PadColorMap.slice(1));

this.PerformancePad = function(n) {
this.midi = [0x94 + offset, 0x14 + n];
this.number = n + 1;
this.on = this.color + DJ505.PadColor.DIM_MODIFIER;
this.colors = pitchplayColors;
this.colorIdKey = "hotcue_" + this.number + "_color_id";
this.colorMapper = DJ505.PadColorMap;
this.colorKey = "hotcue_" + this.number + "_color";
components.Button.call(this);
};
this.PerformancePad.prototype = new components.Button({
Expand All @@ -1614,10 +1618,10 @@ DJ505.PitchPlayMode = function(deck, offset) {
mode: this,
outConnect: false,
off: DJ505.PadColor.OFF,
outputColor: function(id) {
outputColor: function(colorCode) {
// For colored hotcues (shifted only)
var color = this.colors[id];
this.send((this.mode.cuepoint === this.number) ? color : (color + DJ505.PadColor.DIM_MODIFIER));
var midiColor = this.colorMapper.getNearestValue(colorCode);
this.send((this.mode.cuepoint === this.number) ? midiColor : (midiColor + DJ505.PadColor.DIM_MODIFIER));
},
unshift: function() {
this.outKey = "pitch_adjust";
Expand Down Expand Up @@ -1665,8 +1669,8 @@ DJ505.PitchPlayMode = function(deck, offset) {
this.outKey = "hotcue_" + this.number + "_enabled";
this.output = function(value, _group, _control) {
var outval = this.outValueScale(value);
if (this.colorIdKey !== undefined && outval !== this.off) {
this.outputColor(engine.getValue(this.group, this.colorIdKey));
if (this.colorKey !== undefined && outval !== this.off) {
this.outputColor(engine.getValue(this.group, this.colorKey));
} else {
this.send(DJ505.PadColor.OFF);
}
Expand All @@ -1676,13 +1680,13 @@ DJ505.PitchPlayMode = function(deck, offset) {
var previousCuepoint = this.mode.cuepoint;
this.mode.cuepoint = this.number;
this.mode.pads[previousCuepoint - 1].trigger();
this.outputColor(engine.getValue(this.group, this.colorIdKey));
this.outputColor(engine.getValue(this.group, this.colorKey));
}
};
this.connect = function() {
components.Button.prototype.connect.call(this); // call parent connect
if (undefined !== this.group && this.colorIdKey !== undefined) {
this.connections[1] = engine.makeConnection(this.group, this.colorIdKey, function(id) {
if (undefined !== this.group && this.colorKey !== undefined) {
this.connections[1] = engine.makeConnection(this.group, this.colorKey, function(id) {
if (engine.getValue(this.group, this.outKey)) {
this.outputColor(id);
}
Expand Down
Loading