Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.3' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Jul 1, 2022
2 parents bf98de3 + d852fa1 commit 5f65259
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 46 deletions.
1 change: 1 addition & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ jobs:
stale-pr-label: "stale"
days-before-stale: 90
days-before-close: -1
exempt-pr-labels: "needs review"
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3005,6 +3005,14 @@ if(APPLE AND MACOS_BUNDLE)
set(BUNDLE_DIRS "${CMAKE_PREFIX_PATH}/lib")
set(APPLE_CODESIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/packaging/macos/entitlements.plist")

# Starting with arm64 macOS Apple will require ad-hoc code signatures,
# which can be generated by setting the identity to a single dash (-).
# These only include a checksum for verifying integrity, not an actual
# signature.
if (NOT APPLE_CODESIGN_IDENTITY)
set(APPLE_CODESIGN_IDENTITY -)
endif()

configure_file(cmake/modules/BundleInstall.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/BundleInstall.cmake" @ONLY)
install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/BundleInstall.cmake")
endif()
21 changes: 15 additions & 6 deletions cmake/modules/BundleInstall.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@ fixup_bundle("${BUNDLE_PATH}" "${BUNDLE_LIBS}" "${BUNDLE_DIRS}")

if(DEFINED APPLE_CODESIGN_IDENTITY AND DEFINED APPLE_CODESIGN_ENTITLEMENTS)
foreach(PATH_TO_SIGN IN LISTS BUNDLE_LIBS BUNDLE_PATH)
execute_process(COMMAND
codesign --verbose=4 --deep --force --options runtime
--entitlements "${APPLE_CODESIGN_ENTITLEMENTS}"
--sign "${APPLE_CODESIGN_IDENTITY}"
"${PATH_TO_SIGN}"
)
if(APPLE_CODESIGN_IDENTITY STREQUAL "-")
message(STATUS "Ad-hoc signing bundle without hardened runtime")
execute_process(COMMAND
codesign --verbose=4 --deep --force
--sign "${APPLE_CODESIGN_IDENTITY}"
"${PATH_TO_SIGN}"
)
else()
execute_process(COMMAND
codesign --verbose=4 --deep --force --options runtime
--entitlements "${APPLE_CODESIGN_ENTITLEMENTS}"
--sign "${APPLE_CODESIGN_IDENTITY}"
"${PATH_TO_SIGN}"
)
endif()
endforeach()
else()
message(STATUS "Not signing bundle. Specify -DAPPLE_CODESIGN_IDENTITY and -DAPPLE_CODESIGN_ENTITLEMENTS to cmake before running cpack to sign")
Expand Down
89 changes: 50 additions & 39 deletions res/controllers/midi-components-0.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
* This library depends on Lodash, which is copyright JS Foundation
* and other contributors and licensed under the MIT license. Refer to
* the lodash.mixxx.js file in this directory for details.
**/
*/

(function(global) {
var Component = function(options) {
const Component = function(options) {
if (Array.isArray(options) && typeof options[0] === "number") {
this.midi = options;
} else {
Expand Down Expand Up @@ -118,7 +118,7 @@
by calling this.disconnect(). This can be helpful for multicolor LEDs that show a
different color depending on the state of different Mixxx COs. Refer to
SamplerButton.connect() and SamplerButton.output() for an example.
**/
*/
if (undefined !== this.group &&
undefined !== this.outKey &&
undefined !== this.output &&
Expand Down Expand Up @@ -159,7 +159,7 @@
},
};

var Button = function(options) {
const Button = function(options) {
Component.call(this, options);
};
Button.prototype = new Component({
Expand Down Expand Up @@ -215,7 +215,7 @@
},
});

var PlayButton = function(options) {
const PlayButton = function(options) {
Button.call(this, options);
};
PlayButton.prototype = new Button({
Expand All @@ -229,7 +229,7 @@
outKey: "play_indicator",
});

var CueButton = function(options) {
const CueButton = function(options) {
Button.call(this, options);
};
CueButton.prototype = new Button({
Expand All @@ -246,7 +246,7 @@
outKey: "cue_indicator",
});

var SyncButton = function(options) {
const SyncButton = function(options) {
Button.call(this, options);
};
SyncButton.prototype = new Button({
Expand Down Expand Up @@ -278,7 +278,7 @@
outKey: "sync_enabled",
});

var LoopToggleButton = function(options) {
const LoopToggleButton = function(options) {
Button.call(this, options);
};
LoopToggleButton.prototype = new Button({
Expand All @@ -289,7 +289,7 @@
outKey: "loop_enabled",
});

var HotcueButton = function(options) {
const HotcueButton = function(options) {
if (options.number === undefined) {
print("ERROR: No hotcue number specified for new HotcueButton.");
return;
Expand All @@ -309,7 +309,7 @@
this.inKey = "hotcue_" + this.number + "_clear";
},
output: function(value) {
var outval = this.outValueScale(value);
const outval = this.outValueScale(value);
// NOTE: outputColor only handles hotcueColors
// and there is no hotcueColor for turning the LED
// off. So the `send()` function is responsible for turning the
Expand All @@ -332,7 +332,7 @@
// This HotcueButton holds a reference to a ColorMapper. This means
// that the controller only supports a fixed set of colors, so we
// get the MIDI value for the nearest supported color and send it.
var nearestColorValue = this.colorMapper.getValueForNearestColor(colorCode);
const nearestColorValue = this.colorMapper.getValueForNearestColor(colorCode);
this.send(nearestColorValue);
} else {
// Since outputColor has been called but no ColorMapper is
Expand All @@ -357,7 +357,7 @@
}
},
});
var SamplerButton = function(options) {
const SamplerButton = function(options) {
if (options.number === undefined) {
print("ERROR: No sampler number specified for new SamplerButton.");
return;
Expand Down Expand Up @@ -433,7 +433,7 @@
outKey: null, // hack to get Component constructor to call connect()
});

var EffectAssignmentButton = function(options) {
const EffectAssignmentButton = function(options) {
options.key = "group_" + options.group + "_enable";
options.group = "[EffectRack1_EffectUnit" + options.effectUnit + "]";
Button.call(this, options);
Expand All @@ -442,7 +442,7 @@
type: Button.prototype.types.toggle,
});

var Pot = function(options) {
const Pot = function(options) {
Component.call(this, options);

this.firstValueReceived = false;
Expand All @@ -452,7 +452,7 @@
if (this.MSB !== undefined) {
value = (this.MSB << 7) + value;
}
var newValue = this.inValueScale(value);
let newValue = this.inValueScale(value);
if (this.invert) {
newValue = 1 - newValue;
}
Expand All @@ -467,16 +467,25 @@
// For the first messages, disregard the LSB in case
// the first LSB is received after the first MSB.
if (this.MSB === undefined) {
this.max = 127;
// a flaw in the Pot API does not mandate consumers
// to supply an accurate max value when using
// this with non-7-bit inputs. We cannot detect
// that in the constructor so set the max
// appropriately here
if (this.max === Component.prototype.max) {
this.max = (1 << 14) - 1;
}
value = (value << 7) + (this._firstLSB ? this._firstLSB : 0);
this.input(channel, control, value, status, group);
this.max = 16383;
}
this.MSB = value;
},
inputLSB: function(channel, control, value, status, group) {
// Make sure the first MSB has been received
if (this.MSB !== undefined) {
this.input(channel, control, value, status, group);
} else {
this._firstLSB = value;
}
},
connect: function() {
Expand All @@ -495,13 +504,15 @@
/**
The generic Component code provides everything to implement an Encoder. This Encoder Component
exists so instanceof can be used to separate Encoders from other Components.
**/
var Encoder = function(options) {
*
* @param options
*/
const Encoder = function(options) {
Component.call(this, options);
};
Encoder.prototype = new Component();

var ComponentContainer = function(initialLayer) {
const ComponentContainer = function(initialLayer) {
if (typeof initialLayer === "object") {
this.applyLayer(initialLayer);
}
Expand All @@ -514,7 +525,7 @@
}
if (recursive === undefined) { recursive = true; }

var that = this;
const that = this;
var applyOperationTo = function(obj) {
if (obj instanceof Component) {
operation.call(that, obj);
Expand All @@ -527,7 +538,7 @@
}
};

for (var memberName in this) {
for (const memberName in this) {
if (ComponentContainer.prototype.hasOwnProperty.call(this, memberName)) {
applyOperationTo(this[memberName]);
}
Expand All @@ -540,7 +551,7 @@
}
if (recursive === undefined) { recursive = true; }

var that = this;
const that = this;
var applyOperationTo = function(obj) {
if (obj instanceof ComponentContainer) {
operation.call(that, obj);
Expand All @@ -555,7 +566,7 @@
}
};

for (var memberName in this) {
for (const memberName in this) {
if (ComponentContainer.prototype.hasOwnProperty.call(this, memberName)) {
applyOperationTo(this[memberName]);
}
Expand Down Expand Up @@ -663,7 +674,7 @@
},
};

var Deck = function(deckNumbers) {
const Deck = function(deckNumbers) {
if (deckNumbers !== undefined && Array.isArray(deckNumbers)) {
// These must be unique to each instance,
// so they cannot be in the prototype.
Expand Down Expand Up @@ -703,7 +714,7 @@
},
toggle: function() {
// cycle through deckNumbers array
var index = this.deckNumbers.indexOf(parseInt(
let index = this.deckNumbers.indexOf(parseInt(
script.channelRegEx.exec(this.currentDeck)[1]
));
if (index === (this.deckNumbers.length - 1)) {
Expand All @@ -715,8 +726,8 @@
}
});

var EffectUnit = function(unitNumbers, allowFocusWhenParametersHidden, colors) {
var eu = this;
const EffectUnit = function(unitNumbers, allowFocusWhenParametersHidden, colors) {
const eu = this;
this.focusChooseModeActive = false;

// This is only connected if allowFocusWhenParametersHidden is false.
Expand Down Expand Up @@ -777,8 +788,8 @@
// Do not enable soft takeover upon EffectUnit construction
// so initial values can be loaded from knobs.
if (this.hasInitialized === true) {
for (var n = 1; n <= 3; n++) {
var effect = "[EffectRack1_EffectUnit" + this.currentUnitNumber +
for (let n = 1; n <= 3; n++) {
const effect = "[EffectRack1_EffectUnit" + this.currentUnitNumber +
"_Effect" + n + "]";
engine.softTakeover(effect, "meta", true);
engine.softTakeover(effect, "parameter1", true);
Expand All @@ -789,12 +800,12 @@

this.reconnectComponents(function(component) {
// update [EffectRack1_EffectUnitX] groups
var unitMatch = component.group.match(script.effectUnitRegEx);
const unitMatch = component.group.match(script.effectUnitRegEx);
if (unitMatch !== null) {
component.group = eu.group;
} else {
// update [EffectRack1_EffectUnitX_EffectY] groups
var effectMatch = component.group.match(script.individualEffectRegEx);
const effectMatch = component.group.match(script.individualEffectRegEx);
if (effectMatch !== null) {
component.group = "[EffectRack1_EffectUnit" +
eu.currentUnitNumber +
Expand All @@ -806,7 +817,7 @@

this.toggle = function() {
// cycle through unitNumbers array
var index = this.unitNumbers.indexOf(this.currentUnitNumber);
let index = this.unitNumbers.indexOf(this.currentUnitNumber);
if (index === (this.unitNumbers.length - 1)) {
index = 0;
} else {
Expand Down Expand Up @@ -876,7 +887,7 @@
this.inSetParameter(this.inValueScale(value));

if (this.previousValueReceived === undefined) {
var effect = "[EffectRack1_EffectUnit" + eu.currentUnitNumber +
const effect = "[EffectRack1_EffectUnit" + eu.currentUnitNumber +
"_Effect" + this.number + "]";
engine.softTakeover(effect, "meta", true);
engine.softTakeover(effect, "parameter1", true);
Expand Down Expand Up @@ -905,12 +916,12 @@
return;
}

var change = value - this.valueAtLastEffectSwitch;
const change = value - this.valueAtLastEffectSwitch;
if (Math.abs(change) >= this.changeThreshold
// this.valueAtLastEffectSwitch can be undefined if
// shift was pressed before the first MIDI value was received.
|| this.valueAtLastEffectSwitch === undefined) {
var effectGroup = "[EffectRack1_EffectUnit" +
const effectGroup = "[EffectRack1_EffectUnit" +
eu.currentUnitNumber + "_Effect" +
this.number + "]";
engine.setValue(effectGroup, "effect_selector", change);
Expand Down Expand Up @@ -1041,7 +1052,7 @@

this.knobs = new ComponentContainer();
this.enableButtons = new ComponentContainer();
for (var n = 1; n <= 3; n++) {
for (let n = 1; n <= 3; n++) {
this.knobs[n] = new this.EffectUnitKnob(n);
this.enableButtons[n] = new this.EffectEnableButton(n);
}
Expand Down Expand Up @@ -1073,7 +1084,7 @@
},
unshift: function() {
this.input = function(channel, control, value, status, _group) {
var showParameters = engine.getValue(this.group, "show_parameters");
const showParameters = engine.getValue(this.group, "show_parameters");
if (this.isPress(channel, control, value, status)) {
this.longPressTimer = engine.beginTimer(this.longPressTimeout,
this.startEffectFocusChooseMode.bind(this),
Expand Down Expand Up @@ -1153,7 +1164,7 @@
};
EffectUnit.prototype = new ComponentContainer();

var exports = {};
const exports = {};
exports.Component = Component;
exports.Button = Button;
exports.PlayButton = PlayButton;
Expand Down
4 changes: 3 additions & 1 deletion res/skins/Shade/library.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<!-- Sidebar etc. -->
<WidgetGroup>
<!-- Required for restoring the splitter sizes, otherwise the searchbox
would force.expand the left side. -->
would force.expand the left side.
Also required to avoid resize (shrink) glitch with long titles loaded
to the preview deck. -->
<SizePolicy>i,min</SizePolicy>
<Layout>vertical</Layout>
<Children>
Expand Down

0 comments on commit 5f65259

Please sign in to comment.