@@ -200,13 +200,13 @@ const SoftwareMixerHeadphone = !!engine.getSetting("softwareMixerHeadphone");
200200const DefaultPadLayout = engine . getSetting ( "defaultPadLayout" ) ;
201201
202202// Use alternative movemode instead of default.
203- const AlternativeMoveMode = engine . getSetting ( "alternativeMoveMode" ) ;
203+ const AlternativeMoveMode = engine . getSetting ( "alternativeMoveMode" ) || false ;
204204
205205// Relative tempo slider mode -- the tempo slider does not care about its absolute position,
206206// only changes in position. Use Shift to adjust slider without changing tempo (for recentering, etc).
207- const RelativeTempoMode = engine . getSetting ( "relativeTempoMode" ) ;
207+ const RelativeTempoMode = engine . getSetting ( "relativeTempoMode" ) || false ;
208208// Only adjust tempo if shift is held.
209- const ShiftTempoMode = engine . getSetting ( "shiftTempoMode" ) ;
209+ const ShiftTempoMode = engine . getSetting ( "shiftTempoMode" ) || false ;
210210
211211// The LEDs only support 16 base colors. Adding 1 in addition to
212212// the normal 2 for Button.prototype.brightnessOn changes the color
@@ -603,6 +603,7 @@ class Deck extends ComponentContainer {
603603 }
604604 this . secondDeckModes = null ;
605605 this . selectedHotcue = null ;
606+ this . relativeTempoMode = RelativeTempoMode ;
606607
607608 updateRuntimeData ( {
608609 selectedHotcue : {
@@ -1992,6 +1993,7 @@ class S4Mk3Deck extends Deck {
19921993 this . mixer = mixer ;
19931994
19941995 this . syncMasterButton = new Button ( {
1996+ deck : this ,
19951997 key : "sync_leader" ,
19961998 defaultRange : 0.08 ,
19971999 shift : UseKeylockOnMaster ? function ( ) {
@@ -2004,13 +2006,18 @@ class S4Mk3Deck extends Deck {
20042006 script . toggleControl ( this . group , this . inKey ) ;
20052007 } ,
20062008 onLongPress : function ( ) {
2007- const currentRange = engine . getValue ( this . group , "rateRange" ) ;
2008- if ( currentRange < 1.0 ) {
2009- engine . setValue ( this . group , "rateRange" , 1.0 ) ;
2010- this . indicator ( true ) ;
2009+ if ( this . shifted ) {
2010+ this . deck . relativeTempoMode = ! this . deck . relativeTempoMode ;
2011+ this . deck . tempoFader . resync ( ) ;
20112012 } else {
2012- engine . setValue ( this . group , "rateRange" , this . defaultRange ) ;
2013- this . indicator ( false ) ;
2013+ const currentRange = engine . getValue ( this . group , "rateRange" ) ;
2014+ if ( currentRange < 1.0 ) {
2015+ engine . setValue ( this . group , "rateRange" , 1.0 ) ;
2016+ this . indicator ( true ) ;
2017+ } else {
2018+ engine . setValue ( this . group , "rateRange" , this . defaultRange ) ;
2019+ this . indicator ( false ) ;
2020+ }
20142021 }
20152022 } ,
20162023 } ) ;
@@ -2042,11 +2049,23 @@ class S4Mk3Deck extends Deck {
20422049 inKey : "rate" ,
20432050 outKey : "rate" ,
20442051 appliedValue : null ,
2045- lastRelativeValue : - 1 ,
2052+ lastHardwareValue : null ,
2053+ lastRelativeValue : null ,
20462054 tempoCenterUpper : this . settings . tempoCenterUpper ,
20472055 tempoCenterLower : this . settings . tempoCenterLower ,
2056+ resync : function ( ) {
2057+ this . appliedValue = null ;
2058+ if ( ! this . deck . relativeTempoMode ) {
2059+ if ( this . lastHardwareValue ) {
2060+ this . input ( this . lastHardwareValue ) ;
2061+ } else {
2062+ this . input ( 0 ) ;
2063+ }
2064+ }
2065+ } ,
20482066 input : function ( value ) {
20492067 const receivingFirstValue = this . appliedValue === null ;
2068+ this . lastHardwareValue = value ;
20502069
20512070 if ( value < this . tempoCenterLower ) {
20522071 // scale input for lower range
@@ -2059,7 +2078,7 @@ class S4Mk3Deck extends Deck {
20592078 this . appliedValue = 0 ;
20602079 }
20612080
2062- if ( RelativeTempoMode ) {
2081+ if ( this . deck . relativeTempoMode ) {
20632082 const lastVal = this . lastRelativeValue ;
20642083 this . lastRelativeValue = this . appliedValue ;
20652084 // We do want to reset the slider to the physical position when receiving the
@@ -2075,7 +2094,7 @@ class S4Mk3Deck extends Deck {
20752094
20762095 let relVal = engine . getValue ( this . group , "rate" ) ;
20772096 relVal += this . appliedValue - lastVal ;
2078- this . appliedValue = relVal ;
2097+ this . appliedValue = Math . max ( Math . min ( relVal , 10.0 ) , - 10.0 ) ;
20792098 }
20802099 }
20812100 engine . setValue ( this . group , this . inKey , this . appliedValue ) ;
@@ -2089,7 +2108,7 @@ class S4Mk3Deck extends Deck {
20892108 }
20902109 } ,
20912110 output : function ( value ) {
2092- if ( RelativeTempoMode || this . appliedValue === null ) {
2111+ if ( this . deck . relativeTempoMode || this . appliedValue === null ) {
20932112 return ;
20942113 }
20952114
0 commit comments