diff options
author | Be <be@mixxx.org> | 2020-04-22 16:52:33 -0500 |
---|---|---|
committer | Be <be@mixxx.org> | 2020-04-22 16:52:33 -0500 |
commit | 44f11ef4472b8b4094545d40bf757afe4ce61747 (patch) | |
tree | 428fce24a7569515f3910ecb9d158229201973cb /res | |
parent | 5b6bea1c446bb95273f9bd65fb85ff32ea343d26 (diff) | |
parent | 688d20447cb6bc7a328cca211ec4b206448e06f6 (diff) |
Merge remote-tracking branch 'upstream/master' into migrate-to-QJSEngine
Diffstat (limited to 'res')
-rw-r--r-- | res/controllers/Reloop-Beatmix-2-4-scripts.js | 2 | ||||
-rw-r--r-- | res/controllers/Roland_DJ-505-scripts.js | 19 | ||||
-rw-r--r-- | res/controllers/common-controller-scripts.js | 39 | ||||
-rw-r--r-- | res/controllers/midi-components-0.0.js | 2 | ||||
-rw-r--r-- | res/skins/Tango/mixer_headphone.xml | 2 |
5 files changed, 51 insertions, 13 deletions
diff --git a/res/controllers/Reloop-Beatmix-2-4-scripts.js b/res/controllers/Reloop-Beatmix-2-4-scripts.js index 1be884fc60..655dc003b6 100644 --- a/res/controllers/Reloop-Beatmix-2-4-scripts.js +++ b/res/controllers/Reloop-Beatmix-2-4-scripts.js @@ -407,7 +407,7 @@ ReloopBeatmix24.WheelTurn = function(channel, control, value, status, group) { if (engine.isScratching(deck)) { engine.scratchTick(deck, newValue); // Scratch! } else { - engine.setValue(group, 'jog', newValue); // Pitch bend + engine.setValue(group, 'jog', newValue / 5); // Pitch bend } }; diff --git a/res/controllers/Roland_DJ-505-scripts.js b/res/controllers/Roland_DJ-505-scripts.js index abb3f8ea8f..89264bf625 100644 --- a/res/controllers/Roland_DJ-505-scripts.js +++ b/res/controllers/Roland_DJ-505-scripts.js @@ -201,6 +201,8 @@ DJ505.shutdown = function() { DJ505.browseEncoder = new components.Encoder({ longPressTimer: 0, longPressTimeout: 250, + trackColorCycleEnabled: false, + trackColorCycleHappened: false, previewSeekEnabled: false, previewSeekHappened: false, unshift: function() { @@ -249,12 +251,25 @@ DJ505.browseEncoder = new components.Encoder({ shift: function() { this.onKnobEvent = function(rotateValue) { if (rotateValue !== 0) { - engine.setValue("[Playlist]", "SelectPlaylist", rotateValue); + if (this.trackColorCycleEnabled) { + var key = (rotateValue > 0) ? "track_color_next" : "track_color_prev"; + engine.setValue("[Library]", key, 1.0); + this.trackColorCycleHappened = true; + } else { + engine.setValue("[Playlist]", "SelectPlaylist", rotateValue); + } } }; this.onButtonEvent = function(value) { if (value) { - script.triggerControl("[Playlist]", "ToggleSelectedSidebarItem"); + this.trackColorCycleEnabled = true; + this.trackColorCycleHappened = false; + } else { + if (!this.trackColorCycleHappened) { + script.triggerControl("[Playlist]", "ToggleSelectedSidebarItem"); + } + this.trackColorCycleEnabled = false; + this.trackColorCycleHappened = false; } }; }, diff --git a/res/controllers/common-controller-scripts.js b/res/controllers/common-controller-scripts.js index a7421d613f..af8e6ae620 100644 --- a/res/controllers/common-controller-scripts.js +++ b/res/controllers/common-controller-scripts.js @@ -455,6 +455,7 @@ var bpm = function() { }; bpm.tapTime = 0.0; +bpm.previousTapDelta = 0.0; bpm.tap = []; // Tap sample values /* -------- ------------------------------------------------------ @@ -467,30 +468,50 @@ bpm.tap = []; // Tap sample values Output: - -------- ------------------------------------------------------ */ bpm.tapButton = function(deck) { - var now = new Date() / 1000; // Current time in seconds + var now = new Date() / 1000; // Current time in seconds var tapDelta = now - bpm.tapTime; bpm.tapTime = now; - if (tapDelta > 2.0) { // reset if longer than two seconds between taps + + // assign tapDelta in cases where the button has not been pressed previously + if (bpm.tap.length < 1) { + bpm.previousTapDelta = tapDelta; + } + // reset if longer than two seconds between taps + if (tapDelta > 2.0) { bpm.tap = []; return; } + // reject occurences of accidental double or missed taps + // a tap is considered missed when the delta of this press is 80% longer than the previous one + // and a tap is considered double when the delta is shorter than 40% of the previous one. + // these numbers are just guesses that produced good results in practice + if ((tapDelta > bpm.previousTapDelta * 1.8)||(tapDelta < bpm.previousTapDelta * 0.6)) { + return; + } + bpm.previousTapDelta = tapDelta; bpm.tap.push(60 / tapDelta); - if (bpm.tap.length > 8) bpm.tap.shift(); // Keep the last 8 samples for averaging + // Keep the last 8 samples for averaging + if (bpm.tap.length > 8) bpm.tap.shift(); var sum = 0; - for (var i = 0; i < bpm.tap.length; i++) { + for (var i=0; i<bpm.tap.length; i++) { sum += bpm.tap[i]; } var average = sum / bpm.tap.length; - var fRateScale = average / engine.getValue("[Channel" + deck + "]", "bpm"); + var group = "[Channel" + deck + "]"; + + // "bpm" was changed in 1.10 to reflect the *adjusted* bpm, but I presume it + // was supposed to return the tracks bpm (which it did before the change). + // "file_bpm" is supposed to return the set BPM of the loaded track of the + // channel. + var fRateScale = average/engine.getValue(group, "file_bpm"); // Adjust the rate: - fRateScale = (fRateScale - 1.) / engine.getValue("[Channel" + deck + "]", "rateRange"); + fRateScale = (fRateScale - 1.) / engine.getValue(group, "rateRange"); engine.setValue( - "[Channel" + deck + "]", "rate", - fRateScale * engine.getValue("[Channel" + deck + "]", "rate_dir")); -// print("Script: BPM="+average+" setting to "+fRateScale); + group, "rate", + fRateScale * engine.getValue(group, "rate_dir")); }; // ----------------- Common regular expressions -------------------------- diff --git a/res/controllers/midi-components-0.0.js b/res/controllers/midi-components-0.0.js index 93a41a2a95..76c93796e7 100644 --- a/res/controllers/midi-components-0.0.js +++ b/res/controllers/midi-components-0.0.js @@ -759,6 +759,7 @@ } delete this.previouslyFocusedEffect; } + engine.setValue(this.group, "controller_input_active", 0); this.group = "[EffectRack1_EffectUnit" + newNumber + "]"; @@ -774,6 +775,7 @@ this.onShowParametersChange.bind(this)); this.showParametersConnection.trigger(); } + engine.setValue(this.group, "controller_input_active", 1); // Do not enable soft takeover upon EffectUnit construction // so initial values can be loaded from knobs. diff --git a/res/skins/Tango/mixer_headphone.xml b/res/skins/Tango/mixer_headphone.xml index 288afc6b1d..d23e17d3c8 100644 --- a/res/skins/Tango/mixer_headphone.xml +++ b/res/skins/Tango/mixer_headphone.xml @@ -72,7 +72,7 @@ Description: <SliderComposed> <TooltipId>headMix</TooltipId> - <Size>60f,24f</Size> + <Size>54f,24f</Size> <ObjectName>MixerbarSlider</ObjectName> <Handle scalemode="STRETCH_ASPECT">knobs_sliders/headMix_handle.svg</Handle> <Slider scalemode="STRETCH_ASPECT">knobs_sliders/headMix_scale.svg</Slider> |