fx knob wiring (qml coding)

oviwan
oviwan Member Posts: 120 Helper

Any ideas what's wrong with this:

Wire { from: "%surface_prefix%.fx.knobs.1" to: EncoderScriptAdapter { onTurn: { ... } } }

Am I using the right knob names/events?

«1

Comments

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 2,816 mod

    EncoderScriptAdapter only knows onTick, onIncrement and onDecrement.

    onTurn is used by KnobScriptAdapter.

  • oviwan
    oviwan Member Posts: 120 Helper

    EncoderScriptAdapter onIncrement doesn't seem to get called on s4mk3.left.fx.knobs.X

    Using KnobScriptAdapter onTurn won't allow Traktor to start

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 2,816 mod

    Hmm.

    Here is some code that works:

    Wire {
      from: "%surface%.knobs.1";
      to: KnobScriptAdapter {
        onTurn: {
          lastActiveKnobProp.value = 1
        }
      }
    }
    

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

    Wire {
      from: "%surface%.browse";
      to: EncoderScriptAdapter { 
        onIncrement: clockBpm.value = clockBpm.value + stepBpm.value;
        onDecrement: clockBpm.value = clockBpm.value - stepBpm.value
      }
      enabled: !shift
    }
    

    What value do you want to control with the knob?

  • oviwan
    oviwan Member Posts: 120 Helper

    ButtonScriptAdapter doesn't seem to work at all for me (Traktor won't start). Is that Traktor4 specific?

    Neither onTick or onIncrement work with EncoderScriptAdapter on s4mk3.left.fx.knobs.1 or s4mk3.left.knobs.1

    No matter what value I try to control, the event handler is not triggered.

    EncoderScriptAdapter.onIncrement works for me for %surface%.browse.encoder.turn tho.

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 2,816 mod

    Post your code. :)

  • oviwan
    oviwan Member Posts: 120 Helper

    property real b: 0;

    Wire { enabled: true; from: "s4mk3.left.browse.preview"; to: ButtonScriptAdapter { brightness: b } }

    Wire { enabled: true; from: "s4mk3.left.fx.knobs.1"; to: EncoderScriptAdapter { onIncrement: { b = 1 } onDecrement: { b = 0 } } }

    Dunno how to format code…

  • ErikMinekus
    ErikMinekus Member Posts: 110 Advisor

    Encoders are endless knobs, so I doubt EncoderScriptAdapter works with plain knobs like the FX knobs. Have you tried the KnobScriptAdapter example posted earlier?

  • pixel
    pixel Member Posts: 232 Advisor

    You're right, I tried this with channel fx.amount without success.

    KnobScriptAdapter works :)

  • oviwan
    oviwan Member Posts: 120 Helper

    Traktor won't start if I add: Wire { enabled: true from: "s4mk3.left.fx.knobs.1"; to: KnobScriptAdapter { onTurn: { b = 1 } } }

    I tried different values for "from"…

  • pixel
    pixel Member Posts: 232 Advisor
    property int brightnessVar: 0
    
    Wire {  from: "s4mk3.left.fx.knobs.1";
      to: KnobScriptAdapter {
        onTurn: {
          if (value > .50) brightnessVar = 0.0
          else brightnessVar = 1.0
        }
      }
    }
    Wire { from: "s4mk3.left.browse.preview"; to: ButtonScriptAdapter {
    		brightness: brightnessVar;
    	}
    }
    

    I created an example for you :)

  • oviwan
    oviwan Member Posts: 120 Helper

    Traktor won't start if I add that code. Have you tried it with Traktor 3?

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 2,816 mod

    What happens if you define b as int instead of real? You are only using int values in your example.

    Why are you assigning real values (0.0, 1.0) to an int? ^^

  • pixel
    pixel Member Posts: 232 Advisor

    did you add "import QtQuick 2.0" in your qml file?
    If not, it might not work for you.

    @Sûlherokhh You're right, but there shouldn't be any errors

  • oviwan
    oviwan Member Posts: 120 Helper

    Changing b to real doesn't seem to make a difference. As soon as I add KnobScriptAdapter to my qml file, Traktor fails to load.

  • Sûlherokhh
    Sûlherokhh Member, Traktor Mapping Mod Posts: 2,816 mod
    edited December 21

    KnobScriptAdapter may indeed be new to Traktor 4. Only X1Mk3 and Z1Mk2 use it.

    How about this?

    MappingPropertyDescriptor {
      id: CounterProp;
      path: "mapping.state.left.counter";
      type: MappingPropertyDescriptor.Float;
      value: 0.0;
      min: 0.0
      max: 1.0
    }
    
    Wire { from: "s4mk3.left.fx.knobs.1"; to: DirectPropertyAdapter{ path: CounterProp.path } }
    

Back To Top