fx knob wiring (qml coding)

Member Posts: 128 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?

Welcome!

It looks like you're new here. Sign in or register to get started.
LOGIN / REGISTER
«1

Comments

  • Member, Traktor Mapping Mod Posts: 3,222 mod

    EncoderScriptAdapter only knows onTick, onIncrement and onDecrement.

    onTurn is used by KnobScriptAdapter.

  • Member Posts: 128 Helper

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

    Using KnobScriptAdapter onTurn won't allow Traktor to start

  • Member, Traktor Mapping Mod Posts: 3,222 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?

  • Member Posts: 128 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.

  • Member, Traktor Mapping Mod Posts: 3,222 mod

    Post your code. :)

  • Member Posts: 128 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…

  • Member Posts: 132 Pro

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

  • Member Posts: 350 Pro

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

    KnobScriptAdapter works :)

  • Member Posts: 128 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"…

  • Member Posts: 350 Pro
    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 :)

  • Member Posts: 128 Helper

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

  • Member, Traktor Mapping Mod Posts: 3,222 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? ^^

  • Member Posts: 350 Pro

    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

  • Member Posts: 128 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.

  • Member, Traktor Mapping Mod Posts: 3,222 mod
    edited December 2024

    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 } }
    

Welcome!

It looks like you're new here. Sign in or register to get started.
LOGIN / REGISTER
Back To Top