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
lp1336866: Fixed bpm.tapButton in common-controller-script.js #1811
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -406,8 +406,8 @@ bpm = function() { | |||||
} | ||||||
|
||||||
bpm.tapTime = 0.0 | ||||||
bpm.previousTapDelta = 0.0 | ||||||
bpm.tap = [] // Tap sample values | ||||||
|
||||||
/* -------- ------------------------------------------------------ | ||||||
bpm.tapButton | ||||||
Purpose: Sets the tempo of the track on a deck by tapping the desired beats, | ||||||
|
@@ -421,10 +421,18 @@ bpm.tapButton = function(deck) { | |||||
var now = new Date() / 1000 // Current time in seconds | ||||||
var tapDelta = now - bpm.tapTime | ||||||
bpm.tapTime = now | ||||||
if (bpm.tap.length < 1.0) { | ||||||
bpm.previousTapDelta=tapDelta | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
// assign tapDelta in cases where the button has not been pressed previously | ||||||
if (tapDelta > 2.0) { // reset if longer than two seconds between taps | ||||||
bpm.tap = [] | ||||||
return | ||||||
} | ||||||
if ((tapDelta > bpm.previousTapDelta*1.8) || (tapDelta < bpm.previousTapDelta*0.4)) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a comment that explains where these constants come from. |
||||||
return | ||||||
} | ||||||
bpm.previousTapDelta = tapDelta | ||||||
bpm.tap.push(60 / tapDelta) | ||||||
if (bpm.tap.length > 8) bpm.tap.shift() // Keep the last 8 samples for averaging | ||||||
var sum = 0 | ||||||
|
@@ -433,7 +441,11 @@ bpm.tapButton = function(deck) { | |||||
} | ||||||
var average = sum / bpm.tap.length | ||||||
|
||||||
var fRateScale = average / engine.getValue("[Channel" + deck + "]", "bpm") | ||||||
var fRateScale = average / engine.getValue("[Channel" + deck + "]", "bpm") | ||||||
// "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. | ||||||
|
||||||
// Adjust the rate: | ||||||
fRateScale = (fRateScale - 1.) / engine.getValue("[Channel" + deck + "]", "rateRange") | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't
bpm.tap.length
an integer?