QML: encoder.is_turned

oviwan
oviwan Member Posts: 107 Helper
edited February 27 in Mapping Traktor

Hi - is there a way to determine the direction the encoder is turned?

«13

Comments

  • Uwe303
    Uwe303 Moderator Posts: 2,915 mod

    Hello,

    for traktor normally in the mapping.

  • oviwan
    oviwan Member Posts: 107 Helper

    I meant in QML.

    E.g:

    Wire {

    from: "s4mk3.left.browse.encoder.is_turned";

    to: ButtonScriptAdapter {

    onRelease: {

    // how do I read the encoder value and or the direction?

    }

    }

    }

  • Stevan
    Stevan Traktor Mapping Mod Posts: 1,550 mod

    What is the application for this encoder?

  • oviwan
    oviwan Member Posts: 107 Helper
    edited November 2022

    Sorry, not sure I understand your question.

  • Stevan
    Stevan Traktor Mapping Mod Posts: 1,550 mod

    Sorry, what you need this encoder to do or why is it important to track the direction of the turn?

  • oviwan
    oviwan Member Posts: 107 Helper

    I use it to browse through a list and need to be able to move up and down the list.

  • Uwe303
    Uwe303 Moderator Posts: 2,915 mod
    edited November 2022

    Ahh i think now i get it, QML is a GitHub project (i mean for traktor, it is of course more)? So the experts for that stuff you will find there. I would also ask there.

  • Uwe303
    Uwe303 Moderator Posts: 2,915 mod

    You could try to ask this guy @kokernutz he is also active on GitHub

  • oviwan
    oviwan Member Posts: 107 Helper
    edited November 2022

    Thanks @Uwe303, QML is a language.

    @Stevan, @kokernutz any hints?

  • Uwe303
    Uwe303 Moderator Posts: 2,915 mod

    I know that, but i refered to the project about traktor, but thanks for clearing that up, so one read that knows it

  • oviwan
    oviwan Member Posts: 107 Helper

    Does anyone know if this functionality is being used in any of the available mods?

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 1,533 mod
    edited November 2022 Answer ✓

    The input '.encoder.is_turned' only registers turning it like a button trigger, hence the ButtonScriptAdapter attached.

    To use the different turning directions you have two choices.

    Example 1:

    Wire { from: "%surface%.s4mk3.left.browse.encoder.turn"; to:
      EncoderScriptAdapter {
        onIncrement: { selectedHotcueType.value ==5 ? selectedHotcueType.value = selectedHotcueType.value - 5 : selectedHotcueType.value = selectedHotcueType.value + 1 }
        onDecrement: { selectedHotcueType.value ==0 ? selectedHotcueType.value = hotcue1Type.value + 5 : selectedHotcueType.value = selectedHotcueType.value -1 }
      }
    }
    

    'onIncrement {}' is the command block for turning the encoder clockwise.


    Example 2:

    Wire { from: "%surface%.s4mk3.left.browse.encoder.turn"; to: 
      RelativePropertyAdapter { path: "app.traktor.decks." + deckId + ".track.key.adjust"; step: 1/12; mode: RelativeMode.Stepped }
    }
    

    'RelativePropertyAdapter' is the streamlined version, 'mode: RelativeMode.Increment' and 'mode: RelativeMode.Decrement' increases or decrases the value of something by 1, regardless of direction,

    'mode: RelativeMode.Stepped' increases (clockwise) and decreases (counter-clockwise) a value with 'step:'being used for the size of a single step on the encoder.

    'EncoderScriptAdapter' and 'RelativePropertyAdapter' can be used for the stepped encoders as well as for endless encoders and Jogwheels.


    'EncoderScriptAdapter' has a lot more versatility, since you can include a lot of computations in the codeblock like for example register the speed of turning the encoder and do different things according to the speed. Here is one example i coded myself (without explanation):

     Wire { from: "%surface%.knobs.1"; 
       to: EncoderScriptAdapter {
         onTick: { 
           if (value < -minimalTickValue1 || value > minimalTickValue1)
             mixerFXAdjust3.value = mixerFXAdjust3.value + (value * rotationScaleFactor1); 
           else if (value < -minimalTickValue2 || value > minimalTickValue2)
             mixerFXAdjust3.value = mixerFXAdjust3.value + (value * rotationScaleFactor2); 
           else if (value < -minimalTickValue3 || value > minimalTickValue3)
             mixerFXAdjust3.value = mixerFXAdjust3.value + (value * rotationScaleFactor3); 
         }
       }
     }
    


  • oviwan
    oviwan Member Posts: 107 Helper

    Amazing! Thank you!

  • oviwan
    oviwan Member Posts: 107 Helper

    Is there a way to set the master volume from qml? (or any AppProperty for that matter?)

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 1,533 mod
    edited November 2022
    AppProperty { id: masterVolume; path: "app.traktor.mixer.master_volume" }
    

    Once you have done that, you can adjust 'masterVolume.value' with any control you like. I am pretty certain that the value goes from 0.000 to 1.000.

    Like this:

    Wire { from: "%surface%.s4mk3.left.browse.encoder.turn"; to: 
      RelativePropertyAdapter { path: "app.traktor.mixer.master_volume"; step: 0.05; mode: RelativeMode.Stepped }
    }
    
    

    If you use a knob like on the mixer controls or fx section, you can also use DirectPropertyAdapter without 'Step:...' or 'Mode:...'.


    Another way:

    Wire { from: "%surface%.s4mk3.left.browse.encoder.turn"; to:
      EncoderScriptAdapter {
        onIncrement: { masterVolume.value = masterVolume.value + 0.05 }
        onDecrement: { masterVolume.value = masterVolume.value - 0.05 }
      }
    }
    

    Here is a textfile with all the commands we could glean from the exe file:


Back To Top