Fader changing UpDown axis to LeftRight axis


(Phil Golden) #1

I remember reading a post on GitHub about changing the axis’s on a fader to use it as a crossfader. L/R as opposed to Up/Down

I have the L/R implemented it is just that Up/Down with the mouse is still +/- for the param. I would like to change this behaviour so Left/Right mouse changes the crossfader left and right respectively.


(Andrew Belt) #2

Not sure about 0.6, but I could add a flag to Knob in 1.0.


(Phil Golden) #3

Is it on drag that the up/down axis is detected. Drag left to right or right to left is what I was thinking. Iv’e not updated the repo to the changes yet, spent the majority of the day coding 1 line :sweat:

I planned on making a a sequencer module also to use 4 axis’s of a mouse, in the form of a crossfader (up/down length of gate L/R time, I was thinking). Is there support for joysticks, same axis no?


(Andrew Belt) #4

In Rack 0.6, you could probably do it with

	void onDragMove(EventDragMove &e) override {
		EventDragMove e2 = e;
		e2.mouseRel = Vec(e.mouseRel.y, -e.mouseRel.x);
		Knob::onDragMove(e2);
	}

in your Knob subclass.

In Rack v1, you can now set horizontal = true in your Knob subclass’s constructor.


(Phil Golden) #5

Sweet. Cheers Andrew will try both tomorrow. :zzz:


(David O'Rourke) #6

If you find that the slider goes the wrong way, try changing that to:

e2.mouseRel = Vec(e.mouseRel.y, -e.mouseRel.x);

where I’ve added a minus sign before the mouseRel.x

This is similar to what I’ve done previously, but Andrew’s code is a bit safer than what I actually did. (I’ve copied Andrew’s suggestion now)


(Andrew Belt) #7

Thanks, fixed.


(Phil Golden) #8

Perfect, works like a charm!