From 9382d645373158bc8b806835c7d2b37fdb2aaee6 Mon Sep 17 00:00:00 2001 From: Radu Suciu Date: Tue, 14 Feb 2017 15:49:56 -0800 Subject: [PATCH] Get track duration directly from engine I believe this work-around is no longer necessary after this bug was fixed: https://bugs.launchpad.net/mixxx/+bug/1497183 in https://github.com/mixxxdj/mixxx/pull/970 --- res/controllers/Numark-Mixtrack-3-scripts.js | 27 +------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/res/controllers/Numark-Mixtrack-3-scripts.js b/res/controllers/Numark-Mixtrack-3-scripts.js index b673a3272b8..4f8885f8b99 100644 --- a/res/controllers/Numark-Mixtrack-3-scripts.js +++ b/res/controllers/Numark-Mixtrack-3-scripts.js @@ -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); } @@ -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);