Skip to content

Commit

Permalink
Get track duration directly from engine
Browse files Browse the repository at this point in the history
I believe this work-around is no longer necessary after this bug was
fixed: https://bugs.launchpad.net/mixxx/+bug/1497183 in
mixxxdj#970
  • Loading branch information
radusuciu committed Feb 15, 2017
1 parent 33bcbcd commit 9382d64
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions res/controllers/Numark-Mixtrack-3-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,32 +215,6 @@ function toggleValue(group, key) {
engine.setValue(group, key, !engine.getValue(group, key));
}

function RealDuration(group) {
var ts = engine.getValue(group, "track_samples");
if (ts <= 0) {
return 0;
} else {
// this is an integer :
var d1 = engine.getValue(group, "duration");
//this is a real value :
var d2 = engine.getValue(group, "track_samples") / engine.getValue(
group, "track_samplerate");

if (d1 === d2) {
//it is mono
return d2;
} else {
if ((d1 > Math.floor(d2)) && (d1 < Math.ceil(d2))) {
//It is mono
return d2;
} else {
//It is stereo
return d2 / 2;
}
}
}
}

function sendShortMsg(control, midino, value) {
midi.sendShortMsg(control, midino, value);
}
Expand Down Expand Up @@ -2293,6 +2267,7 @@ NumarkMixtrack3.OnVuMeterChange = function(value, group, control) {

NumarkMixtrack3.OnPlaypositionChange = function(value, group, control) {
var deck = NumarkMixtrack3.deckFromGroup(group);
var duration = engine.getValue(group, "duration");

if (deck.loaded && TrackEndWarning) {
var timeremaining = RealDuration(group) * (1 - value);
Expand Down

0 comments on commit 9382d64

Please sign in to comment.