PFKtl a MIDIKtl class for the Doepfer PocketFader


The Doepfer PockectFader only has 16 faders, so PFKtl is an extremely simple class. 

It only has a single scene, so one uses mapCC(key, action). 


The layout is: 


sl01  sl02  sl03  sl04  sl05  sl06  sl07  sl08  sl09  sl10  sl11  sl12  sl13  sl14  sl15  sl16


see also MIDIKtl, NanoKtl


first example


// make a new PFKtl

f = PFKtl.new;


// map a single slider's action

f.mapCC(\sl01, { |ccval| "PFKtl test: ccval %\n".postf(ccval) }); 


// warns if no midi info for that key

f.mapCC(\wrongKey, { |ccval| "PFKtl test: ccval %\n".postf(ccval) }); 



Class Variables

*verbose // a flag whether the class posts extended info  

PFKtl.verbose = true;

PFKtl.verbose = false;


Instance Variables


softWithin how close controllers should be for soft takeOver (default 0.05).

see also softSet. 


ctlNames a dictionary of the controller element names and their midi info.

lastVals the last values that come from each controller element (used for softSet)



Methods


*new(uid) make a new PFKtl. uid is an optional ID for the MIDI port to listen to. 

f = PFKtl.new;

f.dump

mapCC(ctl, action)

// map a single slider's action

f.mapCC(\sl01, { |ccval| "PFKtl test: sl01 ccval %\n".postf(ccval) }); 


// all valid names are:

f.orderedCtlNames;



mapToEnvirGui(gui, indices) - map to an EnvirGui.

gui the gui

indices which sliders to map to. default is [1, 2 .. 8]. 


(

Spec.add(\harm, [1, 100]);

e = EnvirGui.new( (freq: 12, amp: 0.2, harm: 12, otto: 10), 4);

f.mapToEnvirGui(e);

)

mapToPdefGui(gui, indices) - map to a PdefGui.

mapToTdefGui(gui, indices) - map to a TdefGui.

gui the gui

indices which sliders to map to. default is [1, 2 .. 8]. 

(

Tdef(\a, { |e| 100.do { |i| i.postln; 0.5.wait } });

t = TdefGui(Tdef(\a), 4);

Tdef(\a).set(\freq, 200, \dur, 0.1, \otto, 12, \ann, 1234);


f.mapToPdefGui(t, [5, 6, 7, 8]);

)




mapToNdefGui(gui, indices, lastIsVol) - map to an NdefGui.

gui the gui

indices which sliders to map to. default is [1, 2 .. 8]. 

lastIsVol flag whether the last slider becomes a volume control for that editor.

( // make an Ndef and its editor first

Spec.add(\harm, [2, 200, \exp]);

Ndef(\a, { |freq = 20, harm = 20, pan, amp, rate, rq, detune| Blip.ar(freq, harm) });

g = NdefGui(Ndef(\a), 8);


f.mapToNdefGui(g, (9..16));

)



mapToMixer(mixer, numVols, lastEdIsVol, lastIsMaster) map to a proxymixer. 


mixer is the mixer to map to. 

the left hand sliders (sliders 1 to splitIndex) are mapped to volumes;

the right hand sliders  map to the mixer.editGui parameters. 

lastIsMaster: if true, the rightmost control maps to server volume.

lastEdIsVol: if true, the last free slider on the right side is used for 

the edited proxy's volume.

(

Spec.add(\harm, [2, 200, \exp]);

Ndef(\a, { |freq = 20, harm = 20, pan, amp, rate, rq, detune| Blip.ar(freq, harm) });

10.do { |i| 

Ndef(("test" ++ i).asSymbol, { 

Pan2.ar(Ringz.ar(Impulse.ar(exprand(0.5, 4)), exprand(300, 3000), 0.02), 1.0.rand2, 0.2) 

}).play(vol: 0.2)

; 

};


m = NdefMixer(s, 7);

m.switchSize(2);

m.editGui.proxy_(Ndef(\a));


f.mapToMixer(m, 7); 

)


// maybe add flags for mapping arScroller and paramGui.scroller as well?



//////////////// OLD VERSIONS of JITGuis - will go away eventually. //////////////////////////


mapToPxEdit(editor, indices, lastIsVol) - map to a NodeProxyEditor.

editor the editor

indices which sliders to map to. default is [1, 2 .. 8]. 

lastIsVol flag whether the last slider becomes a volume control for that editor.

( // make an Ndef and its editor first

Spec.add(\harm, [2, 200, \exp]);

Ndef(\a, { |freq = 20, harm = 20, pan, amp, rate, rq, detune| Blip.ar(freq, harm) });

g = NdefGui(Ndef(\a));


f.mapToPxEdit(o);

)


mapToPxMix(mixer, splitIndex, lastEdIsVol, lastIsMaster) map to a proxymixer. 


mixer is the mixer to map to. 

the left hand sliders (sliders 1 to splitIndex) are mapped to volumes;

the right hand sliders  map to the mixer.editor parameters. 

lastIsMaster: if true, the rightmost control maps to server volume.

lastEdIsVol: if true, the last free slider on the right side is used for 

the edited proxy's volume.

(


m = NdefMixerOld();

f.mapToPxMix(m); 

m.openEditZone;

m.editor.proxy_(Ndef(\a));

)