KnobEditor KrKnobEditor IrKnobEditor

KnobEditor A Scalar control object with a Knob and a NumberBox GUI controls.

IrKnobEditor A Instrument rate control object with a Knob and a NumberBox GUI controls.

KrKnobEditor A control rate control object with a Knob and a NumberBox GUI controls.

KnobEditor:new(initVal, spec)

KnobEditor:value_(val)

KnobEditor:action_({ arg this; actionFunc })

KnobEditor:changed - notify dependants from a value change in the object. ie, the gui.

KnobEditor:gui(layout, bounds, knobSize=28, numWidth=48, numHeight=14, hasKnob=true, back)

KnobEditorGui:centered_(bool)

KnobEditorGui:knob - the knob object

KnobEditorGui:numv - the number box object

KnobEditorGui:roundVal - numbox round value - not the actual control's value.

Keys work like on slider when the Knob gains focus:

arrow up, arrow right or ] - increment value by keystep

arrow dn, arrow left or [ decrement value by keystep

x - set value to 1.0

c - set value to 0.5

n - set value to 0.0

Behavior:

The Knob's default tracking mode is \round.

Pressing the Control key and drag places the knob temporarily into \vert tracking mode.

Pressing the Option key and drag places the knob temporarily into \horiz tracking mode.

Pressing the Command or Apple key drags out the knob's value. like for other views.

In \round mode, draging farther from the knob's center increases the control's precision.

see also: [Knob], [EZKnob], [NumberEditor], [IrNumberEditor], [KrNumberEditor]

k = KnobEditor(0.0, \pan);

k.action_({ arg v; v.value.postln });

g = k.gui;

g.centered_(true)

g.insp

// layout, bounds, knobSize=28, numWidth=40, numHeight=14, hasBox=true, background

g=k.gui(nil, Rect(100, 400, 200, 200), 38, 50, 14, true, Color.blue(0.2,0.1));

g.knob.color[0] = Color.green(0.5,0.4);

g.knob.refresh;

k = KrKnobEditor.new(880.0,\freq)

k.gui

k.value = 1200

k.value

k.changed

k.set(220.0)

k.changed

k.state_(80)

//

(

var specs = [\boostcut, \freq, \pan, \amp, \amp, \freq, \pos, \amp];

a = Array.fill(8, { arg i; KnobEditor.new(0.1, specs.at(i)) });

)

(

Sheet({ arg l;

a.do(_.gui(l, nil, 36));

}, "Knob Editors", Rect(100,400,420,80));

)

a.collect(_.value);

s.boot;

z = { arg amp=0.25; AudioIn.ar([1,2], amp) }.play

k = KnobEditor(0.25, \amp);

k.action = { arg v; z.set(\amp, v.value) };

g = k.gui(nil, nil, 100,110).roundVal_(1e-8)

z.release

// KnobEditor using the event framework

SynthDescLib.global.read

k = KnobEditor(0.25, \amp);

k.gui

p = Pbind(\amp, k, \dur, 0.25).play

p.stop

// KrKnobEditor in a crucial library patch gui

(

p = Patch({ arg freq=110.0, amp=0.1;

LFCub.ar(freq, 0, amp)

}, [

KrKnobEditor(110.0, \freq),

KrKnobEditor(0.1, \amp),

])

)

p.gui;